[FOLLOW-UP] HIVE-28373: Iceberg: Refactor the code of HadoopTableOptions#6345
Draft
BsoBird wants to merge 2 commits intoapache:masterfrom
Draft
[FOLLOW-UP] HIVE-28373: Iceberg: Refactor the code of HadoopTableOptions#6345BsoBird wants to merge 2 commits intoapache:masterfrom
BsoBird wants to merge 2 commits intoapache:masterfrom
Conversation
deniskuzZ
reviewed
Mar 3, 2026
Member
There was a problem hiding this comment.
please drop the unnecessary casts
deniskuzZ
reviewed
Mar 3, 2026
| String cmd = String.format("mv -n %s %s", srcPathStr, dstPathStr); | ||
| Process process = Runtime.getRuntime().exec(cmd); | ||
| assertThat(process.waitFor()).isZero(); | ||
| Files.move( |
Member
There was a problem hiding this comment.
why such a massive copy-paste?
try {
HadoopTableOperations tableOperations = (HadoopTableOperations) baseTable.operations();
HadoopTableOperations spyOps = spy(tableOperations);
doNothing().when(spyOps).tryLock(any(), any());
doAnswer(x -> {
countDownLatch.countDown();
countDownLatch.await();
return x.callRealMethod();
}).when(spyOps).renameMetaDataFileAndCheck(any(), any(), any(), anyBoolean());
doAnswer(x -> {
Path srcPath = x.getArgument(1);
Path dstPath = x.getArgument(2);
Files.move(
Paths.get(srcPath.toUri()), Paths.get(dstPath.toUri()),
StandardCopyOption.ATOMIC_MOVE
);
return true;
}).when(spyOps).renameMetaDataFile(any(), any(), any());
TableMetadata metadataV1 = spyOps.current();
SortOrder dataSort = SortOrder.builderFor(baseTable.schema()).asc("data").build();
TableMetadata metadataV2 = metadataV1.replaceSortOrder(dataSort);
spyOps.commit(metadataV1, metadataV2);
} catch (CommitFailedException e) {
expectedException.set(e);
} catch (Throwable e) {
unexpectedException.set(e);
}
Member
There was a problem hiding this comment.
why 8 threads? Executors.newFixedThreadPool(8)
use virtual threads instead
Member
There was a problem hiding this comment.
Runnable commitTask = () -> {
try {
HadoopTableOperations tableOperations = (HadoopTableOperations) baseTable.operations();
HadoopTableOperations spyOps = spy(tableOperations);
doNothing().when(spyOps).tryLock(any(), any());
doAnswer(x -> {
countDownLatch.countDown();
countDownLatch.await();
return x.callRealMethod();
}).when(spyOps).renameMetaDataFileAndCheck(any(), any(), any(), anyBoolean());
doAnswer(x -> {
Path srcPath = x.getArgument(1);
Path dstPath = x.getArgument(2);
var src = Paths.get(srcPath.toUri());
var dst = Paths.get(dstPath.toUri());
Files.move(src, dst, StandardCopyOption.ATOMIC_MOVE);
return Files.exists(dst) && Files.notExists(src);
}).when(spyOps).renameMetaDataFile(any(), any(), any());
TableMetadata metadataV1 = spyOps.current();
SortOrder dataSort = SortOrder.builderFor(baseTable.schema()).asc("data").build();
TableMetadata metadataV2 = metadataV1.replaceSortOrder(dataSort);
spyOps.commit(metadataV1, metadataV2);
} catch (CommitFailedException e) {
expectedException.set(e);
} catch (Throwable e) {
unexpectedException.set(e);
}
};
Tasks.range(2)
.executeWith(executorService)
.run(i -> commitTask.run());
2.remove unnecessary casts 3.remove massive copy-paste
Member
|
@BsoBird this test fails most of the time for me. failed on jenkins as well: https://ci.hive.apache.org/job/hive-precommit/job/PR-6345/1/testReport/junit/org.apache.iceberg.hadoop/TestHiveHadoopCommits/Testing___split_20___PostProcess___testTwoClientCommitSameVersion/ |
|
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.



What changes were proposed in this pull request?
Modify the test case to ensure it can run on macOS environments.
Why are the changes needed?
Since a considerable number of developers use macOS as their local development environment, the test case code should avoid relying on Linux-specific commands.
Does this PR introduce any user-facing change?
No