-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29390 Too many logs in AsyncBatchRpcRetryingCaller when hitting… #7105
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
Conversation
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 addresses excessive logging in AsyncBatchRpcRetryingCaller
when many actions fail (e.g., due to RegionTooBusyException
) by batching and sampling error logs, and adds a unit test to verify the new behavior.
- Introduce a static, test-visible
logException
method to sample up to 3 action errors per region and emit a single WARN log. - Update
onComplete
to collect action-level exceptions in anIdentityHashMap
and invoke the new sampling logger. - Refactor an existing WARN log call to use parameterized logging and adjust
RegionRequest
visibility for testing. - Add
TestAsyncBatchRpcRetryingCaller
to validate log sampling, level, and formatting via a mock appender.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncBatchRpcRetryingCaller.java | Added logException for batched error sampling, updated onComplete logic, refactored existing log warning, and changed RegionRequest visibility. |
hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncBatchRpcRetryingCaller.java | New test class using a mock Log4j appender to assert sampling behavior, log level, and message content. |
Comments suppressed due to low confidence (2)
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncBatchRpcRetryingCaller.java:232
- [nitpick] Add a Javadoc comment to
logException
explaining its purpose, the meaning ofstartLogErrorsCnt
, and the sampling behavior to make the API clearer for future maintainers.
static void logException(int tries, int startLogErrorsCnt, RegionRequest regionReq,
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncBatchRpcRetryingCaller.java:232
- [nitpick] The static
logException
overload shares its name with the existing instance-levellogException
. Consider renaming one (e.g.,logSampledErrors
) to reduce confusion.
static void logException(int tries, int startLogErrorsCnt, RegionRequest regionReq,
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncBatchRpcRetryingCaller.java
Outdated
Show resolved
Hide resolved
} | ||
StringWriter sw = new StringWriter(); | ||
PrintWriter action2ErrorWriter = new PrintWriter(sw); | ||
action2ErrorWriter.println(); |
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.
[nitpick] This initial println()
call introduces a leading blank line in the logged message. If consistent log formatting is desired, consider removing or relocating it.
action2ErrorWriter.println(); |
Copilot uses AI. Check for mistakes.
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.
This is intentional, to make the detailed exception information to a new line.
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncBatchRpcRetryingCaller.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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
… RegionTooBusyException
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
+1, LGTM |
… RegionTooBusyException