Skip to content

Commit b468d1a

Browse files
committed
roachpb: stop reading Lease.DeprecatedStartStasis
This will allow removing the field in a later version. We still have to populate the field for backwards compatibility with 23.2. Epic: none Release note: None
1 parent a57ec22 commit b468d1a

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

pkg/kv/kvserver/replica_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,9 +1942,6 @@ func TestAcquireLease(t *testing.T) {
19421942
t.Errorf("unexpected lease start: %s; expected %s", lease.Start, expStart)
19431943
}
19441944

1945-
if *lease.DeprecatedStartStasis != *lease.Expiration {
1946-
t.Errorf("%s already in stasis (or beyond): %+v", ts, lease)
1947-
}
19481945
if lease.Expiration.LessEq(ts) {
19491946
t.Errorf("%s already expired: %+v", ts, lease)
19501947
}

pkg/roachpb/data.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,8 +1981,8 @@ func equivalentTimestamps(a, b *hlc.Timestamp) bool {
19811981

19821982
// Equal implements the gogoproto Equal interface. This implementation is
19831983
// forked from the gogoproto generated code to allow l.Expiration == nil and
1984-
// l.Expiration == &hlc.Timestamp{} to compare equal. Ditto for
1985-
// DeprecatedStartStasis.
1984+
// l.Expiration == &hlc.Timestamp{} to compare equal. It also ignores
1985+
// DeprecatedStartStasis entirely to allow for its removal in a later release.
19861986
func (l *Lease) Equal(that interface{}) bool {
19871987
if that == nil {
19881988
return l == nil
@@ -2012,9 +2012,6 @@ func (l *Lease) Equal(that interface{}) bool {
20122012
if !l.Replica.Equal(&that1.Replica) {
20132013
return false
20142014
}
2015-
if !equivalentTimestamps(l.DeprecatedStartStasis, that1.DeprecatedStartStasis) {
2016-
return false
2017-
}
20182015
if !l.ProposedTS.Equal(that1.ProposedTS) {
20192016
return false
20202017
}

pkg/roachpb/data.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,16 @@ message Lease {
664664
ReplicaDescriptor replica = 3 [(gogoproto.nullable) = false];
665665

666666
// The start of the lease stasis period. This field is deprecated.
667+
//
668+
// TODO(erikgrinaker): remove this. Migration:
669+
//
670+
// - 2016: the field was deprecated (#10305).
671+
//
672+
// - 24.1: stop reading the field. 23.2 nodes compare the field below Raft in
673+
// Lease.Equal(), so we must populate the field for backwards compatibility.
674+
//
675+
// - 24.2 or later: remove the field when backwards compatibility with 23.2
676+
// is no longer needed.
667677
util.hlc.Timestamp deprecated_start_stasis = 4;
668678

669679
// The current timestamp when this lease has been proposed. Used after a

pkg/roachpb/data_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,14 @@ func TestLeaseEqual(t *testing.T) {
11461146
t.Fatalf("unexpectedly did not compare equal: %s", pretty.Diff(a, b))
11471147
}
11481148

1149+
// Verify that DeprecatedStartStasis is ignored entirely.
1150+
a = Lease{DeprecatedStartStasis: &hlc.Timestamp{WallTime: 1}}
1151+
b = Lease{DeprecatedStartStasis: &hlc.Timestamp{WallTime: 2}}
1152+
c := Lease{}
1153+
require.True(t, a.Equal(b))
1154+
require.True(t, a.Equal(c))
1155+
require.True(t, b.Equal(c))
1156+
11491157
if !(*Lease)(nil).Equal(nil) {
11501158
t.Fatalf("unexpectedly did not compare equal")
11511159
}
@@ -1171,7 +1179,6 @@ func TestLeaseEqual(t *testing.T) {
11711179
{Start: clockTS},
11721180
{Expiration: &ts},
11731181
{Replica: ReplicaDescriptor{NodeID: 1}},
1174-
{DeprecatedStartStasis: &ts},
11751182
{ProposedTS: &clockTS},
11761183
{Epoch: 1},
11771184
{Sequence: 1},

0 commit comments

Comments
 (0)