-
Notifications
You must be signed in to change notification settings - Fork 3.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
HBASE-27157 Potential race condition in WorkerAssigner #4577
Conversation
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
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
Skimmed the code, I think we'd better just fold the suspend method into acquire, and also fold the wake method into release. I do not see the necessity to expose these methods to upper layer. |
Good idea. I'll fix this. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
if (!event.isReady()) { | ||
event.wake(scheduler); | ||
event.wake(master.getMasterProcedureExecutor().getEnvironment().getProcedureScheduler()); | ||
} | ||
} | ||
|
||
@Override | ||
public void serverAdded(ServerName worker) { |
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.
Better to also add synchronized here?
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.
sorry, miss here. will fix it. Thanks for reminding.
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Some unit tests failed. A little weird. Let me see why. |
💔 -1 overall
This message was automatically generated. |
@@ -60,27 +59,23 @@ public synchronized Optional<ServerName> acquire() { | |||
.findAny(); | |||
worker.ifPresent(name -> currentWorkers.compute(name, (serverName, | |||
availableWorker) -> availableWorker == null ? maxTasks - 1 : availableWorker - 1)); | |||
event.suspend(); |
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.
Should only suspend the procedure when there is no worker available? And I think here we could make the return value as ServerName instead of Optional, and throw ProcedureSuspendedException directly if worker is not available.
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.
Ok. Let me try. Thanks Duo.
💔 -1 overall
This message was automatically generated. |
Co-authored-by: huiruan <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Lijin Bin <[email protected]> (cherry picked from commit f76d855)
No description provided.