swamirishi commented on code in PR #8141:
URL: https://github.com/apache/ozone/pull/8141#discussion_r2093793254
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotCache.java:
##########
@@ -220,6 +246,8 @@ void cleanup() {
LOG.debug("Closing SnapshotId {}. It is not being referenced
anymore.", k);
// Close the instance, which also closes its DB handle.
try {
+ compactSnapshotDB(v.get());
Review Comment:
We should perform this outside dbMap.compute since this can block snapshot
reads. dbMap.compute is blocking. We can just move this above line number 235
same level as the dbMap.compute()
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java:
##########
@@ -222,6 +222,22 @@ public void compactDB() throws IOException {
}
}
+ @Override
+ public void compactTable(String tableName) throws IOException {
+ try (ManagedCompactRangeOptions options = new
ManagedCompactRangeOptions()) {
+ compactTable(tableName, options);
+ }
+ }
+
+ @Override
+ public void compactTable(String tableName, ManagedCompactRangeOptions
options) throws IOException {
+ RocksDatabase.ColumnFamily columnFamily = db.getColumnFamily(tableName);
+ if (columnFamily == null) {
+ throw new IOException("Table not found: " + tableName);
+ }
+ db.compactRange(columnFamily, null, null, options);
Review Comment:
We should set options.setMaxCompactionBytes() when we open the snapshot
rocksdb this could be useful so that we ensure one sub compaction doesn't take
up a lot of memory. Also look into making
ManagedCompactRangeOptions.setMaxSubCompactions() configurable so that we don't
use a lot of CPU for this operation. It is ok if the compactions take time.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]