-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29672 Handle runtime comparison failures during filtering gracefully #7397
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ed3ee97 to
6c9d5c1
Compare
|
Code snippet to identify all filters which take ByteArrayComparable, majority (5/8) filters are an extension of CompareFilter , but there are 3 outlier ColumnValue filters which do not extend CompareFilter - |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Pull request overview
This PR adds graceful error handling for runtime exceptions that occur during comparator operations in HBase filters. When a ByteArrayComparable comparator throws a RuntimeException during filtering, it now gets wrapped in an HBaseIOException with a clear error message, preventing unclear remote exceptions on the client side.
Key Changes:
- Added runtime exception handling in CompareFilter's compare methods (compareRow, compareFamily, compareQualifier, compareValue)
- Updated method signatures to throw IOException for affected filter methods
- Added comprehensive unit tests to verify exception handling across all filter types
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| CompareFilter.java | Added wrapInHBaseIOException utility method and try-catch blocks to wrap RuntimeExceptions in all compare methods |
| ValueFilter.java | Updated filterCell method signature to throw IOException |
| SingleColumnValueFilter.java | Updated filterCell and filterColumnValue signatures and added exception wrapping |
| RowFilter.java | Updated filterRowKey method signature to throw IOException |
| QualifierFilter.java | Updated filterCell method signature to throw IOException |
| FamilyFilter.java | Updated filterCell method signature to throw IOException |
| DependentColumnFilter.java | Updated filterCell method signature to throw IOException |
| ColumnValueFilter.java | Updated private compareValue method signature and added exception wrapping |
| TestFiltersWithComparatorException.java | New comprehensive test suite with BadComparator to verify exception handling across all filter types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Outdated
Show resolved
Hide resolved
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Outdated
Show resolved
Hide resolved
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Outdated
Show resolved
Hide resolved
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Outdated
Show resolved
Hide resolved
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Outdated
Show resolved
Hide resolved
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Outdated
Show resolved
Hide resolved
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Outdated
Show resolved
Hide resolved
|
Please fix the typo? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Outdated
Show resolved
Hide resolved
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Outdated
Show resolved
Hide resolved
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Show resolved
Hide resolved
…FiltersWithComparatorException.java Co-authored-by: Copilot <[email protected]>
…FiltersWithComparatorException.java Co-authored-by: Copilot <[email protected]>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@droudnitsky Not all the copilot comments need to be addressed... Let me take a look again. |
Apache9
left a comment
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.
Overall LGTM.
Will be good if we can migrate the test to use junit 5.
...-client/src/test/java/org/apache/hadoop/hbase/filter/TestFiltersWithComparatorException.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
Thank you very much for reviewing @Apache9 ! I have migrated the test to junit 5. I believe this patch is also good to be back-ported to 2.x , in terms of client compatibility we are still throwing |
|
Please open a PR against branch-2, usually the patch for branch-2 can be applied to other 2.x branches cleanly. And please fix the error prone warning if possible. Thanks. |
https://issues.apache.org/jira/browse/HBASE-29672
There is a large class of filters:
RowFilter
ValueFilter
QualifierFilter
FamilyFilter
DependentColumnFilter
ColumnValueFilter
SingleColumnValueFilter
SingleColumnValueExcludeFilter
Which take a ByteArrayComparable comparator as an argument (e.g BinaryComparator, RegexStringComparator, BinaryComponentComparator) and apply the given comparator at query runtime on the server. Due to filter misconfiguration/data shape/comparator bugs, a comparator may throw a runtime exception which filters are not currently handling. In this case the runtime exception gets propagated all the way up the call stack, leading to an unexpected throwable at the topmost RpcServer layer and a very unclear remote exception on the client with a very long mysterious server exception trace.
This PR adds runtime exception handling for comparator runtime exceptions and treats them as HBaseIOException, and propagate a clear exception message to the client. This approach will also lets us handle cases where we know that a client retry is guaranteed to fail and let us prevent bad requests from being excessively retried (such as HBASE-29654).
Some context/discussion in #7389