reddycharan commented on a change in pull request #2186: Fix logic of
areEntriesOfLedgerStoredInTheBookie
URL: https://github.com/apache/bookkeeper/pull/2186#discussion_r338329678
##########
File path:
bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperAdminTest.java
##########
@@ -575,4 +576,38 @@ public void
testGetListOfEntriesOfLedgerWithEntriesNotStripedToABookie() throws
bkAdmin.close();
bkc.close();
}
+
+ @Test
+ public void testAreEntriesOfLedgerStoredInTheBookieForMultipleSegments()
throws Exception {
+ int lastEntryId = 10;
+ long ledgerId = 100L;
+ BookieSocketAddress bookie0 = new BookieSocketAddress("bookie0:3181");
+ BookieSocketAddress bookie1 = new BookieSocketAddress("bookie1:3181");
+ BookieSocketAddress bookie2 = new BookieSocketAddress("bookie2:3181");
+ BookieSocketAddress bookie3 = new BookieSocketAddress("bookie3:3181");
+
+ List<BookieSocketAddress> ensembleOfSegment1 = new
ArrayList<BookieSocketAddress>();
+ ensembleOfSegment1.add(bookie0);
+ ensembleOfSegment1.add(bookie1);
+ ensembleOfSegment1.add(bookie2);
+
+ List<BookieSocketAddress> ensembleOfSegment2 = new
ArrayList<BookieSocketAddress>();
+ ensembleOfSegment2.add(bookie3);
+ ensembleOfSegment2.add(bookie1);
+ ensembleOfSegment2.add(bookie2);
+
+ LedgerMetadataBuilder builder = LedgerMetadataBuilder.create();
+ builder.withEnsembleSize(3)
+ .withWriteQuorumSize(3)
+ .withAckQuorumSize(2)
+ .withDigestType(digestType.toApiDigestType())
+ .withPassword(PASSWORD.getBytes())
+ .newEnsembleEntry(0, ensembleOfSegment1)
+ .newEnsembleEntry(lastEntryId + 1, ensembleOfSegment2)
+
.withLastEntryId(lastEntryId).withLength(65576).withClosedState();
+ LedgerMetadata meta = builder.build();
+
+ assertFalse("expected areEntriesOfLedgerStoredInTheBookie to return
False",
Review comment:
@eolivelli added one more assertTrue case here.
Actually here I'm not adding new logic but just fixing the existing issue.
Thats why i created a testcase to repro it. Anyhow the new positive check
(assertTrue) should be good for what you asked for.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services