1257 Commits

Author SHA1 Message Date
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
212fad1b7e MDEV-36397 Record change_user command in MTR output
MTR .result files currently do not contain output to indicate if a
change_user command has been executed in the corresponding .test files.

Record change_user command in the following format in MTR output only if
disable_query_log is set to false: change_user <user>,<password>,<db>;

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
2025-06-23 20:38:36 +02:00
dfcb5c91e0 Merge branch '11.8' into 12.0 2025-06-18 07:50:39 +02:00
a65f7dc71d Merge branch '11.4' into 11.8 2025-06-18 07:43:24 +02:00
89c7e2b9c7 Merge branch '10.11' into 11.4 2025-06-17 09:50:22 +02:00
3da36fa130 Merge 10.6 into 10.11 2025-05-26 08:10:47 +03:00
fbd736c872 mysqltest: result_format fix
--result_format 2 command fails with assertion:

DbugExit (why=0x7fffffff49e0 "missing DBUG_RETURN or DBUG_VOID_RETURN
macro in function \"do_result_format_version\"\n") at
../src/dbug/dbug.c:2045
2025-05-21 11:10:09 +03:00
0737d8f35d MDEV-33281 Fix mysql-test-run to correctly handle hints
After commit 408a637b87 for MDEV-29344
the mysql-test framework started to misinterpret slash/star sequences for
statements looking like this:
  SELECT /* BNL(t1) */* FROM t1, t2
where there is no space after closing `*/` and the following `*`.
This commit fixes that misinterpretation
2025-05-05 12:02:47 +07:00
26ea37be5d MDEV-36405 Session tracking does not report changes from COM_CHANGE_USER
report all sysvar tracker changes, as for the new login.
also report db and other session state changes.
2025-05-03 12:06:36 +02:00
4042652d7f Improvements to mtr
- Added option $backup_on_restart to store a backup of the var/
  directory after restart. This is useful for debugging recovery.
- The list_files option in mysqltest is now returning the number of
  found files in $sys_files. This is useful to break test if there are
  unknown or lost files in the data directory.
2025-04-28 12:59:39 +03:00
9b824e62d4 Merge branch '11.8' into main 2025-04-18 17:11:01 +02:00
bb1d88b6dc Merge 11.4 into 11.8 2025-04-02 14:07:01 +03:00
f5bd250f5b Merge 10.11 into 11.4 2025-03-28 13:55:21 +02:00
5f7c2a617f Fix typos in C comments in miscellaneous files 2025-03-24 13:36:28 +11:00
408a637b87 MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error)
The syntax error produced on running the test engines/iuds.insert_time
in PS-mode was caused by presence of the C-Style comment containing
the single quote at the end of SQL statement, something like
the following one:
  /* doesn't throw error */;
Presence of the single quote was interpreted by mysqltest utility as
indication of real string literal, that resulted in consuming every
characters following that mark as a literal, including the delimiter
character ';'. It led to concatenation of lines into a single
multi-statement that was sent from mysqltest to MariaDB server for
processing. In case mysqltest is run in regular mode (that is,
not PS-mode), multi-statement is handled successfully on server side,
but in case PS-mode is on, multi-statement is supplied in COM_STMT_PREPARE
that caused the parsing error since multi-statements is not supported by
statement prepare command.

To fix the issue, in case mysqltest encounters the C-Style comment
is should switch to reading next following characters without any
processing until it hit the closing C-style comment marks '*/',
with one exception if the sequence of characters '/*' followed by
the exclamation mark, that means the hint introducer has been read.
2025-03-17 18:11:51 +07:00
618afa32ce Tag mysqltest formatters with ATTRIBUTE_FORMAT
Let GCC `-Wformat` check the formats sent to these `my_vsnprintf`
users and migrate them from the old `%b` to the new `%sB`
2025-02-11 20:32:55 +01:00
e7f7789482 cleanup: select ... into tests
* automatically disable ps2 and cursor protocol when the
  select statement returns no result set
* remove manual {disable|enable}_{ps2|cursor}_protocol from around
  `select ... into` in tests
* other misc collateral test cleanups
2025-02-11 20:31:25 +01:00
ba01c2aaf0 Merge branch '11.4' into 11.7
* rpl.rpl_system_versioning_partitions updated for MDEV-32188
* innodb.row_size_error_log_warnings_3 changed error for MDEV-33658
  (checks are done in a different order)
