-
Notifications
You must be signed in to change notification settings - Fork 14k
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
[sqllab] Help sqllab forget query history #4833
[sqllab] Help sqllab forget query history #4833
Conversation
163ddda
to
5ea9dd9
Compare
I've been meaning to do something like this. I wonder if the state should be altered though, like setting the state to |
I agree with @mistercrunch it would be great to change the state in the |
5ea9dd9
to
e47d8a5
Compare
Okay, I will change the logic to set all pending or running queries older than 6 hours old to failed. |
Codecov Report
@@ Coverage Diff @@
## master #4833 +/- ##
==========================================
- Coverage 77.09% 77.07% -0.02%
==========================================
Files 44 44
Lines 8551 8558 +7
==========================================
+ Hits 6592 6596 +4
- Misses 1959 1962 +3
Continue to review full report at Codecov.
|
@timifasubaa I wonder if |
There is a lot of repeated logic with stop_query for the new timedout query logic. |
138dc75
to
ab18e5f
Compare
@@ -16,12 +17,23 @@ class QueryAutoRefresh extends React.PureComponent { | |||
componentWillUnmount() { | |||
this.stopTimer(); | |||
} | |||
timeoutOldQueries() { |
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 logic should not be in front-end (browser-side).
Query table knows each query started time. it doesn't need front-end sends ajax call to set query state.
when front-end ask a query's status, server side should first check the query's start time, if
- longer than 6 hours old: set it timeout and return timeout state.
- < 6 hours: return its current status.
1ed8142
to
9d2e516
Compare
I changed the logic to update the db's sate to timeout before it responds to polls. |
b922df7
to
a43bc2f
Compare
@john-bodley @mistercrunch @graceguo-supercat ready for review |
dc1ef37
to
a67faa0
Compare
PING Quick update on the state of the logic. Is this backend code worth having? Especially since it may trick people into believing we actually timeout the queries when the query will most likely not be updated to timeout. |
current auto query refresh component work like this:
this PR LGTM. but will not merge until @mistercrunch feel comfortable. Thank you! |
return Object.values(queries) | ||
.some( | ||
q => ['running', 'started', 'pending', 'fetching'].indexOf(q.state) >= 0 && | ||
now - q.startDttm < 21600000, |
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.
No hard coded values please. Put it in src/SqlLab/constants.js
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.
Done
a67faa0
to
ab958c6
Compare
…e_past [sqllab] Help sqllab forget query history
(cherry picked from commit 2014329)
(cherry picked from commit 03cae41)
(cherry picked from commit 2014329)
In the sqllab asynchronous polling logic, it looks through the query history and continues to poll if there is a query in the history that is not successful.
This PR makes it look only at the last 6 hours of queries when checking for their states. The rationale is that a query that was started 6 hours ago is probably dead or problematic and should be rerun.
@graceguo-supercat @mistercrunch @john-bodley