-
Notifications
You must be signed in to change notification settings - Fork 242
Cleanup the persisted assignment state if no resource is on WAGED rebalancer. #1123
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
Conversation
…alancer. This is to prevent the WAGED rebalancer reads stale assignment records from the previous rebalance pipeline. For example, 1. Resource A was the only resource. And it is rebalanced by WAGED, then we have a persisted assignment for A. 2. Resource A was reconfigured to using DelayedRebalancer, then we stop the WAGED rebalancer since there is no more resource using WAGED. So the persisted records are still in ZK. 3. Resource A is recreated and using WAGED again. In this case, the previous persisted assignment is no longer valid. We should treat A as a brand new resource instead of considering the stale assignment record. Moreover, this change will help to clean up the ZK persisted data if no resource is using WAGED.
.../src/test/java/org/apache/helix/controller/rebalancer/waged/TestAssignmentMetadataStore.java
Show resolved
Hide resolved
.../src/test/java/org/apache/helix/controller/rebalancer/waged/TestAssignmentMetadataStore.java
Show resolved
Hide resolved
.../src/test/java/org/apache/helix/controller/rebalancer/waged/TestAssignmentMetadataStore.java
Outdated
Show resolved
Hide resolved
...core/src/main/java/org/apache/helix/controller/rebalancer/waged/AssignmentMetadataStore.java
Show resolved
Hide resolved
...core/src/main/java/org/apache/helix/controller/rebalancer/waged/AssignmentMetadataStore.java
Show resolved
Hide resolved
...core/src/main/java/org/apache/helix/controller/rebalancer/waged/AssignmentMetadataStore.java
Show resolved
Hide resolved
|
One high level question. |
|
My follow-up question is actually that there seems still some potential inconsistency issue here not addressed, namely across controllers over different machine. The pattern is similar to this #1066. If one controller session expired, and super controller assign another controller to take care the cluster. When first controller come up, his controller pipeline may still run and persists his baseline and best possible again. How do we guard this across java process race condition? This is a pattern of similar problems. We should think a little bit more generic and address them all long term. |
You are wrong.
|
Please note that we have an MVCC implemented in the bucket accessor to ensure cross node consistency. |
So the invariant is that each cluster has its own copy of persisted baseline and best-possible. If this is clear, removing sync seems to be safe. |
But it won't hurt. And IMO, the assumption that we won't change WAGED logic in the future is weak. I prefer to keep it. |
As an aside, I recall waged has an advantage as allocating over all clusters to instance. So this is not in this version? |
I will try to examine the bucket accessor a little bit more carefully. Here is the question: Say controller A is for resource R allocation. Then controller A session expires, controller B take care of resource B. Later when A is back, for a while A and B would run at the same time. When serializing say baseline for resource R, A wins over B, is it going to be a problem for this resource as B would later be controller for R. |
|
Whichever wins is fine. Since the next pipeline running will take the cached result and keep calculating based on there.
* If A wins, then A keeps calculating based on its local state.
* If B wins, then because A cache the result after write, it will still calculate based on its local state. And the next pipeline will overwrite B's output. And we are good.
In this case, we don't really need B's result.
Cheers,
-Jiajun
…________________________________
From: kaisun2000 <[email protected]>
Sent: Tuesday, June 30, 2020 1:07 PM
To: apache/helix <[email protected]>
Cc: Jiajun Wang <[email protected]>; Author <[email protected]>
Subject: Re: [apache/helix] Cleanup the persisted assignment state if no resource is on WAGED rebalancer. (#1123)
Please note that we have an MVCC implemented in the bucket accessor to ensure cross node consistency.
I will try to examine the bucket accessor a little bit more carefully. Here is the question:
Say controller A is for resource R allocation. Then controller A session expires, controller B take care of resource B. Later when A is back, for a while A and B would run at the same time. When serializing say baseline for resource R, A wins over B, is it going to be a problem for this resource as B would later be controller for R.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fhelix%2Fpull%2F1123%23issuecomment-652015520&data=02%7C01%7Cjjwang%40linkedin.com%7C61ccb448e537425425a008d81d313072%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637291444385780233&sdata=VIdFasrPljxVkFFnODjJGoxHpYl%2FBmYSxQF5xNHHmzA%3D&reserved=0>, or unsubscribe<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAANYM2AOROJKY37OFQ3OTXTRZJAXHANCNFSM4OI7NZIA&data=02%7C01%7Cjjwang%40linkedin.com%7C61ccb448e537425425a008d81d313072%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637291444385780233&sdata=p2xLzQ1lM%2FPQ2xxMpmqxeMS3cHop%2BzaFqgxPOdOXnc4%3D&reserved=0>.
|
|
I see. Thx for the explanation. |
huizhilu
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
|
This PR is ready to be merged, approved by @pkuwm |
…alancer. (apache#1123) This is to prevent the WAGED rebalancer reads stale assignment records from the previous rebalance pipeline. For example, 1. Resource A was the only resource. And it is rebalanced by WAGED, then we have a persisted assignment for A. 2. Resource A was reconfigured to using DelayedRebalancer, then we stop the WAGED rebalancer since there is no more resource using WAGED. So the persisted records are still in ZK. 3. Resource A is recreated and using WAGED again. In this case, the previous persisted assignment is no longer valid. We should treat A as a brand new resource instead of considering the stale assignment record. Moreover, this change will help to clean up the ZK persisted data if no resource is using WAGED.
Issues
#1120
Description
This is to prevent the WAGED rebalancer reads stale assignment records from the previous rebalance pipeline.
For example,
Moreover, this change will help to clean up the ZK persisted data if no resource is using WAGED.
Tests
TestAssignmentMetadataStore, TestWagedRebalancer
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] TestJobQueueCleanUp.testJobQueueAutoCleanUp » ThreadTimeout Method org.testng....
[INFO]
[ERROR] Tests run: 1149, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:25 h
[INFO] Finished at: 2020-06-26T00:00:39-07:00
[INFO] ------------------------------------------------------------------------
Rerun
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.508 s - in org.apache.helix.integration.task.TestJobQueueCleanUp
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.728 s
[INFO] Finished at: 2020-06-26T00:01:34-07:00
[INFO] ------------------------------------------------------------------------
Commits
Documentation (Optional)
(Link the GitHub wiki you added)
Code Quality
(helix-style-intellij.xml if IntelliJ IDE is used)