Skip to content

fix: make Hudi snapshot sync idempotent for already-synced source commit - #993

Open
csarushan1729 wants to merge 4 commits into
apache:mainfrom
csarushan1729:fix/hudi-idempotent-snapshot-sync-962
Open

csarushan1729 wants to merge 4 commits into
apache:mainfrom
csarushan1729:fix/hudi-idempotent-snapshot-sync-962

Conversation

@csarushan1729

Copy link
Copy Markdown
Contributor

Fixes #962

What is the purpose of the pull request

A Hudi snapshot (FULL) sync currently fails when the source commit has already been synchronized to the target.

HudiConversionTarget derives the Hudi instant from the source commit time. On a repeated FULL sync with an unchanged source, it tries to create the same replace-commit again, which results in:

HoodieIOException: Failed to create immutable file .../.replacecommit.inflight
Caused by: FileAlreadyExistsException

This PR makes the commit path idempotent so that repeating a FULL sync of an unchanged source succeeds safely.

Brief change log

  • In HudiConversionTarget.CommitState.commit(), check whether a completed replace-commit for the target instant already exists
  • If it exists, skip creating the timeline files and return successfully
  • Preserves existing behavior for new instants and for metadata repair cases

Verify this pull request

This change is covered by existing unit tests in TestHudiConversionTarget. The new logic only adds an early return when the instant is already completed, so the normal commit path continues to be exercised by current tests.

@csarushan1729
csarushan1729 force-pushed the fix/hudi-idempotent-snapshot-sync-962 branch from 05a29b1 to a8aff22 Compare October 28, 2026 09:36

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.

[Bug] Hudi snapshot sync fails when reusing an already synchronized source commit

1 participant