Sergei Golubchik
bead24b7f3
mariadb-test: wait on disconnect
...
Remove one of the major sources of race condiitons in mariadb-test.
Normally, mariadb_close() sends COM_QUIT to the server and immediately
disconnects. In mariadb-test it means the test can switch to another
connection and sends queries to the server before the server even
started parsing the COM_QUIT packet and these queries can see the
connection as fully active, as it didn't reach dispatch_command yet.
This is a major source of instability in tests and many - but not all,
still less than a half - tests employ workarounds. The correct one
is a pair count_sessions.inc/wait_until_count_sessions.inc.
Also very popular was wait_until_disconnected.inc, which was completely
useless, because it verifies that the connection is closed, and after
disconnect it always is, it didn't verify whether the server processed
COM_QUIT. Sadly the placebo was as widely used as the real thing.
Let's fix this by making mariadb-test `disconnect` command _to wait_ for
the server to confirm. This makes almost all workarounds redundant.
In some cases count_sessions.inc/wait_until_count_sessions.inc is still
needed, though, as only `disconnect` command is changed:
* after external tools, like `exec $MYSQL`
* after failed `connect` command
* replication, after `STOP SLAVE`
* Federated/CONNECT/SPIDER/etc after `DROP TABLE`
and also in some XA tests, because an XA transaction is dissociated from
the THD very late, after the server has closed the client connection.
Collateral cleanups: fix comments, remove some redundant statements:
* DROP IF EXISTS if nothing is known to exist
* DROP table/view before DROP DATABASE
* REVOKE privileges before DROP USER
etc
2025-07-16 09:14:33 +07:00
..
2018-05-19 14:23:06 +03:00
2025-07-16 09:14:33 +07:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2019-04-12 12:28:09 +03:00
2013-11-08 23:23:35 +04:00
2012-07-16 06:17:56 +04:00
2017-06-03 02:47:52 +03:00
2013-02-03 02:53:57 +04:00
2017-06-03 02:47:52 +03:00
2020-08-21 14:48:53 +03:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2018-02-15 18:41:32 +02:00
2018-02-15 18:41:32 +02:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2016-10-05 01:11:08 +03:00
2013-02-03 02:53:57 +04:00
2016-10-05 01:11:08 +03:00
2012-07-16 06:17:56 +04:00
2016-10-05 01:11:08 +03:00
2013-02-03 02:53:57 +04:00
2016-10-05 01:11:08 +03:00
2013-02-03 02:53:57 +04:00
2012-07-16 06:17:56 +04:00
2020-02-13 13:42:01 +02:00
2020-02-13 13:42:01 +02:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2025-07-16 09:14:33 +07:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2017-06-03 02:47:52 +03:00
2025-07-08 12:30:27 +03:00
2015-08-26 02:09:57 +03:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-11-28 19:54:07 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2025-07-16 09:14:33 +07:00
2013-02-03 02:53:57 +04:00
2025-07-16 09:14:33 +07:00
2013-02-03 02:53:57 +04:00
2025-07-16 09:14:33 +07:00
2014-09-15 20:33:11 +04:00
2014-09-15 20:33:11 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2016-03-31 10:11:16 +04:00
2025-07-16 09:14:33 +07:00
2013-02-03 02:53:57 +04:00
2025-07-16 09:14:33 +07:00
2012-07-16 06:17:56 +04:00
2018-02-24 00:50:58 +01:00
2012-07-16 06:17:56 +04:00
2013-11-11 23:40:40 +04:00
2013-11-07 03:36:53 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2021-05-24 11:38:13 +05:30
2018-05-03 20:54:23 +03:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2025-07-16 09:14:33 +07:00
2015-09-06 21:01:59 +03:00
2015-09-06 21:01:59 +03:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2018-02-15 18:41:32 +02:00
2018-02-15 18:41:32 +02:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2017-06-03 02:47:52 +03:00
2017-06-03 02:47:52 +03:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2017-06-03 02:47:52 +03:00
2017-06-03 02:47:52 +03:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2017-06-03 02:47:52 +03:00
2017-06-03 02:47:52 +03:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2017-06-23 00:34:57 +03:00
2018-02-15 18:41:32 +02:00
2018-02-15 18:41:32 +02:00
2013-02-03 02:53:57 +04:00
2017-06-23 00:34:57 +03:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2012-07-16 06:17:56 +04:00
2017-12-13 00:29:44 +02:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2018-12-21 18:58:23 +02:00
2012-07-16 06:17:56 +04:00
2023-09-30 14:43:12 +02:00
2023-09-30 14:43:12 +02:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2017-06-03 02:47:52 +03:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-11-08 23:21:58 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2016-10-05 01:11:08 +03:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-11-08 23:21:58 +04:00
2012-07-16 06:17:56 +04:00
2017-08-08 10:18:43 +02:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2017-08-08 10:18:43 +02:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-11-08 23:21:58 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-11-08 23:21:58 +04:00
2012-07-16 06:17:56 +04:00
2012-07-16 06:17:56 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2025-07-16 09:14:33 +07:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2013-02-03 02:53:57 +04:00
2019-03-27 12:26:11 +02:00
2013-02-03 02:53:57 +04:00