Himanshu-g81 commented on code in PR #6435:
URL: https://github.com/apache/hbase/pull/6435#discussion_r1846511052
##########
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRowCounter.java:
##########
@@ -524,6 +526,106 @@ public void testInvalidTable() throws Exception {
}
}
+ /**
+ * Step 1: Add 6 rows(row1, row2, row3, row4, row5 and row6) to a table.
Each row contains 1
+ * column family and 4 columns. Step 2: Delete a column for row1. Step 3:
Delete a column family
+ * for row2 and row4. Step 4: Delete all versions of a specific column for
row3, row5 and row6.
+ * <p>
+ * Case 1: Run row counter without countDeleteMarkers flag Step a: Validate
counter values.
+ * <p>
+ * Case 2: Run row counter with countDeleteMarkers flag Step a: Validate
counter values.
+ */
+ @Test
+ public void testRowCounterWithCountDeleteMarkersOption() throws Exception {
+ // Test Setup
+
+ final TableName tableName =
+ TableName.valueOf(TABLE_NAME + "_" + "withCountDeleteMarkersOption");
+ final byte[][] rowKeys = { Bytes.toBytes("row1"), Bytes.toBytes("row2"),
Bytes.toBytes("row3"),
+ Bytes.toBytes("row4"), Bytes.toBytes("row5"), Bytes.toBytes("row6") };
+ final byte[] columnFamily = Bytes.toBytes("cf");
+ final byte[][] columns =
+ { Bytes.toBytes("A"), Bytes.toBytes("B"), Bytes.toBytes("C"),
Bytes.toBytes("D") };
+ final byte[] value = Bytes.toBytes("a");
+
+ try (Table table = TEST_UTIL.createTable(tableName, columnFamily)) {
+ // Step 1: Insert rows with columns
+ for (byte[] rowKey : rowKeys) {
+ Put put = new Put(rowKey);
+ for (byte[] col : columns) {
+ put.addColumn(columnFamily, col, value);
+ }
+ table.put(put);
+ }
+ TEST_UTIL.getAdmin().flush(tableName);
+
+ // Steps 2, 3, and 4: Delete columns, families, and all versions of
columns
Review Comment:
Let's say if there is a bug in this
[logic](https://github.com/apache/hbase/pull/6435/files#diff-d21a22d2237f8dada4e58ea5cd7d695b6dccd97ee58b74408352ebbb51d99858R120-R144)
- (wild guess - break statement is removed in future by mistake) and delete
marker rows are incremented for all the scanned rows - it won't be caught by
existing UTs.
Its ensuring that new code is count the "required" things and not "all" the
things.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]