File tree Expand file tree Collapse file tree 4 files changed +20
-9
lines changed Expand file tree Collapse file tree 4 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -1942,9 +1942,6 @@ func TestAcquireLease(t *testing.T) {
1942
1942
t .Errorf ("unexpected lease start: %s; expected %s" , lease .Start , expStart )
1943
1943
}
1944
1944
1945
- if * lease .DeprecatedStartStasis != * lease .Expiration {
1946
- t .Errorf ("%s already in stasis (or beyond): %+v" , ts , lease )
1947
- }
1948
1945
if lease .Expiration .LessEq (ts ) {
1949
1946
t .Errorf ("%s already expired: %+v" , ts , lease )
1950
1947
}
Original file line number Diff line number Diff line change @@ -1981,8 +1981,8 @@ func equivalentTimestamps(a, b *hlc.Timestamp) bool {
1981
1981
1982
1982
// Equal implements the gogoproto Equal interface. This implementation is
1983
1983
// 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 .
1986
1986
func (l * Lease ) Equal (that interface {}) bool {
1987
1987
if that == nil {
1988
1988
return l == nil
@@ -2012,9 +2012,6 @@ func (l *Lease) Equal(that interface{}) bool {
2012
2012
if ! l .Replica .Equal (& that1 .Replica ) {
2013
2013
return false
2014
2014
}
2015
- if ! equivalentTimestamps (l .DeprecatedStartStasis , that1 .DeprecatedStartStasis ) {
2016
- return false
2017
- }
2018
2015
if ! l .ProposedTS .Equal (that1 .ProposedTS ) {
2019
2016
return false
2020
2017
}
Original file line number Diff line number Diff line change @@ -664,6 +664,16 @@ message Lease {
664
664
ReplicaDescriptor replica = 3 [(gogoproto.nullable ) = false ];
665
665
666
666
// 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.
667
677
util.hlc.Timestamp deprecated_start_stasis = 4 ;
668
678
669
679
// The current timestamp when this lease has been proposed. Used after a
Original file line number Diff line number Diff line change @@ -1146,6 +1146,14 @@ func TestLeaseEqual(t *testing.T) {
1146
1146
t .Fatalf ("unexpectedly did not compare equal: %s" , pretty .Diff (a , b ))
1147
1147
}
1148
1148
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
+
1149
1157
if ! (* Lease )(nil ).Equal (nil ) {
1150
1158
t .Fatalf ("unexpectedly did not compare equal" )
1151
1159
}
@@ -1171,7 +1179,6 @@ func TestLeaseEqual(t *testing.T) {
1171
1179
{Start : clockTS },
1172
1180
{Expiration : & ts },
1173
1181
{Replica : ReplicaDescriptor {NodeID : 1 }},
1174
- {DeprecatedStartStasis : & ts },
1175
1182
{ProposedTS : & clockTS },
1176
1183
{Epoch : 1 },
1177
1184
{Sequence : 1 },
You can’t perform that action at this time.
0 commit comments