jvrao commented on a change in pull request #1683: Enhance Auditor
URL: https://github.com/apache/bookkeeper/pull/1683#discussion_r219619610
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
##########
@@ -345,21 +348,73 @@ public void start() {
return;
}
+ try {
+ watchBookieChanges();
+ knownBookies = getAvailableBookies();
+ } catch (BKException bke) {
+ LOG.error("Couldn't get bookie list, so exiting", bke);
+ submitShutdownTask();
+ }
+
+ try {
+ this.ledgerUnderreplicationManager
+ .notifyLostBookieRecoveryDelayChanged(new
LostBookieRecoveryDelayChangedCb());
+ } catch (UnavailableException ue) {
+ LOG.error("Exception while registering for
LostBookieRecoveryDelay change notification, so exiting",
+ ue);
+ submitShutdownTask();
+ }
+
+ long bookieCheckInterval =
conf.getAuditorPeriodicBookieCheckInterval();
+ if (bookieCheckInterval == 0) {
+ LOG.info("Auditor periodic bookie checking disabled, running
once check now anyhow");
+ executor.submit(bookieCheck);
+ } else {
+ LOG.info("Auditor periodic bookie checking enabled"
+ + " 'auditorPeriodicBookieCheckInterval' {} seconds",
bookieCheckInterval);
+ executor.scheduleAtFixedRate(bookieCheck, 0,
bookieCheckInterval, TimeUnit.SECONDS);
+ }
+
long interval = conf.getAuditorPeriodicCheckInterval();
if (interval > 0) {
- LOG.info("Auditor periodic ledger checking enabled"
- + " 'auditorPeriodicCheckInterval' {} seconds",
interval);
+ LOG.info("Auditor periodic ledger checking enabled" + "
'auditorPeriodicCheckInterval' {} seconds",
+ interval);
+
+ long checkAllLedgersLastExecutedCTime = -1;
+ long durationSinceLastExecutionInSecs = 0;
+ long initialDelay = 0;
+ try {
+ checkAllLedgersLastExecutedCTime =
ledgerUnderreplicationManager.getCheckAllLedgersCTime();
+ } catch (UnavailableException ue) {
+ LOG.error("Got UnavailableException while trying to get
checkAllLedgersCTime", ue);
+ }
+ if (checkAllLedgersLastExecutedCTime == -1) {
+ durationSinceLastExecutionInSecs = -1;
+ initialDelay = 0;
+ } else {
+ durationSinceLastExecutionInSecs =
(System.currentTimeMillis() - checkAllLedgersLastExecutedCTime)
+ / 1000;
+ initialDelay = durationSinceLastExecutionInSecs > interval
? 0
Review comment:
I missed 0 in there.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services