Skip to content

Commit 370dca8

Browse files
committed
kvserver: refresh split comment in post-add triggers
Epic: none Release note: none
1 parent 707cd29 commit 370dca8

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

pkg/kv/kvserver/replica_app_batch.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,18 @@ func (b *replicaAppBatch) runPostAddTriggersReplicaOnly(
309309
}
310310

311311
if res.Split != nil {
312-
// Splits require a new HardState to be written to the new RHS
313-
// range (and this needs to be atomic with the main batch). This
314-
// cannot be constructed at evaluation time because it differs
315-
// on each replica (votes may have already been cast on the
316-
// uninitialized replica). Write this new hardstate to the batch too.
312+
// Splits require a new HardState to be written for the new RHS replica,
313+
// atomically with the main batch. This cannot be constructed at evaluation
314+
// time because it differs on each replica (votes may have already been cast
315+
// on the uninitialized replica). Write this new HardState to the batch too.
317316
// See https://github.com/cockroachdb/cockroach/issues/20629.
318317
//
319-
// Alternatively if we discover that the RHS has already been removed
320-
// from this store, clean up its data.
318+
// Alternatively if we discover that the RHS has already been removed from
319+
// this store, clean up its data.
320+
//
321+
// NB: another reason why we shouldn't write HardState at evaluation time is
322+
// that it belongs to the log engine, whereas the evaluated batch must
323+
// contain only state machine updates.
321324
splitPreApply(ctx, b.r, b.batch, res.Split.SplitTrigger, cmd.Cmd.ClosedTimestamp)
322325

323326
// The rangefeed processor will no longer be provided logical ops for
@@ -330,9 +333,7 @@ func (b *replicaAppBatch) runPostAddTriggersReplicaOnly(
330333
if res.Split.SplitTrigger.ManualSplit {
331334
reason = kvpb.RangeFeedRetryError_REASON_MANUAL_RANGE_SPLIT
332335
}
333-
b.r.disconnectRangefeedWithReason(
334-
reason,
335-
)
336+
b.r.disconnectRangefeedWithReason(reason)
336337
}
337338

338339
if merge := res.Merge; merge != nil {

0 commit comments

Comments
 (0)