Skip to content

Commit

Permalink
1.3.0 DoMaintenance Improvements
Browse files Browse the repository at this point in the history
AG Support for SQL Server 2016 & Bug fix for Azure SQLDB.
Updated versions of the install_all
  • Loading branch information
NikoNeugebauer committed Jul 20, 2016
1 parent 173a57f commit ced680c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Azure/StoredProcs/cstore_install_all_stored_procs.sql
Expand Up @@ -1920,7 +1920,8 @@ begin
closed_time datetime,
created_time datetime );

exec dbo.cstore_GetRowGroupsDetails @objectId = @objectId, @showNonCompressedOnly = 1;
insert into #RowGroupsDetails
exec dbo.cstore_GetRowGroupsDetails @objectId = @objectId, @showNonCompressedOnly = 1;

select @openRows = sum([total_rows] - [deleted_rows]) / 1000000.
from #RowGroupsDetails
Expand Down
8 changes: 5 additions & 3 deletions SQL-2012/StoredProcs/cstore_install_all_stored_procs.sql
Expand Up @@ -982,8 +982,8 @@ Changes in 1.2.0
+ Added information about CU 2 for SQL Server 2012 SP 3
Changes in 1.3.0
+ Added information about CU 12 for SQL Server 2012 SP 2
+ Added information about CU 3 for SQL Server 2012 SP 3
+ Added information about CU 12 & CU 13 for SQL Server 2012 SP 2
+ Added information about CU 3 & CU 4 for SQL Server 2012 SP 3
*/


Expand Down Expand Up @@ -1109,10 +1109,12 @@ begin
( 'SP2', 5643, convert(datetime,'19-01-2016',105), 'CU 10 for SQL Server 2012 SP2' ),
( 'SP2', 5646, convert(datetime,'22-03-2016',105), 'CU 11 for SQL Server 2012 SP2' ),
( 'SP2', 5649, convert(datetime,'17-05-2016',105), 'CU 12 for SQL Server 2012 SP2' ),
( 'SP2', 5644, convert(datetime,'18-07-2016',105), 'CU 13 for SQL Server 2012 SP2' ),
( 'SP3', 6020, convert(datetime,'23-11-2015',105), 'SQL Server 2012 SP3' ),
( 'SP3', 6518, convert(datetime,'19-01-2016',105), 'CU 1 for SQL Server 2012 SP3' ),
( 'SP3', 6523, convert(datetime,'22-03-2016',105), 'CU 2 for SQL Server 2012 SP3' ),
( 'SP3', 6537, convert(datetime,'17-05-2016',105), 'CU 3 for SQL Server 2012 SP3' );
( 'SP3', 6537, convert(datetime,'17-05-2016',105), 'CU 3 for SQL Server 2012 SP3' ),
( 'SP3', 6540, convert(datetime,'18-07-2016',105), 'CU 4 for SQL Server 2012 SP3' );


insert into #SQLColumnstoreImprovements (BuildVersion, SQLBranch, Description, URL )
Expand Down
27 changes: 27 additions & 0 deletions SQL-2016/StoredProcs/cstore_install_all_stored_procs.sql
Expand Up @@ -2171,6 +2171,33 @@ begin
IF EXISTS (select * from sys.objects where type = 'u' and name = 'cstore_Operation_Log' and schema_id = SCHEMA_ID('dbo') )
set @loggingTableExists = 1;

-- Check if we are running on the secondary replica and exit if not, because the AG readable secondary replica is not supported in SQL Server 2014
IF exists (select *
from sys.databases databases
INNER JOIN sys.availability_databases_cluster adc
ON databases.group_database_id = adc.group_database_id
INNER JOIN sys.availability_groups ag
ON adc.group_id = ag.group_id
WHERE databases.name = DB_NAME() )

begin
declare @replicaStatus int;
select @replicaStatus = sys.fn_hadr_is_primary_replica ( DB_NAME() );

if @replicaStatus is NOT NULL or @replicaStatus <> 1
begin
if @loggingTableExists = 1
begin
set @loggingCommand = N'
insert into dbo.cstore_Operation_Log( ExecutionId, TableName, Partition, OperationType, OperationReason, OperationCommand, OperationConfigured, OperationExecuted )
select ''' + convert(nvarchar(50),@execId) + ''', ''NULL'', ' + cast(@partitionNumber as varchar(10)) + ', ''Exit'',
''Secondary Replica'', ''NULL'', 1, ' + cast(case when (@executeReorganize = 1 OR @execute = 1) then 1 else 0 end as char(1));
exec (@loggingCommand);
end
end
return;
end

-- ***********************************************************
-- Enable Reorganize automatically if the Trace Flag 634 is enabled
if( @useRecommendations = 1 )
Expand Down

0 comments on commit ced680c

Please sign in to comment.