File tree 3 files changed +8
-5
lines changed
3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ static TransactionId DtmNextXid;
123
123
static SnapshotData DtmSnapshot = { HeapTupleSatisfiesMVCC };
124
124
static bool DtmHasGlobalSnapshot ;
125
125
static int DtmLocalXidReserve ;
126
+ static CommandId DtmCurcid ;
126
127
static Snapshot DtmLastSnapshot ;
127
128
static TransactionManager DtmTM = {
128
129
DtmGetTransactionStatus ,
@@ -630,11 +631,12 @@ static Snapshot DtmGetSnapshot(Snapshot snapshot)
630
631
{
631
632
if (TransactionIdIsValid (DtmNextXid ) && snapshot != & CatalogSnapshotData )
632
633
{
633
- if (!DtmHasGlobalSnapshot ) {
634
+ if (!DtmHasGlobalSnapshot && ( snapshot != DtmLastSnapshot || DtmCurcid != GetCurrentCommandId (false)) ) {
634
635
DtmGlobalGetSnapshot (DtmNextXid , & DtmSnapshot , & dtm -> minXid );
635
636
}
636
637
DtmLastSnapshot = snapshot ;
637
638
DtmMergeWithGlobalSnapshot (snapshot );
639
+ DtmCurcid = snapshot -> curcid ;
638
640
if (!IsolationUsesXactSnapshot ())
639
641
{
640
642
/* 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 };
107
107
static bool DtmHasGlobalSnapshot ;
108
108
static bool DtmGlobalXidAssigned ;
109
109
static int DtmLocalXidReserve ;
110
+ static CommandId DtmCurcid ;
110
111
static Snapshot DtmLastSnapshot ;
111
112
static TransactionManager DtmTM = {
112
113
DtmGetTransactionStatus ,
@@ -600,7 +601,6 @@ DtmGetNewTransactionId(bool isSubXact)
600
601
return xid ;
601
602
}
602
603
603
-
604
604
static Snapshot DtmGetSnapshot (Snapshot snapshot )
605
605
{
606
606
if (DtmGlobalXidAssigned )
@@ -612,12 +612,13 @@ static Snapshot DtmGetSnapshot(Snapshot snapshot)
612
612
return PgGetSnapshotData (snapshot );
613
613
}
614
614
if (TransactionIdIsValid (DtmNextXid ) && snapshot != & CatalogSnapshotData )
615
- {
616
- if (!DtmHasGlobalSnapshot ) {
615
+ {
616
+ if (!DtmHasGlobalSnapshot && ( snapshot != DtmLastSnapshot || DtmCurcid != GetCurrentCommandId (false))) {
617
617
DtmGlobalGetSnapshot (DtmNextXid , & DtmSnapshot , & dtm -> minXid );
618
618
}
619
619
DtmLastSnapshot = snapshot ;
620
620
DtmMergeWithGlobalSnapshot (snapshot );
621
+ DtmCurcid = snapshot -> curcid ;
621
622
if (!IsolationUsesXactSnapshot ())
622
623
{
623
624
/* 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
70
70
nWriters = 10 ;
71
71
nIterations = 1000 ;
72
72
nAccounts = 1000 ;
73
- isolationLevel = " read committed" ;
73
+ isolationLevel = " repeatable read " ; // " read committed";
74
74
}
75
75
};
76
76
You can’t perform that action at this time.
0 commit comments