Automatic managed-ledger offload triggers create redundant retry work Coalesce automatic…
- User
Automatic managed-ledger offload triggers create redundant retry work
Coalesce automatic offload triggers while an automatic offload is running. There must be at most one active automatic run and at most one follow-up run when additional triggers arrive. A follow-up must still process newly eligible ledgers, and explicit/manual offload futures must retain their existing behavior.
Interface
No new public interfaces are introduced.
- Assistant
Now implementing the coalescing:
- Assistant
While that compiles, let me check the other automatic trigger site in the factory:
- Assistant
Good — the only automatic trigger sites are in managed-ledger and both use
NULL_OFFLOAD_PROMISE, so both are now coalesced. Waiting on the compile result. - Assistant
Compile succeeded. Now run the offload-related tests:
- Assistant
While tests run, let me double-check the final diff:
- Assistant
The diff looks good. Waiting for the test run to finish.
- Assistant
All 51 offload tests pass. Now run checkstyle and the final git diff check:
- Assistant
All checks pass. Final summary of the fix:
Problem
Every automatic offload trigger (
maybeOffloadInBackground(NULL_OFFLOAD_PROMISE)— from ledger rollover and topic load) that foundoffloadMutexlocked scheduled its own 100 ms retry loop. N triggers during a running offload created N redundant, indefinitely-spinning retry chains.Fix (
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java)- Added a
pendingAutomaticOffloadscounter (0= idle,1= active automatic run,2= active run + one pending follow-up).
- Added a
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.