-
Notifications
You must be signed in to change notification settings - Fork 1.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
Clean up BrokerRequestHandler and BrokerResponse #13179
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #13179 +/- ##
============================================
+ Coverage 61.75% 62.21% +0.46%
+ Complexity 207 198 -9
============================================
Files 2436 2527 +91
Lines 133233 138313 +5080
Branches 20636 21394 +758
============================================
+ Hits 82274 86050 +3776
- Misses 44911 45833 +922
- Partials 6048 6430 +382
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
aa1e0a7
to
ea983ce
Compare
ea983ce
to
86c9ed3
Compare
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.
lgtm
/** | ||
* Set the number of servers responded to the broker. | ||
* | ||
* @param numServersResponded number of servers responded. | ||
* Sets the result table. We expose this method to allow modifying the results on the client side, e.g. hiding the | ||
* results and only showing the stats. | ||
*/ | ||
void setNumServersResponded(int numServersResponded); | ||
void setResultTable(@Nullable ResultTable resultTable); |
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 seems to be the only mutable method in this interface. Wouldn't be better to implement the case shown in the example using a delegate/decorate pattern? Basically having an implementation that delegates all methods but getResultTable
and getNumRowsResultSet
to a another BrokerResponse
stored as attribute
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 feel that is a little bit overkilling if the only benefit is getting rid of this setter. I'm not a big fan of this only setter as well, but I feel it is much simpler and easier to understand if we want to allow client to override it
As of PR apache#13179, the query response time metrics started to get extremely high for all tables. The root cause tured out to be a missed initialization in which the query arrival time was set to 0 by default. The refactor broke the contract that the broker request handler always returns the time taken to handle the request. Added code to initialize the arrival time. Since the refactor attempted to include client pre-processing time, added this code under the condition that the value is not already set. Ideally, callers of the method should add on their own pre and post-processing time to the time returned by the handleRequest() method.
* Fix query response time metric As of PR #13179, the query response time metrics started to get extremely high for all tables. The root cause tured out to be a missed initialization in which the query arrival time was set to 0 by default. The refactor broke the contract that the broker request handler always returns the time taken to handle the request. Added code to initialize the arrival time. Since the refactor attempted to include client pre-processing time, added this code under the condition that the value is not already set. Ideally, callers of the method should add on their own pre and post-processing time to the time returned by the handleRequest() method. * Changed as per review comments and offline discussion * Added comments
Clean up
BrokerRequestHandler
:BaseBrokerRequestHandler
BaseSingleStageRequestHandler
for the single-stage methodsClean up
BrokerResponse
:BrokerResponse
BrokerResponseNative
andBrokerResponseNativeV2
Refactor
BrokerQueryEventListenerFactory
to be easier to use and more efficientIncompatible
BrokerResponse
andBrokerRequestHandler
, which might cause compile failure, but no backward incompatibility introduced