Skip to content
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

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

GrantPSpencer
Copy link
Contributor

@GrantPSpencer GrantPSpencer commented Aug 5, 2024

Issues

  • My PR addresses the following Helix issues and references them in the PR description:

#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

  • Here are some details about my PR, including screenshots of any UI changes:

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

  • The following tests are written for this issue:

testGCScheduler

  • The following is the result of the "mvn test" command on the appropriate module:

(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

  • My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Code Quality

  • My diff has been formatted using helix-style.xml
    (helix-style-intellij.xml if IntelliJ IDE is used)

Comment on lines +435 to +436
throw new ZkNoNodeException(
String.format("Last successful write ZNode does not exist for path: %s", path));
Copy link
Contributor

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...

Copy link
Contributor Author

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

@GrantPSpencer GrantPSpencer force-pushed the zk-bucket-gc-scheduler branch from d72bbea to 1816aba Compare August 13, 2024 19:03
@GrantPSpencer
Copy link
Contributor Author

Pull request approved @junkaixue
Commit message: ZkBucketDataAccessor always complete scheduled GC

@junkaixue junkaixue merged commit 321f4eb into apache:master Aug 16, 2024
5 checks passed
htin1 pushed a commit to htin1/helix that referenced this pull request Aug 22, 2024
ZkBucketDataAccessor always complete scheduled GC
@palmier-bot palmier-bot bot mentioned this pull request Aug 23, 2024
3 tasks
htin1 pushed a commit to htin1/helix that referenced this pull request Aug 23, 2024
ZkBucketDataAccessor always complete scheduled GC
htin1 pushed a commit to htin1/helix that referenced this pull request Aug 29, 2024
ZkBucketDataAccessor always complete scheduled GC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants