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-25922 - Disabled sanity checks ignored on snapshot restore #4533
Conversation
@virajjasani Can you help in reviewing this ? |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@ujjawal4046 are these failed tests passing in your local? https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4533/1/testReport/ |
💔 -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. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
…ading check fails while opening hregion TestAssignmentManagerMetrics - Enable sanity checks on RS so that region reopen fails during modify table, disable sanity check on HMaster so that modify table doesn't terminate prematurely without calling assigment manager
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
if (conf.getBoolean(TABLE_SANITY_CHECKS, DEFAULT_TABLE_SANITY_CHECKS)) { | ||
return true; | ||
} | ||
String tableVal = td.getValue(TABLE_SANITY_CHECKS); |
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 this come before the conf check? Otherwise if you enabled sanity checks globally, then I don't think TableDescriptor could be used to override?
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.
I see you sort of pulled this logic from lines 71-79 below, but inverted the conditions. But I think the way you have it here is now more restrictive and doesn't allow the table descriptor to override.
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.
Hmm, seems true. Have added the table descriptor check first so that it can override the global check
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.
The first line in the sanityCheck method has aleady one the trick for you? It creates a CompoundConfiguration with td.getValues override the configs in Configuration.
@@ -186,9 +178,18 @@ public static void sanityCheck(final Configuration c, final TableDescriptor td) | |||
} | |||
|
|||
// check replication scope | |||
checkReplicationScope(hcd); | |||
try { |
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.
it would be nice to keep these check methods somewhat consistent. You removed the warnOrThrowExceptionForFailure from the above checks, but added them here. Can you instead keep it consistent (all here or all in the check methods)?
That might mean either removing this diff here, or adding back the try/catches above.
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.
Sure, to keep consistency for all additional check methods I have moved the warnOrThrowExceptionForFailure
logic there.
i) Table Descriptor should come before global check to allow for overrides ii) Check methods in TableDescriptorChecker can do sanity check on their own
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.
Thanks for the review @bbeaudreault. Have handled your comments.
@@ -186,9 +178,18 @@ public static void sanityCheck(final Configuration c, final TableDescriptor td) | |||
} | |||
|
|||
// check replication scope | |||
checkReplicationScope(hcd); | |||
try { |
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.
Sure, to keep consistency for all additional check methods I have moved the warnOrThrowExceptionForFailure
logic there.
if (conf.getBoolean(TABLE_SANITY_CHECKS, DEFAULT_TABLE_SANITY_CHECKS)) { | ||
return true; | ||
} | ||
String tableVal = td.getValue(TABLE_SANITY_CHECKS); |
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.
Hmm, seems true. Have added the table descriptor check first so that it can override the global check
🎊 +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. |
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.
I do not think we need such big refactoring here?
The only problem is in the HRegion code?
if (conf.getBoolean(TABLE_SANITY_CHECKS, DEFAULT_TABLE_SANITY_CHECKS)) { | ||
return true; | ||
} | ||
String tableVal = td.getValue(TABLE_SANITY_CHECKS); |
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.
The first line in the sanityCheck method has aleady one the trick for you? It creates a CompoundConfiguration with td.getValues override the configs in Configuration.
The issue here is HRegion code calls various public methods ( |
🎊 +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.
No big concerns then. @bbeaudreault Do you have any other comments here?
@@ -185,11 +175,6 @@ public static void sanityCheck(final Configuration c, final TableDescriptor td) | |||
warnOrThrowExceptionForFailure(logWarn, message, null); |
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 is the place where we use logWarn in this method? Then let's move the boolean logWarn = !shouldSanityCheck(conf);
line 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.
There are multiple checks based on logWarn variable before this line (for e.g. at line no 92, 106, 127, 134 above)
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.
Ah, OK, in unchanged code.
Configuration conf = TEST_UTIL.getConfiguration(); | ||
|
||
// Enable sanity check for coprocessor | ||
conf.setBoolean(TableDescriptorChecker.TABLE_SANITY_CHECKS, true); |
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 we need this change?
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.
Oh, it's due to the fact that this test checks region open is failing due to invalid loaded coprocessor at line 90 below, before this change it was always true (since the coprocessor loading was independent of sanity check). However after this change, we have made it configurable based on the sanity check config (which is always false in hbase-server's test related hbase-site.xml), so we need to explicitly enable sanity check in the test setup
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, seems to have some side effects. Need to fill a release note.
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.
@Apache9 Have replied to your queries, can you take a look ?
@@ -185,11 +175,6 @@ public static void sanityCheck(final Configuration c, final TableDescriptor td) | |||
warnOrThrowExceptionForFailure(logWarn, message, null); |
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.
There are multiple checks based on logWarn variable before this line (for e.g. at line no 92, 106, 127, 134 above)
Configuration conf = TEST_UTIL.getConfiguration(); | ||
|
||
// Enable sanity check for coprocessor | ||
conf.setBoolean(TableDescriptorChecker.TABLE_SANITY_CHECKS, true); |
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.
Oh, it's due to the fact that this test checks region open is failing due to invalid loaded coprocessor at line 90 below, before this change it was always true (since the coprocessor loading was independent of sanity check). However after this change, we have made it configurable based on the sanity check config (which is always false in hbase-server's test related hbase-site.xml), so we need to explicitly enable sanity check in the test setup
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.
Looks good! I'll merge tomorrow
Co-authored-by: Ujjawal Kumar <u.kumar@ukumar-ltmit1s.internal.salesforce.com> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org> Conflicts: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Co-authored-by: Ujjawal Kumar <u.kumar@ukumar-ltmit1s.internal.salesforce.com> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org> Conflicts: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
…che#4533) Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org> Conflicts: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
…) (#4734) Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org> Conflicts: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
…che#4533) (apache#4734) Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org> Conflicts: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (cherry picked from commit 8659c93) Change-Id: I13ded9ca65b094a0cf05920e42a44fdfc4381a56
JIRA - https://issues.apache.org/jira/browse/HBASE-25922
TableDescriptorChecker.checkClassLoading()
while trying to restore a snapshot. This should adhere to the sanity checks provided as part of TableDescriptorChecker.