zhaohaidao commented on code in PR #3620:
URL: https://github.com/apache/bookkeeper/pull/3620#discussion_r1081002465
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/client/PendingAddOpTest.java:
##########
@@ -87,4 +103,70 @@ public void testExecuteAfterCancelled() {
assertNull(op.lh);
}
+ @Test
+ public void testLedgerHandleWithDeferredSyncDuringRecoveryAdd() throws
Exception {
+ final BookieId b1 = new BookieSocketAddress("b1", 3181).toBookieId();
+ final BookieId b2 = new BookieSocketAddress("b2", 3181).toBookieId();
+ final BookieId b3 = new BookieSocketAddress("b3", 3181).toBookieId();
+ MockClientContext clientCtx = MockClientContext.create();
+ Versioned<LedgerMetadata> md = ClientUtil.setupLedger(clientCtx, 0,
+
LedgerMetadataBuilder.create().withInRecoveryState().newEnsembleEntry(0L,
+ Lists.newArrayList(b1, b2, b3)));
+ LedgerHandle lh = new LedgerHandle(clientCtx, 0, md,
BookKeeper.DigestType.CRC32C,
+ ClientUtil.PASSWD, EnumSet.of(WriteFlag.DEFERRED_SYNC));
+ lh.notifyWriteFailed(0, b1);
+ AtomicInteger rcHolder = new AtomicInteger(-0xdead);
+ PendingAddOp op = PendingAddOp.create(
+ lh, mockClientContext, lh.getCurrentEnsemble(),
+ payload, EnumSet.of(WriteFlag.DEFERRED_SYNC),
+ (rc, handle, entryId, qwcLatency, ctx) -> {
+ rcHolder.set(rc);
+ }, null).enableRecoveryAdd();
+ assertSame(lh, op.lh);
+ lh.pendingAddOps.add(op);
Review Comment:
Nice catch. This is a redundant one
--
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]