Skip to content

Allowwrite.metadata.previous-versions-max table property to be 0 for empty metadata logs #16797

@smaheshwar-pltr

Description

@smaheshwar-pltr

Feature Request / Improvement

write.metadata.previous-versions-max is currently floored to 1:

int maxSize =
Math.max(
1,
PropertyUtil.propertyAsInt(
properties,
TableProperties.METADATA_PREVIOUS_VERSIONS_MAX,
TableProperties.METADATA_PREVIOUS_VERSIONS_MAX_DEFAULT));

so a table always retains at least one previous metadata file in the metadata-log.

I was a bit confused by this, because I don't see a concrete reason to disallow empty metadata logs; I'd therefore like to know what folks think about permitting a value of 0 instead to enable this.

With write.metadata.delete-after-commit.enabled=true, this would then delete the superseded metadata file on every commit.

(My use case for this is from a REST catalog standpoint where an empty metadata log would allow metadata JSON to be "self-contained" and only reference its current snapshots, instead of indirectly reference snapshots in prior metadata files too)

Query engine

None

Willingness to contribute

  • I can contribute this improvement/feature independently
  • I would be willing to contribute this improvement/feature with guidance from the Iceberg community
  • I cannot contribute this improvement/feature at this time

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementPR that improves existing functionality

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions