Skip to content

Improve the driver's interactions with SHOW PROCESSLIST and KILL.#215

Merged
coffeegoddd merged 20 commits into
mainfrom
aaron/process-list
Mar 26, 2026
Merged

Improve the driver's interactions with SHOW PROCESSLIST and KILL.#215
coffeegoddd merged 20 commits into
mainfrom
aaron/process-list

Conversation

@reltuk
Copy link
Copy Markdown
Contributor

@reltuk reltuk commented Mar 23, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the embedded driver’s integration with go-mysql-server’s ProcessList so that SHOW PROCESSLIST and KILL QUERY behave more like the server path, including creating a per-query context and ensuring query lifecycle transitions are reflected correctly.

Changes:

  • Introduces per-query contexts (with unique PIDs) and wires query begin/end to the engine ProcessList.
  • Updates row-set closing behavior to end queries when Rows.Close() is called.
  • Refactors smoke test DB initialization/cleanup and adds a new smoke test covering SHOW PROCESSLIST and KILL QUERY.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
conn.go Adds per-query context creation (beginQuery) / cleanup (endQuery) and removes connections from ProcessList on close.
connector.go Builds a session/context that registers connections with the engine ProcessList.
statement.go Routes statement execution through DoltConn.beginQuery and uses per-query contexts for engine calls.
rows.go Ends the active query in the process list when rows are closed.
smoke_test.go Refactors test DB setup/cleanup, switches many tests to t.Context(), and adds a SHOW PROCESSLIST / KILL QUERY smoke test.
Comments suppressed due to low confidence (1)

conn.go:52

  • Prepare updates d.gmsCtx's QueryTime, but queries now execute against the per-query queryCtx created in beginQuery. That means QueryTime updates on d.gmsCtx will no longer affect functions that read ctx.QueryTime (e.g., NOW()) when a ProcessList is present. Consider setting QueryTime on freshCtx/queryCtx inside beginQuery (and updating the comment in Prepare, since the context is no longer reused for execution).
// Prepare packages up |query| as a *doltStmt so it can be executed. If multistatements mode
// has been enabled, then a *doltMultiStmt will be returned, capable of executing multiple statements.
func (d *DoltConn) Prepare(query string) (driver.Stmt, error) {
	// Reuse the same ctx instance, but update the QueryTime to the current time.
	// Statements are executed serially on a connection, so it's safe to reuse
	// the same ctx instance and update the time.
	d.gmsCtx.SetQueryTime(time.Now())


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread conn.go
Comment thread smoke_test.go Outdated
Comment thread smoke_test.go Outdated
Comment thread smoke_test.go Outdated
Copy link
Copy Markdown
Contributor

@coffeegoddd coffeegoddd left a comment

Choose a reason for hiding this comment

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

A few questions/comments.

Comment thread conn.go Outdated
Comment thread conn.go Outdated
Comment thread smoke_test.go Outdated
Comment thread statement.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread smoke_test.go Outdated
Comment thread conn.go
Comment thread conn.go
Comment thread result.go
Comment thread smoke_test.go Outdated
Comment thread smoke_test.go Outdated
Comment thread smoke_test.go Outdated
Comment thread transaction.go
Comment thread connector.go Outdated
@coffeegoddd coffeegoddd merged commit ae3b64f into main Mar 26, 2026
3 checks passed
@coffeegoddd coffeegoddd deleted the aaron/process-list branch March 26, 2026 16:51
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