@@ -51,19 +51,24 @@ typedef struct DtmTransStatus
5151 TransactionId xid ;
5252 XidStatus status ;
5353 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 */
5657} DtmTransStatus ;
5758
5859/* State of DTM node */
5960typedef struct
6061{
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 */
6772 DtmTransStatus * * trans_list_tail ;
6873} DtmNodeState ;
6974
@@ -181,6 +186,7 @@ static cid_t
181186dtm_sync (cid_t global_cid )
182187{
183188 cid_t local_cid ;
189+
184190 while ((local_cid = dtm_get_cid ()) < global_cid )
185191 {
186192 local -> time_shift += global_cid - local_cid ;
@@ -559,7 +565,7 @@ DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
559565 DTM_TRACE ((stderr , "%d: wait for in-doubt transaction %u in snapshot %lu\n" , getpid (), xid , dtm_tx .snapshot ));
560566 SpinLockRelease (& local -> lock );
561567
562- dtm_sleep (delay );
568+ dtm_sleep (delay );
563569
564570 if (delay * 2 <= MAX_WAIT_TIMEOUT )
565571 delay *= 2 ;
@@ -776,8 +782,8 @@ DtmLocalEndPrepare(GlobalTransactionId gtid, cid_t cid)
776782 SpinLockRelease (& local -> lock );
777783
778784 /*
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
781787 */
782788 if (DtmRecordCommits )
783789 {
@@ -795,7 +801,7 @@ DtmLocalEndPrepare(GlobalTransactionId gtid, cid_t cid)
795801 }
796802}
797803
798- /*
804+ /*
799805 * Mark tranasction as prepared
800806 */
801807void
@@ -819,7 +825,7 @@ DtmLocalCommitPrepared(DtmCurrentTrans * x, GlobalTransactionId gtid)
819825 SpinLockRelease (& local -> lock );
820826}
821827
822- /*
828+ /*
823829 * Set transaction status to committed
824830 */
825831void
@@ -863,7 +869,7 @@ DtmLocalCommit(DtmCurrentTrans * x)
863869 SpinLockRelease (& local -> lock );
864870}
865871
866- /*
872+ /*
867873 * Mark tranasction as prepared
868874 */
869875void
@@ -887,7 +893,7 @@ DtmLocalAbortPrepared(DtmCurrentTrans * x, GlobalTransactionId gtid)
887893 SpinLockRelease (& local -> lock );
888894}
889895
890- /*
896+ /*
891897 * Set transaction status to aborted
892898 */
893899void
0 commit comments