-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
IGNITE-17086 Warnings added for long lazy SQL queries #11405
Closed
Closed
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b79b7b5
IGNITE-17086 MapQueryResult#executeWithTimer added
oleg-vlsk 64b7ce7
IGNITE-17086 Execution with timer refactored for queries and fetches
oleg-vlsk ad0eda4
IGNITE-17086 Test refactoring
oleg-vlsk b32155b
IGNITE-17086 Test refactoring
oleg-vlsk 088a450
IGNITE-17086 Long query tracking has been bound to H2ResultSetIterato…
oleg-vlsk 607f640
IGNITE-17086 Minor refactoring
oleg-vlsk 35f430d
IGNITE-17086 Minor refactoring
oleg-vlsk b96f1d8
Revert "IGNITE-17086 Long query tracking has been bound to H2ResultSe…
oleg-vlsk 11c3b6c
IGNITE-17086 Separate tracking for Map and Reduce phases, introductio…
oleg-vlsk 36a6d9f
IGNITE-17086 Minor refactoring
oleg-vlsk 1650a4d
IGNITE-17086 LongRunningQueryTest#testLazyWithExternalWait added
oleg-vlsk 3d76931
IGNITE-17086 External wait checks added for local queries
oleg-vlsk 1c455fb
IGNITE-17086 Corrections as per review
oleg-vlsk 1454fc0
IGNITE-17086 Minor refactoring of GridMapQueryExecutor#onNextPageRequest
oleg-vlsk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -446,6 +446,8 @@ private void onQueryRequest0( | |
|
||
qryResults.addResult(qryIdx, res); | ||
|
||
MapH2QueryInfo qryInfo = null; | ||
|
||
try { | ||
res.lock(); | ||
|
||
|
@@ -460,7 +462,9 @@ private void onQueryRequest0( | |
|
||
H2Utils.bindParameters(stmt, params0); | ||
|
||
MapH2QueryInfo qryInfo = new MapH2QueryInfo(stmt, qry.query(), node.id(), qryId, reqId, segmentId); | ||
qryInfo = new MapH2QueryInfo(stmt, qry.query(), node.id(), qryId, reqId, segmentId); | ||
|
||
h2.heavyQueriesTracker().startTracking(qryInfo); | ||
|
||
if (performanceStatsEnabled) { | ||
ctx.performanceStatistics().queryProperty( | ||
|
@@ -472,14 +476,20 @@ private void onQueryRequest0( | |
); | ||
} | ||
|
||
ResultSet rs = h2.executeSqlQueryWithTimer( | ||
stmt, | ||
conn, | ||
sql, | ||
timeout, | ||
qryResults.queryCancel(qryIdx), | ||
dataPageScanEnabled, | ||
qryInfo); | ||
GridQueryCancel qryCancel = qryResults.queryCancel(qryIdx); | ||
|
||
ResultSet rs = h2.executeWithResumableTimeTracking( | ||
() -> h2.executeSqlQueryWithTimer( | ||
stmt, | ||
conn, | ||
sql, | ||
timeout, | ||
qryCancel, | ||
dataPageScanEnabled, | ||
null | ||
), | ||
qryInfo | ||
); | ||
|
||
if (evt) { | ||
ctx.event().record(new CacheQueryExecutedEvent<>( | ||
|
@@ -507,14 +517,21 @@ private void onQueryRequest0( | |
|
||
res.openResult(rs, qryInfo); | ||
|
||
final GridQueryNextPageResponse msg = prepareNextPage( | ||
nodeRess, | ||
node, | ||
qryResults, | ||
qryIdx, | ||
segmentId, | ||
pageSize, | ||
dataPageScanEnabled | ||
MapQueryResults qryResults0 = qryResults; | ||
|
||
int qryIdx0 = qryIdx; | ||
|
||
final GridQueryNextPageResponse msg = h2.executeWithResumableTimeTracking( | ||
() -> prepareNextPage( | ||
nodeRess, | ||
node, | ||
qryResults0, | ||
qryIdx0, | ||
segmentId, | ||
pageSize, | ||
dataPageScanEnabled | ||
), | ||
qryInfo | ||
); | ||
|
||
if (msg != null) | ||
|
@@ -528,6 +545,12 @@ private void onQueryRequest0( | |
|
||
qryIdx++; | ||
} | ||
catch (Throwable e) { | ||
if (qryInfo != null) | ||
h2.heavyQueriesTracker().stopTracking(qryInfo, e); | ||
|
||
throw e; | ||
} | ||
finally { | ||
try { | ||
res.unlockTables(); | ||
|
@@ -862,14 +885,18 @@ else if (qryResults.cancelled()) | |
|
||
Boolean dataPageScanEnabled = isDataPageScanEnabled(req.getFlags()); | ||
|
||
GridQueryNextPageResponse msg = prepareNextPage( | ||
nodeRess, | ||
node, | ||
qryResults, | ||
req.query(), | ||
req.segmentId(), | ||
req.pageSize(), | ||
dataPageScanEnabled); | ||
GridQueryNextPageResponse msg = h2.executeWithResumableTimeTracking( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tracking is not stopped in case of exception here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stopping the time tracking is added to the catch section. |
||
() -> prepareNextPage( | ||
nodeRess, | ||
node, | ||
qryResults, | ||
req.query(), | ||
req.segmentId(), | ||
req.pageSize(), | ||
dataPageScanEnabled | ||
), | ||
res.qryInfo() | ||
); | ||
|
||
if (msg != null) | ||
sendNextPage(node, msg); | ||
|
@@ -939,6 +966,9 @@ private GridQueryNextPageResponse prepareNextPage( | |
if (last) { | ||
qr.closeResult(qry); | ||
|
||
if (res.qryInfo() != null) | ||
h2.heavyQueriesTracker().stopTracking(res.qryInfo(), null); | ||
|
||
if (qr.isAllClosed()) { | ||
nodeRess.remove(qr.queryRequestId(), segmentId, qr); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think explicit lock is redundant, synchronized method can be used.
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.
Corrected.