[GOBBLIN-2266] Add rename order functionality for Iceberg table replication#4202
Merged
Blazer-007 merged 2 commits intoJun 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an ordered, two-phase recursive rename utility intended to support Iceberg table publishing semantics where metadata/ must not become visible before the data files it references.
Changes:
- Introduces
HadoopUtils.renameRecursivelyOrdered(...), deferring selected directory subtrees (e.g.,metadata/) to a second rename phase. - Adds Iceberg-specific predicate
HadoopUtils.isIcebergMetadataDir(...)and unit tests validating ordering and failure behavior. - Switches
CopyDataPublisherpublishing path move to use the new ordered rename.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java | Adds ordered two-phase rename + Iceberg metadata/ predicate and shared future-draining helper. |
| gobblin-utility/src/test/java/org/apache/gobblin/util/HadoopUtilsTest.java | Adds tests covering ordered rename sequencing, atomic subtree move case, and abort-on-data-failure behavior. |
| gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/publisher/CopyDataPublisher.java | Uses ordered rename during publish to avoid publishing Iceberg metadata before data. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+631
to
+639
| private static void drainFutures(Queue<Future<?>> futures) throws IOException { | ||
| while (!futures.isEmpty()) { | ||
| try { | ||
| futures.poll().get(); | ||
| } catch (ExecutionException | InterruptedException ee) { | ||
| throw new IOException(ee.getCause()); | ||
| } | ||
| } | ||
| } |
Comment on lines
+581
to
+585
| * Used by Iceberg distcp publishing to move the {@code metadata/} subtree only after every other file (the | ||
| * {@code data/} files and anything else) has landed, since Iceberg metadata references data files by path and must | ||
| * never become visible ahead of the data it points to. {@code deferToLastPhase} is evaluated only on directory | ||
| * nodes encountered during the descent -- not on every file -- so the {@code metadata/} subtree is identified by | ||
| * its directory name and never enumerated file-by-file. |
Comment on lines
343
to
+346
| if (statesHelper.hasAnyCopyableFile()) { | ||
| // Targets are always absolute, so we start moving from root (will skip any existing directories). | ||
| HadoopUtils.renameRecursively(this.fs, datasetWriterOutputPath, new Path("/")); | ||
| HadoopUtils.renameRecursivelyOrdered(this.fs, datasetWriterOutputPath, new Path("/"), | ||
| HadoopUtils::isIcebergMetadataDir); |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4202 +/- ##
============================================
+ Coverage 43.26% 51.98% +8.71%
- Complexity 2583 7872 +5289
============================================
Files 516 1413 +897
Lines 22087 54033 +31946
Branches 2505 5954 +3449
============================================
+ Hits 9557 28087 +18530
- Misses 11566 23579 +12013
- Partials 964 2367 +1403 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dear Gobblin maintainers,
Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!
JIRA
Description
Changes:
Introduces HadoopUtils.renameRecursivelyOrdered(...), deferring selected directory subtrees (e.g., metadata/) to a second rename phase.
Adds Iceberg-specific predicate HadoopUtils.isIcebergMetadataDir(...) and unit tests validating ordering and failure behavior.
Switches CopyDataPublisher publishing path move to use the new ordered rename.
Tests
Commits