Skip to content

Commit

Permalink
HDDS-9419. java.lang.UnsatisfiedLinkError when trying to read RocksDB…
Browse files Browse the repository at this point in the history
… with ozone debug ldb (#5416)
  • Loading branch information
xichen01 authored Oct 13, 2023
1 parent 7d93446 commit 607122c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.hadoop.hdds.utils.db.managed.ManagedReadOptions;
import org.apache.hadoop.hdds.utils.db.managed.ManagedRocksDB;
import org.apache.hadoop.hdds.utils.db.managed.ManagedRocksIterator;
import org.apache.hadoop.hdds.utils.db.managed.ManagedRocksObjectUtils;
import org.apache.hadoop.hdds.utils.db.managed.ManagedTransactionLogIterator;
import org.apache.hadoop.hdds.utils.db.managed.ManagedWriteBatch;
import org.apache.hadoop.hdds.utils.db.managed.ManagedWriteOptions;
Expand Down Expand Up @@ -80,9 +81,11 @@ public final class RocksDatabase implements Closeable {
static final Logger LOG = LoggerFactory.getLogger(RocksDatabase.class);

public static final String ESTIMATE_NUM_KEYS = "rocksdb.estimate-num-keys";
static {
ManagedRocksObjectUtils.loadRocksDBLibrary();
}
private static final ManagedReadOptions DEFAULT_READ_OPTION =
new ManagedReadOptions();

private static Map<String, List<ColumnFamilyHandle>> dbNameToCfHandleMap =
new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.hadoop.hdds.HddsUtils;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException;
import org.rocksdb.RocksDB;
import org.rocksdb.RocksObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -113,4 +114,13 @@ public static void waitForFileDelete(File file, Duration maxDuration)
waitForFileDelete(file, maxDuration, POLL_INTERVAL_DURATION,
POLL_DELAY_DURATION);
}

/**
* Ensures that the RocksDB native library is loaded.
* This method should be called before performing any operations
* that require the RocksDB native library.
*/
public static void loadRocksDBLibrary() {
RocksDB.loadLibrary();
}
}

0 comments on commit 607122c

Please sign in to comment.