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 07:12:18 UTC

[hbase] branch branch-2.2 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 branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git


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

commit 75f53cea7421069a7671fab15efb3049371cbadd
Author: Xu Cang <xu...@apache.org>
AuthorDate: Fri May 10 00:11:52 2019 -0700

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

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 10d2614..ad4011f 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
@@ -8045,6 +8045,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.
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 b99ecf0..077e276 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
@@ -6428,7 +6428,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