Documentation
¶
Index ¶
Constants ¶
const ( MinHashtreeHeight = 0 MaxHashtreeHeight = 20 MinDiffBatchSize = 1 MaxDiffBatchSize = 10_000 MinPropagationLimit = 1 MaxPropagationLimit = 100_000 MinPropagationConcurrency = 1 MaxPropagationConcurrency = 20 MinPropagationBatchSize = 1 MaxPropagationBatchSize = 1_000 )
Bounds for per-class async-replication schema values; the db layer also uses them to clamp global runtime-config values.
const MaxDurationMillis = int64(math.MaxInt64 / int64(time.Millisecond))
MaxDurationMillis is the largest millisecond value that fits in a time.Duration without wrapping.
Variables ¶
This section is empty.
Functions ¶
func SanitizeAsyncConfig ¶ added in v1.38.10
func SanitizeAsyncConfig(cfg *models.ReplicationAsyncConfig) (*models.ReplicationAsyncConfig, []error)
SanitizeAsyncConfig returns a copy of cfg with each invalid field cleared (falling back to its default), keeping valid siblings, plus the dropped fields' errors.
func ValidateAsyncConfig ¶ added in v1.38.10
func ValidateAsyncConfig(cfg *models.ReplicationAsyncConfig) error
ValidateAsyncConfig is the single source of truth for the reject-set: it runs at schema proposal time and asyncReplicationConfigFromModel delegates to it, so the layers cannot drift. Sub-minimum frequencies are accepted (the db layer clamps them), and duration fields are checked after conversion so overflowed values stay rejected.
Types ¶
type GlobalConfig ¶
type GlobalConfig struct {
AsyncReplicationDisabled *runtime.DynamicValue[bool] `json:"async_replication_disabled" yaml:"async_replication_disabled"`
// Async replication knobs. A zero value means "not configured at the cluster
// level"; the per-class API override (or the hardcoded code default) takes
// effect instead. The per-shard timing/limit fields below are polled by
// Effective() on every hashbeat cycle, so updates take effect without a
// restart. AsyncReplicationSchedulerWorkers is handled separately by the
// scheduler's worker watcher, and AsyncReplicationHashtreeInitConcurrency is
// read when the scheduler is constructed.
AsyncReplicationSchedulerWorkers *runtime.DynamicValue[int] `json:"async_replication_scheduler_workers" yaml:"async_replication_scheduler_workers"`
AsyncReplicationHashtreeInitConcurrency *runtime.DynamicValue[int] `json:"async_replication_hashtree_init_concurrency" yaml:"async_replication_hashtree_init_concurrency"`
AsyncReplicationHashtreeHeight *runtime.DynamicValue[int] `json:"async_replication_hashtree_height" yaml:"async_replication_hashtree_height"`
AsyncReplicationFrequency *runtime.DynamicValue[time.Duration] `json:"async_replication_frequency" yaml:"async_replication_frequency"`
AsyncReplicationFrequencyWhilePropagating *runtime.DynamicValue[time.Duration] `json:"async_replication_frequency_while_propagating" yaml:"async_replication_frequency_while_propagating"`
AsyncReplicationLoggingFrequency *runtime.DynamicValue[time.Duration] `json:"async_replication_logging_frequency" yaml:"async_replication_logging_frequency"`
AsyncReplicationDiffBatchSize *runtime.DynamicValue[int] `json:"async_replication_diff_batch_size" yaml:"async_replication_diff_batch_size"`
AsyncReplicationDiffPerNodeTimeout *runtime.DynamicValue[time.Duration] `json:"async_replication_diff_per_node_timeout" yaml:"async_replication_diff_per_node_timeout"`
AsyncReplicationPrePropagationTimeout *runtime.DynamicValue[time.Duration] `json:"async_replication_pre_propagation_timeout" yaml:"async_replication_pre_propagation_timeout"`
AsyncReplicationPropagationTimeout *runtime.DynamicValue[time.Duration] `json:"async_replication_propagation_timeout" yaml:"async_replication_propagation_timeout"`
AsyncReplicationPropagationLimit *runtime.DynamicValue[int] `json:"async_replication_propagation_limit" yaml:"async_replication_propagation_limit"`
AsyncReplicationPropagationConcurrency *runtime.DynamicValue[int] `json:"async_replication_propagation_concurrency" yaml:"async_replication_propagation_concurrency"`
AsyncReplicationPropagationBatchSize *runtime.DynamicValue[int] `json:"async_replication_propagation_batch_size" yaml:"async_replication_propagation_batch_size"`
AsyncReplicationPropagationDelay *runtime.DynamicValue[time.Duration] `json:"async_replication_propagation_delay" yaml:"async_replication_propagation_delay"`
// Root pre-filter batch size: cluster-wide cap on same-collection hashtree roots
// compared per batched RPC. 1 disables the pre-filter; <= 0 falls back to the default.
AsyncReplicationRootPrefilterBatchSize *runtime.DynamicValue[int] `json:"async_replication_root_prefilter_batch_size" yaml:"async_replication_root_prefilter_batch_size"`
// MinimumFactor can enforce replication. For example, with MinimumFactor set
// to 2, users can no longer create classes with a factor of 1, therefore
// forcing them to have replicated classes.
MinimumFactor int `json:"minimum_factor" yaml:"minimum_factor"`
// MaximumFactor caps the replication factor allowed on any class. A value
// <= 0 means "no cap". Set via REPLICATION_MAXIMUM_FACTOR. Used by the
// usage-limits guardrails: when any object/tenant/shard cap is set,
// MaximumFactor must be 1 (only the RF=1 deployment shape is supported).
MaximumFactor int `json:"maximum_factor" yaml:"maximum_factor"`
DeletionStrategy string `json:"deletion_strategy" yaml:"deletion_strategy"`
ReplicationGRPCEnabled *runtime.DynamicValue[bool] `json:"replication_grpc_enabled" yaml:"replication_grpc_enabled"`
// ReplicaMovementCleanupEnabled is the master switch, REPLICA_MOVEMENT_CLEANUP_ENABLED.
ReplicaMovementCleanupEnabled *runtime.DynamicValue[bool] `json:"replica_movement_cleanup_enabled" yaml:"replica_movement_cleanup_enabled"`
// ReplicaMovementCleanupMaxAge is how old a terminal op must be before it is
// swept, REPLICA_MOVEMENT_CLEANUP_MAX_AGE. 0 disables the sweep and must
// never be read as "delete everything". A negative value is rejected rather
// than coerced: it fails startup via env and is refused at reload, leaving
// the previous value in place.
ReplicaMovementCleanupMaxAge *runtime.DynamicValue[time.Duration] `json:"replica_movement_cleanup_max_age" yaml:"replica_movement_cleanup_max_age"`
// ReplicaMovementCleanupInterval is the sweep period,
// REPLICA_MOVEMENT_CLEANUP_INTERVAL. 0 disables the sweep; any other value
// must lie within [1m, 168h] and is otherwise rejected on the same terms as
// MaxAge above.
ReplicaMovementCleanupInterval *runtime.DynamicValue[time.Duration] `json:"replica_movement_cleanup_interval" yaml:"replica_movement_cleanup_interval"`
// ReplicaMovementCleanupIncludeCancelled widens the sweep predicate to old
// CANCELLED ops, REPLICA_MOVEMENT_CLEANUP_INCLUDE_CANCELLED. Opt-in because
// CANCELLED ops carry diagnostic error context.
ReplicaMovementCleanupIncludeCancelled *runtime.DynamicValue[bool] `json:"replica_movement_cleanup_include_cancelled" yaml:"replica_movement_cleanup_include_cancelled"`
}
GlobalConfig represents system-wide config that may restrict settings of an individual class