Commit e9a146d
authored
[fix](connect) Align COM_RESET_CONNECTION behavior with MySQL (#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.1 parent 88185e8 commit e9a146d
6 files changed
Lines changed: 366 additions & 18 deletions
File tree
- fe/fe-core/src
- main/java/org/apache/doris/qe
- test/java/org/apache/doris/qe
- regression-test
- framework/src/main/groovy/org/apache/doris/regression/suite
- suites/query_p0/session_variable
Lines changed: 88 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| 117 | + | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| |||
128 | 130 | | |
129 | 131 | | |
130 | 132 | | |
131 | | - | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| |||
369 | 371 | | |
370 | 372 | | |
371 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
372 | 415 | | |
373 | 416 | | |
374 | 417 | | |
| |||
385 | 428 | | |
386 | 429 | | |
387 | 430 | | |
388 | | - | |
| 431 | + | |
389 | 432 | | |
390 | 433 | | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | 434 | | |
395 | 435 | | |
396 | 436 | | |
| |||
490 | 530 | | |
491 | 531 | | |
492 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
493 | 545 | | |
494 | 546 | | |
495 | 547 | | |
| |||
911 | 963 | | |
912 | 964 | | |
913 | 965 | | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
914 | 974 | | |
915 | 975 | | |
916 | 976 | | |
917 | 977 | | |
918 | 978 | | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
919 | 984 | | |
920 | 985 | | |
921 | | - | |
922 | | - | |
923 | | - | |
| 986 | + | |
| 987 | + | |
924 | 988 | | |
925 | 989 | | |
| 990 | + | |
926 | 991 | | |
927 | 992 | | |
928 | | - | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
929 | 1001 | | |
930 | 1002 | | |
931 | 1003 | | |
932 | 1004 | | |
933 | 1005 | | |
934 | 1006 | | |
935 | 1007 | | |
936 | | - | |
937 | | - | |
| 1008 | + | |
| 1009 | + | |
938 | 1010 | | |
939 | 1011 | | |
940 | 1012 | | |
| |||
945 | 1017 | | |
946 | 1018 | | |
947 | 1019 | | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
948 | 1025 | | |
949 | 1026 | | |
950 | 1027 | | |
| |||
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
| |||
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
| |||
214 | 220 | | |
215 | 221 | | |
216 | 222 | | |
217 | | - | |
218 | | - | |
| 223 | + | |
| 224 | + | |
219 | 225 | | |
220 | 226 | | |
221 | 227 | | |
| |||
0 commit comments