Repository navigation
Conversation
|
@JingsongLi Can I get a review on the PR? Having more schemas can slow down table operations as finding the latest schema lists the entire schema directory. |
JingsongLi
left a comment
There was a problem hiding this comment.
All 80 SchemaManagerTest cases passed locally on JDK 8.
|
I have identified a regression with Hive catalog as well where the assumption is that a commit operation will always result in schema change. This is fixed in ee9c6bc |
JingsongLi
left a comment
There was a problem hiding this comment.
All 423 focused JDK 8 tests passed. A legacy filesystem catalog fixture exposed a change in ALTER validation.
| && Objects.equals(oldTableSchema.comment(), newTableSchema.comment())) { | ||
| // Branch existence can change even when the schema is unchanged. | ||
| SchemaValidation.validateFallbackBranch(this, newTableSchema); | ||
| return oldTableSchema; |
There was a problem hiding this comment.
[P2] Validate persisted schema history before returning on a no-op ALTER
The regular commit(newTableSchema) path validates Iceberg metadata compatibility across all historical schemas. This early return only validates the fallback branch. I opened a legacy metadata.iceberg.storage=table-location table with a VECTOR in schema 0 that had already been dropped in schema 1. Reapplying table-location is rejected by the existing validate-and-write path. The new FileSystemCatalog.alterTable path reports success using schema 1, but the first actual data commit still rejects schema 0 and publishes no snapshot. Please share the schema validation with the regular commit path before reusing the old schema. The write itself can still be skipped.
There was a problem hiding this comment.
Thanks, fixed. Unchanged ALTERs now share the regular commit validation, including historical Iceberg compatibility checks, while still skipping the schema write. Added regression coverage; all 87 focused tests pass.
Report whether a schema change committed a new version and only delete that version when the Hive Metastore update fails. Cover unchanged and changed ALTER failures, plus retries after a concurrent schema commit.
Validate fallback and primary branch references before returning an unchanged schema. Cover repeated SET operations after branch deletion and preserve schema versions for valid unchanged changes.
Keep separate schema revisions for main-branch Hive ALTERs so an HMS rollback cannot undo a successful concurrent ALTER. Continue skipping unchanged commits for filesystem ALTERs and Hive branches. Compare persisted schema fields and options directly to preserve explicitly permitted nullability changes in legacy primary-key schemas. Add regression coverage for both cases and concurrent commit retries.
Share validation between schema reuse and regular commits so unchanged ALTERs still reject incompatible historical Iceberg types. Cover changed and unchanged ALTERs against legacy schema history.
ee9c6bc to
fd5d0d7
Compare
|
The docs test failure regression is introduced in this PR. |
Purpose
Schema alterations currently create a new schema revision even when they leave the schema unchanged, such as setting an option to its existing value or submitting an empty list of changes. This produces redundant schema files and unnecessarily advances the schema ID. Such patterns are common if you have a streaming FlinkSQL job with ALTER TABLE statements. Any crash looping jobs can cause a large number of schema version creation.
Update FileSystemSchemaManager to return the existing schema when the generated schema content, schema format version, and highest field ID are unchanged. The comparison ignores the generated revision ID and timestamp. Actual schema changes, field-ID allocation, and schema format upgrades continue to create new revisions.
Tests
Added regression coverage for unchanged and reverted alterations, tables with existing snapshots, mixed changes, type and option updates, field-ID allocation, schema format upgrades, and missing-table validation.
Validated with SchemaManagerTest: 80 tests passed, with no failures, errors, or skipped tests. Normal Maven style checks also passed.