-
Notifications
You must be signed in to change notification settings - Fork 228
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
ZkBucketDataAccessor always complete scheduled GC #2873
ZkBucketDataAccessor always complete scheduled GC #2873
Conversation
throw new ZkNoNodeException( | ||
String.format("Last successful write ZNode does not exist for path: %s", path)); |
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.
If we throw exception, the gc thread will be break, right? Shall we just log it and let it continue? Or we should stop the entire Accessor...
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.
I believe this try block should catch it, the one we are submitting to the GC thread:
try {
_gcTaskFutureMap.remove(rootPath);
deleteStaleVersions(rootPath);
} catch (Exception ex) {
LOG.error("Failed to delete the stale versions.", ex);
}
}, _versionTTLms, TimeUnit.MILLISECONDS));
My understanding is that this should prevent the gc thread from crashing and just log the exception
compressedBucketRead
will still throw the exception though
d72bbea
to
1816aba
Compare
Pull request approved @junkaixue |
ZkBucketDataAccessor always complete scheduled GC
ZkBucketDataAccessor always complete scheduled GC
ZkBucketDataAccessor always complete scheduled GC
Issues
#2872
When a write occurs, ZkBucketDataAccessor schedules a GC task to execute 60s (default ttl) from when the task was submitted. If there already exists a GC task, updateGCTimer attempts to cancel it reschedule it for 60s from then.
With this current logic, if the time between subsequent writes is never slower than the ttl (60s), then a GC task will never be executed - the task will constantly be scheduled and then cancelled.
Description
ZkBucket GC's are no longer rescheduled if another write occurs.
deleteStaleVersions has been refactored to determine recent version at method execution time (rather than passing currentVersion as a parameter)
This should guarantee that a GC will occur within TTL delay (60) seconds from any write.
Tests
testGCScheduler
(If CI test fails due to known issue, please specify the issue and test PR locally. Then copy & paste the result of "mvn test" to here.)
Commits
Code Quality
(helix-style-intellij.xml if IntelliJ IDE is used)