-
Notifications
You must be signed in to change notification settings - Fork 2k
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
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. |
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]>
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 fromFileTransferTracker
that are less than the min generation.OpenSearch/server/src/main/java/org/opensearch/index/translog/RemoteFsTimestampAwareTranslog.java
Lines 128 to 141 in 34ef146
readers
is ArrayList, that means without locking readers if we try to read the list contents, we will getConcurrentModificationException
if a other thread is writing to readers.Translog
class 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.