Skip to content

[Bug]: iceberg_rewrite_data_files reports zero commit metadata after a successful rewrite #27201

Closed

Description

@Ariznawlll

Bug description

iceberg_rewrite_data_files successfully rewrites and commits Iceberg data files through a Nessie catalog, but its returned commit metadata is false or empty. The procedure reports snapshot_after=0, removed_file_count=0, an empty commit_id, and verified=0, while Spark observes a new non-zero rewrite_data_files snapshot and the file count has actually changed from 8 to 1.

Environment

  • Branch: main
  • Commit: 1f9e501594509fb5d2e0284833faf8c3426e2285
  • Test date: 2026-08-17
  • Deployment: local 1 CN + 1 TN + 1 LogService, DISK-V2
  • External services: native MinIO RELEASE.2025-09-06T17-38-46Z + Nessie 0.108.4
  • Oracle: Spark 3.5.1, Iceberg 1.6.1, JDK 21.0.12
  • Iceberg table: format v2, Parquet, unpartitioned

Steps to reproduce

  1. Through Spark, create a fresh Iceberg table in the same Nessie catalog and MinIO warehouse. Append 8 independent batches of 10 rows so the table contains 8 data files and 80 rows (SUM(id)=3160).
  2. Create the normal MatrixOne Iceberg catalog/access mapping for this table.
  3. Verify through MatrixOne that the table contains 80 rows and SUM(id)=3160.
  4. Run:
CALL iceberg_rewrite_data_files(
  'native_t3',
  'tiera',
  'public_negative',
  'maintenance_run_1',
  '{"target-file-size-bytes":1048576}'
);
  1. Read the returned maintenance result, then inspect the same table and its snapshots through Spark.
  2. Repeat with two fresh tables (maintenance_run_2 and maintenance_run_3).

Actual behavior

All three fresh runs return the following shape from MatrixOne:

status=committed
snapshot_after=0
rewritten_file_count=8
removed_file_count=0
commit_id=''
verified=0

However, Spark confirms that every rewrite was committed:

Table Files before Files after Rows / checksum after Spark rewrite snapshot
maintenance_run_1 8 1 80 / 3160 2957571463810659778
maintenance_run_2 8 1 80 / 3160 1786896348434282000
maintenance_run_3 8 1 80 / 3160 4584431734387923674

MatrixOne can also read all three rewritten tables afterward and still returns 80 / 3160. Thus the rewrite itself succeeds; the procedure result does not describe the committed operation.

Expected behavior

For a successful committed rewrite:

  • snapshot_after should be the non-zero committed Iceberg snapshot ID.
  • commit_id should identify the committed Nessie/Iceberg change.
  • verified should reflect successful post-commit verification.
  • removed/rewritten file metadata should agree with the actual table transition.
  • row count and checksum must remain unchanged.

Frequency

3/3 on three independently created tables.

Impact

Automation cannot safely determine whether maintenance was durably committed or verified. It may retry a successful rewrite or report false failure/success state even though the table has changed.

Initial analysis

The MatrixOne maintenance result type and procedure/workflow tests expect SnapshotAfter, CommitID, and verification state to be populated. The Nessie-backed commit path appears to complete the rewrite but drop or fail to propagate the returned commit/verification metadata.

This is separate from #27196: the minimal 8-file rewritten tables remain readable from MatrixOne. No large-data test is required because the metadata defect reproduces deterministically with 80 rows and 8 files.

Suggested regression

Add an external MinIO + Nessie maintenance scenario that:

  1. creates at least 8 small files;
  2. records the Spark snapshot and file count;
  3. calls iceberg_rewrite_data_files;
  4. asserts a non-zero/new snapshot_after, a non-empty commit ID and successful verification;
  5. cross-checks the returned snapshot against Spark/Nessie;
  6. asserts files are compacted and rows/checksum are unchanged;
  7. repeats on three fresh tables.

Related feature: #23359.

