You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/09/29 07:58:35 UTC

[GitHub] [bookkeeper] wenbingshen commented on a diff in pull request #3505: Rename success with writableResult and update final writableResult about wait writeSet

wenbingshen commented on code in PR #3505:
URL: https://github.com/apache/bookkeeper/pull/3505#discussion_r983191361


##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/client/SlowBookieTest.java:
##########
@@ -390,4 +390,32 @@ public void operationComplete(int rc, Set<LedgerFragment> fragments) {
         checklatch.await();
         assertEquals("There should be no missing fragments", 0, numFragments.get());
     }
+
+    @Test
+    public void testWaitForWritable() throws Exception {
+        final ClientConfiguration conf = new ClientConfiguration();
+        conf.setMetadataServiceUri(zkUtil.getMetadataServiceUri());
+        BookKeeper bkc = new BookKeeper(conf);
+
+        byte[] pwd = new byte[]{};
+        try (LedgerHandle lh = bkc.createLedger(1, 1, 1, BookKeeper.DigestType.CRC32, pwd)) {
+            long entryId = lh.addEntry(this.entry);
+
+            RoundRobinDistributionSchedule schedule = new RoundRobinDistributionSchedule(1, 1, 1);
+            DistributionSchedule.WriteSet writeSet = schedule.getWriteSet(entryId);
+
+            int slowBookieIndex = writeSet.get(ThreadLocalRandom.current().nextInt(writeSet.size()));
+            List<BookieId> curEns = lh.getCurrentEnsemble();
+
+            // disable channel writable
+            setTargetChannelState(bkc, curEns.get(slowBookieIndex), 0, false);
+            boolean isWriteable = lh.waitForWritable(writeSet, 0, 1000);

Review Comment:
   ok, i'll fix it later.



-- 
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