Repository navigation
Conversation
When the database was down during a reward job, saving the failure state threw out of processJob and processJobs moved on to the next job. The failed epoch's job was lost until a restart, the next epoch was calculated from an incomplete AdaPot (reserves 0), and when that failed the loop returned and no later job ran. - AdaPotJobManager runs each job until it completes, becomes stale or is cancelled by a rollback, retrying with backoff (10 s doubling, max 5 min). The loop no longer exits on a failure, so epoch N+1 cannot start before epoch N completes. - AdaPotJobProcessor saves the failure state best-effort and returns false if it cannot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MJrQUCWhJpLCQR5Asv7nDb (cherry picked from commit 09c2c0f)
|
Initial automated review · Aster Hi @satran004, thanks for the PR! 🙏 This is an automatic first check by an AI reviewer. It does not replace maintainer review and may be wrong. Reviewed commit: Issues found:
Not tested: I reviewed the backport and CI without running builds, tests, or an outage simulation. |
- AdaPotJobProcessor makes one attempt per call. Its own loop (4 full runs with 5 s pauses) is removed now that AdaPotJobManager retries, so a failure that repeats, such as a verification mismatch, no longer reruns the whole job 4 times per retry. - Retry backoff is capped at 30 min instead of 5 min. - The retry loop also catches errors (e.g. StackOverflowError), which would otherwise end the job thread. - The backoff wait checks for a rollback cancel every second. - The job thread is interrupted on shutdown. - Tests: next epoch not started before the failed one completes (real job thread), an Error, a rollback while the job throws and during the backoff, interrupt, a failing save of the failure state, one attempt per processJob call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MJrQUCWhJpLCQR5Asv7nDb (cherry picked from commit 9ced88d)
The rollback in the backoff test now waits for the first attempt instead of a fixed 300 ms sleep. New test: stop() ends the real job thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MJrQUCWhJpLCQR5Asv7nDb (cherry picked from commit 3c15ae1)
|
Member
Author
|
End-to-end check of this backport, using the jar built from
Details: #1353 (comment) 🤖 Generated with Claude Code |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Backport of #1353 to
release/2.0.x. Fixes #1352 on 2.0.x. Part of #1339.Clean
cherry-pick -xof bothmaincommits.release/2.0.xalready has the job-cancellation code (activeJob,StaleAdaPotJobException) that the change builds on../gradlew :aggregates:adapot:test: 47 tests, 0 failures (JDK 21).The 2.0.x ledger-state fault run found the bug (scenario L03: Postgres down during the epoch 36 reward calculation, preprod). I'll rerun L03 and L18 with this change.
Problem
If the database went down while an AdaPot reward job was running, saving the job's failure state also failed. The exception escaped
processJob, andAdaPotJobManager.processJobs()moved on to the next job:STARTED, itsadapotrow keptreserves = 0);processJobs()returned, and no later job ran until a restart.Past the end of the bundled expected-values file, nothing would catch the wrong reserves, and the next epoch would be saved as
COMPLETED. Details and logs are in #1352.Change
AdaPotJobManager:runUntilDone(job)runs a job until it completes, becomes stale, or is cancelled by a rollback.StackOverflowError) is retried with backoff: 10 s, doubling, capped at 30 min. The loop no longer exits on a failure, so jobs stay in epoch order: epoch N+1 can't start before epoch N completes.handleRollbackcan still cancel it. The wait checks for a cancel every second.@PreDestroy).AdaPotJobProcessor:processJobreturns false instead of throwing.A job that keeps failing for a reason other than an outage (for example a real calculation mismatch) is now retried at most every 30 min, with an error logged each time, instead of stopping the job thread.
adapot_jobs.error_messageshows the last error.Not changed here
Found in review. These existed before this change; a restart reruns the job the same way.
PostgresPartitionManagermarks an epoch's partition as created before the snapshot transaction commits. If that transaction rolls back, retries in the same JVM write to the default partition until a restart.take()andactivateJob(), or whose database deletes then fail, isn't fully coordinated with the in-memory cancel.🤖 Generated with Claude Code
https://claude.ai/code/session_01MJrQUCWhJpLCQR5Asv7nDb