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 state field near the offload mutex:
- Assistant
Now rewrite
maybeOffloadInBackgroundandmaybeOffload: - Assistant
The build is still running. While waiting, let me check for any tests that specifically exercise the retry path:
- Assistant
The compile is running in the background; I'll continue when it finishes.
- Assistant
Compilation is in progress (Gradle is resolving dependencies on first run). I'll wait for the monitor notification.
- Assistant
No local caches yet, so Gradle is downloading dependencies — this will take several minutes. Waiting for the monitor event.
- Assistant
Dependencies are cached; compilation is proceeding. Waiting for the completion event.
- Assistant
The diff looks correct. Now waiting for the test run:
- Assistant
Both test classes passed. Let me confirm the tests actually executed and ran the expected cases:
- Assistant
Waiting for the second test batch to complete.
- Assistant
Waiting for the background test run to finish — the notification will resume me.
- Assistant
Checkstyle is configured, so the background run will cover it. Waiting for completion.
- Assistant
Still running. Waiting for the task notification before summarizing.
- Assistant
Tests still executing — pausing until the completion notification arrives.
- Assistant
Waiting for the background test run (
OffloadPrefixReadTest,OffloadEvictUnusedLedgersTest, checkstyle) to finish — I'll resume when the notification arrives. - Assistant
All checks pass. Summary of the fix:
Problem
Every automatic offload trigger (
maybeOffloadInBackground(NULL_OFFLOAD_PROMISE)from ledger rollover and the factory's periodic check) that arrived while an offload was already running spawned its own 100 ms retry loop againstoffloadMutex. N triggers during one long-running offload meant N concurrent retry loops doing redundant work.Change —
managed-ledger/.../ManagedLedgerImpl.java - Assistant
That's the stale monitor from the initial
compileJavarun timing out — that build already completed successfully (exit code 0) and was verified earlier, so no action is needed. The task remains complete: the coalescing fix is inManagedLedgerImpl.java, all 58 offload tests and checkstyle pass, and the changes are left uncommitted in the working tree.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.