Nicklee007 commented on code in PR #3802:
URL: https://github.com/apache/bookkeeper/pull/3802#discussion_r1135345694
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java:
##########
@@ -374,6 +382,36 @@ public void compact(byte[] firstKey, byte[] lastKey)
throws IOException {
}
}
+ @Override
+ public void compact() throws IOException {
+ try {
+ final long start = System.currentTimeMillis();
+ final int oriRocksDBFileCount = db.getLiveFilesMetaData().size();
+ final long oriRocksDBSize = getRocksDBSize();
+ log.info("Starting RocksDB {} compact, current RocksDB hold {}
files and {} Bytes.",
+ db.getName(), oriRocksDBFileCount, oriRocksDBSize);
+
+ db.compactRange();
+
+ final long end = System.currentTimeMillis();
+ final int rocksDBFileCount = db.getLiveFilesMetaData().size();
+ final long rocksDBSize = getRocksDBSize();
+ log.info("RocksDB {} compact finished {} ms, space reduced {}
Bytes, current hold {} files and {} Bytes.",
+ db.getName(), end - start, oriRocksDBSize - rocksDBSize,
rocksDBFileCount, rocksDBSize);
+ } catch (RocksDBException e) {
+ throw new IOException("Error in RocksDB compact", e);
Review Comment:
db.getName() return the db Path, like
/data1/bookkeeper/ledgers/current/locations
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]