Skip to content

Commit

Permalink
HBASE-22274 Cell size limit check on append considers cell's previous…
Browse files Browse the repository at this point in the history
… size

change
  • Loading branch information
xcangCRM committed May 10, 2019
1 parent 4d64dd2 commit 987d368
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8101,7 +8101,15 @@ private List<Cell> reckonDeltasByStore(HStore store, Operation op, Mutation muta
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6417,7 +6417,7 @@ public void testCellSizeLimit() throws IOException {
// 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
Expand Down

0 comments on commit 987d368

Please sign in to comment.