HBASE-24618 Backport HBASE-21204 to branch-1

This commit is contained in:
Abhishek Singh Chouhan 2020-06-23 17:43:42 -07:00 committed by Abhishek Singh Chouhan
parent d1449231f0
commit 54c38c840c
3 changed files with 44 additions and 7 deletions

View File

@ -30,14 +30,18 @@ public final class CellProtos {
* <code>DELETE = 8;</code>
*/
DELETE(2, 8),
/**
* <code>DELETE_FAMILY_VERSION = 10;</code>
*/
DELETE_FAMILY_VERSION(3, 10),
/**
* <code>DELETE_COLUMN = 12;</code>
*/
DELETE_COLUMN(3, 12),
DELETE_COLUMN(4, 12),
/**
* <code>DELETE_FAMILY = 14;</code>
*/
DELETE_FAMILY(4, 14),
DELETE_FAMILY(5, 14),
/**
* <code>MAXIMUM = 255;</code>
*
@ -45,7 +49,7 @@ public final class CellProtos {
* MAXIMUM is used when searching; you look from maximum on down.
* </pre>
*/
MAXIMUM(5, 255),
MAXIMUM(6, 255),
;
/**
@ -60,6 +64,10 @@ public final class CellProtos {
* <code>DELETE = 8;</code>
*/
public static final int DELETE_VALUE = 8;
/**
* <code>DELETE_FAMILY_VERSION = 10;</code>
*/
public static final int DELETE_FAMILY_VERSION_VALUE = 10;
/**
* <code>DELETE_COLUMN = 12;</code>
*/
@ -85,6 +93,7 @@ public final class CellProtos {
case 0: return MINIMUM;
case 4: return PUT;
case 8: return DELETE;
case 10: return DELETE_FAMILY_VERSION;
case 12: return DELETE_COLUMN;
case 14: return DELETE_FAMILY;
case 255: return MAXIMUM;
@ -2207,11 +2216,12 @@ public final class CellProtos {
"\030\007 \001(\014\"\220\001\n\010KeyValue\022\013\n\003row\030\001 \002(\014\022\016\n\006fami" +
"ly\030\002 \002(\014\022\021\n\tqualifier\030\003 \002(\014\022\021\n\ttimestamp" +
"\030\004 \001(\004\022$\n\010key_type\030\005 \001(\0162\022.hbase.pb.Cell" +
"Type\022\r\n\005value\030\006 \001(\014\022\014\n\004tags\030\007 \001(\014*`\n\010Cel" +
"Type\022\r\n\005value\030\006 \001(\014\022\014\n\004tags\030\007 \001(\014*{\n\010Cel" +
"lType\022\013\n\007MINIMUM\020\000\022\007\n\003PUT\020\004\022\n\n\006DELETE\020\010\022" +
"\021\n\rDELETE_COLUMN\020\014\022\021\n\rDELETE_FAMILY\020\016\022\014\n",
"\007MAXIMUM\020\377\001B=\n*org.apache.hadoop.hbase.p" +
"rotobuf.generatedB\nCellProtosH\001\240\001\001"
"\031\n\025DELETE_FAMILY_VERSION\020\n\022\021\n\rDELETE_COL",
"UMN\020\014\022\021\n\rDELETE_FAMILY\020\016\022\014\n\007MAXIMUM\020\377\001B=" +
"\n*org.apache.hadoop.hbase.protobuf.gener" +
"atedB\nCellProtosH\001\240\001\001"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {

View File

@ -32,6 +32,7 @@ enum CellType {
PUT = 4;
DELETE = 8;
DELETE_FAMILY_VERSION = 10;
DELETE_COLUMN = 12;
DELETE_FAMILY = 14;

View File

@ -16,6 +16,8 @@
*/
package org.apache.hadoop.hbase.client;
import static org.apache.hadoop.hbase.HConstants.RPC_CODEC_CONF_KEY;
import static org.apache.hadoop.hbase.ipc.RpcClient.DEFAULT_CODEC_CLASS;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@ -575,6 +577,30 @@ public class TestScannersFromClientSide {
"Testing offset + multiple CFs + maxResults");
}
@Test
public void testScanRawDeleteFamilyVersion() throws Exception {
TableName tableName = TableName.valueOf("testScanRawDeleteFamilyVersion");
TEST_UTIL.createTable(tableName, FAMILY);
Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
conf.set(RPC_CODEC_CONF_KEY, "");
conf.set(DEFAULT_CODEC_CLASS, "");
try (Connection connection = ConnectionFactory.createConnection(conf);
Table table = connection.getTable(tableName)) {
Delete delete = new Delete(ROW);
delete.addFamilyVersion(FAMILY, 0L);
table.delete(delete);
Scan scan = new Scan().withStartRow(ROW).setRaw(true);
ResultScanner scanner = table.getScanner(scan);
int count = 0;
while (scanner.next() != null) {
count++;
}
assertEquals(1, count);
} finally {
TEST_UTIL.deleteTable(tableName);
}
}
/**
* Test from client side for scan while the region is reopened
* on the same region server.