Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
39145: storage: add empty DeprecatedTxnSpanGCThreshold to snapshot when key missing r=nvanbenschoten a=nvanbenschoten

Fixes cockroachdb#39138.

This was missed in cockroachdb#39003. v19.1 nodes populate their ReplicaState with an empty TxnSpanGCThreshold when the key is missing, not a nil TxnSpanGCThreshold. See https://github.com/cockroachdb/cockroach/blob/b8554ec29fd1620c0e6af9544d678db57d251f4c/pkg/storage/stateloader/stateloader.go#L474-L482

We need to do the same to avoid an assertion failure after a snapshot.

Release note: None

Co-authored-by: Nathan VanBenschoten <[email protected]>
  • Loading branch information
craig[bot] and nvanbenschoten committed Jul 29, 2019
2 parents 39ccedb + cf72c7f commit 18a7112
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pkg/storage/stateloader/stateloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,8 @@ func (rsl StateLoader) LoadLegacyTxnSpanGCThreshold(
ctx context.Context, reader engine.Reader,
) (*hlc.Timestamp, error) {
var t hlc.Timestamp
found, err := engine.MVCCGetProto(ctx, reader, rsl.RangeTxnSpanGCThresholdKey(),
_, err := engine.MVCCGetProto(ctx, reader, rsl.RangeTxnSpanGCThresholdKey(),
hlc.Timestamp{}, &t, engine.MVCCGetOptions{})
if !found {
return nil, err
}
return &t, err
}

Expand Down

0 comments on commit 18a7112

Please sign in to comment.