Skip to content
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

Managing sessions and queries #1828

Merged
merged 8 commits into from
Aug 23, 2017
Merged

Managing sessions and queries #1828

merged 8 commits into from
Aug 23, 2017

Conversation

jseldess
Copy link
Contributor

@jseldess jseldess commented Aug 16, 2017

  • Add 1.1 page for SHOW SESSIONS
  • Add 1.1 page for SHOW QUERIES
  • Add 1.1 page for CANCEL QUERY
  • Add 1.1 page for Managing Long-Running Queries
  • Generate sql diagrams
  • Add statements to 1.1 sidenav
  • Add statements to 1.1 sql statements overview
  • Update Query Behavior Troubleshooting page

Fixes #1562
Fixes #1572
Fixes #1571

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@jseldess jseldess requested review from itsbilal and knz and removed request for knz August 16, 2017 18:28
@jseldess
Copy link
Contributor Author

cc: @knz, @dianasaur323, and @nstewart, if you want to take a look as well.

@jseldess jseldess requested a review from nstewart August 16, 2017 18:31
@jseldess jseldess force-pushed the inspect-sessions-and-queries branch from 60d74b8 to dcdbccb Compare August 16, 2017 18:33
@dianasaur323
Copy link
Contributor

Great, thank you. This is on my list of features to QA, so I'll let you know if I hit any issues.

@jseldess
Copy link
Contributor Author

Actually, @nstewart and @dianasaur323, please hold off on your reviews until @itsbilal gets his in. Want to ensure everything's correct technically. Also need to integrate some changes from cockroachdb/cockroach#17579.

Copy link
Member

@itsbilal itsbilal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Save for the last_active_query field in SHOW SESSIONS (as you pointed out).

You may also wanna mention that you can do queries like:

CANCEL QUERY (SELECT query_id FROM [SHOW CLUSTER QUERIES] WHERE client_address = '192.168.0.72:56194'
          AND username = 'mroach'
          AND query = 'SELECT * FROM test.kv ORDER BY k'); 

Instead of running the SELECT/SHOW first and then copy/pasting the ID into the CANCEL statement.

@jseldess
Copy link
Contributor Author

TFTR, @itsbilal. Just expanded the SHOW SESSIONS to cover last_active_query. Please take a quick look.

I can't quite understand your suggestion about filtering above. I think part of your query got truncated?

@itsbilal
Copy link
Member

@jseldess The initial message got truncated but I edited it. Take another look? It's basically just the nesting of a SELECT inside the CANCEL QUERY.

LGTM otherwise. It's your call on whether to mention the nested query example in the docs or not, but I'd argue it's a very useful one to have in there.

@jseldess jseldess force-pushed the inspect-sessions-and-queries branch from bfbb23a to a5ef25a Compare August 17, 2017 18:56
@jseldess
Copy link
Contributor Author

jseldess commented Aug 17, 2017

Added your nested query example, @itsbilal. Thanks! Also added a dummy SHOW JOBS page to fix broken links. Will tackle that page in a follow-up PR.

@jseldess
Copy link
Contributor Author

@nstewart, @dianasaur323, PTAL when you have time.

@jseldess jseldess force-pushed the inspect-sessions-and-queries branch from a5ef25a to d03fd7d Compare August 18, 2017 01:13
@jseldess
Copy link
Contributor Author

Ping, @nstewart.

@jseldess jseldess force-pushed the inspect-sessions-and-queries branch from d03fd7d to c6c7c83 Compare August 21, 2017 21:15
@jseldess jseldess changed the title Inspecting active sessions and queries Managing sessions and queries Aug 21, 2017
@jseldess
Copy link
Contributor Author

@itsbilal, I ended up expanding this PR to cover CANCEL QUERY and another high-level page on Managing Long-Running Queries that links the disparate SQL statements. PTAL.

@jseldess jseldess force-pushed the inspect-sessions-and-queries branch from c6c7c83 to 58430df Compare August 22, 2017 01:28
@jseldess
Copy link
Contributor Author

Might need to integrate changes from cockroachdb/cockroach#17739.

@itsbilal
Copy link
Member

When the cancelled query is part of a multi-statement transaction, CockroachDB aborts the transaction and sends a query execution cancelled error to the client, at which point the client should issue a ROLLBACK statement.

This seems to imply that CANCEL QUERY only works for queries in multi-statement transactions, and that it won't do anything for autocommit queries. It would be good to mention that it does cancel standalone/autocommit queries too. However cancellation isn't guaranteed; if the request is received too late, the query could still run till completion. That should probably be stated too.

Also note that the spelling of cancelled in the query execution cancelled error has been changed to canceled in cockroachdb/cockroach#17739 .

@jseldess jseldess force-pushed the inspect-sessions-and-queries branch from 58430df to fd31a6c Compare August 23, 2017 01:59
@jseldess
Copy link
Contributor Author

Thanks, @itsbilal. Made updates.

@jseldess jseldess force-pushed the inspect-sessions-and-queries branch from fd31a6c to 93b5eb7 Compare August 23, 2017 13:58
@jseldess jseldess merged commit 37d57f6 into master Aug 23, 2017
@jseldess jseldess deleted the inspect-sessions-and-queries branch August 23, 2017 14:15
@dianasaur323
Copy link
Contributor

dianasaur323 commented Sep 17, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants