DatabaseProcApplicationCreatedLinks
sybsystemprocssp_dtx_purge_completedxacts  31 Aug 14Defects Dependencies

1     
2     /*
3     ** sp_dtx_purge_completedxacts
4     **
5     ** This stored procedure deletes all the logically deleted distributed
6     ** transaction meta-data in sybsystemdb..syscoordinations system catalog.
7     ** As a part of diagnostics, the server can be booted with an option to
8     ** not physically delete syscoordinations meta-data after a distributed
9     ** transaction commits or aborts. Instead, the row(s) will be logically
10    ** deleted. With this stored procedure, such row(s) can physically
11    ** deleted.
12    **
13    ** Parameters:
14    **	None.
15    **
16    ** Returns:
17    **	1 - if error.
18    **	0 - if no error.
19    */
20    
21    create procedure sp_dtx_purge_completedxacts
22    as
23    
24        if @@trancount > 0
25        begin
26            /* 17260, "Can't run %1! from within a transaction." */
27            raiserror 17260, "sp_dtx_purge_completedxacts"
28            return (1)
29        end
30    
31        /* we don't want row count information */
32        set nocount on
33    
34        /* Must have sa_role */
35        if (proc_role("sa_role") < 1)
36            return (1)
37    
38        /*
39        ** Deletes syscoordinations distributed transactions meta-data that
40        ** are logically deleted and managed by dtm services.
41        */
42        delete from sybsystemdb.dbo.syscoordinations
43        where (owner = 1) and ((status & 1) = 1)
44    
45        return (0)
46    


exec sp_procxmode 'sp_dtx_purge_completedxacts', 'AnyMode'
go

Grant Execute on sp_dtx_purge_completedxacts to public
go
DEFECTS
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: syscoordinations.csyscoordinations unique clustered
(xactkey, participant, owner)
Intersection: {owner}
43
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs int 43
 MGTP 3 Grant to public sybsystemdb..syscoordinations  
 MGTP 3 Grant to public sybsystemprocs..sp_dtx_purge_completedxacts  
 MNER 3 No Error Check should check @@error after delete 42
 MUCO 3 Useless Code Useless Brackets 28
 MUCO 3 Useless Code Useless Brackets 35
 MUCO 3 Useless Code Useless Brackets 36
 MUCO 3 Useless Code Useless Brackets 45
 MTR1 2 Metrics: Comments Ratio Comments: 62% 21
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 2 = 2dec - 2exi + 2 21
 MTR3 2 Metrics: Query Complexity Complexity: 14 21

DEPENDENCIES
PROCS AND TABLES USED
writes table sybsystemdb..syscoordinations (1)