-
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-27905 Directly schedule procedures that do not need to acquire … #5267
base: master
Are you sure you want to change the base?
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.
Which are the current procedures that don't need any lock? Can we add the override for needLock
on those procedures here?
Does this change add the risk of procedures that don't need lock to starve those that need locks? I'm not sure this is indeed an issue, just wonder if that was already considered here.
@@ -272,6 +272,10 @@ protected boolean waitInitialized(TEnvironment env) { | |||
return false; | |||
} | |||
|
|||
public boolean needLock() { |
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.
nit: needsLock
if (hasNoLockNeededProcedure(queue)) { | ||
if (LOG.isTraceEnabled()) { | ||
LOG.trace("DO NOT remove {} from run queue because There are still procedures in the " | ||
+ "queue that do not need to acquire locks", queue); | ||
} | ||
return; | ||
} |
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.
Mind explain why we do this here? I see removeFromRunQueue
is called from several places, some apparently expecting the call to effectively remove the queue.
Thank you for your attention. @wchevreuil The background of the matter is this, I try to introduce a new Procedure in HBASE-26768 —— |
I've commented on the design doc. PTAL. I think first we need to polish the design, before actually writing the code. And this is a sueful feature, better also start a discussion thread in the mailing list and also post the design there. Thanks. |
@@ -219,6 +222,9 @@ private <T extends Comparable<T>> Procedure<?> doPoll(final FairQueue<T> fairq) | |||
// procedures, then we give up and remove the queue from run queue. | |||
for (int i = 0, n = rq.size(); i < n; i++) { | |||
Procedure<?> proc = rq.poll(); | |||
if (!proc.needLock()) { |
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.
Why not add this logic in the below isLockReady method?
@@ -368,6 +374,13 @@ private static <T extends Comparable<T>> void addToRunQueue(FairQueue<T> fairq, | |||
|
|||
private static <T extends Comparable<T>> void removeFromRunQueue(FairQueue<T> fairq, | |||
Queue<T> queue, Supplier<String> reason) { | |||
if (hasNoLockNeededProcedure(queue)) { |
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.
Ideally, if there are still no lock procedure in the queue, we should not arrive here?
Thanks Duo. After I implement the optimization items you proposed, I will send an email to the community to discuss it. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
…locks