2025-02-06 16:46:36 +01:00
f1a7693bc0 Merge branch '10.11' into 11.4 2025-01-14 23:45:41 +01:00
221aa5e08f Merge branch '10.6' into 10.11 2025-01-10 13:14:42 +01:00
a0e5dd5433 mysqltest: fix --sorted_results
only sort actual results not warnings or metadata
also work for vertical results
warnings are sorted separately
2025-01-09 10:00:36 +01:00
15700f54c2 Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
a54d151fc1 Merge 10.6 into 10.11 2024-12-19 15:38:53 +02:00
69e20cab28 Merge 10.5 into 10.6 2024-12-11 14:46:43 +02:00
bf7cfa2535 MDEV-35574 remove obsolete pthread_exit calls
Threads can normally exit without a explicit pthread_exit call.

There seem to date to old glibc bugs, many around 2.2.5.

The semi related bug was https://bugs.mysql.com/bug.php?id=82886.

To improve safety in the signal handlers DBUG_* code was removed.

These where also needed to avoid some MSAN unresolved stack issues.

This is effectively a backport of 2719cc4925.
2024-12-10 12:12:20 +11:00
0f47db8525 Merge 10.11 -> 11.4
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-12-05 11:01:42 +01:00
e7c6cdd842 Merge 10.6 -> 10.11
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-12-05 10:11:58 +01:00
0166c89e02 Merge 10.5 -> 10.6
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-12-05 09:20:36 +01:00
c772344510 Allow mysqltest to run COMMIT statement under --ps-protocol
Fix the regular expression that determines which statements
can use the Prepared Statement API, when --ps-protocol is
used. The current regular expression allows COMMIT only if
it is followed by a whitespace.
Meaning that statement "COMMIT ;" is allowed to run with
prepared statements, while "COMMIT;" is not.
Fix the filter so that both are allowed.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-12-03 14:56:45 +01:00
33907f9ec6 Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
2719cc4925 Merge 10.11 into 11.4 2024-12-02 11:35:34 +02:00
3d23adb766 Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
7d4077cc11 Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
840fe316d4 MDEV-34348: my_hash_get_key fixes
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

Change the type of my_hash_get_key to:
 1) Return const
 2) Change the context parameter to be const void*

Also fix casting in hash adjacent areas.

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:22 -07:00
dbfee9fc2b MDEV-34348: Consolidate cmp function declarations
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

The functions queue_compare, qsort2_cmp, and qsort_cmp2
all had similar interfaces, and were used interchangable
and unsafely cast to one another.

This patch consolidates the functions all into the
qsort_cmp2 interface.

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:22 -07:00
b12ff287ec Merge branch '11.6' into 11.7 2024-11-10 19:22:21 +01:00
9e1fb104a3 Merge tag '11.4' into 11.6
MariaDB 11.4.4 release
2024-11-08 07:17:00 +01:00
d046aca0c7 cleanup: CREATE_TYPELIB_FOR() helper 2024-11-05 14:00:47 -08:00
c770bce898 Merge branch '11.2' into 11.4 2024-10-30 15:11:17 +01:00
69d033d165 Merge branch '10.11' into 11.2 2024-10-29 16:42:46 +01:00
3d0fb15028 Merge branch '10.6' into 10.11 2024-10-29 15:24:38 +01:00
f00711bba2 Merge branch '10.5' into 10.6 2024-10-29 14:20:03 +01:00
8b057fee62 Fixed core dump in mysqltest in move-file when using wrong paths 2024-10-16 17:24:46 +03:00
1d0e94c55f Merge branch '10.5' into 10.6 2024-10-09 08:38:48 +02:00
e9c999caf4 MDEV-34915 Sort output of session track system variable in mysqltest
Updated the output format too.

Before:

-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- autocommit
-- ON
-- time_zone
-- SYSTEM
-- character_set_client
-- latin1
-- character_set_connection
-- latin1
-- redirect_url
--

After:

-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- autocommit: ON
-- character_set_client: latin1
-- character_set_connection: latin1
-- redirect_url:
-- time_zone: SYSTEM
2024-10-04 10:32:02 +10:00
43465352b9 Merge 11.4 into 11.6 2024-10-03 16:09:56 +03:00
b53b81e937 Merge 11.2 into 11.4 2024-10-03 14:32:14 +03:00
12a91b57e2 Merge 10.11 into 11.2 2024-10-03 13:24:43 +03:00
63913ce5af Merge 10.6 into 10.11 2024-10-03 10:55:08 +03:00
7e0afb1c73 Merge 10.5 into 10.6 2024-10-03 09:31:39 +03:00