yuruguo opened a new pull request, #18728:
URL: https://github.com/apache/pulsar/pull/18728

   ### Motivation
   Some scheduled tasks will be started when the broker starting, including:
   ```java
           // start other housekeeping functions
           this.startStatsUpdater(
                   serviceConfig.getStatsUpdateInitialDelayInSecs(),
                   serviceConfig.getStatsUpdateFrequencyInSecs());
           this.startInactivityMonitor();
           this.startMessageExpiryMonitor();
           this.startCompactionMonitor();
           this.startConsumedLedgersMonitor();
           this.startBacklogQuotaChecker();
           this.startCheckReplicationPolicies();
           this.startDeduplicationSnapshotMonitor();
   ```
   The interval of these scheduled tasks must be greater than 0, or an error 
will be reported during startup, as below:
   ```
   java.lang.IllegalArgumentException: null
        at 
java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:623)
 ~[?:?]
        at 
java.util.concurrent.Executors$DelegatedScheduledExecutorService.scheduleAtFixedRate(Executors.java:819)
 ~[?:?]
        at 
org.apache.pulsar.broker.service.BrokerService.startInactivityMonitor(BrokerService.java:568)
 ~[classes/:?]
        at 
org.apache.pulsar.broker.service.BrokerService.start(BrokerService.java:534) 
~[classes/:?]
        at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:784) 
~[classes/:?]
   ```
   Therefore, it is necessary to judge whether the interval is greater than 0, 
and these scheduled tasks will be started only when the interval is greater 
than 0
   ### Modifications
   - check interval > 0
   
   ### Documentation
   - [ ] `doc` <!-- Your PR contains doc changes. Please attach the local 
preview screenshots (run `sh start.sh` at `pulsar/site2/website`) to your PR 
description, or else your PR might not get merged. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   PR in forked repository: 


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

Reply via email to