@@ -444,7 +444,7 @@ type pebbleMVCCScanner struct {
444
444
// extended encoding of any returned value. This includes the
445
445
// MVCCValueHeader.
446
446
rawMVCCValues bool
447
- moreRecentPolicy MVCCGetMoreRecentPolicy
447
+ failOnMoreRecent bool
448
448
keyBuf []byte
449
449
savedBuf []byte
450
450
lazyFetcherBuf pebble.LazyFetcher
@@ -571,12 +571,12 @@ func (p *pebbleMVCCScanner) init(
571
571
// future-time timestamps with earlier local timestamps. We are only able
572
572
// to skip uncertainty checks if p.ts >= global_uncertainty_limit.
573
573
//
574
- // We disable checkUncertainty when the scanner is configured with a
575
- // moreRecentPolicy other than IgnoreMoreRecent. This avoids cases in which a
576
- // scan would have failed with a WriteTooOldError or ExclusionViolationError
577
- // but instead gets an unexpected ReadWithinUncertaintyIntervalError See:
574
+ // We disable checkUncertainty when the scanner is configured with failOnMoreRecent.
575
+ // This avoids cases in which a scan would have failed with a WriteTooOldError
576
+ // but instead gets an unexpected ReadWithinUncertaintyIntervalError
577
+ // See:
578
578
// https://github.com/cockroachdb/cockroach/issues/119681
579
- p .checkUncertainty = p .ts .Less (p .uncertainty .GlobalLimit ) && p . moreRecentPolicy == IgnoreMoreRecent
579
+ p .checkUncertainty = p .ts .Less (p .uncertainty .GlobalLimit ) && ! p . failOnMoreRecent
580
580
}
581
581
582
582
// get seeks to the start key exactly once and adds one KV to the result set.
@@ -793,15 +793,9 @@ func (p *pebbleMVCCScanner) maybeFailOnMoreRecent() {
793
793
if p .err != nil || p .mostRecentTS .IsEmpty () {
794
794
return
795
795
}
796
-
797
- switch p .moreRecentPolicy {
798
- case WriteTooOldErrorOnMoreRecent :
799
- // The txn can't write at the existing timestamp, so we provide the error
800
- // with the timestamp immediately after it.
801
- p .err = kvpb .NewWriteTooOldError (p .ts , p .mostRecentTS .Next (), p .mostRecentKey )
802
- case ExclusionViolationErrorOnMoreRecent :
803
- p .err = kvpb .NewExclusionViolationError (p .ts , p .mostRecentTS , p .mostRecentKey )
804
- }
796
+ // The txn can't write at the existing timestamp, so we provide the error
797
+ // with the timestamp immediately after it.
798
+ p .err = kvpb .NewWriteTooOldError (p .ts , p .mostRecentTS .Next (), p .mostRecentKey )
805
799
p .results .clear ()
806
800
p .intents .Reset ()
807
801
}
@@ -867,7 +861,7 @@ func (p *pebbleMVCCScanner) getOne(ctx context.Context) (ok, added bool) {
867
861
868
862
// ts == read_ts
869
863
if p .curUnsafeKey .Timestamp == p .ts {
870
- if p .moreRecentPolicy != IgnoreMoreRecent {
864
+ if p .failOnMoreRecent {
871
865
// 2. Our txn's read timestamp is equal to the most recent
872
866
// version's timestamp and the scanner has been configured to
873
867
// throw a write too old error on equal or more recent versions.
@@ -899,7 +893,7 @@ func (p *pebbleMVCCScanner) getOne(ctx context.Context) (ok, added bool) {
899
893
}
900
894
901
895
// ts > read_ts
902
- if p .moreRecentPolicy != IgnoreMoreRecent {
896
+ if p .failOnMoreRecent {
903
897
// 4. Our txn's read timestamp is less than the most recent
904
898
// version's timestamp and the scanner has been configured to
905
899
// throw a write too old error on equal or more recent versions.
@@ -982,7 +976,7 @@ func (p *pebbleMVCCScanner) getOne(ctx context.Context) (ok, added bool) {
982
976
983
977
ownIntent := p .txn != nil && p .meta .Txn .ID .Equal (p .txn .ID )
984
978
if ! ownIntent {
985
- conflictingIntent := metaTS .LessEq (p .ts ) || ( p . moreRecentPolicy != IgnoreMoreRecent )
979
+ conflictingIntent := metaTS .LessEq (p .ts ) || p . failOnMoreRecent
986
980
if ! conflictingIntent {
987
981
// 8. The key contains an intent, but we're reading below the intent.
988
982
// Seek to the desired version, checking for uncertainty if necessary.
@@ -1578,7 +1572,7 @@ func (p *pebbleMVCCScanner) processRangeKeys(seeked bool, reverse bool) bool {
1578
1572
// Check for conflicts with range keys at or above the read timestamp.
1579
1573
// We don't need to handle e.g. skipLocked, because range keys don't
1580
1574
// currently have intents.
1581
- if p .moreRecentPolicy != IgnoreMoreRecent {
1575
+ if p .failOnMoreRecent {
1582
1576
if key := p .parent .UnsafeKey (); ! hasPoint || ! key .Timestamp .IsEmpty () {
1583
1577
if newest := p .curRangeKeys .Newest (); p .ts .LessEq (newest ) {
1584
1578
if p .mostRecentTS .Forward (newest ) {
0 commit comments