diff --git a/pkg/roachpb/api.go b/pkg/roachpb/api.go index dafdf4ada9dc..5cff531b3dfa 100644 --- a/pkg/roachpb/api.go +++ b/pkg/roachpb/api.go @@ -1076,11 +1076,20 @@ func (*ImportRequest) flags() int { return isAdmin | isAlone } func (*AdminScatterRequest) flags() int { return isAdmin | isAlone | isRange } func (*AddSSTableRequest) flags() int { return isWrite | isAlone | isRange | isUnsplittable } -// RefreshRequest and RefreshRangeRequest both list -// updates(Read)TSCache, though they actually update the read or write -// timestamp cache depending on the write parameter in the request. -func (*RefreshRequest) flags() int { return isRead | isTxn | updatesReadTSCache } -func (*RefreshRangeRequest) flags() int { return isRead | isTxn | isRange | updatesReadTSCache } +// RefreshRequest and RefreshRangeRequest both determine which timestamp cache +// they update based on their Write parameter. +func (r *RefreshRequest) flags() int { + if r.Write { + return isRead | isTxn | updatesWriteTSCache + } + return isRead | isTxn | updatesReadTSCache +} +func (r *RefreshRangeRequest) flags() int { + if r.Write { + return isRead | isTxn | isRange | updatesWriteTSCache + } + return isRead | isTxn | isRange | updatesReadTSCache +} func (*SubsumeRequest) flags() int { return isRead | isAlone | updatesReadTSCache } diff --git a/pkg/storage/replica_tscache.go b/pkg/storage/replica_tscache.go index 616b85268758..1a36dc941651 100644 --- a/pkg/storage/replica_tscache.go +++ b/pkg/storage/replica_tscache.go @@ -132,10 +132,6 @@ func (r *Replica) updateTimestampCache( tc.Add(start, end, t.Txn.Timestamp, uuid.UUID{}, true /* readCache */) } } - case *roachpb.RefreshRequest: - tc.Add(start, end, ts, txnID, !t.Write /* readCache */) - case *roachpb.RefreshRangeRequest: - tc.Add(start, end, ts, txnID, !t.Write /* readCache */) default: tc.Add(start, end, ts, txnID, !roachpb.UpdatesWriteTimestampCache(args)) }