eolivelli commented on code in PR #4661:
URL: https://github.com/apache/bookkeeper/pull/4661#discussion_r2312975261
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java:
##########
@@ -1156,6 +1158,10 @@ private LedgerDirsManager.LedgerDirsListener
getLedgerDirsListener() {
@Override
public void diskAlmostFull(File disk) {
+ if (!Objects.equals(disk.getPath(), currentFile.getPath())) {
Review Comment:
let's reduce code duplication and make this block a method
if (!isCurrentFile(disk)) {
return;
}
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java:
##########
@@ -158,7 +160,7 @@ public SingleDirectoryDbLedgerStorage(ServerConfiguration
conf, LedgerManager le
throws IOException {
checkArgument(ledgerDirsManager.getAllLedgerDirs().size() == 1,
"Db implementation only allows for one storage dir");
-
+ currentFile = ledgerDirsManager.getAllLedgerDirs().get(0);
Review Comment:
cosmetic change to make the code clearer:
pass `currentFile` to getLedgerDirsListener() and make it a private field in
the anonymous class (I also suggest to make it no more anonymous)
I think that we could also pass `gcThread` and make the inner class static,
so that it is also easier to write unit tests to it (and I would add them)
--
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]