hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject hbase git commit: HBASE-20444 Addendum keep folks from looking at raw version component array.
Date Thu, 31 May 2018 18:31:05 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 286245987 -> d909ec55a


HBASE-20444 Addendum keep folks from looking at raw version component array.

Signed-off-by: Andrew Purtell <apurtell@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/d909ec55
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d909ec55
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d909ec55

Branch: refs/heads/master
Commit: d909ec55aa54330e0251593fa0e7c2d2fd61681d
Parents: 2862459
Author: Sean Busbey <busbey@apache.org>
Authored: Wed May 30 22:23:56 2018 -0500
Committer: Sean Busbey <busbey@apache.org>
Committed: Thu May 31 13:29:52 2018 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/util/VersionInfo.java  | 2 +-
 .../java/org/apache/hadoop/hbase/util/TestVersionInfo.java   | 8 ++++++++
 .../main/java/org/apache/hadoop/hbase/util/HBaseFsck.java    | 3 +--
 3 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/d909ec55/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java
index 0f368f3..b57255a 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java
@@ -140,7 +140,7 @@ public class VersionInfo {
    * "4.5.6-UNKNOW" returns ["4", "5", "6", "-4"]
    * @return the components of the version string
    */
-  static String[] getVersionComponents(final String version) {
+  private static String[] getVersionComponents(final String version) {
     assert(version != null);
     String[] strComps = version.split("[\\.-]");
     assert(strComps.length > 0);

http://git-wip-us.apache.org/repos/asf/hbase/blob/d909ec55/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestVersionInfo.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestVersionInfo.java
b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestVersionInfo.java
index 2e638cf..b8d2f02 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestVersionInfo.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestVersionInfo.java
@@ -56,5 +56,13 @@ public class TestVersionInfo {
     assertTrue(VersionInfo.compareVersion("3.0.0-alpha-2", "3.0.0-alpha-11") < 0);
     assertTrue(VersionInfo.compareVersion("3.0.0-beta-2", "3.0.0-beta-11") < 0);
     assertTrue(VersionInfo.compareVersion("2.0.0-foobar", "2.0.0.1") < 0);
+    assertTrue(VersionInfo.compareVersion("2.any.any", "2.0.0") < 0);
+    assertTrue(VersionInfo.compareVersion("2.0.0", "2.any.any") > 0);
+    assertTrue(VersionInfo.compareVersion("2.any.any", "2.0.0-alpha-1") < 0);
+    assertTrue(VersionInfo.compareVersion("2.0.0-alpha-1", "2.any.any") > 0);
+    assertTrue(VersionInfo.compareVersion("2.any.any", "2.0.0-beta-5-SNAPSHOT") < 0);
+    assertTrue(VersionInfo.compareVersion("2.0.0-beta-5-SNAPSHOT", "2.any.any") > 0);
+    assertTrue(VersionInfo.compareVersion("2.any.any", "1.4.4") > 0);
+    assertTrue(VersionInfo.compareVersion("1.4.4", "2.any.any") < 0);
   }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/d909ec55/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
index 6d9ca9a..035ebd6 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
@@ -5139,8 +5139,7 @@ public class HBaseFsck extends Configured implements Closeable {
   private boolean isOptionsSupported(String[] args) {
     boolean result = true;
     String hbaseServerVersion = status.getHBaseVersion();
-    Object[] versionComponents = VersionInfo.getVersionComponents(hbaseServerVersion);
-    if (versionComponents[0] instanceof Integer && ((Integer) versionComponents[0])
>= 2) {
+    if (VersionInfo.compareVersion("2.any.any", hbaseServerVersion) < 0) {
       // Process command-line args.
       for (String arg : args) {
         if (unsupportedOptionsInV2.contains(arg)) {


Mime
View raw message