Skip to content

Commit 557d95d

Browse files
committed
kvpb: allow CanForwardReadTimestamp and ExpectExclusionSince for RC
CanForwardReadTimestamp and ExpectExclusionSince can co-exist in transactions that use per statement read snapshots since the read footprint gets reset each time the transaction is stepped. Epic: none Release note: None
1 parent 4fa3974 commit 557d95d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/kv/kvpb/api.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2555,10 +2555,14 @@ func validateExclusionTimestampForBatch(ts hlc.Timestamp, h Header) error {
25552555
return nil
25562556
}
25572557

2558+
// Unless the IsoLevel allows per-statement read snapshots,
25582559
// CanForwardReadTimestamp implies we haven't served a read, so it makes no
25592560
// sense that ExpectExclusionSince would be set since it is the result of a
25602561
// locking read.
2561-
if h.CanForwardReadTimestamp {
2562+
//
2563+
// If the IsoLevel permits per-statement read snapshots, then the read
2564+
// footprint may have been reset since the locking read was issued.
2565+
if h.CanForwardReadTimestamp && !h.Txn.IsoLevel.PerStatementReadSnapshot() {
25622566
return errors.New("unexpected ExpectExclusionSince in batch with CanForwardReadTimestamp set")
25632567
}
25642568
return nil

0 commit comments

Comments
 (0)