eolivelli commented on a change in pull request #13679:
URL: https://github.com/apache/pulsar/pull/13679#discussion_r825499966
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -2233,6 +2263,13 @@ private void updateBrokerPublisherThrottlingMaxRate() {
}
}
+ private void updateCacheSizeAndThreshold(long maxSize) {
+ ManagedLedgerFactoryImpl managedLedgerFactory =
(ManagedLedgerFactoryImpl) pulsar().getManagedLedgerFactory();
+ double thresholdPercent =
managedLedgerFactory.getEntryCacheManager().getEvictionTriggerThresholdPercent();
+ managedLedgerFactory.getEntryCacheManager().setMaxSize(maxSize);
Review comment:
We should move these lines into method in ManagedLedgerFactoryImpl
Otherwise we are breaking incapsulation
Probably it is better to add the new method to the interface and not only in
the Impl classe
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -2233,6 +2263,13 @@ private void updateBrokerPublisherThrottlingMaxRate() {
}
}
+ private void updateCacheSizeAndThreshold(long maxSize) {
+ ManagedLedgerFactoryImpl managedLedgerFactory =
(ManagedLedgerFactoryImpl) pulsar().getManagedLedgerFactory();
+ double thresholdPercent =
managedLedgerFactory.getEntryCacheManager().getEvictionTriggerThresholdPercent();
+ managedLedgerFactory.getEntryCacheManager().setMaxSize(maxSize);
Review comment:
The same applies to setCacheEvictionTimeThresholdNanos
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/EntryCacheManager.java
##########
@@ -45,9 +47,12 @@
@SuppressWarnings("checkstyle:javadoctype")
public class EntryCacheManager {
- private final long maxSize;
- private final long evictionTriggerThreshold;
- private final double cacheEvictionWatermark;
+ @Setter
+ private volatile long maxSize;
+ @Setter
Review comment:
See my comments below
We should add a new method and do not expose internals otherwise we are
breaking encapsulation
--
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]