sandeepvinayak commented on a change in pull request #837: HBASE-23309: Adding
the flexibility to ChainWalEntryFilter to filter the whole entry if all cells
get filtered
URL: https://github.com/apache/hbase/pull/837#discussion_r347715850
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ChainWALEntryFilter.java
##########
@@ -68,13 +82,17 @@ public void initCellFilters() {
@Override
public Entry filter(Entry entry) {
+
for (WALEntryFilter filter : filters) {
if (entry == null) {
return null;
}
entry = filter.filter(entry);
}
filterCells(entry);
+ if (shouldFilterEmptyEntry() && entry != null &&
entry.getEdit().isEmpty()) {
Review comment:
@apurtell This is the flexility we want to provide to customer replication
endpoint so that they every custom replication endpoint doesn't need to
re-implement everything what `ChainWALEntryFilter` already does.
Here is the scenario we want to cover, let's take an example:
```java
CustomWALFilter implements WALEntryFilter, WALCellFilter {
@override
public void filter(Entry) {
}
@override
public void filterCell(Entry, Cell){
}
}
```
Custom Replication endpoint set the filters by:
```java
ChainWALEntryFilter(filters); \\ new CustomWALFilter() is part of filters
```
if `filter` in the above `CustomWALFilter` returns Entry but filterCell
filters all the cells, the `ChainWALEntryFilter` will not return null in
current implementation. Since most of the `CustomWALFilter` uses
`ChainWALEntryFilter`, isn't it better to provide this flexibility in
ChainWALFilter itself? Sure, it's possible to all this logic in
CustomWALFilter, but shouldn't we provide re-usability through ChainWALFilter
and provides a flexibility through a config? Let me know your thoughts.
----------------------------------------------------------------
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]
With regards,
Apache Git Services