HBASE-21483 [hbck2] version string checking should look for exactly the version we...
authorSean Busbey <busbey@cloudera.com>
Thu, 15 Nov 2018 22:45:13 +0000 (16:45 -0600)
committerSean Busbey <sean.busbey@gmail.com>
Fri, 16 Nov 2018 12:04:23 +0000 (06:04 -0600)
hbase-hbck2/src/main/java/org/apache/hbase/HBCK2.java
hbase-hbck2/src/test/java/org/apache/hbase/TestHBCK2.java

index 49e9c64..e9089e8 100644 (file)
@@ -101,12 +101,13 @@ public class HBCK2 extends Configured implements Tool {
   }
 
   static void checkVersion(final String versionStr) {
-    if (versionStr.startsWith(TWO_POINT_ONE)) {
-      throw new UnsupportedOperationException(TWO_POINT_ONE + " has no support for hbck2");
-    }
     if (VersionInfo.compareVersion(MININUM_VERSION, versionStr) > 0) {
       throw new UnsupportedOperationException("Requires " + MININUM_VERSION + " at least.");
     }
+    // except 2.1.0 didn't ship with support
+    if (VersionInfo.compareVersion(TWO_POINT_ONE, versionStr) == 0) {
+      throw new UnsupportedOperationException(TWO_POINT_ONE + " has no support for hbck2");
+    }
   }
 
   TableState setTableState(TableName tableName, TableState.State state) throws IOException {
index 1b54687..e902275 100644 (file)
@@ -70,6 +70,11 @@ public class TestHBCK2 {
   }
 
   @Test
+  public void testCheckVersionSpecial210() {
+    HBCK2.checkVersion("2.1.0-patchedForHBCK2");
+  }
+
+  @Test
   public void testCheckVersion203() {
     HBCK2.checkVersion("2.0.3");
   }