Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-24401 Cell size limit check on append should consider 0 or less… #1742

Merged
merged 1 commit into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8265,14 +8265,14 @@ 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 in region " + this;
if (LOG.isDebugEnabled()) {
if (this.maxCellSize > 0) {
int newCellSize = PrivateCellUtil.estimatedSerializedSizeOf(newCell);
if (newCellSize > this.maxCellSize) {
String msg = "Cell with size " + newCellSize + " exceeds limit of " + this.maxCellSize
+ " bytes in region " + this;
LOG.debug(msg);
throw new DoNotRetryIOException(msg);
}
wchevreuil marked this conversation as resolved.
Show resolved Hide resolved
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,7 @@ private void checkCellSizeLimit(final HRegion r, final Mutation m) throws IOExce
int size = PrivateCellUtil.estimatedSerializedSizeOf(cells.current());
if (size > r.maxCellSize) {
String msg = "Cell with size " + size + " exceeds limit of " + r.maxCellSize + " bytes";
if (LOG.isDebugEnabled()) {
LOG.debug(msg);
}
LOG.debug(msg);
throw new DoNotRetryIOException(msg);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,7 @@ public void testFilterAllRecords() throws IOException {

@Test
public void testCellSizeLimit() throws IOException {
final TableName tableName = TableName.valueOf("testCellSizeLimit");
final TableName tableName = name.getTableName();
TableDescriptorBuilder.ModifyableTableDescriptor tableDescriptor =
new TableDescriptorBuilder.ModifyableTableDescriptor(tableName)
.setValue(HRegion.HBASE_MAX_CELL_SIZE_KEY, Integer.toString(10 * 1024));
Expand Down Expand Up @@ -2276,6 +2276,28 @@ public void testCellSizeLimit() throws IOException {
}
}

@Test
public void testCellSizeNoLimit() throws IOException {
final TableName tableName = name.getTableName();
ColumnFamilyDescriptor familyDescriptor =
new ColumnFamilyDescriptorBuilder.ModifyableColumnFamilyDescriptor(FAMILY);
TableDescriptorBuilder.ModifyableTableDescriptor tableDescriptor =
new TableDescriptorBuilder.ModifyableTableDescriptor(tableName)
.setValue(HRegion.HBASE_MAX_CELL_SIZE_KEY, Integer.toString(0));
tableDescriptor.setColumnFamily(familyDescriptor);

try (Admin admin = TEST_UTIL.getAdmin()) {
admin.createTable(tableDescriptor);
}

// Will succeed
try (Table ht = TEST_UTIL.getConnection().getTable(tableName)) {
ht.put(new Put(ROW).addColumn(FAMILY, QUALIFIER, new byte[HRegion.DEFAULT_MAX_CELL_SIZE -
1024]));
ht.append(new Append(ROW).addColumn(FAMILY, QUALIFIER, new byte[1024 + 1]));
}
}

@Test
public void testDeleteSpecifiedVersionOfSpecifiedColumn() throws Exception {
final TableName tableName = name.getTableName();
Expand Down