-
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-28226 Add logic to check for RegionStateNode null pointer in FlushRegionProcedure #5548
Conversation
💔 -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. |
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.
Checked the code in FlushTableProcedure, we only acquire shared lock on a table so it is possible that merge/split procedures are executed at the same time, thus it is possible that we get a null RegionStateNode while actually executing the FlushRegionProcedure.
And adding a null check is enough, because we need to close the region before merging/splitting, so we can make sure that the region is flushed.
Overall LGTM. Just some minor updates about logging, comments and style.
import org.apache.hadoop.hbase.procedure2.ProcedureSuspendedException; | ||
import org.apache.hadoop.hbase.procedure2.ProcedureUtil; | ||
import org.apache.hadoop.hbase.procedure2.ProcedureYieldException; | ||
import org.apache.hadoop.hbase.procedure2.*; |
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.
Please avoid star imports?
@@ -88,6 +81,12 @@ protected Procedure<MasterProcedureEnv>[] execute(MasterProcedureEnv env) | |||
|
|||
RegionStates regionStates = env.getAssignmentManager().getRegionStates(); | |||
RegionStateNode regionNode = regionStates.getRegionStateNode(region); | |||
if (regionNode == null) { | |||
LOG.warn( |
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.
Since this is possible in normal flow, I think a debug log is enough? And better add a comment to reference HBASE-28226 too.
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.
Thank you for your suggestions, I have made the appropriate adjustments.
💔 -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. |
@@ -88,6 +88,12 @@ protected Procedure<MasterProcedureEnv>[] execute(MasterProcedureEnv env) | |||
|
|||
RegionStates regionStates = env.getAssignmentManager().getRegionStates(); | |||
RegionStateNode regionNode = regionStates.getRegionStateNode(region); | |||
if (regionNode == null) { | |||
LOG.debug( | |||
"Region {} is not in region states, it is very likely that it has been cleared by other procedures such as merge or split, so skip {}. See HBASE-28226", |
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.
This line is too long, please split it so we can avoid the checkstyle warning? The maximum length for HBase is 100.
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.
Thank you for the reminder, I have split it into two lines.
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
…ushRegionProcedure (apache#5548) Co-authored-by: lvhaiping.lhp <lvhaiping.lhp@alibaba-inc.com> Signed-off-by: Duo Zhang <zhangduo@apache.org>
No description provided.