HBASE-20444 Addendum keep folks from looking at raw version component array.
Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
parent
286245987f
commit
d909ec55aa
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue