Skip to content

refactor: protect merging snapshot update hooks - #885

Open
manuzhang wants to merge 1 commit into
apache:mainfrom
manuzhang:agent/protect-merging-snapshot-update-hooks
Open

refactor: protect merging snapshot update hooks#885
manuzhang wants to merge 1 commit into
apache:mainfrom
manuzhang:agent/protect-merging-snapshot-update-hooks

Conversation

@manuzhang

Copy link
Copy Markdown
Member

Summary

  • move MergingSnapshotUpdate's Apply, CleanUncommitted, and Summary overrides from public to protected
  • keep the destructor public
  • explicitly re-expose the protected hooks only in test subclasses that need white-box access

Why

These methods implement internal extension hooks that are already protected in SnapshotUpdate. Declaring the overrides public unnecessarily widens the MergingSnapshotUpdate API. Keeping them protected aligns the derived class with the base-class contract while preserving access for subclasses and virtual dispatch from SnapshotUpdate.

External code that directly called these internal hooks through a concrete merging update will need to use the public snapshot-update workflow instead. The virtual function layout and runtime behavior are unchanged.

Validation

  • clang-format --dry-run --Werror src/iceberg/update/merging_snapshot_update.h src/iceberg/test/merging_snapshot_update_test.cc
  • cmake --build build --target table_update_test -j2
  • build/src/iceberg/test/table_update_test --gtest_filter='MergingSnapshotUpdateTest.*:MergingSnapshotUpdateV1Test.*' (79 tests passed)
  • git diff --check upstream/main...HEAD

Co-authored-by: Codex <codex@openai.com>
Copilot AI lite review requested due to automatic review settings August 17, 2026 10:54
@manuzhang
manuzhang force-pushed the agent/protect-merging-snapshot-update-hooks branch from 4ee9380 to 1a71cbb Compare August 17, 2026 10:54

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

This PR narrows the public surface area of MergingSnapshotUpdate by making its internal hook overrides (Apply, CleanUncommitted, Summary) protected, matching the SnapshotUpdate base-class contract. It preserves white-box test access by explicitly re-exposing these hooks only in test subclasses.

Changes:

  • Move MergingSnapshotUpdate’s Apply, CleanUncommitted, and Summary overrides from public to protected while keeping the destructor public.
  • Re-expose the now-protected hooks via using declarations in test-only subclasses that require direct access.

Reviewed changes

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

File Description
src/iceberg/update/merging_snapshot_update.h Makes internal hook overrides protected to align with SnapshotUpdate’s intended API boundaries.
src/iceberg/test/merging_snapshot_update_test.cc Re-exposes protected hook methods in test subclasses to keep existing white-box tests working.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@manuzhang
manuzhang marked this pull request as ready for review August 17, 2026 11:03
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.

2 participants