You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by "hangc0276 (via GitHub)" <gi...@apache.org> on 2023/04/03 07:32:29 UTC

[GitHub] [bookkeeper] hangc0276 commented on a diff in pull request #3679: Add ledgerDir to GarbageCollectionStatus

hangc0276 commented on code in PR #3679:
URL: https://github.com/apache/bookkeeper/pull/3679#discussion_r1155578594


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:
##########
@@ -777,6 +777,7 @@ EntryLogMetadataMap getEntryLogMetaMap() {
 
     public GarbageCollectionStatus getGarbageCollectionStatus() {
         return GarbageCollectionStatus.builder()
+            .ledgerDir(ledgerDirsManager.getAllLedgerDirs().get(0).getParent())

Review Comment:
   For DbLedgerStorage, each directory has on gc thread, and the ledgerDirManager only has one directory. It's OK to get the first directory.  However, for SortedLedgerStorage or InterleavedLedgerStorage, the ledgerDirsManagers has multiple directories, it will lose the other ledgers if we only get the first one.



##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/server/http/TestHttpService.java:
##########
@@ -65,10 +68,11 @@
 import org.apache.bookkeeper.server.http.service.ClusterInfoService;
 import org.apache.bookkeeper.stats.NullStatsLogger;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
-import org.junit.Before;
-import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;

Review Comment:
   All the BookKeeper unit tests use JUnit, please do not import the testng dependency.



##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/server/http/TestHttpService.java:
##########
@@ -838,12 +858,14 @@ public void testGCDetailsService() throws Exception {
         HttpServiceRequest request1 = new HttpServiceRequest(null, HttpServer.Method.GET, null);
         HttpServiceResponse response1 = gcDetailsService.handle(request1);
         assertEquals(HttpServer.StatusCode.OK.getValue(), response1.getStatusCode());
+        assertTrue(JsonUtil.fromJson(response1.getBody(), List.class).get(0).toString().contains("ledgerDir"));

Review Comment:
   Please check all the contents of your output instead of testing whether the `ledgerDir` exists or not.



-- 
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: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org