synccompactor

package
v0.13.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotEnoughFilesToCompact = errors.New("must provide two or more files to compact")

Functions

This section is empty.

Types

type CompactableSync

type CompactableSync struct {
	FilePath string
	SyncID   string
}

type Compactor

type Compactor struct {
	// contains filtered or unexported fields
}

func NewCompactor

func NewCompactor(ctx context.Context, outputDir string, compactableSyncs []*CompactableSync, opts ...Option) (*Compactor, func() error, error)

func (*Compactor) Compact

func (c *Compactor) Compact(ctx context.Context) (*CompactableSync, error)

type CompactorType added in v0.3.36

type CompactorType string
const (
	CompactorTypeAttached CompactorType = "attached"
)

type Option added in v0.3.5

type Option func(*Compactor)

func WithC1ZOptions added in v0.7.22

func WithC1ZOptions(opts ...dotc1z.C1ZOption) Option

WithC1ZOptions sets the C1Z options to use for the compactor. This allows tweaking C1Z opts such as encoder/decoder parallelism.

func WithCompactorType deprecated added in v0.3.36

func WithCompactorType(compactorType CompactorType) Option

Deprecated: There is now only one compactor type, so this option is no longer needed.

func WithEngine added in v0.12.5

func WithEngine(engine dotc1z.Engine) Option

WithEngine selects the storage engine for the compacted output. The default (unset) is sqlite, which is byte-identical to the historical compactor. EnginePebble produces a v3 Pebble c1z via a native record merge.

This is the only supported way to choose the engine; an engine passed through WithC1ZOptions does not select the compaction strategy and is overridden.

func WithOverlayRecordChunkSize added in v0.13.2

func WithOverlayRecordChunkSize(n int) Option

WithOverlayRecordChunkSize overrides how many winner records the overlay merge buffers per raw write batch. Zero (the default) uses the merge's built-in production value.

func WithOverlaySeenKeyLimit added in v0.13.2

func WithOverlaySeenKeyLimit(n int64) Option

WithOverlaySeenKeyLimit overrides the overlay merge's per-bucket seen-set cap: buckets whose estimated key count exceeds it route to the K-way run-file fallback. Zero (the default) uses the merge's built-in production value. Intended for tests and benchmarks; the cap bounds merge memory (~40B per seen key).

func WithPebbleCompactorMode added in v0.13.2

func WithPebbleCompactorMode(mode PebbleCompactorMode) Option

WithPebbleCompactorMode overrides the Pebble merge strategy. The default (PebbleCompactorModeAuto) chooses for you; passing an explicit mode is intended for benchmarks and debugging, not normal operation. No-op for the SQLite engine.

func WithRunDuration added in v0.5.13

func WithRunDuration(runDuration time.Duration) Option

func WithSkipGrantExpansion added in v0.8.2

func WithSkipGrantExpansion() Option

WithSkipGrantExpansion skips grant expansion after compaction. This is useful when expansion will be handled separately (e.g. by incremental expansion).

func WithSyncLimit added in v0.7.0

func WithSyncLimit(limit int) Option

WithSyncLimit sets the number of syncs to keep after compaction cleanup.

func WithTmpDir added in v0.3.5

func WithTmpDir(tempDir string) Option

WithTmpDir sets the working directory where files will be created and edited during compaction. If not provided, the temporary directory will be used.

type PebbleCompactorMode added in v0.13.2

type PebbleCompactorMode string

PebbleCompactorMode selects the record-merge strategy for Pebble (v3) compaction.

const (
	// PebbleCompactorModeAuto (the zero value) picks the best strategy.
	// Currently that is overlay: it won or tied every measured shape
	// (same-size and skewed inputs at 10/50/500 sources) and degrades
	// gracefully — buckets whose estimated keys exceed its in-memory
	// seen-set bound are routed to the kway path inside the merge.
	PebbleCompactorModeAuto PebbleCompactorMode = ""

	// PebbleCompactorModeKWay forces the bounded-fan-in external merge
	// sort. Never the fastest on its own, but it is the machinery
	// overlay falls back to for oversized buckets; forcing it is for
	// debugging and benchmarks.
	PebbleCompactorModeKWay PebbleCompactorMode = "kway"

	// PebbleCompactorModeOverlay forces the seen-set overlay merge.
	PebbleCompactorModeOverlay PebbleCompactorMode = "overlay"
)

Directories

Path Synopsis
Package pebble implements the cross-engine compaction primitive for the v3 Pebble-backed storage engine.
Package pebble implements the cross-engine compaction primitive for the v3 Pebble-backed storage engine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL