-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBASE-28622 FilterListWithAND can swallow SEEK_NEXT_USING_HINT #5955
Conversation
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
I am open to suggestions for a better name for the HintingFilter marker interface. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there could be performance improvements if there are some filters can return SEEK_NEXT_USING_HINT, but if there are none, will there be some performance downgrade?
hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithAND.java
Show resolved
Hide resolved
@@ -184,9 +205,20 @@ public ReturnCode filterCell(Cell c) throws IOException { | |||
// otherwise we may mess up the global state (such as offset, count..) in the following | |||
// sub-filters. (HBASE-20565) | |||
if (!isIncludeRelatedReturnCode(rc)) { | |||
return rc; | |||
i++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
I think the intention here is that, usually SEEK_NEXT_USING_HINT can skip more rows, so even if we decide to skip the current cell, we'd better still looking to remaining filters to see if we can get a SEEK_NEXT_USING_HINT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will add more comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's speak more here? It is not easy for a developer without the context of this issue here to understand, and please also mention the issue number.
hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithAND.java
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
Added more comments, @Apache9 . |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
retVal = true; | ||
anyFiltered = true; | ||
} else if (hintingFilters[i]) { | ||
// If any of the hinting filters has returned false, then we must not filter this rowkey. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think hintingFilters being true only means it is a HintingFilter, does not mean it has returned false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, hintingFilters is just caching if a filter is a HintingFilter, it's just a performance aid to reduce instanceof calls.
We know that filterRowKey() has returned false, becasue we are in the else clause of the if clause which checks the return value.
We do want the case where filterRowKey() has returned false.
if filterRowKey() returns true, then we skip the whole rowkey.
If it returns false, then the we call filterCell() on the individual cells (which is what we want in this case)
However, I realize that the patch regresses the filterAllRemaining() case performance.
If any of the filters returns true for filterAllRemaining, then we can just skip the row. I will update the patch.
@@ -184,9 +205,20 @@ public ReturnCode filterCell(Cell c) throws IOException { | |||
// otherwise we may mess up the global state (such as offset, count..) in the following | |||
// sub-filters. (HBASE-20565) | |||
if (!isIncludeRelatedReturnCode(rc)) { | |||
return rc; | |||
i++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's speak more here? It is not easy for a developer without the context of this issue here to understand, and please also mention the issue number.
I have fixed two bugs in the patch:
|
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
break; | ||
} | ||
} | ||
// We have the preliminary return code. However, if there are remaining uncalled hintingFilters, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good. Much clear now.
for (int i = 0, n = filters.size(); i < n; i++) { | ||
Filter filter = filters.get(i); | ||
if (filter.filterAllRemaining() || filter.filterRowKey(firstRowCell)) { | ||
if (filter.filterAllRemaining()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check this here? We do have a filterAllRemaining method below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically no, but we do it anyway everywhere, so I didn't want to remove it just here.
There is also an MR job that possibly requires this.
I have opened HBASE-28633 for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize that I referred a wrong ticket in the comment.
Fixing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithAND.java
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Signed-off-by: Duo Zhang <[email protected]> (cherry picked from commit c0fb41f)
Signed-off-by: Duo Zhang <[email protected]> (cherry picked from commit c0fb41f)
Signed-off-by: Duo Zhang <[email protected]> (cherry picked from commit c0fb41f)
Signed-off-by: Duo Zhang <[email protected]> (cherry picked from commit c0fb41f)
No description provided.