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
9431ee3f49
commit
fc9743c17a
|
@ -140,7 +140,7 @@ public class VersionInfo {
|
||||||
* "4.5.6-UNKNOW" returns ["4", "5", "6", "-4"]
|
* "4.5.6-UNKNOW" returns ["4", "5", "6", "-4"]
|
||||||
* @return the components of the version string
|
* @return the components of the version string
|
||||||
*/
|
*/
|
||||||
static String[] getVersionComponents(final String version) {
|
private static String[] getVersionComponents(final String version) {
|
||||||
assert(version != null);
|
assert(version != null);
|
||||||
String[] strComps = version.split("[\\.-]");
|
String[] strComps = version.split("[\\.-]");
|
||||||
assert(strComps.length > 0);
|
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-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("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.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5141,8 +5141,7 @@ public class HBaseFsck extends Configured implements Closeable {
|
||||||
private boolean isOptionsSupported(String[] args) {
|
private boolean isOptionsSupported(String[] args) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
String hbaseServerVersion = status.getHBaseVersion();
|
String hbaseServerVersion = status.getHBaseVersion();
|
||||||
Object[] versionComponents = VersionInfo.getVersionComponents(hbaseServerVersion);
|
if (VersionInfo.compareVersion("2.any.any", hbaseServerVersion) < 0) {
|
||||||
if (versionComponents[0] instanceof Integer && ((Integer) versionComponents[0]) >= 2) {
|
|
||||||
// Process command-line args.
|
// Process command-line args.
|
||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
if (unsupportedOptionsInV2.contains(arg)) {
|
if (unsupportedOptionsInV2.contains(arg)) {
|
||||||
|
|
Loading…
Reference in New Issue