Skip to content

Commit 2d5eaef

Browse files
craig[bot]sumeerbholatbg
committed
157118: mma: convert kvpb.ReplicationChanges to a single change per store r=tbg a=sumeerbhola Previously, a VOTER => NON_VOTER transition, or vice versa, was producing multiple changes for a store, which is invalid according to the contract of PendingRangeChange. This is now fixed by changing the logic in mmaintegration.convertReplicaChangeToMMA, and adding a mmaprototype.MakeReplicaTypeChange function. Informs cockroachdb#157049 Epic: CRDB-55052 Release note: None Co-authored-by: sumeerbhola <[email protected]> Co-authored-by: Tobias Grieger <[email protected]>
2 parents 4028293 + ff8481a commit 2d5eaef

File tree

10 files changed

+659
-158
lines changed

10 files changed

+659
-158
lines changed

pkg/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ ALL_TESTS = [
276276
"//pkg/kv/kvserver/logstore:logstore_test",
277277
"//pkg/kv/kvserver/loqrecovery/loqrecoverypb:loqrecoverypb_test",
278278
"//pkg/kv/kvserver/loqrecovery:loqrecovery_test",
279+
"//pkg/kv/kvserver/mmaintegration:mmaintegration_test",
279280
"//pkg/kv/kvserver/multiqueue:multiqueue_test",
280281
"//pkg/kv/kvserver/print:print_test",
281282
"//pkg/kv/kvserver/protectedts/ptcache:ptcache_test",
@@ -1597,6 +1598,7 @@ GO_TARGETS = [
15971598
"//pkg/kv/kvserver/loqrecovery:loqrecovery",
15981599
"//pkg/kv/kvserver/loqrecovery:loqrecovery_test",
15991600
"//pkg/kv/kvserver/mmaintegration:mmaintegration",
1601+
"//pkg/kv/kvserver/mmaintegration:mmaintegration_test",
16001602
"//pkg/kv/kvserver/multiqueue:multiqueue",
16011603
"//pkg/kv/kvserver/multiqueue:multiqueue_test",
16021604
"//pkg/kv/kvserver/print:print",

pkg/kv/kvserver/allocator/mmaprototype/allocator_state.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func (a *allocatorState) AdjustPendingChangeDisposition(change PendingRangeChang
280280
// state. We gather the found changes.
281281
var changes []*pendingReplicaChange
282282
for _, c := range change.pendingReplicaChanges {
283-
ch, ok := a.cs.pendingChanges[c.ChangeID]
283+
ch, ok := a.cs.pendingChanges[c.changeID]
284284
if !ok {
285285
continue
286286
}
@@ -297,9 +297,9 @@ func (a *allocatorState) AdjustPendingChangeDisposition(change PendingRangeChang
297297
}
298298
for _, c := range changes {
299299
if success {
300-
a.cs.pendingChangeEnacted(c.ChangeID, a.cs.ts.Now())
300+
a.cs.pendingChangeEnacted(c.changeID, a.cs.ts.Now())
301301
} else {
302-
a.cs.undoPendingChange(c.ChangeID)
302+
a.cs.undoPendingChange(c.changeID)
303303
}
304304
}
305305
}

0 commit comments

Comments
 (0)