Conversation
dain
commented
Sep 19, 2018
- Fix warnings
- Extract out complex book keeping like query timeout tracking
- Simplify session creation code
- Prepare manager for split into dispatcher and coordinator
8c52864 to
f406efc
Compare
|
Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours has expired. Before we can review or merge your code, we need you to email cla@fb.com with your details so we can update your status. |
f406efc to
0161718
Compare
raghavsethi
left a comment
There was a problem hiding this comment.
Fix IntelliJ warnings LGTM
raghavsethi
left a comment
There was a problem hiding this comment.
Move worker specific bindings to WorkerModule LGTM
raghavsethi
left a comment
There was a problem hiding this comment.
Fix raw use of ResourceGroupManager type LGTM. Thank you for cleaning up my mess.
raghavsethi
left a comment
There was a problem hiding this comment.
Add abstraction for applying default session properties LGTM with nits.
presto-main/src/main/java/com/facebook/presto/execution/SqlQueryManager.java
Outdated
Show resolved
Hide resolved
|
The changes to auto commit handling depend on #11511. The |
raghavsethi
left a comment
There was a problem hiding this comment.
Add abstraction for processing prepared statement has minor comments.
presto-main/src/main/java/com/facebook/presto/execution/QueryPreparation.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/execution/QueryPreparation.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/execution/SqlQueryManager.java
Outdated
Show resolved
Hide resolved
raghavsethi
left a comment
There was a problem hiding this comment.
Add abstraction to manage abandonment and expiration of queries LGTM. As far as I can tell, this a pure refactor, no functional changes, right?
presto-main/src/main/java/com/facebook/presto/execution/QueryTracker.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/execution/QueryTracker.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
How would this appear in debugging/ops tools? What would the object name be?
There was a problem hiding this comment.
Actually, this is totally wrong. QueryTracker is not exported to JMX, so it won't show up at all. I'm going to change query tracker to take the executor in the constructor, and will use the existing executor in the SqlQueryManager, so there will be no change to the existing JMX exports.
presto-main/src/main/java/com/facebook/presto/execution/QueryTracker.java
Outdated
Show resolved
Hide resolved
raghavsethi
left a comment
There was a problem hiding this comment.
Simplify FailedQueryExecution has some question marks
presto-main/src/main/java/com/facebook/presto/execution/FailedQueryExecution.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
I've never seen a public logger shared between classes. Not sure why we went in this direction.
There was a problem hiding this comment.
The QUERY_STATE_LOG is a special log that all of the query state changes are logged to, and I want to maintain that behavior.
There was a problem hiding this comment.
Don't all failed queries become a FailedQueryExecution (including ones with resource groups)?
There was a problem hiding this comment.
It makes the code a bit messier. How important is it to have this?
raghavsethi
left a comment
There was a problem hiding this comment.
Inline FailedQueryExecution static factory LGTM
raghavsethi
left a comment
There was a problem hiding this comment.
Remove unnecessary metadata cleanup in SqlQueryManager LGTM assuming you're sure that there is no case where metadata is created for a failed execution.
There was a problem hiding this comment.
I thought there might be a race between the two calls, but it seems the only way to remove the transaction is to call asyncAbort which is guarded by the state machine.
There was a problem hiding this comment.
the extra call is required for ROLLBACK which immediately removes the transaction from the manager, so without the exists check the call to isAutoCommit fails. I looked as having an explicit check for ROLLBACK here, but that would require breaking to many abstractions. I also looked at making isAutoCommit, return Optional, or just false, for unknown queries, but that makes is difficult to work with in the normal case.
There was a problem hiding this comment.
I think we can get rid of transactionControl now, here and all the way up, including in DataDefinitionTask.
There was a problem hiding this comment.
@electrum transactionControl is used on the next line of this code: if (!session.getTransactionId().isPresent() && !transactionControl) {
c883d82 to
497e2e5
Compare
|
@raghavsethi changes applied. Please review again. |
|
I reviewed the two transaction related commits and they look good. |
c5faf04 to
83568a2
Compare
|
Looks good to merge after rebase + tests. |
83568a2 to
26c7586
Compare
26c7586 to
921fcf2
Compare
Application of defaults during session creation conflicts with resource group selection and query parsing. Separating out the application of default session properties allows us to refactor query creation in SqlQueryManager.
Processing and validation of prepared statements is complex and performed in several locations.
Instead of using a QueryStateMachine to create QueryInfo, add helpers to directly create a QueryInfo for a failed query. Also add cleanup performed by QueryStateMachine to FailedQueryExecution.
When a query fails during construction of QueryExecution, the metadata system for the query has not be initialized, so clean up of metadata is not necessary.
921fcf2 to
2002a15
Compare