This is an automated email from the ASF dual-hosted git repository.
psomogyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase-operator-tools.git
The following commit(s) were added to refs/heads/master by this push:
new a441c11 HBASE-29635 HBCK scheduleRecoveries incompatible with HBase 3
(#152)
a441c11 is described below
commit a441c1104f6be059473f61ffae8a825d9163e9b2
Author: Peter Somogyi <[email protected]>
AuthorDate: Mon Oct 6 10:42:28 2025 +0200
HBASE-29635 HBCK scheduleRecoveries incompatible with HBase 3 (#152)
Signed-off-by: Wellington Chevreuil <[email protected]>
Signed-off-by: Dávid Paksy <[email protected]>
Signed-off-by: Chandra Kambham <[email protected]>
Reviewed-by: Aman Poonia <[email protected]>
---
.../src/main/java/org/apache/hbase/HBCK2.java | 34 ++++++++++++++++++++--
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/hbase-hbck2/src/main/java/org/apache/hbase/HBCK2.java
b/hbase-hbck2/src/main/java/org/apache/hbase/HBCK2.java
index 67ca904..4e4ff2c 100644
--- a/hbase-hbck2/src/main/java/org/apache/hbase/HBCK2.java
+++ b/hbase-hbck2/src/main/java/org/apache/hbase/HBCK2.java
@@ -589,14 +589,42 @@ public class HBCK2 extends Configured implements
org.apache.hadoop.util.Tool {
}
List<Long> scheduleRecoveries(Hbck hbck, String[] args) throws IOException {
- List<HBaseProtos.ServerName> serverNames = new ArrayList<>();
+ List<ServerName> serverNames = new ArrayList<>();
List<String> inputList = getInputList(args);
if (inputList != null) {
for (String serverName : inputList) {
- serverNames.add(parseServerName(serverName));
+ serverNames.add(ServerName.parseServerName(serverName));
}
}
- return hbck.scheduleServerCrashProcedure(serverNames);
+ try {
+ return hbck.scheduleServerCrashProcedures(serverNames);
+ } catch (NoSuchMethodError | UnsupportedOperationException e) {
+ LOG.warn("scheduleServerCrashProcedures not supported, "
+ + "falling back to scheduleServerCrashProcedure");
+ return scheduleRecoveriesDeprecated(hbck, inputList);
+ }
+ }
+
+ /**
+ * Fallback for old versions of HBase which do not have the new
scheduleServerCrashProcedures
+ * method.
+ */
+ @SuppressWarnings("unchecked")
+ private List<Long> scheduleRecoveriesDeprecated(Hbck hbck, List<String>
inputList)
+ throws IOException {
+ try {
+ List<HBaseProtos.ServerName> protoServerNames = new ArrayList<>();
+ if (inputList != null) {
+ for (String serverName : inputList) {
+ protoServerNames.add(parseServerName(serverName));
+ }
+ }
+ // Fallback to the old method with reflection
+ Method method =
hbck.getClass().getMethod("scheduleServerCrashProcedure", List.class);
+ return (List<Long>) method.invoke(hbck, protoServerNames);
+ } catch (Exception ex) {
+ throw new IOException("This HBase cluster does not support
scheduleRecoveries command", ex);
+ }
}
List<Long> recoverUnknown(Hbck hbck) throws IOException {