[GitHub] [hbase] Reidddddd commented on a change in pull request #3385: HBASE-26001 When turn on access control, the cell level TTL of Increment and Append operations is invalid

2021-06-16 Thread GitBox


Reidd commented on a change in pull request #3385:
URL: https://github.com/apache/hbase/pull/3385#discussion_r652458898



##
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestPostIncrementAndAppendBeforeWAL.java
##
@@ -161,6 +173,80 @@ public void testChangeCellWithNotExistColumnFamily() 
throws Exception {
 }
   }
 
+  @Test
+  public void testIncrementTTLWithACLTag() throws Exception {
+TableName tableName = TableName.valueOf(name.getMethodName());
+createTableWithCoprocessor(tableName, 
ChangeCellWithACLTagObserver.class.getName());
+try (Table table = connection.getTable(tableName)) {
+  // Increment without TTL
+  Increment firstIncrement = new Increment(ROW).addColumn(CF1_BYTES, CQ1, 
1).setACL(new HashMap<>());
+  Result result = table.increment(firstIncrement);
+  assertEquals(1, result.size());
+  assertEquals(1, Bytes.toLong(result.getValue(CF1_BYTES, CQ1)));
+
+  // Check if the new cell can be read
+  Get get = new Get(ROW).addColumn(CF1_BYTES, CQ1);
+  result = table.get(get);
+  assertEquals(1, result.size());
+  assertEquals(1, Bytes.toLong(result.getValue(CF1_BYTES, CQ1)));
+
+  // Increment with TTL
+  Increment secondIncrement = new Increment(ROW).addColumn(CF1_BYTES, CQ1, 
1).setTTL(1000)
+.setACL(new HashMap<>());
+  result = table.increment(secondIncrement);
+
+  // We should get value 2 here
+  assertEquals(1, result.size());
+  assertEquals(2, Bytes.toLong(result.getValue(CF1_BYTES, CQ1)));
+
+  // Wait 2s to let the second increment expire
+  Thread.sleep(2000);
+  get = new Get(ROW).addColumn(CF1_BYTES, CQ1);
+  result = table.get(get);
+
+  // The value should revert to 1
+  assertEquals(1, result.size());
+  assertEquals(1, Bytes.toLong(result.getValue(CF1_BYTES, CQ1)));
+}
+  }
+
+  @Test
+  public void testAppendTTLWithACLTag() throws Exception {
+TableName tableName = TableName.valueOf(name.getMethodName());
+createTableWithCoprocessor(tableName, 
ChangeCellWithACLTagObserver.class.getName());
+try (Table table = connection.getTable(tableName)) {
+  // Append without TTL
+  Append firstAppend = new Append(ROW).addColumn(CF1_BYTES, CQ2, 
VALUE).setACL(new HashMap<>());

Review comment:
   Is it possible we add a non-null empty acls? then after the 2nd 
increment, we verify whether the result has the carried-forward acls?




-- 
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:
us...@infra.apache.org




[GitHub] [hbase] Reidddddd commented on a change in pull request #3385: HBASE-26001 When turn on access control, the cell level TTL of Increment and Append operations is invalid

2021-06-16 Thread GitBox


Reidd commented on a change in pull request #3385:
URL: https://github.com/apache/hbase/pull/3385#discussion_r652457713



##
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestPostIncrementAndAppendBeforeWAL.java
##
@@ -232,4 +318,25 @@ private Cell newCellWithNotExistColumnFamily(Cell cell) {
   .collect(Collectors.toList());
 }
   }
-}

Review comment:
   new line?




-- 
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:
us...@infra.apache.org