Skip to content

Skip set-properties updates that change nothing - #4632

Open
tomron wants to merge 1 commit into
apache:mainfrom
tomron:skip-noop-set-properties
Open

tomron wants to merge 1 commit into
apache:mainfrom
tomron:skip-noop-set-properties

Conversation

@tomron

@tomron tomron commented Dec 6, 2026

Copy link
Copy Markdown

Rationale for this change

set_properties with values the table already has still recorded a SetPropertiesUpdate. That bumped last_updated_ms, so the staged metadata no longer equaled the current metadata. The catalogs' skip-commit check (updated_staged_table.metadata == current_table.metadata) never fired, and a new metadata version was written for a commit that changes nothing.

This records the update only when the merged properties differ from the current ones. It mirrors the remove-properties handler in #4545 and Java's PropertiesUpdate. Follow-up to the review discussion on #4545.

Are these changes tested?

Yes. A unit test in tests/table/test_init.py covers unchanged, new-key, changed-value and mixed updates. A catalog behavior test in tests/catalog/test_catalog_behaviors.py checks that re-setting a property to its current value leaves metadata_location unchanged. Both fail without the source change.

Are there any user-facing changes?

Yes, small. Re-setting a property to its current value no longer bumps last_updated_ms or writes a new metadata file. RestCatalog is unchanged here, since the server decides.

Generated-by: an LLM-based AI coding assistant, reviewed and tested by me

Setting properties to the values they already have still recorded the update, bumping last_updated_ms and defeating the catalogs' skip-commit check, so a metadata version was written for a commit that changes nothing. Record the update only when the merged properties differ from the current ones, matching the remove-properties handler (apache#4545) and Java's PropertiesUpdate.

@Fokko Fokko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice follow-up on #4545, @tomron! 🚀 Verified the Java parity myself: in TableMetadata, replaceProperties() only records entries that actually differ and Builder.build() returns base when hasChanges() is false, so a no-op set skips the commit there too. Also confirmed the new catalog test fails without the source change. LGTM!

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants