-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
try to acquire segmentLock before taking segment snapshot #14179
try to acquire segmentLock before taking segment snapshot #14179
Conversation
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 otherwise
.../src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java
Show resolved
Hide resolved
.../src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14179 +/- ##
============================================
+ Coverage 61.75% 63.95% +2.19%
- Complexity 207 1536 +1329
============================================
Files 2436 2621 +185
Lines 133233 144103 +10870
Branches 20636 22039 +1403
============================================
+ Hits 82274 92154 +9880
- Misses 44911 45141 +230
- Partials 6048 6808 +760
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ 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!
} | ||
} | ||
_updatedSegmentsSinceLastSnapshot.clear(); |
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.
Is there guarantee that all segments are cleared here? Seems we don't remove segments when they are deleted.
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.
good catch. To be simple, I'll do retainAll(_trackedSegments) here to avoid keeping removed segments around
6530186
to
1eeab6f
Compare
This PR tries to fix a race condition between consuming thread taking snapshot for upsert table, and the Helix task threading replacing a segment.
When replacing a segment,
FileUtils.cleanupDirectory(indexDir)
was called but failed due toDirectoryNotEmptyException
with stack trace like belowBecause due to race condition, the consuming thread put a new snapshot file into the folder between the two major cleanup steps in this deleteDirectory() method showed below.