You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/08/23 06:56:47 UTC

[GitHub] [pulsar] Jason918 commented on a diff in pull request #17192: [fix][broker] Fix pulsarLedgerIdGenerator can't delete index path when zk metadata store config rootPath.

Jason918 commented on code in PR #17192:
URL: https://github.com/apache/pulsar/pull/17192#discussion_r952219796


##########
pulsar-metadata/src/test/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerIdGeneratorTest.java:
##########
@@ -108,19 +109,118 @@ public void testGenerateLedgerId(String provider, Supplier<String> urlSupplier)
 
         assertTrue(countDownLatch2.await(120, TimeUnit.SECONDS),
                 "Wait ledger id generation threads to stop timeout : ");
-        log.info("Number of generated ledger id: {}, time used: {}", ledgerIds.size(),
+        log.info("Number of generated ledger id: {}, time used: {}", shortLedgerIds.size() + longLedgerIds.size(),
                 System.currentTimeMillis() - start);
         assertEquals(errCount.get(), 0, "Error occur during ledger id generation : ");
 
         Set<Long> ledgers = new HashSet<>();
-        while (!ledgerIds.isEmpty()) {
-            Long ledger = ledgerIds.poll();
+        while (!shortLedgerIds.isEmpty()) {
+            Long ledger = shortLedgerIds.poll();
+            assertNotNull(ledger, "Generated ledger id is null");
+            assertFalse(ledgers.contains(ledger), "Ledger id [" + ledger + "] conflict : ");
+            ledgers.add(ledger);
+        }
+        while (!longLedgerIds.isEmpty()) {
+            Long ledger = longLedgerIds.poll();
+            assertNotNull(ledger, "Generated ledger id is null");
+            assertFalse(ledgers.contains(ledger), "Ledger id [" + ledger + "] conflict : ");
+            ledgers.add(ledger);
+        }
+    }
+
+    @Test
+    public void testGenerateLedgerIdWithZkPrefix() throws Exception {
+        @Cleanup
+        MetadataStoreExtended store =

Review Comment:
   If this line is the only difference between `testGenerateLedgerId` and `testGenerateLedgerIdWithZkPrefix`, we can reuse the common codes here.



-- 
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@pulsar.apache.org

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