Skip to content

Commit 9b670a4

Browse files
authored
HBASE-25431 MAX_FILESIZE and MEMSTORE_FLUSHSIZE should not be set negative number (#2803)
Signed-off-by: stack <[email protected]>
1 parent 3d34623 commit 9b670a4

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
2828
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
2929
import org.apache.hadoop.hbase.client.TableDescriptor;
30+
import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
3031
import org.apache.hadoop.hbase.regionserver.DefaultStoreEngine;
3132
import org.apache.hadoop.hbase.regionserver.HStore;
3233
import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
@@ -82,10 +83,11 @@ public static void sanityCheck(final Configuration c, final TableDescriptor td)
8283

8384
// check max file size
8485
long maxFileSizeLowerLimit = 2 * 1024 * 1024L; // 2M is the default lower limit
85-
long maxFileSize = td.getMaxFileSize();
86-
if (maxFileSize < 0) {
87-
maxFileSize = conf.getLong(HConstants.HREGION_MAX_FILESIZE, maxFileSizeLowerLimit);
88-
}
86+
// if not set MAX_FILESIZE in TableDescriptor, and not set HREGION_MAX_FILESIZE in
87+
// hbase-site.xml, use maxFileSizeLowerLimit instead to skip this check
88+
long maxFileSize = td.getValue(TableDescriptorBuilder.MAX_FILESIZE) == null ?
89+
conf.getLong(HConstants.HREGION_MAX_FILESIZE, maxFileSizeLowerLimit) :
90+
Long.parseLong(td.getValue(TableDescriptorBuilder.MAX_FILESIZE));
8991
if (maxFileSize < conf.getLong("hbase.hregion.max.filesize.limit", maxFileSizeLowerLimit)) {
9092
String message =
9193
"MAX_FILESIZE for table descriptor or " + "\"hbase.hregion.max.filesize\" (" +
@@ -96,10 +98,11 @@ public static void sanityCheck(final Configuration c, final TableDescriptor td)
9698

9799
// check flush size
98100
long flushSizeLowerLimit = 1024 * 1024L; // 1M is the default lower limit
99-
long flushSize = td.getMemStoreFlushSize();
100-
if (flushSize < 0) {
101-
flushSize = conf.getLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, flushSizeLowerLimit);
102-
}
101+
// if not set MEMSTORE_FLUSHSIZE in TableDescriptor, and not set HREGION_MEMSTORE_FLUSH_SIZE in
102+
// hbase-site.xml, use flushSizeLowerLimit instead to skip this check
103+
long flushSize = td.getValue(TableDescriptorBuilder.MEMSTORE_FLUSHSIZE) == null ?
104+
conf.getLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, flushSizeLowerLimit) :
105+
Long.parseLong(td.getValue(TableDescriptorBuilder.MEMSTORE_FLUSHSIZE));
103106
if (flushSize < conf.getLong("hbase.hregion.memstore.flush.size.limit", flushSizeLowerLimit)) {
104107
String message = "MEMSTORE_FLUSHSIZE for table descriptor or " +
105108
"\"hbase.hregion.memstore.flush.size\" (" + flushSize +

0 commit comments

Comments
 (0)