Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

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

未關閉 適合新手
#1,011 0 則留言 0 個 reaction 已指派 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() 中的目前 schema 檢查是如何使用該索引的。完成的標準是:呼叫 RemoveSchemas({1}) 後,SetCurrentSchema(1) 會失敗,並且對同一個 schema 呼叫 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++
星號
226
分支
133
平均合併
6 天 2 小時
30 天內合併 PR
49

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

apache/iceberg-cpp 的其他 Issue

查看 apache/iceberg-cpp 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。