Skip to content

feat(core): add append-only/key-value file store write and compaction…#92

Open
lucasfang wants to merge 1 commit into
apache:mainfrom
lucasfang:migrate
Open

feat(core): add append-only/key-value file store write and compaction…#92
lucasfang wants to merge 1 commit into
apache:mainfrom
lucasfang:migrate

Conversation

@lucasfang

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: No linked issue

This change adds file store write operations and compaction metrics support for the core operation module.

Included changes:

  • Append-only file store write:

    • Adds append_only_file_store_write.h and .cpp implementing append-only table write logic.
    • Adds test coverage in append_only_file_store_write_test.cpp.
  • Key-value file store write:

    • Adds key_value_file_store_write.h and .cpp implementing key-value table write logic.
    • Adds test coverage in key_value_file_store_write_test.cpp.
  • Compaction metrics:

    • Adds metrics/compaction_metrics.h defining compaction-related metric instruments.
    • Adds test coverage in metrics/compaction_metrics_test.cpp.

Tests

Test coverage included in this change:

  • AppendOnlyFileStoreWriteTest
  • KeyValueFileStoreWriteTest
  • CompactionMetricsTest

Local compile, CMake, and gtest environment checks are not part of this PR description.

API and Format

No public API, storage format, or protocol changes.

Documentation

No documentation changes required.

Generative AI tooling

Migrate-by: Aone Copilot (Qwen-3.7-Max)

Copilot AI review requested due to automatic review settings June 18, 2026 02:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds core write-path implementations for append-only and key-value tables, and introduces compaction-related metrics with accompanying unit tests.

Changes:

  • Introduces AppendOnlyFileStoreWrite implementation plus unit tests.
  • Introduces KeyValueFileStoreWrite implementation plus unit tests.
  • Adds CompactionMetrics and unit tests for reporter aggregation, counters, and time window behavior.

Reviewed changes

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

Show a summary per file
File Description
src/paimon/core/operation/metrics/compaction_metrics.h New compaction metrics aggregator + per-partition/bucket reporters.
src/paimon/core/operation/metrics/compaction_metrics_test.cpp Tests for compaction metrics aggregation, unregister behavior, and time windowing.
src/paimon/core/operation/key_value_file_store_write.h Declares key-value table write implementation.
src/paimon/core/operation/key_value_file_store_write.cpp Implements key-value writer creation, scan creation, and close logic.
src/paimon/core/operation/key_value_file_store_write_test.cpp Tests write validation + spill/commit behaviors for key-value writer.
src/paimon/core/operation/append_only_file_store_write.h Declares append-only table write implementation and compaction rewrite API.
src/paimon/core/operation/append_only_file_store_write.cpp Implements append-only write + compaction rewrite flow and readers/writers creation.
src/paimon/core/operation/append_only_file_store_write_test.cpp Tests write validation and max sequence number scanning for append-only writer.

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

Comment on lines +26 to +28
#include "paimon/core/mergetree/compact/merge_function_wrapper.h"
#include "paimon/core/mergetree/compact/merge_tree_compact_manager_factory.h"
#include "paimon/core/operation/abstract_file_store_write.h"
Comment on lines +33 to +37
#include "paimon/core/deletionvectors/deletion_vector.h"
#include "paimon/core/io/single_file_writer.h"
#include "paimon/core/operation/abstract_file_store_write.h"
#include "paimon/core/table/bucket_mode.h"
#include "paimon/file_store_write.h"
Comment on lines +27 to +29
#include "paimon/core/mergetree/compact/merge_tree_compact_manager_factory.h"
#include "paimon/core/operation/abstract_file_store_write.h"
#include "paimon/core/utils/batch_writer.h"
Comment on lines +233 to +235
PAIMON_RETURN_NOT_OK_FROM_ARROW(arrow::ExportSchema(*schema, &arrow_schema));
PAIMON_ASSIGN_OR_RAISE(std::shared_ptr<FormatStatsExtractor> stats_extractor,
format->CreateStatsExtractor(&arrow_schema));
ASSERT_OK_AND_ASSIGN(std::unique_ptr<WriteContext> write_context, context_builder.Finish());
ASSERT_OK_AND_ASSIGN(auto file_store_write,
FileStoreWrite::Create(std::move(write_context)));
auto array = std::make_shared<arrow::Array>();
ASSERT_OK_AND_ASSIGN(std::unique_ptr<WriteContext> write_context, context_builder.Finish());
ASSERT_OK_AND_ASSIGN(auto file_store_write,
FileStoreWrite::Create(std::move(write_context)));
auto array = std::make_shared<arrow::Array>();
ASSERT_OK_AND_ASSIGN(std::unique_ptr<WriteContext> write_context, context_builder.Finish());
ASSERT_OK_AND_ASSIGN(auto file_store_write,
FileStoreWrite::Create(std::move(write_context)));
auto array = std::make_shared<arrow::Array>();
Comment on lines +54 to +56
void ReportLevel0FileCount(int64_t count) {
level0_file_count_ = count;
}

@zjw1111 zjw1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

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