-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix ConcurrentModificationException in RemoteFsTimestampAwareTranslog.trimUnreferencedReaders #17028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ConcurrentModificationException in RemoteFsTimestampAwareTranslog.trimUnreferencedReaders #17028
Conversation
|
❌ Gradle check result for bbb355d: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
bbb355d to
044793f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17028 +/- ##
============================================
+ Coverage 72.38% 72.40% +0.02%
- Complexity 65516 65532 +16
============================================
Files 5291 5291
Lines 304319 304301 -18
Branches 44176 44173 -3
============================================
+ Hits 220269 220342 +73
+ Misses 65964 65936 -28
+ Partials 18086 18023 -63 ☔ View full report in Codecov by Sentry. |
skumawat2025
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
server/src/main/java/org/opensearch/index/translog/RemoteFsTimestampAwareTranslog.java
Outdated
Show resolved
Hide resolved
….trimUnreferencedReaders Signed-off-by: Sachin Kale <[email protected]>
Signed-off-by: Sachin Kale <[email protected]>
044793f to
4bae69c
Compare
….trimUnreferencedReaders (#17028) * Fix ConcurrentModificationException in RemoteFsTimestampAwareTranslog.trimUnreferencedReaders Signed-off-by: Sachin Kale <[email protected]> * Address PR comments Signed-off-by: Sachin Kale <[email protected]> --------- Signed-off-by: Sachin Kale <[email protected]> (cherry picked from commit 171433c) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
….trimUnreferencedReaders (opensearch-project#17028) * Fix ConcurrentModificationException in RemoteFsTimestampAwareTranslog.trimUnreferencedReaders Signed-off-by: Sachin Kale <[email protected]> * Address PR comments Signed-off-by: Sachin Kale <[email protected]> --------- Signed-off-by: Sachin Kale <[email protected]>
….trimUnreferencedReaders (opensearch-project#17028) * Fix ConcurrentModificationException in RemoteFsTimestampAwareTranslog.trimUnreferencedReaders Signed-off-by: Sachin Kale <[email protected]> * Address PR comments Signed-off-by: Sachin Kale <[email protected]> --------- Signed-off-by: Sachin Kale <[email protected]> Signed-off-by: Vinay Krishna Pudyodu <[email protected]>
….trimUnreferencedReaders (opensearch-project#17028) * Fix ConcurrentModificationException in RemoteFsTimestampAwareTranslog.trimUnreferencedReaders Signed-off-by: Sachin Kale <[email protected]> * Address PR comments Signed-off-by: Sachin Kale <[email protected]> --------- Signed-off-by: Sachin Kale <[email protected]> (cherry picked from commit 171433c) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
….trimUnreferencedReaders (#17028) (#17460) --------- (cherry picked from commit 171433c) Signed-off-by: Sachin Kale <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
RemoteFsTimestampAwareTranslog.trimUnreferencedReaders, in order to update file tracker to reflect local translog state, we fetch the minimum generation across all readers and delete all generations fromFileTransferTrackerthat are less than the min generation.OpenSearch/server/src/main/java/org/opensearch/index/translog/RemoteFsTimestampAwareTranslog.java
Lines 128 to 141 in 34ef146
readersis ArrayList, that means without locking readers if we try to read the list contents, we will getConcurrentModificationExceptionif a other thread is writing to readers.Translogclass that safely returns the min generation by taking a read lock:getMinFileGeneration()getMinFileGeneration()to get the min generation.Related Issues
Check List
[ ] Functionality includes testing.[ ] API changes companion pull request created, if applicable.[ ] Public documentation issue/PR created, if applicable.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.