@@ -51,19 +51,24 @@ typedef struct DtmTransStatus
51
51
TransactionId xid ;
52
52
XidStatus status ;
53
53
int nSubxids ;
54
- cid_t cid ; /* CSN */
55
- struct DtmTransStatus * next ; /* pointer to next element in finished transaction list */
54
+ cid_t cid ; /* CSN */
55
+ struct DtmTransStatus * next ;/* pointer to next element in finished
56
+ * transaction list */
56
57
} DtmTransStatus ;
57
58
58
59
/* State of DTM node */
59
60
typedef struct
60
61
{
61
- cid_t cid ; /* last assigned CSN; used to provide unique ascending CSNs */
62
- TransactionId oldest_xid ; /* XID of oldest transaction visible by any active transaction (local or global) */
63
- long time_shift ; /* correction to system time */
64
- volatile slock_t lock ; /* spinlock to protect access to hash table */
65
- DtmTransStatus * trans_list_head ; /* L1 list of finished transactions present in xid2status hash table.
66
- This list is used to perform cleanup of too old transactions */
62
+ cid_t cid ; /* last assigned CSN; used to provide unique
63
+ * ascending CSNs */
64
+ TransactionId oldest_xid ; /* XID of oldest transaction visible by any
65
+ * active transaction (local or global) */
66
+ long time_shift ; /* correction to system time */
67
+ volatile slock_t lock ; /* spinlock to protect access to hash table */
68
+ DtmTransStatus * trans_list_head ; /* L1 list of finished transactions
69
+ * present in xid2status hash table.
70
+ * This list is used to perform
71
+ * cleanup of too old transactions */
67
72
DtmTransStatus * * trans_list_tail ;
68
73
} DtmNodeState ;
69
74
@@ -181,6 +186,7 @@ static cid_t
181
186
dtm_sync (cid_t global_cid )
182
187
{
183
188
cid_t local_cid ;
189
+
184
190
while ((local_cid = dtm_get_cid ()) < global_cid )
185
191
{
186
192
local -> time_shift += global_cid - local_cid ;
@@ -559,7 +565,7 @@ DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
559
565
DTM_TRACE ((stderr , "%d: wait for in-doubt transaction %u in snapshot %lu\n" , getpid (), xid , dtm_tx .snapshot ));
560
566
SpinLockRelease (& local -> lock );
561
567
562
- dtm_sleep (delay );
568
+ dtm_sleep (delay );
563
569
564
570
if (delay * 2 <= MAX_WAIT_TIMEOUT )
565
571
delay *= 2 ;
@@ -776,8 +782,8 @@ DtmLocalEndPrepare(GlobalTransactionId gtid, cid_t cid)
776
782
SpinLockRelease (& local -> lock );
777
783
778
784
/*
779
- * Record commit in pg_committed_xact table to be make it possible to perform recovery in case of crash
780
- * of some of cluster nodes
785
+ * Record commit in pg_committed_xact table to be make it possible to
786
+ * perform recovery in case of crash of some of cluster nodes
781
787
*/
782
788
if (DtmRecordCommits )
783
789
{
@@ -795,7 +801,7 @@ DtmLocalEndPrepare(GlobalTransactionId gtid, cid_t cid)
795
801
}
796
802
}
797
803
798
- /*
804
+ /*
799
805
* Mark tranasction as prepared
800
806
*/
801
807
void
@@ -819,7 +825,7 @@ DtmLocalCommitPrepared(DtmCurrentTrans * x, GlobalTransactionId gtid)
819
825
SpinLockRelease (& local -> lock );
820
826
}
821
827
822
- /*
828
+ /*
823
829
* Set transaction status to committed
824
830
*/
825
831
void
@@ -863,7 +869,7 @@ DtmLocalCommit(DtmCurrentTrans * x)
863
869
SpinLockRelease (& local -> lock );
864
870
}
865
871
866
- /*
872
+ /*
867
873
* Mark tranasction as prepared
868
874
*/
869
875
void
@@ -887,7 +893,7 @@ DtmLocalAbortPrepared(DtmCurrentTrans * x, GlobalTransactionId gtid)
887
893
SpinLockRelease (& local -> lock );
888
894
}
889
895
890
- /*
896
+ /*
891
897
* Set transaction status to aborted
892
898
*/
893
899
void
0 commit comments