You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by xu...@apache.org on 2019/05/10 03:52:19 UTC

[hbase] branch master updated: HBASE-22274 Cell size limit check on append considers cell's previous size

This is an automated email from the ASF dual-hosted git repository.

xucang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 987d368  HBASE-22274 Cell size limit check on append considers cell's previous size
987d368 is described below

commit 987d36879c310d567f3b0b0e04a91960f14f453f
Author: Xu Cang <xu...@apache.org>
AuthorDate: Mon Apr 22 10:12:29 2019 -0700

    HBASE-22274 Cell size limit check on append considers cell's previous size
    
    change
---
 .../java/org/apache/hadoop/hbase/regionserver/HRegion.java     | 10 +++++++++-
 .../org/apache/hadoop/hbase/client/TestFromClientSide.java     |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 25e040c..84cd10f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -8101,7 +8101,15 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
           break;
         default: throw new UnsupportedOperationException(op.toString());
       }
-
+      int newCellSize = PrivateCellUtil.estimatedSerializedSizeOf(newCell);
+      if (newCellSize > this.maxCellSize) {
+        String msg = "Cell with size " + newCellSize + " exceeds limit of " +
+            this.maxCellSize + " bytes";
+        if (LOG.isDebugEnabled()) {
+          LOG.debug(msg);
+        }
+        throw new DoNotRetryIOException(msg);
+      }
       cellPairs.add(new Pair<>(currentValue, newCell));
       // Add to results to get returned to the Client. If null, cilent does not want results.
       if (results != null) {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
index 2c41ed3..77b5f93 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
@@ -6417,7 +6417,7 @@ public class TestFromClientSide {
         // expected
       }
       try {
-        t.append(new Append(ROW).addColumn(FAMILY, QUALIFIER, new byte[10 * 1024]));
+        t.append(new Append(ROW).addColumn(FAMILY, QUALIFIER, new byte[2 * 1024]));
         fail("Oversize cell failed to trigger exception");
       } catch (IOException e) {
         // expected