Skip to content

Commit c37f1d2

Browse files
committed
asim: pass simulator.Replica instead to pushReplicateChange
Previously, we passed state.Range to pushReplicateChange. This commit changes it to pass the simulator.Replica directly, as future commits will require access to additional fields such as Desc and RangeUsageInfo. Epic: none Release note: none
1 parent 21a2810 commit c37f1d2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/kv/kvserver/asim/queue/lease_queue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (lq *leaseQueue) Tick(ctx context.Context, tick time.Time, s state.State) {
159159
}
160160

161161
lq.next = pushReplicateChange(
162-
ctx, change, rng, tick, lq.settings.ReplicaChangeDelayFn(), lq.baseQueue)
162+
ctx, change, repl, tick, lq.settings.ReplicaChangeDelayFn(), lq.baseQueue)
163163
}
164164

165165
lq.lastTick = tick

pkg/kv/kvserver/asim/queue/replicate_queue.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (rq *replicateQueue) Tick(ctx context.Context, tick time.Time, s state.Stat
153153
}
154154

155155
rq.next = pushReplicateChange(
156-
ctx, change, rng, tick, rq.settings.ReplicaChangeDelayFn(), rq.baseQueue)
156+
ctx, change, repl, tick, rq.settings.ReplicaChangeDelayFn(), rq.baseQueue)
157157
}
158158

159159
rq.lastTick = tick
@@ -162,7 +162,7 @@ func (rq *replicateQueue) Tick(ctx context.Context, tick time.Time, s state.Stat
162162
func pushReplicateChange(
163163
ctx context.Context,
164164
change plan.ReplicateChange,
165-
rng state.Range,
165+
repl *SimulatorReplica,
166166
tick time.Time,
167167
delayFn func(int64, bool) time.Duration,
168168
queue baseQueue,
@@ -180,15 +180,15 @@ func pushReplicateChange(
180180
RangeID: state.RangeID(change.Replica.GetRangeID()),
181181
TransferTarget: state.StoreID(op.Target.StoreID),
182182
Author: state.StoreID(op.Source.StoreID),
183-
Wait: delayFn(rng.Size(), false /* add */),
183+
Wait: delayFn(repl.rng.Size(), false /* add */),
184184
}
185185
case plan.AllocationChangeReplicasOp:
186-
log.VEventf(ctx, 1, "pushing state change for range=%s, details=%s", rng, op.Details)
186+
log.VEventf(ctx, 1, "pushing state change for range=%s, details=%s", repl.rng, op.Details)
187187
stateChange = &state.ReplicaChange{
188188
RangeID: state.RangeID(change.Replica.GetRangeID()),
189189
Changes: op.Chgs,
190190
Author: state.StoreID(op.LeaseholderStore),
191-
Wait: delayFn(rng.Size(), true),
191+
Wait: delayFn(repl.rng.Size(), true),
192192
}
193193
default:
194194
panic(fmt.Sprintf("Unknown operation %+v, unable to create state change", op))

0 commit comments

Comments
 (0)