Repository navigation
Description
Description
An Iceberg external-table mapping that uses a Nessie commit hash cannot be read. The same table and catalog are readable through ref='main'.
Environment
- Branch:
main - Commit:
b7125edccd610e96039bd84b0213a2beb6583877 - Deployment: local 1CN MatrixOne (
127.0.0.1:6001) with the official local Iceberg topology: Nessie REST catalog and MinIO/S3 warehouse;MO_ICEBERG_ALLOW_PLAIN_HTTP=1for this local-only environment. - Date: 2026-08-17
Steps to reproduce
-
Create a Spark Iceberg format-v2/Parquet table with rows in a Nessie
mainbranch. The validation used independent tablestiera.mor_dml.r1,r2, andr3. -
Obtain the current Nessie commit hash:
curl -fsS http://127.0.0.1:29120/api/v2/trees/main \ | python3 -c 'import json,sys; print(json.load(sys.stdin)["reference"]["hash"])'
-
Create a read-only MO mapping using that hash and query it:
CREATE EXTERNAL TABLE hash_r1 ( id BIGINT, balance BIGINT, region TEXT ) ENGINE=ICEBERG WITH ( 'catalog'='coverage_cat', 'namespace'='mor_dml', 'table'='r1', 'ref'='hash:<Nessie-commit-hash>', 'read_mode'='merge_on_read', 'write_mode'='read_only' ); SELECT count(*), sum(balance) FROM hash_r1;
Actual behavior
The SELECT fails before reading the table:
ERROR 20300 (HY000): invalid configuration: ICEBERG_CONFIG_INVALID:
Iceberg REST catalog request failed [catalog_error_code=400,
operation=load_credentials, status=400]
ref='<Nessie-commit-hash>' has the same failure. It is reproducible on three independently seeded tables.
Expected behavior
ref='hash:<Nessie-commit-hash>' is a supported read-only Nessie ref and should read the exact snapshot at that commit. A hash ref must reject writes as read-only, but it must not fail catalog credential loading for a valid read.
Stability and controls
- Reproducer: 3/3 failed with the same
load_credentialsHTTP 400. - Control: the same catalog, namespace, table schema and
merge_on_readmapping withref='main'returnedcount=4, sum(balance)=1343in all 3/3 rounds. - Failure atomicity: the failing mapping was dropped after each round; each fresh
maincontrol was still readable. No remote DML was issued through the hash mapping.
Evidence
Saved local reproducer: /private/tmp/iceberg_hash_ref_verify.sh.
ROUND=1 CASE=hash_ref_read RESULT=FAIL reproducible_error=load_credentials_400
ROUND=1 CASE=main_ref_control RESULT=PASS
ROUND=2 CASE=hash_ref_read RESULT=FAIL reproducible_error=load_credentials_400
ROUND=2 CASE=main_ref_control RESULT=PASS
ROUND=3 CASE=hash_ref_read RESULT=FAIL reproducible_error=load_credentials_400
ROUND=3 CASE=main_ref_control RESULT=PASS
Code analysis
pkg/iceberg/metadata/runtime_planner.go recognizes hash:<value> and rewrites a Nessie catalog prefix to that ref. The observed HTTP 400 arises when the subsequent catalog credential load receives that hash-based prefix. This is an observed call boundary, not a root-cause claim.
Regression coverage
After the product fix, add a deterministic Iceberg scenario covering branch, tag, hash, and snapshot reads plus write rejection for tag/hash/snapshot refs. This needs Nessie + MinIO, so it belongs in the Iceberg scenario/E2E suite rather than a plain SQL result file.
Related
- Feature validation: [Feature Request]: Support External Iceberg Tables #23359
- The issue is distinct from [Bug]: Iceberg years(date) partition pruning silently returns an empty result #27200, [Bug]: Iceberg DATE predicates return empty result on unpartitioned tables #27209, [Bug]: Iceberg STRING table with an empty value is rejected as invalid manifest metadata #27210, and [Bug]: Iceberg append_only mapping permits DELETE then cannot read its own table #27211: those cover date pruning, empty strings, and append-only DML semantics, not catalog resolution of a valid Nessie commit hash.
Activity
fix(iceberg): encode Nessie hash refs as detached commits (#27254)
Ariznawlll commentedon Aug 19, 2026
测试版本
mainb5c948130897783c544e12ab83bfd94702282f89原问题验证
原问题是 Iceberg Nessie catalog 使用
ref='hash:<commit>'时加载 credentials 失败,而ref='main'正常。Happy Path 覆盖
TestRuntimeScanPlannerRewritesNessieHashAsDetachedRef:Nessie hash ref 被编码为 detached commit,3/3 通过。ref='main'分支保持原有规划行为,3/3 通过。Unhappy Path 覆盖
TestNessieRefNameRejectsEmptyHash覆盖空 hash 和非法 ref,确认返回校验错误而不是继续访问错误 catalog。白盒验证
执行
go test ./pkg/iceberg/metadata -run 'TestRuntimeScanPlannerRewritesNessieHashAsDetachedRef|TestNessieRefNameRejectsEmptyHash' -count=3,全部通过。对应修复为 PR #27254,commit66e6310e9。回归测试
该场景依赖 Nessie catalog,不适合普通 MOTR SQL suite;保留 Iceberg metadata/integration suite。
大数据评估
不需要新增 big-data。问题发生在 ref 编码和 catalog metadata 请求阶段,与数据量无关。
测试结论
测试通过。
fix(iceberg): encode Nessie hash refs as detached commits (matrixorig…
fix(iceberg): encode Nessie hash refs as detached commits (matrixorig…
fix(iceberg): encode Nessie hash refs as detached commits (matrixorig…