Skip to content

[Bug]: Iceberg Nessie hash ref fails catalog credential loading #27221

Closed

Description

@Ariznawlll

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=1 for this local-only environment.
  • Date: 2026-08-17

Steps to reproduce

  1. Create a Spark Iceberg format-v2/Parquet table with rows in a Nessie main branch. The validation used independent tables tiera.mor_dml.r1, r2, and r3.

  2. 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"])'
  3. 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_credentials HTTP 400.
  • Control: the same catalog, namespace, table schema and merge_on_read mapping with ref='main' returned count=4, sum(balance)=1343 in all 3/3 rounds.
  • Failure atomicity: the failing mapping was dropped after each round; each fresh main control 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

Activity

  1. added this to the MO-202608 milestone on Aug 17, 2026
  2. added
    kind/bug
    on Aug 17, 2026
  3. added a commit that references this issue on Aug 18, 2026
    66e6310
  4. added
    ai-easy
    on Aug 18, 2026
  5. Ariznawlll commented on Aug 19, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main
    • commit:b5c948130897783c544e12ab83bfd94702282f89
    • 测试日期:2026-08-19
    • 环境:macOS arm64;Iceberg Nessie ref planner 回归

    原问题验证

    原问题是 Iceberg Nessie catalog 使用 ref='hash:<commit>' 时加载 credentials 失败,而 ref='main' 正常。

    Happy Path 覆盖

    1. TestRuntimeScanPlannerRewritesNessieHashAsDetachedRef:Nessie hash ref 被编码为 detached commit,3/3 通过。
    2. ref='main' 分支保持原有规划行为,3/3 通过。

    Unhappy Path 覆盖

    TestNessieRefNameRejectsEmptyHash 覆盖空 hash 和非法 ref,确认返回校验错误而不是继续访问错误 catalog。

    白盒验证

    执行 go test ./pkg/iceberg/metadata -run 'TestRuntimeScanPlannerRewritesNessieHashAsDetachedRef|TestNessieRefNameRejectsEmptyHash' -count=3,全部通过。对应修复为 PR #27254,commit 66e6310e9。

    回归测试

    该场景依赖 Nessie catalog,不适合普通 MOTR SQL suite;保留 Iceberg metadata/integration suite。

    大数据评估

    不需要新增 big-data。问题发生在 ref 编码和 catalog metadata 请求阶段,与数据量无关。

    测试结论

    测试通过。

  6. added 3 commits that reference this issue on Sep 17, 2026
    42062dd
    1e36980
    2e63a4e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easykind/bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions