You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2021/02/08 22:40:08 UTC
[hbase] 01/02: HBASE-25431 MAX_FILESIZE and MEMSTORE_FLUSHSIZE
should not be set negative number (#2803)
This is an automated email from the ASF dual-hosted git repository.
stack pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
commit 2989f8edb0559f01488dd6fd52e27373d35d7d3c
Author: Baiqiang Zhao <zb...@gmail.com>
AuthorDate: Fri Jan 15 14:00:50 2021 +0800
HBASE-25431 MAX_FILESIZE and MEMSTORE_FLUSHSIZE should not be set negative number (#2803)
Signed-off-by: stack <st...@apache.org>
---
.../hadoop/hbase/util/TableDescriptorChecker.java | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java
index c69d38a..30c07b3 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/TableDescriptorChecker.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
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.HStore;
import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
@@ -82,10 +83,11 @@ public final class TableDescriptorChecker {
// check max file size
long maxFileSizeLowerLimit = 2 * 1024 * 1024L; // 2M is the default lower limit
- long maxFileSize = td.getMaxFileSize();
- if (maxFileSize < 0) {
- maxFileSize = conf.getLong(HConstants.HREGION_MAX_FILESIZE, maxFileSizeLowerLimit);
- }
+ // if not set MAX_FILESIZE in TableDescriptor, and not set HREGION_MAX_FILESIZE in
+ // hbase-site.xml, use maxFileSizeLowerLimit instead to skip this check
+ 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)) {
String message =
"MAX_FILESIZE for table descriptor or " + "\"hbase.hregion.max.filesize\" (" +
@@ -96,10 +98,11 @@ public final class TableDescriptorChecker {
// check flush size
long flushSizeLowerLimit = 1024 * 1024L; // 1M is the default lower limit
- long flushSize = td.getMemStoreFlushSize();
- if (flushSize < 0) {
- flushSize = conf.getLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, flushSizeLowerLimit);
- }
+ // if not set MEMSTORE_FLUSHSIZE in TableDescriptor, and not set HREGION_MEMSTORE_FLUSH_SIZE in
+ // hbase-site.xml, use flushSizeLowerLimit instead to skip this check
+ 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)) {
String message = "MEMSTORE_FLUSHSIZE for table descriptor or " +
"\"hbase.hregion.memstore.flush.size\" (" + flushSize +