Jason918 commented on code in PR #14488:
URL: https://github.com/apache/pulsar/pull/14488#discussion_r925431403
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java:
##########
@@ -2839,4 +2845,10 @@ public int getMetadataStoreOperationTimeoutSeconds() {
public int getMetadataStoreCacheExpirySeconds() {
return zooKeeperCacheExpirySeconds > 0 ? zooKeeperCacheExpirySeconds :
metadataStoreCacheExpirySeconds;
}
+
+ public long getManagedLedgerCacheEvictionIntervalMs() {
+ return managedLedgerCacheEvictionFrequency > 0
+ ? (long) (1000 /
Math.max(Math.min(managedLedgerCacheEvictionFrequency, 1000.0), 0.001))
+ : Math.min(1000000, managedLedgerCacheEvictionIntervalMs);
Review Comment:
Where does this `1000000` comes from?
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedLedgerFactoryConfig.java:
##########
@@ -44,9 +44,16 @@ public class ManagedLedgerFactoryConfig {
/**
* Frequency of cache eviction triggering. Default is 100 times per second.
+ * @Deprecated Use {@link #cacheEvictionIntervalMs} instead.
*/
+ @Deprecated
private double cacheEvictionFrequency = 100;
Review Comment:
+1,If we deprecated this, then we should add compatible logic for getter and
setter from `cacheEvictionIntervalMs` for this value.
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java:
##########
@@ -203,8 +202,14 @@ private ManagedLedgerFactoryImpl(MetadataStoreExtended
metadataStore,
this.cacheEvictionTimeThresholdNanos = TimeUnit.MILLISECONDS
.toNanos(config.getCacheEvictionTimeThresholdMillis());
-
- cacheEvictionExecutor.execute(this::cacheEvictionTask);
+ long evictionTaskInterval = config.getCacheEvictionIntervalMs();
+ cacheEvictionExecutor.scheduleWithFixedDelay(() -> {
+ try {
Review Comment:
Consider use
`org.apache.pulsar.common.util.Runnables#catchingAndLoggingThrowables`?
--
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]