-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-28898. Use reflection to access recoverLease(), setSafeMode() APIs. #6342
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-28898. Use reflection to access recoverLease(), setSafeMode() APIs. #6342
Conversation
Change-Id: I1a7b7bad0e8967553490b70439b18f8ddfed6d14
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Change-Id: Ibf0ded6e104e9ed16f887f8411f4816eab8cea00
|
javac warning is unrelated. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
hbase-asyncfs/src/main/java/org/apache/hadoop/hbase/util/RecoverLeaseFSUtils.java
Outdated
Show resolved
Hide resolved
hbase-asyncfs/src/main/java/org/apache/hadoop/hbase/util/RecoverLeaseFSUtils.java
Outdated
Show resolved
Hide resolved
hbase-asyncfs/src/main/java/org/apache/hadoop/hbase/util/RecoverLeaseFSUtils.java
Outdated
Show resolved
Hide resolved
hbase-asyncfs/src/main/java/org/apache/hadoop/hbase/util/RecoverLeaseFSUtils.java
Outdated
Show resolved
Hide resolved
(1) Use FileSystem class instead of Object for file system object. (2) Added one more test case to properly test reflection code. Change-Id: I0710ae1023d81f68fb18ec3f8dd5b228d90df21e
Change-Id: I5e29bacec957d76555a0ff7483a462b614a8f3f5
This comment has been minimized.
This comment has been minimized.
Change-Id: I4dd951945920220678677acefd27710eaf0f5658
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Looks good to me. I am a bit worried about the runtime errors. |
|
The unit test failures do not reproduce in my local tree, so assuming flaky. But I wonder if the this change makes them easier to fail. Will dig into it. |
Change-Id: Iec1149e25f6a8ac3f5fe4d2eb7287af9c0c75021
|
The spotbugs warning is unrelated. Will open another jira to track it. |
stoty
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.
Sorry, forgot to send my pending comments.
Adding them now.
| private static Method recoverLeaseMethod = null; | ||
| public static final String LEASE_RECOVERABLE_CLASS_NAME = "org.apache.hadoop.fs.LeaseRecoverable"; | ||
| static { | ||
| LOG.debug("RecoverLeaseFSUtils loaded"); |
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: This should be after initializeRecoverLeaseMethod
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.
Having this log message before the actual initialization is misleading.
Is there a specific reason for this ordering ?
Alternatively change the message to "initializing RecoverLeaseFSUtils"
| LOG.debug( | ||
| "LeaseRecoverable interface not in the classpath, this means Hadoop 3.3.5 or below."); | ||
| try { | ||
| recoverLeaseMethod = DistributedFileSystem.class.getMethod("recoverLease", Path.class); |
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.
We expect to have this on all supported releases, right ?
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.
Maybe log an error message to explain that this should never happen ?
| .invoke(dfs, safeModeGet, true); | ||
| return (Boolean) ret; | ||
| } catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) { | ||
| throw new RuntimeException(e); |
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 is no Hadoop release where we expect to get here, right ?
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.
Maybe log an error message to explain that this should never happen ?
| if (isDistributedFileSystem(dfs)) { | ||
| return ((DistributedFileSystem) dfs).setSafeMode(SAFEMODE_GET, true); | ||
| } else { | ||
| 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.
Should we just return false here if we could not find the method previously ?
i.e. if this is an older Hadoop, and this is called with say, LocalFilesystem ?
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.
Before calling isInSafeMode() it calls supportSafeMode(). If it's LocalFileSystem it will not enter isInSafeMode().
Change-Id: Iee3f259a46b5f12ed5948c61738a19ef77e29b5a
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
https://issues.apache.org/jira/browse/HBASE-28918 for the spotbug error |
This comment has been minimized.
This comment has been minimized.
stoty
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.
+1 LGTM
I have kicked off a new CI run
stoty
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.
The log message in the static initializer is still misleading.
This comment has been minimized.
This comment has been minimized.
|
Please also re-run spotless:apply, the new log message does not comply with the spotless rules. |
This comment has been minimized.
This comment has been minimized.
Change-Id: Iee20335148f41592ed5b36c7c526a544fce6ed87
|
Thanks for the review! Updated. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
stoty
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.
+1 LGTM
|
Merged. Thanks @stoty |
…PIs. (apache#6342) (cherry picked from commit 11c0742)
…PIs. (apache#6342) (cherry picked from commit 11c0742) (cherry picked from commit f373405)
…PIs. (apache#6342) (cherry picked from commit 11c0742) (cherry picked from commit f373405) (cherry picked from commit d2f0547)
TODO: