-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Push taskId filter down to storage layer in AsyncProfilerTaskLog query #13787
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
Changes from all commits
20050ba
d176f60
44983a6
47c05b0
0785951
623b963
0e804ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,13 +47,14 @@ public AsyncProfilerTaskLogQueryEsDAO(ElasticSearchClient client, int queryMaxSi | |
| } | ||
|
|
||
| @Override | ||
| public List<AsyncProfilerTaskLog> getTaskLogList() throws IOException { | ||
| public List<AsyncProfilerTaskLog> getTaskLogList(String taskId) throws IOException { | ||
| final String index = IndexController.LogicIndicesRegister.getPhysicalTableName( | ||
| AsyncProfilerTaskLogRecord.INDEX_NAME); | ||
| final BoolQueryBuilder query = Query.bool(); | ||
| if (IndexController.LogicIndicesRegister.isMergedTable(AsyncProfilerTaskLogRecord.INDEX_NAME)) { | ||
| query.must(Query.term(IndexController.LogicIndicesRegister.RECORD_TABLE_NAME, AsyncProfilerTaskLogRecord.INDEX_NAME)); | ||
| } | ||
| query.must(Query.term(AsyncProfilerTaskLogRecord.TASK_ID, taskId)); | ||
| final SearchBuilder search = | ||
|
Comment on lines
49
to
58
|
||
| Search.builder().query(query) | ||
| .sort(AsyncProfilerTaskLogRecord.OPERATION_TIME, Sort.Order.DESC) | ||
|
|
||
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.
getTaskLogList(taskId)is now called directly and the ES implementation usesQuery.term(..., taskId)which throws a NullPointerException whentaskIdis null. To keep behavior consistent across storage implementations (JDBC would just bind null) and avoid unexpected NPEs, add a fast-fail/guard here (e.g., validatetaskIdis non-null/non-blank and return empty list or throw an IllegalArgumentException with a clear message) before invoking the DAO.