From 32f9b7f986d1bf461884d9dad8dded231b57ddbe Mon Sep 17 00:00:00 2001 From: Andrei Matei Date: Fri, 2 Apr 2021 15:52:54 -0400 Subject: [PATCH] kvserver: switch meaning of RER.Timestamp The ReplicatedEvalResult.Timestamp used to carry the read timestamp of the request that proposed the respective command. This patch renames it to WriteTimestamp and sets it accordingly. The field is used for two purposes: for bumping the clock on followers such that they don't have values above their clock, and for checking that we're not writing below the GC threshold. Both of these use cases actually want the write timestamps, so they were broken. The second use seems dubious to me (I don't think it's actually needed) but this patch does not take a position on it beyond adding a TODO. Beyond fixing the existing uses of this field, putting the write timestamp in every Raft command has the added benefit that we can use it to assert below Raft that nobody tries to write below the closed timestamp. Before this patch, only the leaseholder was able to do this assertion (because it was the only replica that had access to the write timestamp) and so the leaseholder had to do it as a non-deterministic error (and non-deterministic errors are nasty, even when they're assertion failures). This patch will help turn the assertion into a deterministic one in the future. In addition, by clarifying the meaning of this field, this patch opens the door for #62569 to muddy the field back and give it a special meaning for lease transfers - the lease start time. Also mentioning #55293 because this patch lightly touches on the interaction between requests and the GC threshold. Release note: None --- pkg/kv/kvserver/client_raft_test.go | 2 +- pkg/kv/kvserver/client_replica_test.go | 2 +- pkg/kv/kvserver/kvserverpb/proposer_kv.pb.go | 208 +++++++++--------- pkg/kv/kvserver/kvserverpb/proposer_kv.proto | 8 +- pkg/kv/kvserver/replica.go | 4 +- pkg/kv/kvserver/replica_application_result.go | 4 +- .../replica_application_state_machine.go | 15 +- .../replica_application_state_machine_test.go | 2 +- pkg/kv/kvserver/replica_proposal.go | 6 +- 9 files changed, 129 insertions(+), 122 deletions(-) diff --git a/pkg/kv/kvserver/client_raft_test.go b/pkg/kv/kvserver/client_raft_test.go index 338048c3c98d..80e72eca642b 100644 --- a/pkg/kv/kvserver/client_raft_test.go +++ b/pkg/kv/kvserver/client_raft_test.go @@ -4702,7 +4702,7 @@ func TestAckWriteBeforeApplication(t *testing.T) { blockPreApplication, blockPostApplication := make(chan struct{}), make(chan struct{}) applyFilterFn := func(ch chan struct{}) kvserverbase.ReplicaApplyFilter { return func(filterArgs kvserverbase.ApplyFilterArgs) (int, *roachpb.Error) { - if atomic.LoadInt32(&filterActive) == 1 && filterArgs.Timestamp == magicTS { + if atomic.LoadInt32(&filterActive) == 1 && filterArgs.WriteTimestamp == magicTS { <-ch } return 0, nil diff --git a/pkg/kv/kvserver/client_replica_test.go b/pkg/kv/kvserver/client_replica_test.go index 9e0e2dffb00f..efc66a769264 100644 --- a/pkg/kv/kvserver/client_replica_test.go +++ b/pkg/kv/kvserver/client_replica_test.go @@ -3342,7 +3342,7 @@ func TestProposalOverhead(t *testing.T) { } // Sometime the logical portion of the timestamp can be non-zero which makes // the overhead non-deterministic. - args.Cmd.ReplicatedEvalResult.Timestamp.Logical = 0 + args.Cmd.ReplicatedEvalResult.WriteTimestamp.Logical = 0 atomic.StoreUint32(&overhead, uint32(args.Cmd.Size()-args.Cmd.WriteBatch.Size())) // We don't want to print the WriteBatch because it's explicitly // excluded from the size computation. Nil'ing it out does not diff --git a/pkg/kv/kvserver/kvserverpb/proposer_kv.pb.go b/pkg/kv/kvserver/kvserverpb/proposer_kv.pb.go index 3b4049be469e..23909fca7afe 100644 --- a/pkg/kv/kvserver/kvserverpb/proposer_kv.pb.go +++ b/pkg/kv/kvserver/kvserverpb/proposer_kv.pb.go @@ -285,10 +285,10 @@ type ReplicatedEvalResult struct { Merge *Merge `protobuf:"bytes,4,opt,name=merge,proto3" json:"merge,omitempty"` ComputeChecksum *ComputeChecksum `protobuf:"bytes,21,opt,name=compute_checksum,json=computeChecksum,proto3" json:"compute_checksum,omitempty"` IsLeaseRequest bool `protobuf:"varint,6,opt,name=is_lease_request,json=isLeaseRequest,proto3" json:"is_lease_request,omitempty"` - // The BatchRequest.Timestamp of the request that produced this command. Used - // to verify the validity of the command against the GC threshold and to - // update the followers' clocks. - Timestamp hlc.Timestamp `protobuf:"bytes,8,opt,name=timestamp,proto3" json:"timestamp"` + // The timestamp at which this command is writing. Used to verify the validity + // of the command against the GC threshold and to update the followers' + // clocks. + WriteTimestamp hlc.Timestamp `protobuf:"bytes,8,opt,name=write_timestamp,json=writeTimestamp,proto3" json:"write_timestamp"` // The stats delta corresponding to the data in this WriteBatch. On // a split, contains only the contributions to the left-hand side. DeprecatedDelta *enginepb.MVCCStats `protobuf:"bytes,10,opt,name=deprecated_delta,json=deprecatedDelta,proto3" json:"deprecated_delta,omitempty"` @@ -704,102 +704,102 @@ func init() { } var fileDescriptor_19df0b186dd19269 = []byte{ - // 1510 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xd1, 0x6f, 0x13, 0x47, - 0x1a, 0x8f, 0x63, 0x3b, 0x59, 0x8f, 0x13, 0x7b, 0x33, 0x04, 0xd8, 0xcb, 0xdd, 0xd9, 0x91, 0x8f, - 0x43, 0x39, 0x8e, 0x5b, 0xa3, 0xe4, 0x4e, 0x42, 0x1c, 0xaa, 0x88, 0x1d, 0x28, 0x31, 0x49, 0x0a, - 0xe3, 0x40, 0x2b, 0x5a, 0x69, 0x35, 0xde, 0x1d, 0xd6, 0x5b, 0xaf, 0x77, 0x97, 0x99, 0xb1, 0x21, - 0x7f, 0x45, 0x5b, 0xa9, 0x52, 0xfb, 0x54, 0x78, 0xec, 0x9f, 0xc2, 0x23, 0x8f, 0xa8, 0x0f, 0x56, - 0x09, 0x2f, 0xfd, 0x1b, 0x78, 0xaa, 0x66, 0x76, 0xd6, 0x5e, 0xa3, 0xd0, 0x18, 0xfa, 0x36, 0xfb, - 0xcd, 0x7c, 0xbf, 0x6f, 0xe6, 0xfb, 0x7e, 0xdf, 0x6f, 0x66, 0xc1, 0x46, 0x6f, 0x58, 0xef, 0x0d, - 0x19, 0xa1, 0x43, 0x42, 0xc7, 0x83, 0xa8, 0x53, 0x8f, 0x68, 0x18, 0x85, 0x8c, 0x50, 0xab, 0x37, - 0x34, 0x23, 0x1a, 0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 0xd6, - 0x4c, 0x43, 0x4b, 0xc2, 0xd8, 0x56, 0x36, 0xb8, 0x05, 0x72, 0xfd, 0xd0, 0x21, 0x46, 0x76, 0x3d, - 0xb3, 0x51, 0x3a, 0x31, 0xd9, 0x49, 0xdc, 0xfd, 0xd0, 0x21, 0x48, 0x2e, 0x86, 0x15, 0x10, 0xef, - 0x20, 0x0a, 0xbd, 0x80, 0x1b, 0x39, 0x09, 0x9b, 0xb2, 0xc0, 0xdb, 0xa0, 0xc0, 0x09, 0xed, 0x7b, - 0x01, 0xe6, 0xc4, 0x58, 0x58, 0xcf, 0x6e, 0x14, 0x37, 0x2f, 0x9c, 0x80, 0xac, 0x72, 0xbc, 0x43, - 0x98, 0x4d, 0xbd, 0x88, 0x87, 0xb4, 0x91, 0x13, 0x39, 0x42, 0x13, 0x67, 0x55, 0xc9, 0x07, 0x00, - 0x88, 0x14, 0x63, 0x9b, 0x8b, 0x73, 0xad, 0x82, 0x7c, 0xe7, 0x88, 0x13, 0x26, 0xf3, 0x9a, 0x45, - 0xf1, 0x07, 0xbc, 0x0c, 0x20, 0x1b, 0xb8, 0x2e, 0x61, 0x9c, 0x38, 0x16, 0xe6, 0x56, 0x80, 0x83, - 0x90, 0xc9, 0x23, 0x67, 0x91, 0x3e, 0x9e, 0xd9, 0xe6, 0x07, 0xc2, 0xae, 0x70, 0xbf, 0x9f, 0x07, - 0x67, 0xda, 0xc9, 0x54, 0x2a, 0xc2, 0x3d, 0x50, 0x60, 0x1c, 0x53, 0x6e, 0xf5, 0xc8, 0x91, 0xaa, - 0xde, 0x7f, 0xdf, 0x8e, 0xaa, 0x57, 0x66, 0xaa, 0x5c, 0x72, 0xba, 0x3b, 0xe4, 0x08, 0x69, 0x12, - 0xe6, 0x0e, 0x39, 0x82, 0xfb, 0x60, 0x91, 0x04, 0x8e, 0x04, 0x9c, 0xff, 0x13, 0x80, 0x0b, 0x24, - 0x70, 0x04, 0xdc, 0x7d, 0x00, 0xec, 0xf1, 0x7e, 0x65, 0xf1, 0x8a, 0x9b, 0xff, 0x36, 0x4f, 0x91, - 0x42, 0x73, 0x72, 0xc4, 0x14, 0x9f, 0x53, 0x40, 0x2a, 0x2d, 0xcf, 0x0a, 0x60, 0x55, 0xd5, 0x86, - 0x13, 0xe7, 0xe6, 0x10, 0xfb, 0x88, 0xb0, 0x81, 0x2f, 0x64, 0x24, 0x2f, 0xb5, 0x4b, 0x75, 0xff, - 0x7f, 0x4e, 0x0d, 0xa8, 0x50, 0x84, 0x0a, 0x10, 0x14, 0xfb, 0xc2, 0xeb, 0x20, 0xcf, 0x84, 0xd2, - 0xa8, 0x5d, 0x5f, 0x3c, 0x15, 0x44, 0xea, 0x12, 0x8a, 0x9d, 0x84, 0x77, 0x5f, 0x74, 0xbf, 0x64, - 0xdd, 0x2c, 0xde, 0x52, 0x2b, 0x50, 0xec, 0x04, 0xbf, 0x04, 0xba, 0x1d, 0xf7, 0xaa, 0x95, 0xb4, - 0x90, 0x71, 0x56, 0x02, 0x5d, 0x99, 0x29, 0x79, 0xa9, 0x26, 0x47, 0x65, 0xfb, 0x9d, 0xae, 0xdf, - 0x00, 0xba, 0xc7, 0x2c, 0x9f, 0x60, 0x46, 0x2c, 0x4a, 0x1e, 0x0f, 0x08, 0xe3, 0xc6, 0x82, 0xec, - 0x8d, 0x92, 0xc7, 0xf6, 0x84, 0x19, 0xc5, 0x56, 0xb8, 0x0d, 0x0a, 0x63, 0x05, 0x37, 0x34, 0x19, - 0xff, 0xef, 0xa9, 0xf8, 0xa2, 0xf7, 0xcd, 0xae, 0x6f, 0x9b, 0x87, 0xc9, 0xa2, 0x71, 0x63, 0x24, - 0x06, 0x78, 0x17, 0xe8, 0x0e, 0x89, 0x28, 0x91, 0x25, 0x52, 0x9a, 0x0c, 0x3e, 0x40, 0x93, 0x51, - 0x79, 0xe2, 0x2e, 0x85, 0x18, 0xde, 0x02, 0xf9, 0x18, 0x06, 0x4a, 0x98, 0x4b, 0x33, 0xc1, 0x48, - 0x57, 0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0x56, 0xcf, 0x8d, 0x5b, 0x76, 0x5e, 0xcf, 0xc6, 0xed, 0xf8, 0xec, 0xa0, 0x76, 0x15, - 0x94, 0xf6, 0x15, 0x49, 0x6e, 0x85, 0x21, 0x27, 0x74, 0x56, 0x36, 0xd5, 0x5c, 0x70, 0xb6, 0x39, - 0x4d, 0x0b, 0x05, 0x70, 0xf0, 0x91, 0x34, 0x53, 0xe5, 0x7f, 0x97, 0x6c, 0x8d, 0xcb, 0x2f, 0x5e, - 0x57, 0xe6, 0x5e, 0x1c, 0x57, 0x32, 0x2f, 0x8f, 0x2b, 0x99, 0x57, 0xc7, 0x95, 0xcc, 0xaf, 0xc7, - 0x95, 0xcc, 0xb7, 0x6f, 0x2a, 0x73, 0x2f, 0xdf, 0x54, 0xe6, 0x5e, 0xbd, 0xa9, 0xcc, 0x3d, 0x04, - 0x93, 0x3f, 0xb4, 0xce, 0x82, 0xfc, 0x81, 0xda, 0xfa, 0x3d, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xe6, - 0x84, 0xc3, 0x87, 0x0e, 0x00, 0x00, + // 1515 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x51, 0x6f, 0x13, 0xc7, + 0x16, 0x8e, 0x63, 0x3b, 0x59, 0x8f, 0x13, 0x7b, 0x33, 0x04, 0xd8, 0x9b, 0x7b, 0xaf, 0x1d, 0xf9, + 0x72, 0x51, 0x2e, 0x97, 0xae, 0x51, 0xd2, 0x4a, 0x88, 0xa2, 0x0a, 0xec, 0x40, 0x89, 0x49, 0x52, + 0x18, 0x07, 0x5a, 0xd1, 0x4a, 0xab, 0xf1, 0xee, 0xb0, 0xde, 0x7a, 0xbd, 0xbb, 0xcc, 0x8c, 0x0d, + 0xf9, 0x15, 0x6d, 0xa5, 0x4a, 0xed, 0x53, 0xcb, 0x63, 0xd5, 0x5f, 0xc2, 0x23, 0x8f, 0xa8,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, 0xea, 0xc1, 0xc0, 0x73, + 0xcc, 0x7b, 0xf7, 0x76, 0xb6, 0x8f, 0x46, 0x55, 0x90, 0xa0, 0xef, 0x6c, 0x23, 0x90, 0xa0, 0xef, + 0x38, 0xd0, 0x00, 0x8b, 0x43, 0x42, 0x99, 0x17, 0x06, 0x46, 0x7e, 0x3d, 0xb3, 0xb1, 0x8c, 0x92, + 0x4f, 0xf8, 0x1f, 0xb0, 0xcc, 0xf0, 0x90, 0x58, 0x2c, 0xc0, 0x11, 0xeb, 0x86, 0x5c, 0xd6, 0x4c, + 0x43, 0x4b, 0xc2, 0xd8, 0x56, 0x36, 0xb8, 0x05, 0x72, 0xfd, 0xd0, 0x21, 0x46, 0x76, 0x3d, 0xb3, + 0x51, 0x3a, 0x36, 0xd9, 0xc9, 0xba, 0x7b, 0xa1, 0x43, 0x90, 0x74, 0x86, 0x15, 0x10, 0xef, 0x20, + 0x0a, 0xbd, 0x80, 0x1b, 0x39, 0x09, 0x9b, 0xb2, 0xc0, 0x5b, 0xa0, 0xc0, 0x09, 0xed, 0x7b, 0x01, + 0xe6, 0xc4, 0x58, 0x58, 0xcf, 0x6e, 0x14, 0x37, 0xcf, 0x1d, 0x83, 0xac, 0x72, 0xbc, 0x4d, 0x98, + 0x4d, 0xbd, 0x88, 0x87, 0xb4, 0x91, 0x13, 0x39, 0x42, 0x93, 0x60, 0x55, 0xc9, 0xfb, 0x00, 0x88, + 0x14, 0x63, 0x9b, 0x8b, 0x73, 0xad, 0x82, 0x7c, 0xe7, 0x90, 0x13, 0x26, 0xf3, 0x9a, 0x45, 0xf1, + 0x07, 0xbc, 0x08, 0x20, 0x1b, 0xb8, 0x2e, 0x61, 0x9c, 0x38, 0x16, 0xe6, 0x56, 0x80, 0x83, 0x90, + 0xc9, 0x23, 0x67, 0x91, 0x3e, 0x9e, 0xb9, 0xce, 0xf7, 0x85, 0x5d, 0xe1, 0x7e, 0x3f, 0x0f, 0x4e, + 0xb5, 0x93, 0xa9, 0xd4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, 0xa4, 0xb4, + 0x2e, 0xf9, 0xfa, 0xf1, 0xc9, 0x99, 0x98, 0xf0, 0xd2, 0x3c, 0x10, 0xe1, 0xdb, 0x98, 0xe3, 0x1b, + 0x01, 0xa7, 0x87, 0xa8, 0xc0, 0x93, 0xef, 0xb5, 0xab, 0xa0, 0x34, 0x3d, 0x09, 0x75, 0x90, 0x4d, + 0x9e, 0x3b, 0x05, 0x24, 0x86, 0xe2, 0xa1, 0x35, 0xc4, 0xfe, 0x20, 0xbe, 0xee, 0x0b, 0x28, 0xfe, + 0xb8, 0x32, 0x7f, 0x59, 0x34, 0x6b, 0x56, 0xcf, 0x8d, 0x5b, 0x76, 0x5e, 0xcf, 0xc6, 0xed, 0xf8, + 0xf3, 0x7e, 0xed, 0x32, 0x28, 0xed, 0x29, 0x92, 0xdc, 0x0c, 0x43, 0x4e, 0xe8, 0xac, 0x6c, 0xaa, + 0xb9, 0xe0, 0x74, 0x73, 0x9a, 0x16, 0x0a, 0x60, 0xff, 0x3d, 0x69, 0xa6, 0xca, 0xff, 0x26, 0xd9, + 0x1a, 0x17, 0x9f, 0xbd, 0xac, 0xcc, 0x3d, 0x3b, 0xaa, 0x64, 0x9e, 0x1f, 0x55, 0x32, 0x2f, 0x8e, + 0x2a, 0x99, 0xdf, 0x8f, 0x2a, 0x99, 0x6f, 0x5f, 0x55, 0xe6, 0x9e, 0xbf, 0xaa, 0xcc, 0xbd, 0x78, + 0x55, 0x99, 0x7b, 0x00, 0x26, 0x3f, 0x6b, 0x9d, 0x05, 0xf9, 0x2f, 0xb5, 0xf5, 0x67, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xf2, 0x56, 0x08, 0x65, 0x92, 0x0e, 0x00, 0x00, } func (this *Split) Equal(that interface{}) bool { @@ -1365,7 +1365,7 @@ func (m *ReplicatedEvalResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x52 } { - size, err := m.Timestamp.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.WriteTimestamp.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1837,7 +1837,7 @@ func (m *ReplicatedEvalResult) Size() (n int) { if m.IsLeaseRequest { n += 2 } - l = m.Timestamp.Size() + l = m.WriteTimestamp.Size() n += 1 + l + sovProposerKv(uint64(l)) if m.DeprecatedDelta != nil { l = m.DeprecatedDelta.Size() @@ -2860,7 +2860,7 @@ func (m *ReplicatedEvalResult) Unmarshal(dAtA []byte) error { m.IsLeaseRequest = bool(v != 0) case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WriteTimestamp", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2887,7 +2887,7 @@ func (m *ReplicatedEvalResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.WriteTimestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/pkg/kv/kvserver/kvserverpb/proposer_kv.proto b/pkg/kv/kvserver/kvserverpb/proposer_kv.proto index dbc8a20fd232..d6a72965ffa2 100644 --- a/pkg/kv/kvserver/kvserverpb/proposer_kv.proto +++ b/pkg/kv/kvserver/kvserverpb/proposer_kv.proto @@ -125,10 +125,10 @@ message ReplicatedEvalResult { Merge merge = 4; ComputeChecksum compute_checksum = 21; bool is_lease_request = 6; - // The BatchRequest.Timestamp of the request that produced this command. Used - // to verify the validity of the command against the GC threshold and to - // update the followers' clocks. - util.hlc.Timestamp timestamp = 8 [(gogoproto.nullable) = false]; + // The timestamp at which this command is writing. Used to verify the validity + // of the command against the GC threshold and to update the followers' + // clocks. + util.hlc.Timestamp write_timestamp = 8 [(gogoproto.nullable) = false]; // The stats delta corresponding to the data in this WriteBatch. On // a split, contains only the contributions to the left-hand side. storage.enginepb.MVCCStats deprecated_delta = 10; // See #18828 diff --git a/pkg/kv/kvserver/replica.go b/pkg/kv/kvserver/replica.go index 865175233bb4..334829e18677 100644 --- a/pkg/kv/kvserver/replica.go +++ b/pkg/kv/kvserver/replica.go @@ -1348,8 +1348,8 @@ func (r *Replica) checkSpanInRangeRLocked(ctx context.Context, rspan roachpb.RSp ) } -// checkTSAboveGCThresholdRLocked returns an error if a request (identified -// by its MVCC timestamp) can be run on the replica. +// checkTSAboveGCThresholdRLocked returns an error if a request (identified by +// its read timestamp) wants to read below the range's GC threshold. func (r *Replica) checkTSAboveGCThresholdRLocked( ts hlc.Timestamp, st kvserverpb.LeaseStatus, isAdmin bool, ) error { diff --git a/pkg/kv/kvserver/replica_application_result.go b/pkg/kv/kvserver/replica_application_result.go index 1d212e8d9c24..c86f35ab5fa7 100644 --- a/pkg/kv/kvserver/replica_application_result.go +++ b/pkg/kv/kvserver/replica_application_result.go @@ -67,7 +67,7 @@ func isTrivial(r *kvserverpb.ReplicatedEvalResult) bool { // it is trivial. allowlist := *r allowlist.Delta = enginepb.MVCCStatsDelta{} - allowlist.Timestamp = hlc.Timestamp{} + allowlist.WriteTimestamp = hlc.Timestamp{} allowlist.DeprecatedDelta = nil allowlist.PrevLeaseProposal = nil allowlist.State = nil @@ -85,7 +85,7 @@ func clearTrivialReplicatedEvalResultFields(r *kvserverpb.ReplicatedEvalResult) // they don't trigger an assertion at the end of the application process // (which checks that all fields were handled). r.IsLeaseRequest = false - r.Timestamp = hlc.Timestamp{} + r.WriteTimestamp = hlc.Timestamp{} r.PrevLeaseProposal = nil // The state fields cleared here were already applied to the in-memory view of // replica state for this batch. diff --git a/pkg/kv/kvserver/replica_application_state_machine.go b/pkg/kv/kvserver/replica_application_state_machine.go index 2aa5acb0f544..7ff541f5df8e 100644 --- a/pkg/kv/kvserver/replica_application_state_machine.go +++ b/pkg/kv/kvserver/replica_application_state_machine.go @@ -318,16 +318,19 @@ func checkForcedErr( ) } - // Verify that the batch timestamp is after the GC threshold. This is + // Verify that command is not trying to write below the GC threshold. This is // necessary because not all commands declare read access on the GC // threshold key, even though they implicitly depend on it. This means // that access to this state will not be serialized by latching, // so we must perform this check upstream and downstream of raft. - // See #14833. - ts := raftCmd.ReplicatedEvalResult.Timestamp - if ts.LessEq(*replicaState.GCThreshold) { + // TODO(andrei,nvanbenschoten,bdarnell): Is this check below-Raft actually + // necessary, given that we've check at evaluation time that the request + // evaluates at a timestamp above the GC threshold? Does it actually matter if + // the GC threshold has advanced since then? + wts := raftCmd.ReplicatedEvalResult.WriteTimestamp + if wts.LessEq(*replicaState.GCThreshold) { return leaseIndex, proposalNoReevaluation, roachpb.NewError(&roachpb.BatchTimestampBeforeGCError{ - Timestamp: ts, + Timestamp: wts, Threshold: *replicaState.GCThreshold, }) } @@ -484,7 +487,7 @@ func (b *replicaAppBatch) Stage(cmdI apply.Command) (apply.CheckedCommand, error } // Update the batch's max timestamp. - if clockTS, ok := cmd.replicatedResult().Timestamp.TryToClockTimestamp(); ok { + if clockTS, ok := cmd.replicatedResult().WriteTimestamp.TryToClockTimestamp(); ok { b.maxTS.Forward(clockTS) } diff --git a/pkg/kv/kvserver/replica_application_state_machine_test.go b/pkg/kv/kvserver/replica_application_state_machine_test.go index c64225c03ec7..11d2c1b04f21 100644 --- a/pkg/kv/kvserver/replica_application_state_machine_test.go +++ b/pkg/kv/kvserver/replica_application_state_machine_test.go @@ -123,7 +123,7 @@ func TestReplicaStateMachineChangeReplicas(t *testing.T) { ReplicatedEvalResult: kvserverpb.ReplicatedEvalResult{ State: &kvserverpb.ReplicaState{Desc: &newDesc}, ChangeReplicas: &kvserverpb.ChangeReplicas{ChangeReplicasTrigger: trigger}, - Timestamp: r.mu.state.GCThreshold.Add(1, 0), + WriteTimestamp: r.mu.state.GCThreshold.Add(1, 0), }, }, confChange: &decodedConfChange{ diff --git a/pkg/kv/kvserver/replica_proposal.go b/pkg/kv/kvserver/replica_proposal.go index 5bd7f506744f..98587f35f088 100644 --- a/pkg/kv/kvserver/replica_proposal.go +++ b/pkg/kv/kvserver/replica_proposal.go @@ -766,6 +766,10 @@ func (r *Replica) evaluateProposal( // Evaluate the commands. If this returns without an error, the batch should // be committed. Note that we don't hold any locks at this point. This is // important since evaluating a proposal is expensive. + // + // Note that, during evaluation, ba's read and write timestamps might get + // bumped (see evaluateWriteBatchWithServersideRefreshes). + // // TODO(tschottdorf): absorb all returned values in `res` below this point // in the call stack as well. batch, ms, br, res, pErr := r.evaluateWriteBatch(ctx, idKey, ba, lul, latchSpans) @@ -822,7 +826,7 @@ func (r *Replica) evaluateProposal( // Set the proposal's replicated result, which contains metadata and // side-effects that are to be replicated to all replicas. res.Replicated.IsLeaseRequest = ba.IsLeaseRequest() - res.Replicated.Timestamp = ba.Timestamp + res.Replicated.WriteTimestamp = ba.WriteTimestamp() res.Replicated.Delta = ms.ToStatsDelta() // This is the result of a migration. See the field for more details.