Conversation
beebec8 to
907ae39
Compare
| this.cursors.forEach(c -> c.setThrottleMarkDelete(config.getThrottleMarkDelete())); | ||
| this.cursors.forEach(c -> { | ||
| if (c instanceof ManagedCursorImpl cursor) { | ||
| cursor.updateRolloverThresholds(config); | ||
| } | ||
| c.setThrottleMarkDelete(config.getThrottleMarkDelete()); | ||
| }); | ||
| } |
There was a problem hiding this comment.
does this get called when the config changes?
Could we add a updateConfig method to ManagedCursorImpl and handle the logic there?
There's no need to add the method to ManagedCursor interface since ManagedLedgerImpl only includes ManagedCursorImpl instances.
There was a problem hiding this comment.
You mean that we add a updateConfig method to ManagedCursorImpl, which involve updateRolloverThresholds() and setThrottleMarkDelete() ?
Currently I add updateRolloverThresholds() to ManagedCursorImpl. While setThrottleMarkDelete() is still in ManagedCursor interface
There was a problem hiding this comment.
You mean that we add a updateConfig method to ManagedCursorImpl, which involve updateRolloverThresholds() and setThrottleMarkDelete() ?
yes
There was a problem hiding this comment.
maybe configUpdated is a better method name, since the method is an event handler for config updates.
There was a problem hiding this comment.
That is reasonable. I have modified.
…olloverThresholds()
Motivation
If topic has multiple subscriptions, the cursor ledgers of subscriptions may rollover at the same time, which may bring additional pressure on zk.
Topic ledger has added the random value to avoid rollover at the same time. While cursor ledger do not have this mechanism.
pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Lines 411 to 412 in 6d9f9ce
Modifications
Also add the 5% random value in rollover cursor ledger.
Verifying this change
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes