File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ static TransactionId DtmNextXid;
123123static SnapshotData DtmSnapshot = { HeapTupleSatisfiesMVCC };
124124static bool DtmHasGlobalSnapshot ;
125125static int DtmLocalXidReserve ;
126+ static CommandId DtmCurcid ;
126127static Snapshot DtmLastSnapshot ;
127128static TransactionManager DtmTM = {
128129 DtmGetTransactionStatus ,
@@ -630,11 +631,12 @@ static Snapshot DtmGetSnapshot(Snapshot snapshot)
630631{
631632 if (TransactionIdIsValid (DtmNextXid ) && snapshot != & CatalogSnapshotData )
632633 {
633- if (!DtmHasGlobalSnapshot ) {
634+ if (!DtmHasGlobalSnapshot && ( snapshot != DtmLastSnapshot || DtmCurcid != GetCurrentCommandId (false)) ) {
634635 DtmGlobalGetSnapshot (DtmNextXid , & DtmSnapshot , & dtm -> minXid );
635636 }
636637 DtmLastSnapshot = snapshot ;
637638 DtmMergeWithGlobalSnapshot (snapshot );
639+ DtmCurcid = snapshot -> curcid ;
638640 if (!IsolationUsesXactSnapshot ())
639641 {
640642 /* Use single global snapshot during all transaction for repeatable read isolation level,
Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ static SnapshotData DtmSnapshot = { HeapTupleSatisfiesMVCC };
107107static bool DtmHasGlobalSnapshot ;
108108static bool DtmGlobalXidAssigned ;
109109static int DtmLocalXidReserve ;
110+ static CommandId DtmCurcid ;
110111static Snapshot DtmLastSnapshot ;
111112static TransactionManager DtmTM = {
112113 DtmGetTransactionStatus ,
@@ -600,7 +601,6 @@ DtmGetNewTransactionId(bool isSubXact)
600601 return xid ;
601602}
602603
603-
604604static Snapshot DtmGetSnapshot (Snapshot snapshot )
605605{
606606 if (DtmGlobalXidAssigned )
@@ -613,11 +613,13 @@ static Snapshot DtmGetSnapshot(Snapshot snapshot)
613613 }
614614 if (TransactionIdIsValid (DtmNextXid ) && snapshot != & CatalogSnapshotData )
615615 {
616+ // if (!DtmHasGlobalSnapshot && (snapshot != DtmLastSnapshot || DtmCurcid != GetCurrentCommandId(false))) {
616617 if (!DtmHasGlobalSnapshot ) {
617618 ArbiterGetSnapshot (DtmNextXid , & DtmSnapshot , & dtm -> minXid );
618619 }
619620 DtmLastSnapshot = snapshot ;
620621 DtmMergeWithGlobalSnapshot (snapshot );
622+ DtmCurcid = snapshot -> curcid ;
621623 if (!IsolationUsesXactSnapshot ())
622624 {
623625 /* Use single global snapshot during all transaction for repeatable read isolation level,
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ struct config
7070 nWriters = 10 ;
7171 nIterations = 1000 ;
7272 nAccounts = 1000 ;
73- isolationLevel = " read committed" ;
73+ isolationLevel = " repeatable read " ; // " read committed";
7474 }
7575};
7676
You can’t perform that action at this time.
0 commit comments