HBASE-22529 Add sanity check for in-memory compaction policy

Signed-off-by: Toshihiro Suzuki <brfrn169@gmail.com>
This commit is contained in:
Junegunn Choi 2019-12-04 13:55:53 +09:00 committed by Toshihiro Suzuki
parent e87db35d1a
commit 40e1c9e310
2 changed files with 12 additions and 0 deletions

View File

@ -188,6 +188,13 @@ public final class TableDescriptorChecker {
" must be greater than zero."; " must be greater than zero.";
warnOrThrowExceptionForFailure(logWarn, message, null); warnOrThrowExceptionForFailure(logWarn, message, null);
} }
// check in-memory compaction
try {
hcd.getInMemoryCompaction();
} catch (IllegalArgumentException e) {
warnOrThrowExceptionForFailure(logWarn, e.getMessage(), e);
}
} }
} }

View File

@ -151,6 +151,11 @@ public class TestIllegalTableDescriptor {
hcd.setScope(0); hcd.setScope(0);
checkTableIsLegal(htd); checkTableIsLegal(htd);
hcd.setValue(ColumnFamilyDescriptorBuilder.IN_MEMORY_COMPACTION, "INVALID");
checkTableIsIllegal(htd);
hcd.setValue(ColumnFamilyDescriptorBuilder.IN_MEMORY_COMPACTION, "NONE");
checkTableIsLegal(htd);
try { try {
hcd.setDFSReplication((short) -1); hcd.setDFSReplication((short) -1);
fail("Illegal value for setDFSReplication did not throw"); fail("Illegal value for setDFSReplication did not throw");