HBASE-25431 MAX_FILESIZE and MEMSTORE_FLUSHSIZE should not be set negative number (#2803)

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Baiqiang Zhao 2021-01-15 14:00:50 +08:00 committed by stack
parent 87e516da6c
commit 2989f8edb0
1 changed files with 11 additions and 8 deletions

View File

@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
import org.apache.hadoop.hbase.client.TableDescriptor; import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
import org.apache.hadoop.hbase.regionserver.DefaultStoreEngine; import org.apache.hadoop.hbase.regionserver.DefaultStoreEngine;
import org.apache.hadoop.hbase.regionserver.HStore; import org.apache.hadoop.hbase.regionserver.HStore;
import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
@ -82,10 +83,11 @@ public final class TableDescriptorChecker {
// check max file size // check max file size
long maxFileSizeLowerLimit = 2 * 1024 * 1024L; // 2M is the default lower limit long maxFileSizeLowerLimit = 2 * 1024 * 1024L; // 2M is the default lower limit
long maxFileSize = td.getMaxFileSize(); // if not set MAX_FILESIZE in TableDescriptor, and not set HREGION_MAX_FILESIZE in
if (maxFileSize < 0) { // hbase-site.xml, use maxFileSizeLowerLimit instead to skip this check
maxFileSize = conf.getLong(HConstants.HREGION_MAX_FILESIZE, maxFileSizeLowerLimit); long maxFileSize = td.getValue(TableDescriptorBuilder.MAX_FILESIZE) == null ?
} conf.getLong(HConstants.HREGION_MAX_FILESIZE, maxFileSizeLowerLimit) :
Long.parseLong(td.getValue(TableDescriptorBuilder.MAX_FILESIZE));
if (maxFileSize < conf.getLong("hbase.hregion.max.filesize.limit", maxFileSizeLowerLimit)) { if (maxFileSize < conf.getLong("hbase.hregion.max.filesize.limit", maxFileSizeLowerLimit)) {
String message = String message =
"MAX_FILESIZE for table descriptor or " + "\"hbase.hregion.max.filesize\" (" + "MAX_FILESIZE for table descriptor or " + "\"hbase.hregion.max.filesize\" (" +
@ -96,10 +98,11 @@ public final class TableDescriptorChecker {
// check flush size // check flush size
long flushSizeLowerLimit = 1024 * 1024L; // 1M is the default lower limit long flushSizeLowerLimit = 1024 * 1024L; // 1M is the default lower limit
long flushSize = td.getMemStoreFlushSize(); // if not set MEMSTORE_FLUSHSIZE in TableDescriptor, and not set HREGION_MEMSTORE_FLUSH_SIZE in
if (flushSize < 0) { // hbase-site.xml, use flushSizeLowerLimit instead to skip this check
flushSize = conf.getLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, flushSizeLowerLimit); long flushSize = td.getValue(TableDescriptorBuilder.MEMSTORE_FLUSHSIZE) == null ?
} conf.getLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, flushSizeLowerLimit) :
Long.parseLong(td.getValue(TableDescriptorBuilder.MEMSTORE_FLUSHSIZE));
if (flushSize < conf.getLong("hbase.hregion.memstore.flush.size.limit", flushSizeLowerLimit)) { if (flushSize < conf.getLong("hbase.hregion.memstore.flush.size.limit", flushSizeLowerLimit)) {
String message = "MEMSTORE_FLUSHSIZE for table descriptor or " + String message = "MEMSTORE_FLUSHSIZE for table descriptor or " +
"\"hbase.hregion.memstore.flush.size\" (" + flushSize + "\"hbase.hregion.memstore.flush.size\" (" + flushSize +