-
Notifications
You must be signed in to change notification settings - Fork 511
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
HDDS-10149. New JNI layer for RawSSTFileReader & RawSSTFileReaderIterator #6182
Conversation
f1fc2c7
to
f2a7869
Compare
4cb44ec
to
bbb15ad
Compare
This reverts commit f4aa7ec.
# Conflicts: # hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDiffManager.java
The PR can be reviewed now. I have fixed all the issues with the patch. |
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.
Thanks @swamirishi for working on this.
...e/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRawSSTFileReaderIterator.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRawSSTFileReaderIterator.java
Outdated
Show resolved
Hide resolved
...ks-native/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRawSSTFileReader.java
Show resolved
Hide resolved
...ks-native/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRawSSTFileReader.java
Outdated
Show resolved
Hide resolved
public static boolean loadLibrary() throws NativeLibraryNotLoadedException { | ||
ManagedRocksObjectUtils.loadRocksDBLibrary(); | ||
if (!NativeLibraryLoader.getInstance() | ||
.loadLibrary(ROCKS_TOOLS_NATIVE_LIBRARY_NAME)) { | ||
throw new NativeLibraryNotLoadedException( | ||
ROCKS_TOOLS_NATIVE_LIBRARY_NAME); | ||
} | ||
return true; | ||
} |
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.
nit:
-
I think, this code should be moved to
SnapshotDiffManager#initSSTDumpTool()
. And in test should load lib wherever is needed in @BeforeAll.ManagedRawSSTFileReader
class in itself doesn't care if native lib is loaded or not. And rely on the caller that they should load it before using it. -
May be call
loadNativeLib
rather thaninitSSTDumpTool
.
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.
done
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.
loadLibrary
is still in ManagedRawSstFileReader
. Please move it to SnapshotDiffManager
.
It is responsibility of the SnapshotDiffManager to make sure native-lib is loaded before using optimized SnapDiff.
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.
No I believe this particular piece should reside in this particular module since this class cannot run without the library being loaded. It has to be self contained.
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.
Even rocksdb does something similar
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.
I disagree with you because if ManagedRawSstFileReader
has some dependency on NativeLibrary
, it should be injected to it.
Since it is static loading, we can move this code inside the constructor of ManagedRawSstFileReader
or static block (which I don't think possible because it is needed to be loaded based on the config) but loading this way doesn't feel good to me.
...one/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java
Show resolved
Hide resolved
...ks-native/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRawSSTFileReader.java
Show resolved
Hide resolved
...e/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRawSSTFileReaderIterator.java
Outdated
Show resolved
Hide resolved
...ks-native/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRawSSTFileReader.java
Show resolved
Hide resolved
.../rocksdb-checkpoint-differ/src/main/java/org/apache/ozone/rocksdb/util/SstFileSetReader.java
Outdated
Show resolved
Hide resolved
hadoop-hdds/rocks-native/src/main/java/org/apache/hadoop/hdds/utils/NativeLibraryLoader.java
Outdated
Show resolved
Hide resolved
...one/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java
Outdated
Show resolved
Hide resolved
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.
Overall looks good to me.
There are few cosmetics comments which are not addressed. Please create follow up task if you don't intend to fix them as part of this PR.
Thanks for the review @hemantk-12 and @smengcl |
Thanks @swamirishi for the fix and improvement. |
…leReaderIterator (apache#6182) (cherry picked from commit d883d7d) Change-Id: I5cade05d6be565acc3d93b6376e7ecf679dccf55
…ator (apache#6182) (cherry picked from commit d883d7d)
What changes were proposed in this pull request?
Including rocksdb in ozone_rocks_tools native library interferes with rocksdb lib loaded from rocksdbjni jar, which leads to issues like block checksum mismatch error. Bad file descriptor error. Instead of adding rocksdb static lib as static lib to ozone_rocks_tools adding rocksdb static lib as a shared lib should prevent such issues from occuring.
Changed the rocks tools build to use rocksdbjnlllib from rocksdb jar instead of building rocksdb from scratch.
Implemented RawSSTFileReader & RawSSTFileReaderIterator in rocksdb tools to implement an iterator in the native side to read tombstone entries.
https://issues.apache.org/jira/browse/HDDS-10149
How was this patch tested?
Refactored and changed existing unit testcases and integration tests.