HBASE-13776 Setting illegal versions for HColumnDescriptor does not throw IllegalArgumentException (Yuhao Bi)

This commit is contained in:
tedyu 2015-05-29 07:35:02 -07:00
parent cca687d718
commit f35b6c6b77
2 changed files with 17 additions and 0 deletions

View File

@ -1466,6 +1466,15 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
}
// max versions already being checked
// HBASE-13776 Setting illegal versions for HColumnDescriptor
// does not throw IllegalArgumentException
// check minVersions <= maxVerions
if (hcd.getMinVersions() > hcd.getMaxVersions()) {
String message = "Min versions for column family " + hcd.getNameAsString()
+ " must be less than the Max versions.";
warnOrThrowExceptionForFailure(logWarn, CONF_KEY, message, null);
}
// check replication scope
if (hcd.getScope() < 0) {
String message = "Replication scope for column family "

View File

@ -5471,6 +5471,14 @@ public class TestFromClientSide {
}
checkTableIsLegal(htd);
// HBASE-13776 Setting illegal versions for HColumnDescriptor
// does not throw IllegalArgumentException
// finally, minVersions must be less than or equal to maxVersions
hcd.setMaxVersions(4);
hcd.setMinVersions(5);
checkTableIsIllegal(htd);
hcd.setMinVersions(3);
hcd.setScope(-1);
checkTableIsIllegal(htd);
hcd.setScope(0);