203
}
204
206
>
207
>
newState := common.CloneProto(sm.scaleState)
208
>
if newState == nil {
209
newState = &persistencespb.PartitionScaleState{}
210
}
212
>
newState.Target = target
213
>
newState.MaxTarget = max(newState.MaxTarget, target)
214
>
newState.TargetVersion = sm.timeSource.Now().UnixNano()
215
>
newState.BacklogCap = int32(backlogCapC8)
216
>
newState.PrivateScalerState = decision.PrivateState
217
>
218
>
mayHaveBacklog := target
219
>
if prevTarget == 0 {
220
// Turning on managed partition scaling: consider all partitions from dynamic
221
// config as having backlog also.
222
mayHaveBacklog = max(mayHaveBacklog, int32(sm.getWritePartitions()))
223
}
225
>
newState.BacklogState = bitSet(newState.BacklogState).set(i)
226
>
}
227
229
if sm.timeSource.Now().Before(sm.nextShadowLog) || // too early
230
sm.prevShadowTarget == target || // only log new changes