Skip to content

Relocate commitTransaction metadata cleanup tests out of CommitTransactionEventTest#5041

Draft
sririshindra wants to merge 1 commit into
apache:mainfrom
sririshindra:relocate-commit-transaction-metadata-tests
Draft

Relocate commitTransaction metadata cleanup tests out of CommitTransactionEventTest#5041
sririshindra wants to merge 1 commit into
apache:mainfrom
sririshindra:relocate-commit-transaction-metadata-tests

Conversation

@sririshindra

@sririshindra sririshindra commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #4920, as discussed in #4920 (comment).

CommitTransactionEventTest is dedicated to Polaris event emission, but two regression tests for metadata-file lifecycle landed there:

  • testCommitTransactionDoesNotDeleteOldMetadataFilesDuringTransaction (from Fix data corruption via premature metadata deletion in commitTransaction #4920) is rewritten as API-level tests in PolarisRestCatalogIntegrationBase

    • testCommitTransactionDoesNotDeleteOldMetadataFilesOnFailure — a failed multi-table transaction must not delete metadata files evicted from the metadata log (write.metadata.delete-after-commit.enabled=true).
    • testCommitTransactionDeletesOldMetadataFilesAfterSuccess — the "positive" counterpart also suggested in review: once the transaction commits, the deferred cleanup deletes the evicted metadata file.

    Both use the RESTCatalog client with the failure-injection pattern of the neighboring transaction tests, and check file existence through the class's initializeClientFileIO(...) hook (instead of walking local java.nio.file paths) so they work across the FILE/S3/MinIO/GCS/ADLS suites.

  • testCommitTransactionCleansUpMetadataOnFailure (from Cleanup metadata files on transaction failure #4934) injects a Mockito spy via TestServices.metaStoreManagerDecorator to simulate a CAS failure in the final batch update, so it cannot run as an integration test. It moves verbatim to a new CommitTransactionMetadataCleanupTest in the same package. The move also restores the recursive Files.walk metadata scan; the non-recursive Files.list variant on main made this test's before/after comparison on the temp-dir root vacuously pass.

CommitTransactionEventTest now contains only the three event-emission tests.

…ctionEventTest

CommitTransactionEventTest is dedicated to Polaris event emission, but two
regression tests for metadata-file lifecycle landed there:

- testCommitTransactionDoesNotDeleteOldMetadataFilesDuringTransaction (apache#4920)
  is rewritten as API-level tests in PolarisRestCatalogIntegrationBase
  (a failure variant plus the "positive" success variant suggested in review),
  using the RESTCatalog client and the client-side FileIO hook so the tests
  work across all storage backends:
  apache#4920 (comment)
- testCommitTransactionCleansUpMetadataOnFailure (apache#4934) injects a Mockito spy
  into the metastore manager and cannot run as an integration test; it moves
  verbatim to a new CommitTransactionMetadataCleanupTest, restoring the
  recursive metadata-file scan its assertion relies on.
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.

1 participant