PDavid commented on code in PR #8412:
URL: https://github.com/apache/hbase/pull/8412#discussion_r3473558316
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilter.java:
##########
@@ -391,6 +391,43 @@ public void testReverseFilterListSkipsSameRowFuzzyHint()
throws IOException {
}
}
+ /**
+ * Serializing a filter must not leak the internal mask encoding. On the
unsafe path the stored
+ * mask is {-1 (fixed), 0 (non-fixed)}; {@code toByteArray} must emit the
public constructor {0,
+ * 1} form so the round-tripped filter behaves identically (otherwise the
leaked {-1, 0} is
+ * reparsed as an all-fixed mask). Processing a cell first must not change
this.
+ */
+ @Test
+ public void testSerializationAfterFilterCellPreservesBehavior() throws
Exception {
+ FuzzyRowFilter original =
+ new FuzzyRowFilter(Arrays.asList(new Pair<>(new byte[] { 1, 2, 3 }, new
byte[] { 0, 1, 0 })));
+ // Process a cell first to prove serialization is unaffected by scanning.
+ original.filterCell(KeyValueUtil.createFirstOnRow(new byte[] { 1, 50, 3
}));
+
+ FuzzyRowFilter parsed = FuzzyRowFilter.parseFrom(original.toByteArray());
+ // A row matching only via the wildcard position must still be INCLUDEEd
after the round-trip.
Review Comment:
Super-minor / nit: typo:
```suggestion
// A row matching only via the wildcard position must still be INCLUDED
after the round-trip.
```
--
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]