Skip to content

Commit

Permalink
roachpb/storage: remove special cases for Refresh{Range}Request
Browse files Browse the repository at this point in the history
We no longer need special cases for these two request types in
updateTimestampCache.

Release note: None
  • Loading branch information
nvanbenschoten committed Feb 5, 2019
1 parent d396c34 commit ab23010
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
19 changes: 14 additions & 5 deletions pkg/roachpb/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
4 changes: 0 additions & 4 deletions pkg/storage/replica_tscache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit ab23010

Please sign in to comment.