Hi everyone,

I want to continue the discussion on making the `metadata.json` file in
storage optional and relying on the REST catalog response instead. This has
come up in a few past threads [1][2][3], and it recently came up again in
the `loadTableV2` discussion in PR #17642 [4], so I think it warrants its
own discussion thread.

My main motivation is speeding up streaming and high-frequency writes,
especially combined with v4 single-file commits. Today the commit protocol
requires writing a new `metadata.json` file to object storage on every
commit. Making it optional removes that extra storage I/O from the commit
path. There are other benefits too, like cheaper commit retries (on a
conflict, the catalog no longer has to write and discard a `metadata.json`
file), avoiding plaintext metadata files for encrypted tables, and letting
catalogs control access to table metadata (for example, redacting sensitive
metadata) instead of clients reading it directly from storage.

The main concern from past discussions is interoperability and catalog
lock-in. The `unregisterTable` endpoint [5] helps address migration since a
catalog can materialize and return the final `metadata.json` and
`metadata-location` when moving a table to another catalog. One gap is that
`unregisterTable` is destructive, so it doesn't cover non-destructive
export for backup, DR, or debugging. `loadTable?snapshots=all` covers part
of that, and we could also consider a dedicated export endpoint.

If we move forward, here is the work I think we need to get there:

1. Update the table spec [6] so commits no longer require writing a new
`metadata.json` file to storage on every commit, as long as the catalog
guarantees atomic commits and a linear history.
2. Update the REST spec to clarify optional `metadata-location` across
`LoadTableResult` [7] (currently optional for staged creates) and
`CommitTableResponse` [8] (currently required), and clarify the portability
contract for `unregisterTable` and `loadTable?snapshots=all`.
3. Remove hard dependencies on `metadata.json` in storage across clients
and engines, such as `RESTTableOperations`, `SerializableTable`,
`StaticTableOperations`, static metadata tables, and maintenance actions
(Yufei started tracking these in [9]).

I'd like to use this thread to build consensus on making `metadata.json`
optional in storage. One open question is scope: should this apply to v4
tables only, or to any table loaded through `loadTableV2`? Existing clients
expect `metadata-location` in `CommitTableResponse`, which is part of why
scope matters.

Let me know what you think!

Best,
Kevin Liu

[1] https://lists.apache.org/thread/clfpm1spd0k6rrvwm3nbt1cs3so7tsjt
[2] https://lists.apache.org/thread/l1onvv5p5cq2vtql9g8w5fbxc1hhd65l
[3] https://lists.apache.org/thread/5g6zfo0yyw8k5lzdd266sb270rxh7tnn
[4] https://github.com/apache/iceberg/pull/17642
[5]
https://github.com/apache/iceberg/blob/121c73fcdcdc7d851ce65634e92fd2a5dc6c3254/open-api/rest-catalog-open-api.yaml#L1374-L1388
[6]
https://github.com/apache/iceberg/blob/121c73fcdcdc7d851ce65634e92fd2a5dc6c3254/format/spec.md?plain=1#L1476-L1480
[7]
https://github.com/apache/iceberg/blob/121c73fcdcdc7d851ce65634e92fd2a5dc6c3254/open-api/rest-catalog-open-api.yaml#L4280-L4336
[8]
https://github.com/apache/iceberg/blob/121c73fcdcdc7d851ce65634e92fd2a5dc6c3254/open-api/rest-catalog-open-api.yaml#L5367-L5376
[9]
https://docs.google.com/document/d/17PBhJ0IBxHxMKvCW6CstGOp7cZnboMDdpO6BCPO2kmA/edit?usp=sharing

Reply via email to