package
25.1.0+incompatible
Repository: https://github.com/cockroachdb/cockroach.git
Documentation: pkg.go.dev

# Functions

CreateTestAllocator creates a stopper, gossip, store pool and allocator for use in tests.
CreateTestAllocatorWithKnobs is like `CreateTestAllocator`, but allows the caller to pass in custom TestingKnobs.
DetermineReplicaToReplaceAndFilter is used on add or replace allocator actions to filter the set of live voter and non-voter replicas to use in determining a new allocation target.
FilterBehindReplicas removes any "behind" replicas from the supplied slice.
FilterReplicasForAction converts a range descriptor to the filtered voter and non-voter replicas needed to allocate a target for the given action.
FilterUnremovableReplicas removes any unremovable replicas from the supplied slice.
FilterUnremovableReplicasWithoutRaftStatus is like FilterUnremovableReplicas, but takes an upToDateReplicas slice to avoid the Raft status dependency.
GetNeededNonVoters calculates the number of non-voters a range should have given the number of voting replicas the range has and the number of nodes available for up-replication.
GetNeededVoters calculates the number of voters a range should have given its zone config and the number of nodes available for up-replication (i.e.
LiveAndDeadVoterAndNonVoterReplicas splits up the replica in the given range descriptor by voters vs non-voters and live replicas vs dead replicas.
LoadMinThresholds returns the minimum absoute load amounts by which a candidate must differ from the mean before it is considered under or overfull.
LoadRebalanceRequiredMinDiff returns the minimum absolute difference between an existing (store) and another candidate that must be met before a rebalance or transfer is allowed.
LoadThresholds returns the load threshold values for the passed in dimensions.
MakeAllocator creates a new allocator.
MakeQPSOnlyDim returns a load dimension with only QPS filled in with the value given.
OverfullLoadThresholds returns the overfull load threshold for each load dimension.
RangeDiversityScore returns a value between 0 and 1 based on how diverse the given range is.
StoreHasReplica returns true if the provided StoreID contains an entry in the provided list of existing replicas.
TestingIOThresholdWithScore returns an IOThreshold where the score will be equal to the value provided.
UnderfullLoadThresholds returns the underfull load threshold for each load dimension.
WillHaveFragileQuorum determines, based on the number of existing voters, incoming voters, and needed voters, if we will be upreplicating to a state in which we don't have enough needed voters and yet will have a fragile quorum due to an even number of voter replicas.
WithAllDims returns a load vector with all dimensions filled in with the value given.

# Constants

Alive represents a replica on a live node.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
These are the possible allocator actions.
Dead represents a replica on a dead node.
Decommissioning represents a replica on a dead node.
DefaultLeaseIOOverloadShedThreshold is used to shed leases from stores with an IO overload score greater than the this threshold.
DefaultLeaseIOOverloadThreshold is used to block lease transfers to stores with an IO overload score greater than this threshold.
DefaultReplicaIOOverloadThreshold is used to avoid allocating to stores with an IO overload score greater than what's set.
DontTransferLeaseCountBalanced indicates the load/lease counts of the valid replica stores are balanced within the target threshold and therefore the lease should not be transferred.
DontTransferLeaseNoStoreDescriptor indicates the lease should not be transferred because the current leaseholder's store descriptor cannot be found.
DontTransferLeaseNoValidTargets indicates the lease should no be transferred from the current leaseholder because there are no valid leaseholder targets.
IOOverloadMeanShedThreshold is the percentage above the mean after which a store could be considered IO overload if also exceeding the absolute IO threshold and looking to shed the lease.
IOOverloadMeanThreshold is the percentage above the mean after which a store could be considered IO overload if also exceeding the absolute IO threshold.
IOOverloadThresholdBlockAll excludes stores for allocation, rebalancing and lease transfer actions if they are IO overloaded.
IOOverloadThresholdBlockTransfers excludes stores for rebalance or lease transfer actions if they are IO overloaded.
IOOverloadThresholdIgnore wil not exclude stores for any action regardless of the store IO overload.
IOOverloadThresholdShed has the same behavior as IOOverloadThresholdBlockAll, however existing stores will be removed.
L0SublevelTrackerRetention is the tracking period for statistics on the number of L0 sublevels within a store.
NonVoterTarget represents a non-voting target replica.
TransferLeaseForAccessLocality indicates the lease should be transferred for better access locality.
TransferLeaseForCountBalance indicates the lease should be transferred to better balance lease counts.
TransferLeaseForIOOverload indicates the lease should be transferred because the current leaseholder's store is IO overloaded.
TransferLeaseForPreferences indicates the lease should be transferred because there is a more preferred leaseholder according the applied range lease preferences.
VoterTarget represents a voting target replica.

# Variables

EnableLoadBasedLeaseRebalancing controls whether lease rebalancing is done via the new heuristic based on request load and latency or via the simpler approach that purely seeks to balance the number of leases per node evenly.
LeaseIOOverloadShedThreshold is the maximum IO overload score the current leaseholder store for a range may have before shedding its leases and no longer receiving new leases.
LeaseIOOverloadThreshold is the maximum IO overload score a store may have before being excluded as a candidate for lease transfers.
LeaseIOOverloadThresholdEnforcement defines the level of enforcement for lease transfers when a candidate stores' IO overload exceeds the threshold defined in IOOverloadThreshold, and additionally ShedIOOverloadThresholdBuffer when shed is set.
LeaseRebalanceThreshold is the minimum ratio of a store's lease surplus to the mean range/lease count that permits lease-transfers away from that store.
LeaseRebalanceThresholdMin is the absolute number of leases above/below the mean lease count that a store can have before considered overfull/underfull.
MinLeaseTransferStatsDuration configures the minimum amount of time a replica must wait for stats about request counts to accumulate before making decisions based on them.
RangeRebalanceThreshold is the minimum ratio of a store's range count to the mean range count at which that store is considered overfull or underfull of ranges.
ReplicaIOOverloadThreshold is the maximum IO overload score of a candidate store before being excluded as a candidate for rebalancing replicas or allocation.
ReplicaIOOverloadThresholdEnforcement defines the level of enforcement when a candidate stores' IO overload exceeds the threshold defined in IOOverloadThresold.

# Structs

Allocator tries to spread replicas as evenly as possible across the stores in the cluster.
AllocatorMetrics capture metrics about the allocator's decisions.
BestCandidateSelector in used to choose the best store to allocate.
DiskCapacityOptions is the scorer options for disk fullness.
GoodCandidateSelector is used to choose a random store out of the stores that are good enough.
IOOverloadOptions is the scorer options for store IO overload.
LoadScorerOptions is used by the StoreRebalancer to tell the Allocator's rebalancing machinery to base its balance/convergence scores on queries-per-second.
RangeCountScorerOptions is used by the replicateQueue to tell the Allocator's rebalancing machinery to base its balance/convergence scores on range counts.
ScatterScorerOptions is used by the replicateQueue when called via the `AdminScatterRequest`.

# Interfaces

CandidateSelector is an interface to select a store from a list of candidates.
ScorerOptions defines the interface for the two heuristics that trigger replica rebalancing: range count convergence and QPS convergence.

# Type aliases

AllocatorAction enumerates the various replication adjustments that may be recommended by the allocator.
IOOverloadEnforcementLevel represents a level of action that may be taken or excluded when a store's disk is considered IO overloaded.
ReplicaStatus represents whether a replica is currently alive, dead or decommissioning.
TargetReplicaType indicates whether the target replica is a voter or non-voter.
TransferLeaseDecision indicates whether a range lease should be transferred and if so, for what reason.