virajjasani commented on a change in pull request #3210:
URL: https://github.com/apache/hbase/pull/3210#discussion_r636308997
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestIncrementsFromClientSide.java
##########
@@ -547,4 +553,51 @@ static void assertIncrementKey(Cell key, byte [] row, byte
[] family,
public static String filterStringSoTableNameSafe(final String str) {
return str.replaceAll("\\[fast\\=(.*)\\]", ".FAST.is.$1");
}
+
+ /*
+ Test that we have only 1 ttl tag with increment mutation.
+ */
+ @Test
+ public void testIncrementWithTtlTags() throws Exception {
+ LOG.info("Starting " + this.name.getMethodName());
+ final TableName TABLENAME =
Review comment:
nit: `s\TABLENAME\tableName` since it is not class level static final
constant
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestIncrementsFromClientSide.java
##########
@@ -547,4 +553,51 @@ static void assertIncrementKey(Cell key, byte [] row, byte
[] family,
public static String filterStringSoTableNameSafe(final String str) {
return str.replaceAll("\\[fast\\=(.*)\\]", ".FAST.is.$1");
}
+
+ /*
+ Test that we have only 1 ttl tag with increment mutation.
+ */
+ @Test
+ public void testIncrementWithTtlTags() throws Exception {
+ LOG.info("Starting " + this.name.getMethodName());
+ final TableName TABLENAME =
+
TableName.valueOf(filterStringSoTableNameSafe(this.name.getMethodName()));
+ Table ht = TEST_UTIL.createTable(TABLENAME, FAMILY);
+ final byte[] COLUMN = Bytes.toBytes("column");
+
+ Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
+ // Set RPC_CODEC_CONF_KEY to KeyValueCodecWithTags so that scan will
return tags.
+ conf.set(RPC_CODEC_CONF_KEY, KeyValueCodecWithTags.class.getName());
+ conf.set(DEFAULT_CODEC_CLASS, "");
+ try (Connection connection = ConnectionFactory.createConnection(conf);
+ Table table = connection.getTable(TABLENAME)) {
+ for (int i = 0; i < 10; i++) {
+ Increment inc = new Increment(ROW);
+ inc.addColumn(FAMILY, COLUMN, 1);
+ long ttl = i + 3600000 ;
+ inc.setTTL(ttl);
+ ht.increment(inc);
+
+ Scan scan = new Scan().withStartRow(ROW);
+ ResultScanner scanner = table.getScanner(scan);
+ int count = 0;
+ Result result;
+ while ((result = scanner.next()) != null) {
+ Cell[] cells = result.rawCells();
+ for (Cell cell: cells) {
+ List<Tag> tags = PrivateCellUtil.getTags(cell);
+ // Make sure there is only 1 tag.
+ assertEquals(1, tags.size());
Review comment:
Nice catch, it seems without the source changes, previous ttl tags stays
and new one gets added with updated ttl value.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]