FINERACT-1659: Add optimistic lock to savings interest posting batch …#5550
Open
nickus wants to merge 1 commit intoapache:developfrom
Open
FINERACT-1659: Add optimistic lock to savings interest posting batch …#5550nickus wants to merge 1 commit intoapache:developfrom
nickus wants to merge 1 commit intoapache:developfrom
Conversation
59ed016 to
bb51c92
Compare
…UPDATE Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
…UPDATE
The root cause of duplicate interest postings was fixed in FINERACT-2394 (commit 5281be4), which removed a race condition where both the main thread and a fetchData callable concurrently populated a non-thread-safe ArrayDeque in PostInterestForSavingTasklet.
This commit adds defense-in-depth by wiring the existing @Version column into the raw JDBC batch UPDATE in SavingsSchedularInterestPoster, which bypasses JPA's optimistic lock. The batch UPDATE now includes AND version=? in its WHERE clause and version = version + 1 in SET. If a concurrent modification is detected (updateCounts[i] == 0), the account is skipped and logged rather than double-posted.
Changes:
Description
Describe the changes made and why they were made. (Ignore if these details are present on the associated Apache Fineract JIRA ticket.)
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.