File tree Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,7 @@ public bool Commit()
3939
4040 if ( transaction . State == TransactionState . Active )
4141 {
42- transaction . Commit ( ) ;
43-
44- _monitor . ReleaseTransaction ( transaction ) ;
42+ this . CommitAndReleaseTransaction ( transaction ) ;
4543
4644 return true ;
4745 }
@@ -82,11 +80,7 @@ private T AutoTransaction<T>(Func<TransactionService, T> fn)
8280
8381 // if this transaction was auto-created for this operation, commit & dispose now
8482 if ( isNew )
85- {
86- transaction . Commit ( ) ;
87-
88- _monitor . ReleaseTransaction ( transaction ) ;
89- }
83+ this . CommitAndReleaseTransaction ( transaction ) ;
9084
9185 return result ;
9286 }
@@ -100,17 +94,14 @@ private T AutoTransaction<T>(Func<TransactionService, T> fn)
10094
10195 throw ;
10296 }
103- finally
104- {
105- //TODO: acho que não é este o lugar para fazer o teste - devo capturar o ReleaseTransaction para isso
106- // (ou seja, faz no final da transacao)
97+ }
10798
108- // do auto-checkpoint if enabled (default: 1000 pages )
109- if ( _header . Pragmas . Checkpoint > 0 && _disk . GetLength ( FileOrigin . Log ) > ( _header . Pragmas . Checkpoint * PAGE_SIZE ) )
110- {
111- _walIndex . TryCheckpoint ( ) ;
112- }
113- }
99+ private void CommitAndReleaseTransaction ( TransactionService transaction )
100+ {
101+ transaction . Commit ( ) ;
102+ _monitor . ReleaseTransaction ( transaction ) ;
103+ if ( _header . Pragmas . Checkpoint > 0 && _disk . GetLength ( FileOrigin . Log ) > ( _header . Pragmas . Checkpoint * PAGE_SIZE ) )
104+ _walIndex . TryCheckpoint ( ) ;
114105 }
115106 }
116107}
You can’t perform that action at this time.
0 commit comments