Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

bug: TableMetadataBuilder::RemoveSchemas leaves removed ids in the schema index

オープン 初心者向け
#1,011 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@LuciferYang がすでに取り組んでいます。

2026年10月14日 から。

  • #1012 @LuciferYang による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp

調査の方向性

TableMetadataBuilder::Impl::RemoveSchemas の実装から始めてください。ここでは metadata_.schemas はフィルタされますが、schemas_by_id_ はフィルタされません。SetCurrentSchema、AddSchema、そして Build() での現在のスキーマの確認が、このインデックスをどのように使っているかを確認してください。RemoveSchemas({1}) の後に SetCurrentSchema(1) が失敗し、同じスキーマを AddSchema すると再び追加される、という両方のケースをテストで確認できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Summary

TableMetadataBuilder::Impl::RemoveSchemas filters metadata_.schemas but never touches schemas_by_id_. Within the same builder the removed ids stay resolvable, so Build() can produce metadata whose current-schema-id points at a schema that is no longer in schemas.

Root cause

SetCurrentSchema checks the id against schemas_by_id_, and the current-schema check in Build() uses the same index. Both still find the removed schema, so:

  1. RemoveSchemas({1}) followed by SetCurrentSchema(1) succeeds, and Build() returns metadata with current-schema-id: 1 while schemas no longer contains schema 1.
  2. RemoveSchemas({1}) followed by AddSchema of the same schema finds it through the stale index and skips re-adding it to schemas.

Impact

InMemoryCatalog::CommitTable and SqlCatalog::CommitTable apply the caller's update list on one builder, then Build() and write the result. A commit carrying [remove-schemas, set-current-schema] for the same id is enough to write that metadata file, and reading it back fails with Cannot find schema with current-schema-id=..., so the table can no longer be loaded.

Java's Builder.removeSchemas does not update schemasById either, so this is stricter than Java's builder.

Proposed fix

Erase the removed ids from schemas_by_id_ alongside the existing filter of metadata_.schemas.

Out of scope

RemovePartitionSpecs has the same gap with specs_by_id_. Follow-up.

主要言語
C++
スター
228
フォーク
136
平均マージ
5日 19時間
マージ済み PR(30日)
53

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/iceberg-cpp のほかの issue

apache/iceberg-cpp の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。