Skip to content

branch-4.1: [fix](connect) Align COM_RESET_CONNECTION behavior with MySQL #63884#64070

Open
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-63884-branch-4.1
Open

branch-4.1: [fix](connect) Align COM_RESET_CONNECTION behavior with MySQL #63884#64070
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-63884-branch-4.1

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Jun 3, 2026

Cherry-picked from #63884

### What problem does this PR solve?

`COM_RESET_CONNECTION` was accepted by Doris, but its behavior was not
compatible with MySQL. The previous implementation cleared the current
catalog/database state and returned OK after only a partial reset. This
could make pooled clients, such as C# MySqlConnector with
`ConnectionReset=True`, fail later unqualified SQL with `Current
database is not set`. Other session-scoped state, including user
variables and prepared statements, also needed to be reset consistently.

### What is changed?

- Preserve the current catalog/database state across
`COM_RESET_CONNECTION` so pooled connections can continue using the
selected database.
- Reset session variables, user variables, prepared statements, running
query state, insert result, command state, and returned row count.
- Roll back transaction state during reset and return an error if
rollback fails.
- Drop temporary tables during reset and return an error if cleanup
fails.
- Return OK with the autocommit server status when reset succeeds.
- Return the MySQL-compatible unknown prepared statement error when
executing a statement cleared by reset.
- Extend regression and FE unit coverage for reset behavior, error
handling, and current database preservation.
@github-actions github-actions Bot requested a review from yiguolei as a code owner June 3, 2026 09:25
@hello-stephen
Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen
Copy link
Copy Markdown
Contributor

run buildall

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.

2 participants