@@ -251,6 +251,12 @@ static Snapshot DtmCopySnapshot(Snapshot snapshot)
251
251
static Snapshot DtmGetSnapshot ()
252
252
{
253
253
CurrentTransactionSnapshot = GetLocalTransactionSnapshot ();
254
+ if (DtmGlobalTransaction && !IsolationUsesXactSnapshot ()){ /* RU & RC */
255
+ DtmEnsureConnection ();
256
+ DtmGlobalGetSnapshot (DtmConn , DtmNodeId , GetCurrentTransactionId (), & DtmSnapshot );
257
+ DtmMergeSnapshots (CurrentTransactionSnapshot , & DtmSnapshot );
258
+ DtmUpdateRecentXmin ();
259
+ }
254
260
return CurrentTransactionSnapshot ;
255
261
}
256
262
@@ -438,16 +444,20 @@ dtm_begin_transaction(PG_FUNCTION_ARGS)
438
444
gtid .nNodes = ArrayGetNItems (ARR_NDIM (nodes ), ARR_DIMS (nodes ));
439
445
DtmGlobalTransaction = true;
440
446
Assert (gtid .xids [DtmNodeId ] == GetCurrentTransactionId ());
441
- XTM_INFO ("Start transaction {%d,%d} at node %d\n" , gtid .xids [0 ], gtid .xids [1 ], DtmNodeId );
447
+ XTM_INFO ("Start transaction {%d,%d} at node %d, iso=%d \n" , gtid .xids [0 ], gtid .xids [1 ], DtmNodeId , XactIsoLevel );
442
448
if (DtmNodeId == gtid .nodes [0 ]) {
443
449
DtmEnsureConnection ();
444
450
DtmGlobalStartTransaction (DtmConn , & gtid );
445
451
}
446
- DtmEnsureConnection ();
447
- DtmGlobalGetSnapshot (DtmConn , DtmNodeId , gtid .xids [DtmNodeId ], & DtmSnapshot );
448
- Assert (CurrentTransactionSnapshot != NULL );
449
- DtmMergeSnapshots (CurrentTransactionSnapshot , & DtmSnapshot );
450
- DtmUpdateRecentXmin ();
452
+
453
+ if (IsolationUsesXactSnapshot ()){ /* RR & S */
454
+ DtmEnsureConnection ();
455
+ DtmGlobalGetSnapshot (DtmConn , DtmNodeId , gtid .xids [DtmNodeId ], & DtmSnapshot );
456
+ Assert (CurrentTransactionSnapshot != NULL );
457
+ DtmMergeSnapshots (CurrentTransactionSnapshot , & DtmSnapshot );
458
+ DtmUpdateRecentXmin ();
459
+ }
460
+
451
461
PG_RETURN_VOID ();
452
462
}
453
463
0 commit comments