Skip to content

Commit

Permalink
HBASE-13776 Setting illegal versions for HColumnDescriptor does not t…
Browse files Browse the repository at this point in the history
…hrow IllegalArgumentException (Yuhao Bi)
  • Loading branch information
tedyu committed May 29, 2015
1 parent cca687d commit f35b6c6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,15 @@ private void sanityCheckTableDescriptor(final HTableDescriptor htd) throws IOExc
}
// 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 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5471,6 +5471,14 @@ public void testIllegalTableDescriptor() throws Exception {
}
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);
Expand Down

0 comments on commit f35b6c6

Please sign in to comment.