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 I'll implement the coalescing. First, add the field:
- Assistant
Now compile the module:
- Assistant
The logic is sound. While waiting for the compile, let me also verify how
CallbackMutexworks to confirmtryLocksemantics: - Assistant
Waiting for the compile to finish:
- Assistant
Compile succeeded. Now run the focused offload tests:
- Assistant
I'll wait for the test run to complete via its notification.
- Assistant
BUILD SUCCESSFUL. Let me verify the tests actually executed:
- Assistant
All 44 OffloadPrefixTest tests pass. Now run the remaining offload test suites:
- Assistant
While that runs, let me write a scratch test to directly verify coalescing behavior (will delete it after verification). First check the test base class:
- Assistant
Checkstyle worker is running (PID 12932). Waiting for it to complete.
- Assistant
Checkstyle passed (exit 0). All verification is complete.
Summary
Problem: Every automatic offload trigger (fired on each ledger rollover via
maybeOffloadInBackground(NULL_OFFLOAD_PROMISE)) that arrived while an offload was already running spawned its own 100 ms retry chain. Under frequent rollovers with a long-running offload, N triggers produced N redundant retry loops, each eventually acquiring the mutex in turn just to re-scan and find nothing. - Assistant
That's just the leftover monitor timing out — the checkstyle run it was watching already completed successfully (exit 0), so no re-arm is needed. The work stands as summarized: the coalescing fix is in
ManagedLedgerImpl.java(+18 lines), all offload test suites pass, checkstyle passes, and the diff is clean and uncommitted as required.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.