-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to use jdk api to create hardlink when rename file when compaction. #3876
Conversation
@hangc0276 @eolivelli @StevenLuMT can you take a look ? |
IIUC, hardlink will result in two files with same inode, which is different from mv command? |
thanks for review. the current code will create a process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bookkeeper-server/src/main/java/org/apache/bookkeeper/util/HardLink.java
Show resolved
Hide resolved
@lifepuzzlefun Thanks for your contribution. Would you please add a test to cover this change? |
sorry for late reply. a unit test to cover this change is uploaded. :-) |
@lifepuzzlefun Could you please try rebase master to retrigger the ci? |
rebased. : -) |
@lifepuzzlefun Would you like to fix the style error |
@lifepuzzlefun Would you please fix the license issue? |
Move to the next release first. If this license can be fixed before the 4.16.4 release is triggered, I will include this PR. |
…n. (apache#3876) ### Motivation Current HardLink will create a process to execute mv like command to rename file in compaction logic. maybe we can just use jdk api to do this with lower overhead. see javadoc: https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createLink(java.nio.file.Path,%20java.nio.file.Path) ### Changes test if `Files.createLink` is available in hardlink static code block. if test fails means `Files.createLink` is not available. else will use `Files.createLink` when call createHardlink (cherry picked from commit af419cc)
…n. (apache#3876) ### Motivation Current HardLink will create a process to execute mv like command to rename file in compaction logic. maybe we can just use jdk api to do this with lower overhead. see javadoc: https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createLink(java.nio.file.Path,%20java.nio.file.Path) ### Changes test if `Files.createLink` is available in hardlink static code block. if test fails means `Files.createLink` is not available. else will use `Files.createLink` when call createHardlink
Motivation
Current HardLink will create a process to execute mv like command to rename file in compaction logic.
maybe we can just use jdk api to do this with lower overhead.
see javadoc: https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createLink(java.nio.file.Path,%20java.nio.file.Path)
Changes
test if
Files.createLink
is available in hardlink static code block.if test fails means
Files.createLink
is not available.else will use
Files.createLink
when call createHardlink