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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]