// DisableCompactions disables auto compactions.
977689
func (db *DB) DisableCompactions() {
	db.autoCompactMtx.Lock()
	defer db.autoCompactMtx.Unlock()

	db.autoCompact = false
	level.Info(db.logger).Log("msg", "compactions disabled")
}
42621
func (s *session) getCompactionRange(sourceLevel int, umin, umax []byte, noLimit bool) *compaction {
	v := s.version()

	if sourceLevel >= len(v.levels) {
		v.release()
		return nil
	}

	t0 := v.levels[sourceLevel].getOverlaps(nil, s.icmp, umin, umax, sourceLevel == 0)
	if len(t0) == 0 {
		v.release()
		return nil
	}

	// Avoid compacting too much in one shot in case the range is large.
	// But we cannot do this for level-0 since level-0 files can overlap
	// and we must not pick one file and drop another older file if the
	// two files overlap.
	if !noLimit && sourceLevel > 0 {
		limit := int64(v.s.o.GetCompactionSourceLimit(sourceLevel))
		total := int64(0)
		for i, t := range t0 {
			total += t.size
			if total >= limit {
				s.logf("table@compaction limiting F·%d -> F·%d", len(t0), i+1)
				t0 = t0[:i+1]
				break
			}
		}
	}

	return newCompaction(s, v, sourceLevel, t0)
}
1162263
func (r *recorder) Disable() {
	r.mu.Lock()
	defer r.mu.Unlock()
	r.enabled = false
	r.entries = nil
}
231688
func (s *DistributionConfig) SetRestrictions(v *Restrictions) *DistributionConfig {
	s.Restrictions = v
	return s
}
53335
func (s *DistributionSummary) SetRestrictions(v *Restrictions) *DistributionSummary {
	s.Restrictions = v
	return s
}
1125387
func DropDisabledFields(pvSpec *api.PersistentVolumeSpec, oldPVSpec *api.PersistentVolumeSpec) {
	if !utilfeature.DefaultFeatureGate.Enabled(features.BlockVolume) && !volumeModeInUse(oldPVSpec) {
		pvSpec.VolumeMode = nil
	}
}
186441
func Compact(list cty.Value) (cty.Value, error) {
	return CompactFunc.Call([]cty.Value{list})
}
553080
func (s *ListBootstrapActionsOutput) SetBootstrapActions(v []*Command) *ListBootstrapActionsOutput {
	s.BootstrapActions = v
	return s
}
497227
func (p *Partition) compact() {
	if p.compactionsDisabled > 0 {
		p.logger.Error("Cannot start a compaction while disabled")
		return
	}

	fs, err := p.fileSet.Duplicate()
	if err != nil {
		p.logger.Error("Attempt to compact while partition is closing", zap.Error(err))
		return
	}
	defer fs.Release()

	// Iterate over each level we are going to compact.
	// We skip the first level (0) because it is log files and they are compacted separately.
	// We skip the last level because the files have no higher level to compact into.
	minLevel, maxLevel := 1, len(p.levels)-2
	for level := minLevel; level <= maxLevel; level++ {
		// Skip level if it is currently compacting.
		if p.levelCompacting[level] {
			continue
		}

		// Collect contiguous files from the end of the level.
		files := fs.LastContiguousIndexFilesByLevel(level)
		if len(files) < 2 {
			continue
		} else if len(files) > MaxIndexMergeCount {
			files = files[len(files)-MaxIndexMergeCount:]
		}

		// We intend to do a compaction. Acquire a resource to do so.
		ref, err := p.res.Acquire()
		if err != nil {
			p.logger.Error("Attempt to compact while partition is closing", zap.Error(err))
			return
		}

		// Acquire references to the files to keep them alive through compaction.
		frefs, err := IndexFiles(files).Acquire()
		if err != nil {
			p.logger.Error("Attempt to compact a file that is closed", zap.Error(err))
			continue
		}

		// Mark the level as compacting.
		p.levelCompacting[level] = true

		// Start compacting in a separate goroutine.
		p.compactionsWG.Add(1)
		go func(level int) {
			// Compact to a new level.
			p.compactToLevel(files, frefs, level+1, ref.Closing())

			// Ensure compaction lock for the level is released.
			p.mu.Lock()
			p.levelCompacting[level] = false
			p.mu.Unlock()

			// Ensure references are released.
			frefs.Release()
			ref.Release()
			p.compactionsWG.Done()

			// Check for new compactions
			p.Compact()
		}(level)
	}
}
387004
func (c *Config) WithDisableComputeChecksums(disable bool) *Config {
	c.DisableComputeChecksums = &disable
	return c
}
482564
func (c *Compactor) DisableSnapshots() {
	c.mu.Lock()
	c.snapshotsEnabled = false
	if c.snapshotsInterrupt != nil {
		close(c.snapshotsInterrupt)
		c.snapshotsInterrupt = nil
	}
	c.mu.Unlock()
}
801029
func (o *MockOracle) Disable() {
	o.Lock()
	defer o.Unlock()
	o.stop = true
}
1361679
func (s *JobFlowDetail) SetBootstrapActions(v []*BootstrapActionDetail) *JobFlowDetail {
	s.BootstrapActions = v
	return s
}
873564
func (s *PutRemediationConfigurationsInput) SetRemediationConfigurations(v []*RemediationConfiguration) *PutRemediationConfigurationsInput {
	s.RemediationConfigurations = v
	return s
}
796
func (opts *Options) SetFIFOCompactionOptions(value *FIFOCompactionOptions) {
	C.rocksdb_options_set_fifo_compaction_options(opts.c, value.c)
}
231193
func (o *ResourceConfig) DisableAll() {
	for k := range o.GroupVersionConfigs {
		o.GroupVersionConfigs[k] = false
	}
}
935656
func (t *seriesPartitionTracker) incCompactions(status string, duration time.Duration) {
	if !t.enabled {
		return
	}

	if duration > 0 {
		labels := t.Labels()
		labels["component"] = "index"
		t.metrics.CompactionDuration.With(labels).Observe(duration.Seconds())
	}

	labels := t.Labels()
	labels["status"] = status
	t.metrics.Compactions.With(labels).Inc()
}