Skip to content

Commit

Permalink
Rename to DefragBatchLimit
Browse files Browse the repository at this point in the history
Signed-off-by: sjdot <[email protected]>
  • Loading branch information
sjdot committed Mar 18, 2023
1 parent e9b810b commit 201fad6
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ type ServerConfig struct {
BackendBatchInterval time.Duration
// BackendBatchLimit is the maximum operations before commit the backend transaction.
BackendBatchLimit int
// DefragLimit is the number of keys iterated before committing a transaction during defragmentation.
DefragLimit int
// DefragBatchLimit is the number of keys iterated before committing a transaction during defragmentation.
DefragBatchLimit int

// BackendFreelistType is the type of the backend boltdb freelist.
BackendFreelistType bolt.FreelistType
Expand Down
4 changes: 2 additions & 2 deletions server/embed/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ type Config struct {
// TODO: Delete in v3.7
ExperimentalEnableLeaseCheckpointPersist bool `json:"experimental-enable-lease-checkpoint-persist"`
ExperimentalCompactionBatchLimit int `json:"experimental-compaction-batch-limit"`
// ExperimentalDefragLimit is the number of keys iterated before committing a transaction during defragmentation.
ExperimentalDefragLimit int `json:"experimental-defrag-limit"`
// ExperimentalDefragBatchLimit is the number of keys iterated before committing a transaction during defragmentation.
ExperimentalDefragBatchLimit int `json:"experimental-defrag-limit"`
// ExperimentalCompactionSleepInterval is the sleep interval between every etcd compaction loop.
ExperimentalCompactionSleepInterval time.Duration `json:"experimental-compaction-sleep-interval"`
ExperimentalWatchProgressNotifyInterval time.Duration `json:"experimental-watch-progress-notify-interval"`
Expand Down
2 changes: 1 addition & 1 deletion server/embed/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
EnableLeaseCheckpoint: cfg.ExperimentalEnableLeaseCheckpoint,
LeaseCheckpointPersist: cfg.ExperimentalEnableLeaseCheckpointPersist,
CompactionBatchLimit: cfg.ExperimentalCompactionBatchLimit,
DefragLimit: cfg.ExperimentalDefragLimit,
DefragBatchLimit: cfg.ExperimentalDefragBatchLimit,
CompactionSleepInterval: cfg.ExperimentalCompactionSleepInterval,
WatchProgressNotifyInterval: cfg.ExperimentalWatchProgressNotifyInterval,
DowngradeCheckTime: cfg.ExperimentalDowngradeCheckTime,
Expand Down
2 changes: 1 addition & 1 deletion server/etcdmain/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func newConfig() *config {
fs.IntVar(&cfg.ec.ExperimentalMaxLearners, "experimental-max-learners", membership.DefaultMaxLearners, "Sets the maximum number of learners that can be available in the cluster membership.")
fs.DurationVar(&cfg.ec.ExperimentalWaitClusterReadyTimeout, "experimental-wait-cluster-ready-timeout", cfg.ec.ExperimentalWaitClusterReadyTimeout, "Maximum duration to wait for the cluster to be ready.")
fs.Uint64Var(&cfg.ec.SnapshotCatchUpEntries, "experimental-snapshot-catchup-entries", cfg.ec.SnapshotCatchUpEntries, "Number of entries for a slow follower to catch up after compacting the the raft storage entries.")
fs.IntVar(&cfg.ec.ExperimentalDefragLimit, "experimental-defrag-limit", cfg.ec.ExperimentalDefragLimit, "Number of keys iterated before committing a transaction during defragmentation.")
fs.IntVar(&cfg.ec.ExperimentalDefragBatchLimit, "experimental-defrag-limit", cfg.ec.ExperimentalDefragBatchLimit, "Number of keys iterated before committing a transaction during defragmentation.")

// unsafe
fs.BoolVar(&cfg.ec.UnsafeNoFsync, "unsafe-no-fsync", false, "Disables fsync, unsafe, will cause data loss.")
Expand Down
2 changes: 1 addition & 1 deletion server/etcdmain/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ Experimental feature:
--experimental-compaction-batch-limit 1000
ExperimentalCompactionBatchLimit sets the maximum revisions deleted in each compaction batch.
--experimental-defrag-limit 10000
ExperimentalDefragLimit sets the number of keys iterated before committing a transaction during defragmentation.
ExperimentalDefragBatchLimit sets the number of keys iterated before committing a transaction during defragmentation.
--experimental-peer-skip-client-san-verification 'false'
Skip verification of SAN field in client certificate for peer connections.
--experimental-watch-progress-notify-interval '10m'
Expand Down
6 changes: 3 additions & 3 deletions server/storage/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ func newBackend(cfg config.ServerConfig, hooks backend.Hooks) backend.Backend {
cfg.Logger.Info("setting backend batch interval", zap.Duration("batch interval", cfg.BackendBatchInterval))
}
}
if cfg.DefragLimit != 0 {
bcfg.DefragLimit = cfg.DefragLimit
if cfg.DefragBatchLimit != 0 {
bcfg.DefragBatchLimit = cfg.DefragBatchLimit
if cfg.Logger != nil {
cfg.Logger.Info("setting backend defrag limit", zap.Int("defrag limit", cfg.DefragLimit))
cfg.Logger.Info("setting backend defrag limit", zap.Int("defrag limit", cfg.DefragBatchLimit))
}
}
bcfg.BackendFreelistType = cfg.BackendFreelistType
Expand Down
10 changes: 5 additions & 5 deletions server/storage/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var (
defaultBatchLimit = 10000
defaultBatchInterval = 100 * time.Millisecond

defaultDefragLimit = 10000
defaultDefragBatchLimit = 10000

// initialMmapSize is the initial size of the mmapped region. Setting this larger than
// the potential max db size can prevent writer from blocking reader.
Expand Down Expand Up @@ -138,8 +138,8 @@ type BackendConfig struct {
BatchInterval time.Duration
// BatchLimit is the maximum puts before flushing the BatchTx.
BatchLimit int
// DefragLimit is the number of keys iterated before committing a transaction during defragmentation.
DefragLimit int
// DefragBatchLimit is the number of keys iterated before committing a transaction during defragmentation.
DefragBatchLimit int
// BackendFreelistType is the backend boltdb's freelist type.
BackendFreelistType bolt.FreelistType
// MmapSize is the number of bytes to mmap for the backend.
Expand All @@ -159,7 +159,7 @@ func DefaultBackendConfig(lg *zap.Logger) BackendConfig {
return BackendConfig{
BatchInterval: defaultBatchInterval,
BatchLimit: defaultBatchLimit,
DefragLimit: defaultDefragLimit,
DefragBatchLimit: defaultDefragBatchLimit,
MmapSize: initialMmapSize,
Logger: lg,
}
Expand Down Expand Up @@ -199,7 +199,7 @@ func newBackend(bcfg BackendConfig) *backend {

batchInterval: bcfg.BatchInterval,
batchLimit: bcfg.BatchLimit,
defragLimit: bcfg.DefragLimit,
defragLimit: bcfg.DefragBatchLimit,
mlock: bcfg.Mlock,

readTx: &readTx{
Expand Down

0 comments on commit 201fad6

Please sign in to comment.