@@ -175,7 +175,7 @@ type ReplicaChange struct {
175175 // The load this change adds to a store. The values will be negative if the
176176 // load is being removed.
177177 loadDelta mmaload.LoadVector
178- secondaryLoadDelta SecondaryLoadVector
178+ secondaryLoadDelta mmaload. SecondaryLoadVector
179179
180180 // target is the target {store,node} for the change.
181181 target roachpb.ReplicationTarget
@@ -328,8 +328,8 @@ func MakeLeaseTransferChanges(
328328 }
329329 removeLease .next .IsLeaseholder = false
330330 addLease .next .IsLeaseholder = true
331- removeLease .secondaryLoadDelta [LeaseCount ] = - 1
332- addLease .secondaryLoadDelta [LeaseCount ] = 1
331+ removeLease .secondaryLoadDelta [mmaload . LeaseCount ] = - 1
332+ addLease .secondaryLoadDelta [mmaload . LeaseCount ] = 1
333333
334334 // Only account for the leaseholder CPU, all other primary load dimensions
335335 // are ignored. Byte size and write bytes are not impacted by having a range
@@ -365,7 +365,7 @@ func MakeAddReplicaChange(
365365 addReplica .next .ReplicaID = unknownReplicaID
366366 addReplica .loadDelta .Add (loadVectorToAdd (rLoad .Load ))
367367 if replicaIDAndType .IsLeaseholder {
368- addReplica .secondaryLoadDelta [LeaseCount ] = 1
368+ addReplica .secondaryLoadDelta [mmaload . LeaseCount ] = 1
369369 } else {
370370 // Set the load delta for CPU to be just the raft CPU. The non-raft CPU we
371371 // assume is associated with the lease.
@@ -393,7 +393,7 @@ func MakeRemoveReplicaChange(
393393 }
394394 removeReplica .loadDelta .Subtract (rLoad .Load )
395395 if replicaState .IsLeaseholder {
396- removeReplica .secondaryLoadDelta [LeaseCount ] = - 1
396+ removeReplica .secondaryLoadDelta [mmaload . LeaseCount ] = - 1
397397 } else {
398398 // Set the load delta for CPU to be just the raft CPU. The non-raft CPU is
399399 // associated with the lease.
@@ -421,10 +421,10 @@ func MakeReplicaTypeChange(
421421 replicaChangeType : ChangeReplica ,
422422 }
423423 if next .IsLeaseholder {
424- change .secondaryLoadDelta [LeaseCount ] = 1
424+ change .secondaryLoadDelta [mmaload . LeaseCount ] = 1
425425 change .loadDelta [mmaload .CPURate ] = loadToAdd (rLoad .Load [mmaload .CPURate ] - rLoad .RaftCPU )
426426 } else if prev .IsLeaseholder {
427- change .secondaryLoadDelta [LeaseCount ] = - 1
427+ change .secondaryLoadDelta [mmaload . LeaseCount ] = - 1
428428 change .loadDelta [mmaload .CPURate ] = rLoad .RaftCPU - rLoad .Load [mmaload .CPURate ]
429429 }
430430 return change
@@ -1786,9 +1786,9 @@ func (cs *clusterState) processStoreLeaseholderMsgInternal(
17861786 // adjusted load being negative is very low.
17871787 adjustedStoreLoadValue := max (0 , ss .adjusted .load [topk .dim ])
17881788 threshold := mmaload .LoadValue (float64 (adjustedStoreLoadValue ) * fraction )
1789- if ss .reportedSecondaryLoad [ReplicaCount ] > 0 {
1789+ if ss .reportedSecondaryLoad [mmaload . ReplicaCount ] > 0 {
17901790 // Allow all ranges above 90% of the mean. This is quite arbitrary.
1791- meanLoad := (adjustedStoreLoadValue * 9 ) / (ss .reportedSecondaryLoad [ReplicaCount ] * 10 )
1791+ meanLoad := (adjustedStoreLoadValue * 9 ) / (ss .reportedSecondaryLoad [mmaload . ReplicaCount ] * 10 )
17921792 threshold = min (meanLoad , threshold )
17931793 }
17941794 topk .threshold = threshold
@@ -2219,7 +2219,7 @@ func (cs *clusterState) undoReplicaChange(change ReplicaChange) {
22192219func (cs * clusterState ) applyChangeLoadDelta (change ReplicaChange ) {
22202220 ss := cs .stores [change .target .StoreID ]
22212221 ss .adjusted .load .Add (change .loadDelta )
2222- ss .adjusted .secondaryLoad .add (change .secondaryLoadDelta )
2222+ ss .adjusted .secondaryLoad .Add (change .secondaryLoadDelta )
22232223 ss .loadSeqNum ++
22242224 ss .computeMaxFractionPending ()
22252225 cs .nodes [ss .NodeID ].adjustedCPU += change .loadDelta [mmaload .CPURate ]
@@ -2230,7 +2230,7 @@ func (cs *clusterState) applyChangeLoadDelta(change ReplicaChange) {
22302230func (cs * clusterState ) undoChangeLoadDelta (change ReplicaChange ) {
22312231 ss := cs .stores [change .target .StoreID ]
22322232 ss .adjusted .load .Subtract (change .loadDelta )
2233- ss .adjusted .secondaryLoad .subtract (change .secondaryLoadDelta )
2233+ ss .adjusted .secondaryLoad .Subtract (change .secondaryLoadDelta )
22342234 ss .loadSeqNum ++
22352235 ss .computeMaxFractionPending ()
22362236 cs .nodes [ss .NodeID ].adjustedCPU -= change .loadDelta [mmaload .CPURate ]
0 commit comments