Skip to content

fix(compaction): make sure that only one task is running at a time, refactor compaction manager creation and add test #201

Open
lucasfang wants to merge 9 commits intoalibaba:mainfrom
lucasfang:compaction_dev
Open

fix(compaction): make sure that only one task is running at a time, refactor compaction manager creation and add test #201
lucasfang wants to merge 9 commits intoalibaba:mainfrom
lucasfang:compaction_dev

Conversation

@lucasfang
Copy link
Copy Markdown
Collaborator

@lucasfang lucasfang commented Mar 27, 2026

Purpose

  1. Fix compaction manager to make sure only one task is running at a time.
  2. Refactor key value table compaction manager creation by adding compaction manager factory.
  3. Add UT for coverage.

Tests

  • NoopCompactManagerTest
    • ShouldIgnoreAddedFilesAndStayIdle
    • ShouldRejectUserTriggeredFullCompaction
    • ShouldReturnEmptyCompactionResult
    • ShouldAllowNoopLifecycleOperations
  • BitmapDeletionVectorTest
    • PositionOutOfRangeShouldFail
    • DeserializeShouldRejectInvalidMagicNumber
    • DeserializeWithoutMagicNumberShouldRoundTrip
  • IOManagerTest
    • CreateShouldReturnManagerWithGivenTempDir
    • GenerateTempFilePathShouldContainPrefixAndSuffix
    • GenerateTempFilePathShouldBeDifferentAcrossCalls
  • ForceUpLevel0CompactionTest
    • TestMaxCompactIntervalConfiguration
    • TestGentleIntervalShouldForcePickAfterThreshold
  • KeyValueFileStoreWriteTest
    • TestWriteShouldSucceedWhenLookupEnabledWithIOManager
    • TestWriteShouldSucceedWhenDefaultCompactRewriterPathEnabled
  • CoreOptionsTest
    • TestPrepareCommitWaitCompaction
  • MergeTreeCompactManagerFactoryDirectTest
    • TestCreateCompactStrategyDefaultUniversal
    • TestCreateCompactStrategyLookupRadicalShouldNotSetMaxInterval
    • TestCreateCompactStrategyLookupGentleShouldSetMaxInterval
    • TestCreateCompactStrategyLookupGentleBehaviorShouldForceAfterThreshold
    • TestCreateCompactStrategyLookupRadicalBehaviorShouldForceImmediately
    • TestCreateCompactStrategyForceUpLevel0OptionShouldTakeEffect
    • TestCreateCompactManagerWriteOnlyShouldReturnNoopCompactManager
    • TestWriteShouldFailWhenLookupEnabledButIOManagerMissing
    • TestCompactShouldUseNoopCompactManagerWhenWriteOnly
    • TestWriteShouldFailForUnsupportedFullCompactionChangelogRewriter
    • TestWriteShouldSucceedWhenLookupDeletionVectorEnabledWithIOManager
    • TestWriteShouldFailWhenFirstRowWithDeletionVectors
    • TestWriteShouldSucceedWhenLookupDeletionVectorEnabledWithSequenceField
    • TestWriteShouldSucceedWhenLookupDeletionVectorEnabledWithLookupChangelog

API and Format

Add options for pk compaction.

lookup-wait

Generative AI tooling

Generated-by: GitHub Copilot (GPT-5.3-Codex)

Copilot AI review requested due to automatic review settings March 27, 2026 03:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves compaction task lifecycle handling to prevent overlapping compaction executions by ensuring outstanding compaction work is joined before starting a new task or closing writers.

Changes:

  • Make CancelCompaction() synchronously wait for the active compaction future to finish, removing the “detached futures” list.
  • Update writer close-path comments to reflect “cancel + wait” behavior.
  • Remove tracking/waiting of previously “cancelled” futures in the compaction future manager.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/paimon/core/mergetree/merge_tree_writer.h Updates close-path comments to describe cancel + wait behavior.
src/paimon/core/compact/compact_future_manager.h Changes cancellation semantics to move+wait the active future; removes cancelled futures tracking.
src/paimon/core/append/append_only_writer.cpp Updates close-path comments to describe cancel + wait behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lucasfang lucasfang changed the title fix(compaction): make sure that only one task is running at a time. fix(compaction): make sure that only one task is running at a time, refactor compaction manager creation and add test Mar 30, 2026

TEST(KeyValueFileStoreWriteTest, TestWriteShouldSucceedWhenLookupEnabledWithIOManager) {
auto fields = {arrow::field("f0", arrow::utf8(), /*nullable=*/false)};
arrow::Schema typed_schema(fields);
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.

I'm not clear on the purpose of these two tests. If they're intended to test lookup behavior during compaction, then we should at least call PrepareCommit(wait_compaction=true).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants