You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using SQLCover.dll to gather coverage information on large project with great amount of TSQLT tests we found that MSSQLServer creates only 5 trace files (SQLCover-Trace-*.xel), and then overwrites older files. Each file size is close to 1GB.
@@Version = Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64) Oct 28 2016 18:17:30 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows Server 2016 Datacenter 6.3 (Build 14393: ) (Hypervisor)
The reason of the problem: when creating event session with asynchronous_file_target, parameter max_rollover_files is not defined. Default value for max_rollover_files in MSSQL is 5, therefore after writing 5 files it overwrites first one, so coverage information for first tests gets lost before reading.
Fix: to solve that problem we had to modify \src\SQLCover\SQLCoverLib\Trace\SqlTraceController.cs by adding max_rollover_files=(999) into definition of target in constant CreateTrace. Fixed line with max_rollover_files added looks like this:
protected const string CreateTrace = @"CREATE EVENT SESSION [{0}] ON SERVER
ADD EVENT sqlserver.sp_statement_starting(action (sqlserver.plan_handle, sqlserver.tsql_stack) where ([sqlserver].[database_id]=({1})))
ADD TARGET package0.asynchronous_file_target(
SET filename='{2}', max_rollover_files=(999))
WITH (MAX_MEMORY=100 MB,EVENT_RETENTION_MODE=NO_EVENT_LOSS,MAX_DISPATCH_LATENCY=1 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)
";
The text was updated successfully, but these errors were encountered:
Thanks @DmytroHavrylov , this resolved the same issue for us. I also found adding source_database_id=({1}) to the where clause of the ADD EVENT definition filtered out a lot of events that weren't needed and keeps the xel files smaller.
When using SQLCover.dll to gather coverage information on large project with great amount of TSQLT tests we found that MSSQLServer creates only 5 trace files (SQLCover-Trace-*.xel), and then overwrites older files. Each file size is close to 1GB.
@@Version = Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64) Oct 28 2016 18:17:30 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows Server 2016 Datacenter 6.3 (Build 14393: ) (Hypervisor)
The reason of the problem: when creating event session with asynchronous_file_target, parameter max_rollover_files is not defined. Default value for max_rollover_files in MSSQL is 5, therefore after writing 5 files it overwrites first one, so coverage information for first tests gets lost before reading.
Fix: to solve that problem we had to modify \src\SQLCover\SQLCoverLib\Trace\SqlTraceController.cs by adding max_rollover_files=(999) into definition of target in constant CreateTrace. Fixed line with max_rollover_files added looks like this:
The text was updated successfully, but these errors were encountered: