@@ -3474,10 +3474,12 @@ ACTOR Future<Version> waitForCommittedVersion(Database cx, Version version, Span
34743474 cx->minAcceptableReadVersion = std::min (cx->minAcceptableReadVersion , v.version );
34753475 if (v.midShardSize > 0 )
34763476 cx->smoothMidShardSize .setTotal (v.midShardSize );
3477- if (cx->isCurrentGrvProxy (v.proxyId )) {
3478- cx->ssVersionVectorCache .applyDelta (v.ssVersionVectorDelta );
3479- } else {
3480- cx->ssVersionVectorCache .clear ();
3477+ if (cx->mayNeedToUpdateVersionVectorCache (v.ssVersionVectorDelta )) {
3478+ if (cx->isCurrentGrvProxy (v.proxyId )) {
3479+ cx->ssVersionVectorCache .applyDelta (v.ssVersionVectorDelta );
3480+ } else {
3481+ cx->ssVersionVectorCache .clear ();
3482+ }
34813483 }
34823484 if (v.version >= version)
34833485 return v.version ;
@@ -3506,10 +3508,12 @@ ACTOR Future<Version> getRawVersion(Reference<TransactionState> trState) {
35063508 TransactionPriority::IMMEDIATE,
35073509 trState->cx ->ssVersionVectorCache .getMaxVersion ()),
35083510 trState->cx ->taskID ))) {
3509- if (trState->cx ->isCurrentGrvProxy (v.proxyId )) {
3510- trState->cx ->ssVersionVectorCache .applyDelta (v.ssVersionVectorDelta );
3511- } else {
3512- trState->cx ->ssVersionVectorCache .clear ();
3511+ if (trState->cx ->mayNeedToUpdateVersionVectorCache (v.ssVersionVectorDelta )) {
3512+ if (trState->cx ->isCurrentGrvProxy (v.proxyId )) {
3513+ trState->cx ->ssVersionVectorCache .applyDelta (v.ssVersionVectorDelta );
3514+ } else {
3515+ trState->cx ->ssVersionVectorCache .clear ();
3516+ }
35133517 }
35143518 return v.version ;
35153519 }
@@ -6640,10 +6644,12 @@ ACTOR Future<GetReadVersionReply> getConsistentReadVersion(SpanContext parentSpa
66406644 " TransactionDebug" , debugID.get ().first (), " NativeAPI.getConsistentReadVersion.After" );
66416645 ASSERT (v.version > 0 );
66426646 cx->minAcceptableReadVersion = std::min (cx->minAcceptableReadVersion , v.version );
6643- if (cx->isCurrentGrvProxy (v.proxyId )) {
6644- cx->ssVersionVectorCache .applyDelta (v.ssVersionVectorDelta );
6645- } else {
6646- continue ; // stale GRV reply, retry
6647+ if (cx->mayNeedToUpdateVersionVectorCache (v.ssVersionVectorDelta )) {
6648+ if (cx->isCurrentGrvProxy (v.proxyId )) {
6649+ cx->ssVersionVectorCache .applyDelta (v.ssVersionVectorDelta );
6650+ } else {
6651+ continue ; // stale GRV reply, retry
6652+ }
66476653 }
66486654 return v;
66496655 }
@@ -6830,10 +6836,12 @@ ACTOR Future<Version> extractReadVersion(Reference<TransactionState> trState,
68306836 }
68316837
68326838 metadataVersion.send (rep.metadataVersion );
6833- if (trState->cx ->isCurrentGrvProxy (rep.proxyId )) {
6834- trState->cx ->ssVersionVectorCache .applyDelta (rep.ssVersionVectorDelta );
6835- } else {
6836- trState->cx ->ssVersionVectorCache .clear ();
6839+ if (trState->cx ->mayNeedToUpdateVersionVectorCache (rep.ssVersionVectorDelta )) {
6840+ if (trState->cx ->isCurrentGrvProxy (rep.proxyId )) {
6841+ trState->cx ->ssVersionVectorCache .applyDelta (rep.ssVersionVectorDelta );
6842+ } else {
6843+ trState->cx ->ssVersionVectorCache .clear ();
6844+ }
68376845 }
68386846 return rep.version ;
68396847}
0 commit comments