Skip to content

feat: implement STCS compaction#430

Open
dkharms wants to merge 2 commits into
336-merge-sourcefrom
336-compaction
Open

feat: implement STCS compaction#430
dkharms wants to merge 2 commits into
336-merge-sourcefrom
336-compaction

Conversation

@dkharms

@dkharms dkharms commented May 27, 2026

Copy link
Copy Markdown
Member

Description

Adds a STCS (Size-Tiered Compaction Strategy) planner that groups sealed fractions into time-bins and selects compaction candidates, and an executor that merges them into a new sealed fraction via k-way merge.


  • I have read and followed all requirements in CONTRIBUTING.md;
  • I used LLM/AI assistance to make this pull request;

If you have used LLM/AI assistance please provide model name and full prompt:

Model: {{model-name}}
Prompt: {{prompt}}

@dkharms dkharms changed the title feat: implement compaction feat: implement STCS compaction May 27, 2026
@dkharms dkharms marked this pull request as ready for review May 29, 2026 09:57
@eguguchkin eguguchkin requested review from eguguchkin and forshev June 1, 2026 11:29
@eguguchkin eguguchkin added this to the v0.73.0 milestone Jun 2, 2026
Comment thread storeapi/store.go Outdated
fracManagerStop func()

SkipMaskManager *skipmaskmanager.SkipMaskManager
Executor *compaction.Executor

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe rename Executor field to something associated with compaction? like CompactionExecutor or Compactor

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, done.

Comment thread compaction/executor.go Outdated
zap.Strings("names", names),
)

preloaded, err := Merge(t.filename, common.SealParams{}, srcs...)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should seal params be empty here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, fixed.

Comment thread compaction/planner.go Outdated

"go.uber.org/zap"

"github.com/alecthomas/units"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import in the wrong group

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@dkharms dkharms force-pushed the 336-merge-source branch from d3e1c9e to 0f1955e Compare June 10, 2026 11:12
@@ -115,6 +118,8 @@ func (fp *fractionProvider) NewRemote(ctx context.Context, name string, cachedIn
// IMPORTANT: This method is not thread-safe. When used in concurrent environments,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to remove the comment.

Comment thread indexwriter/index.go
}

func (s *IndexWriter) newIndexBlockZSTD(raw []byte, level int) indexBlock {
if level <= 0 {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ZSTD can have negative compression levels -- need to handle it correctly.

Comment thread config/config.go
DocBlockZstdCompressionLevel int `config:"doc_block_zstd_compression_level" default:"3"`
} `config:"compression"`

Compaction struct {

@dkharms dkharms Jun 11, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments here and introduce new compaction section in the documentation as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants