bug: TableMetadataBuilder::RemoveSchemas leaves removed ids in the schema index
维护者通常 2 天内回复
评估
- 难度
- 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:
RemoveSchemas({1})followed bySetCurrentSchema(1)succeeds, andBuild()returns metadata withcurrent-schema-id: 1whileschemasno longer contains schema 1.RemoveSchemas({1})followed byAddSchemaof the same schema finds it through the stale index and skips re-adding it toschemas.
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,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/iceberg-cpp 的其他 Issue
-
bug: manifest Avro headers use the wrong partition-spec shape and omit schema-id可能已有人在做 @mavam 于 1 天前认领。 未关闭
难度 4/5 1-2 天 新手友好度 58/100
apache/iceberg-cpp#1016 ·
维护者通常 2 天内回复
-
bug: gzip table metadata is neither written nor detected as gzip可能已有人在做 @LuciferYang 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 66/100
apache/iceberg-cpp#1013 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
apache/iceberg-cpp#1000 · 2 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
Support Iceberg table encryption (Java-compatible)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 5/5 一周以上 新手友好度 8/100
apache/iceberg-cpp#988 · 1 条评论 ·
维护者通常 2 天内回复
-
难度 5/5 一周以上 新手友好度 20/100
apache/iceberg-cpp#959 · 1 条评论 ·
维护者通常 2 天内回复
查看 apache/iceberg-cpp 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
FriendsofECCE/ECCE#336 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 66/100
bitcoin-core/gui-qml#1030 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
tesseract-robotics/tesseract#1384 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
NVIDIA/nccl-extensions#26 ·