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 天 5 小时
30 天内合并 PR
40

环境准备

这个项目没有提供开发容器、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 摘要。