HBASE-23941 : FilterBy operator support in get_slowlog_responses API#1793
HBASE-23941 : FilterBy operator support in get_slowlog_responses API#1793virajjasani merged 2 commits intoapache:masterfrom
Conversation
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
bharathv
left a comment
There was a problem hiding this comment.
Try to make the make it a little concise, otherwise looks fine.
| AdminProtos.SlowLogResponseRequest request, | ||
| List<TooSlowLog.SlowLogPayload> slowLogPayloadList) { | ||
| List<TooSlowLog.SlowLogPayload> filteredSlowLogPayloads = new ArrayList<>(); | ||
| int totalFilters = getTotalFiltersCount(request); |
There was a problem hiding this comment.
if (filterCount == 0) {
return ...
}
| int totalFilters = getTotalFiltersCount(request); | ||
| for (TooSlowLog.SlowLogPayload slowLogPayload : slowLogPayloadList) { | ||
| int totalFilterMatches = 0; | ||
| if (StringUtils.isNotEmpty(request.getRegionName())) { |
There was a problem hiding this comment.
Apply only the filters that are actually in the request, why check if a filter exists in every iteration?
|
|
||
| static List<TooSlowLog.SlowLogPayload> getFilteredLogs( | ||
| AdminProtos.SlowLogResponseRequest request, List<TooSlowLog.SlowLogPayload> logPayloadList) { | ||
| if (isFilterProvided(request)) { |
There was a problem hiding this comment.
no need for this if you implement the above logic I suggested..
| return logPayloadList.subList(0, limit); | ||
| } | ||
|
|
||
| private static boolean isFilterProvided(AdminProtos.SlowLogResponseRequest request) { |
There was a problem hiding this comment.
and you can remove this..
|
🎊 +1 overall
This message was automatically generated. |
ndimiduk
left a comment
There was a problem hiding this comment.
This change looks good to me.
Reading through your examples, I realize it would have been nice if we supported filter operations other than equality. String prefix and regex come to mind, for matching tables, say, by namespace, or regions by rowkey range. Another idea is CIDR matching of client IP addresses by subnet.
|
💔 -1 overall
This message was automatically generated. |
bharathv
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround, lgtm.
That's quite interesting idea 👍 |
…1793) Signed-off-by: Bharath Vissapragada <bharathv@apache.org> Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
…1793) Signed-off-by: Bharath Vissapragada <bharathv@apache.org> Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
…pache#1793) Signed-off-by: Bharath Vissapragada <bharathv@apache.org> Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
No description provided.