Activity

  1. added
    kind/bug
    need-regression-or-chaos
    on Aug 16, 2026
  2. added theissue type on Aug 16, 2026
  3. added this to the MO-202608 milestone on Aug 16, 2026
  4. added
    ai-easy
    on Aug 17, 2026
  5. Ariznawlll commented on Aug 17, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main
    • commit:e32c7dc95946c347710e706e70dfee2927bc84e0
    • 部署方式:本地 1 CN + 1 TN + 1 LogService(DISK-V2),原生 MinIO + Nessie 0.108.4;mo-service 使用上述完整 SHA 构建
    • 测试日期:2026-08-17

    原问题验证

    在同一 Nessie/MinIO catalog 下创建 3 张 format v2、Parquet、无分区表,每张表通过 MatrixOne 连续写入 8 个独立 batch(共 80 行,SUM(id)=3160,写入前 catalog manifest 中为 8 个 data file)。对 maintenance_run_1/2/3 分别执行:

    CALL iceberg_rewrite_data_files(
      'issue27201cat.issue27201.maintenance_run_N',
      'ref=main,target_file_size=1048576'
    );

    3/3 结果均为:status=committed,snapshot_after 为非零且与 Nessie 当前 snapshot 一致,rewritten_file_count=8,removed_file_count=8,commit_id 非空,verified=1。实际返回:

    maintenance_run_1: snapshot_after=1786949316942157000, commit_id=0a51bb02a05724b9, verified=1
    maintenance_run_2: snapshot_after=1786949317241167000, commit_id=463511cf11e836b5, verified=1
    maintenance_run_3: snapshot_after=1786949317546500000, commit_id=986dbfcc17188809, verified=1
    

    Happy Path 覆盖

    1. 三张独立表重复执行原问题场景,结果均 3/3 通过;每张表 rewrite 后 ManifestList 为 1 个 manifest,added=1/deleted=8。
    2. MatrixOne 重新查询三张表均为 COUNT(*)=80, SUM(id)=3160,数据未丢失或重复。
    3. 重复执行已完成 rewrite 的 maintenance_run_1 返回同一 snapshot、rewritten_file_count=0、removed_file_count=0,无二次提交;审计表中前一次提交和本次 no-op 均为 committed。
    4. mo_catalog.mo_iceberg_maintenance_jobs 中三次提交的 snapshot_after、重写/移除文件数与过程返回值一致。

    Unhappy Path 覆盖

    1. 不存在的表返回 ICEBERG_TABLE_NOT_FOUND,审计记录为 failed,snapshot_after 为空且文件计数为 0。
    2. target_file_size=0 返回 ICEBERG_CONFIG_INVALID,审计记录为 failed,未产生 snapshot 或文件变更。
    3. 失败路径后重新查询正常表数据和 catalog metadata,未发现部分提交或行数变化。

    白盒验证

    最新 main 上 go test ./pkg/iceberg/maintenance ./pkg/sql/iceberg -count=1 通过;针对空 commit metadata 恢复、native rewrite-data-files 结果映射和 verifier 的 go test -race ./pkg/iceberg/maintenance -run 'TestCatalogFactoryCommitVerifierRecoversEmptyRewriteDataFilesCommitMetadata|TestMaintenanceProcedureExecutorRunsNativeRewriteDataFilesWithDefaultCompactor|TestCatalogCommitVerifier' -count=1 通过。

    回归测试

    现有 pkg/iceberg/maintenance/verifier_test.go 与 pkg/sql/iceberg/maintenance_executor_test.go 已覆盖 Nessie 标准响应不带 snapshot/commit 字段时的元数据重载与结果补全;本次未修改测试代码,未新增 BVT/motr 文件。

    测试证据

    • 本地黑盒输出:/private/tmp/mo-27201-e2e-20260817/maintenance_run_{1,2,3}-call.out
    • rewrite 后 Nessie metadata、ManifestList 解码和行数校验:同一临时目录下的 *-after.json、*-manifest-list.avro 与审计查询输出
    • 本地 E2E smoke(catalog/mapping、append/time-travel、partition filter、merge-on-read delete):/private/tmp/mo-27201-e2e-20260817/e2e-report/summary.md,4/4 passed

    测试结论

    测试通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easykind/bugneed-regression-or-chaos

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions