merlimat commented on code in PR #4926:
URL: https://github.com/apache/bookkeeper/pull/4926#discussion_r4449687221
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AuditorPeriodicCheckTest.java:
##########
@@ -898,6 +899,56 @@ public void testDelayBookieAuditOfReplicasCheck() throws
Exception {
auditor.close();
}
+ /**
+ * Test that shutting down an auditor doesn't wait for the audit it delayed
+ * for a lost bookie.
+ */
+ @Test
+ public void testShutdownWithDelayedBookieAudit() throws Exception {
+ for (AuditorElector e : auditorElectors.values()) {
+ e.shutdown();
+ }
+ LedgerUnderreplicationManager urm =
driver.getLedgerManagerFactory().newLedgerUnderreplicationManager();
+ urm.setLostBookieRecoveryDelay(Integer.MAX_VALUE);
+
+ ServerConfiguration servConf = new ServerConfiguration(confByIndex(0));
+ Auditor auditor = new
Auditor(BookieImpl.getBookieId(servConf).toString(), servConf, bkc, false,
+ NullStatsLogger.INSTANCE);
+ auditor.start();
+ killBookie(addressByIndex(1));
+ Awaitility.await().until(() -> auditor.getAuditTask() != null);
+
+ assertShutsDownPromptly(auditor);
+ }
+
+ /**
+ * Test that shutting down an auditor doesn't wait for an audit that waits
+ * for the ledger replication to be enabled.
+ */
+ @Test
+ public void testShutdownWithAuditWaitingForReplication() throws Exception {
+ for (AuditorElector e : auditorElectors.values()) {
+ e.shutdown();
+ }
+ LedgerUnderreplicationManager urm =
driver.getLedgerManagerFactory().newLedgerUnderreplicationManager();
+ urm.disableLedgerReplication();
+
+ ServerConfiguration servConf = new ServerConfiguration(confByIndex(0));
+ // start() submits a single bookie check, which waits for the
replication to be enabled
+ servConf.setAuditorPeriodicBookieCheckInterval(0);
+ Auditor auditor = new
Auditor(BookieImpl.getBookieId(servConf).toString(), servConf, bkc, false,
+ NullStatsLogger.INSTANCE);
+ auditor.start();
+
+ assertShutsDownPromptly(auditor);
Review Comment:
The test now spies the bookie check's `LedgerUnderreplicationManager` and
waits until `notifyLedgerReplicationEnabled()` returned, so the check is
running when `shutdown()` is called and has to be interrupted (19799361ed). It
still fails on master, with the `TimeoutException`.
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
--
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]