bug: Iceberg appends write non-cumulative snapshot summary totals (fork lacks apache/iceberg-rust#2391)

Open
#21,149 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@sundy-li is already working on this.

Since Nov 20, 2026.

Assessment

This issue has not been assessed yet.

Description

Search before asking
  • I had searched in the issues and found no similar issues.
Version

v1.2.964-nightly (97eea5624e), and main at a85e50302c. Both pin databendlabs/iceberg-rust branch dev at 15aee17e565d16da842f4ba636e5b1cba3def662 (per Cargo.lock), which is also the current head of that branch.

What's Wrong?

Each INSERT into an Iceberg table commits a snapshot whose total-records, total-data-files and total-files-size equal that snapshot's own added-* values, not the parent's totals plus the additions. The parent link and manifest list are correct, so Databend's own reads are right. Anything that reads the summary gets wrong totals, though: another engine's $snapshots, catalog statistics, and maintenance tooling that checks declared file counts.

Cause: SnapshotProducer::summary() in the fork (crates/iceberg/src/transaction/snapshot.rs) finds the previous snapshot with

let previous_snapshot = table_metadata
    .snapshot_by_id(self.snapshot_id)
    .and_then(|snapshot| snapshot.parent_snapshot_id())
    .and_then(|parent_id| table_metadata.snapshot_by_id(parent_id));

self.snapshot_id is the snapshot being produced, which isn't in the metadata yet, so previous_snapshot is always None and update_snapshot_summaries starts from zero. Upstream fixed this exact line in apache/iceberg-rust#2391 (issue apache/iceberg-rust#2390) with let previous_snapshot = table_metadata.current_snapshot();, which the fork doesn't have yet.

How to Reproduce?

With any Iceberg REST catalog lk:

CREATE TABLE lk.ns.repro (id BIGINT);
INSERT INTO lk.ns.repro VALUES (1), (2);
INSERT INTO lk.ns.repro SELECT number FROM numbers(1000);
SELECT count(*) FROM lk.ns.repro;   -- 1002

Load the table from the REST catalog (GET /v1/{prefix}/namespaces/ns/tables/repro):

snapshot added-records total-records total-data-files
first 2 2 1
current (parent = first) 1000 1000 (expected 1002) 1 (expected 2)
Are you willing to submit PR?
  • Yes I am willing to submit a PR!
Dominant language
Rust
Stars
9.5k
Forks
903
Avg merge
2d 13h
Merged PRs (30d)
204

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from databendlabs/databend

All issues in databendlabs/databend

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.