From 4ee93809b1b3c8f0c5547be18cbbfe754b2570b2 Mon Sep 17 00:00:00 2001 From: Manu Zhang Date: Wed, 12 Aug 2026 19:48:07 +0800 Subject: [PATCH] refactor: protect merging snapshot update hooks Co-authored-by: Codex --- src/iceberg/test/merging_snapshot_update_test.cc | 6 ++++++ src/iceberg/update/merging_snapshot_update.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/iceberg/test/merging_snapshot_update_test.cc b/src/iceberg/test/merging_snapshot_update_test.cc index 1c83e4869..9f960da2b 100644 --- a/src/iceberg/test/merging_snapshot_update_test.cc +++ b/src/iceberg/test/merging_snapshot_update_test.cc @@ -122,6 +122,10 @@ class TestMergeAppend : public MergingSnapshotUpdate { std::string operation() override { return "append"; } // Expose protected API for test access + using MergingSnapshotUpdate::Apply; + using MergingSnapshotUpdate::CleanUncommitted; + using MergingSnapshotUpdate::Summary; + Status AddFile(std::shared_ptr file) { return AddDataFile(std::move(file)); } Status AddDelete(std::shared_ptr file) { return AddDeleteFile(std::move(file)); @@ -268,6 +272,8 @@ class TestOverwriteUpdate : public MergingSnapshotUpdate { std::string operation() override { return DataOperation::kOverwrite; } int64_t GeneratedSnapshotId() { return SnapshotId(); } + using MergingSnapshotUpdate::Apply; + Status AddDelete(std::shared_ptr file) { return AddDeleteFile(std::move(file)); } diff --git a/src/iceberg/update/merging_snapshot_update.h b/src/iceberg/update/merging_snapshot_update.h index 1c08a0667..f8c5ec000 100644 --- a/src/iceberg/update/merging_snapshot_update.h +++ b/src/iceberg/update/merging_snapshot_update.h @@ -70,6 +70,7 @@ class ICEBERG_EXPORT MergingSnapshotUpdate : public SnapshotUpdate { public: ~MergingSnapshotUpdate() override = default; + protected: // SnapshotUpdate overrides Result> Apply( const TableMetadata& metadata_to_update, @@ -79,7 +80,6 @@ class ICEBERG_EXPORT MergingSnapshotUpdate : public SnapshotUpdate { std::unordered_map Summary() override; - protected: /// \brief Constructor; reads merge configuration from table properties. explicit MergingSnapshotUpdate(std::string table_name, std::shared_ptr ctx);