Skip to content

Commit

Permalink
Merge pull request #62606 from nvanbenschoten/backport21.1-62465
Browse files Browse the repository at this point in the history
release-21.1: kvccl: re-order enterprise check in canSendToFollower
  • Loading branch information
nvanbenschoten authored Mar 25, 2021
2 parents dce4749 + 59782f8 commit 2b685a0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/ccl/kvccl/kvfollowerreadsccl/followerreads.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ func canSendToFollower(
ctPolicy roachpb.RangeClosedTimestampPolicy,
ba roachpb.BatchRequest,
) bool {
return checkFollowerReadsEnabled(clusterID, st) &&
kvserver.BatchCanBeEvaluatedOnFollower(ba) &&
closedTimestampLikelySufficient(st, clock, ctPolicy, ba.Txn.RequiredFrontier())
return kvserver.BatchCanBeEvaluatedOnFollower(ba) &&
closedTimestampLikelySufficient(st, clock, ctPolicy, ba.Txn.RequiredFrontier()) &&
// NOTE: this call can be expensive, so perform it last. See #62447.
checkFollowerReadsEnabled(clusterID, st)
}

type followerReadOracle struct {
Expand Down Expand Up @@ -188,9 +189,10 @@ func (o *followerReadOracle) useClosestOracle(
// sent to the correct replicas once canSendToFollower is checked for each
// BatchRequests in the DistSender. This would hurt performance, but would
// not violate correctness.
return checkFollowerReadsEnabled(o.clusterID.Get(), o.st) &&
txn != nil &&
closedTimestampLikelySufficient(o.st, o.clock, ctPolicy, txn.RequiredFrontier())
return txn != nil &&
closedTimestampLikelySufficient(o.st, o.clock, ctPolicy, txn.RequiredFrontier()) &&
// NOTE: this call can be expensive, so perform it last. See #62447.
checkFollowerReadsEnabled(o.clusterID.Get(), o.st)
}

// followerReadOraclePolicy is a leaseholder choosing policy that detects
Expand Down

0 comments on commit 2b685a0

Please sign in to comment.