Skip to content

Commit bc16e41

Browse files
committed
mma: convert kvpb.ReplicationChanges to a single change per store
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 #157049 Epic: CRDB-55052 Release note: None
1 parent ae0b3d7 commit bc16e41

File tree

10 files changed

+568
-152
lines changed

10 files changed

+568
-152
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",
@@ -1596,6 +1597,7 @@ GO_TARGETS = [
15961597
"//pkg/kv/kvserver/loqrecovery:loqrecovery",
15971598
"//pkg/kv/kvserver/loqrecovery:loqrecovery_test",
15981599
"//pkg/kv/kvserver/mmaintegration:mmaintegration",
1600+
"//pkg/kv/kvserver/mmaintegration:mmaintegration_test",
15991601
"//pkg/kv/kvserver/multiqueue:multiqueue",
16001602
"//pkg/kv/kvserver/multiqueue:multiqueue_test",
16011603
"//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
@@ -832,7 +832,7 @@ func (a *allocatorState) AdjustPendingChangeDisposition(change PendingRangeChang
832832
// state. We gather the found changes.
833833
var changes []*pendingReplicaChange
834834
for _, c := range change.pendingReplicaChanges {
835-
ch, ok := a.cs.pendingChanges[c.ChangeID]
835+
ch, ok := a.cs.pendingChanges[c.changeID]
836836
if !ok {
837837
continue
838838
}
@@ -849,9 +849,9 @@ func (a *allocatorState) AdjustPendingChangeDisposition(change PendingRangeChang
849849
}
850850
for _, c := range changes {
851851
if success {
852-
a.cs.pendingChangeEnacted(c.ChangeID, a.cs.ts.Now())
852+
a.cs.pendingChangeEnacted(c.changeID, a.cs.ts.Now())
853853
} else {
854-
a.cs.undoPendingChange(c.ChangeID)
854+
a.cs.undoPendingChange(c.changeID)
855855
}
856856
}
857857
}

0 commit comments

Comments
 (0)