Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c178d8e
MDEV-39368: Trace replay: add --extra-server support, part 1.
spetrunia Apr 19, 2026
8cbdbe7
MDEV-39368: Add --replay-server-manual.
spetrunia Apr 19, 2026
d93bb2f
MDEV-39368: Make --replay-server[-manual] save the output of last EXP…
spetrunia Apr 20, 2026
95b6b5e
MDEV-39368: Make mtr write queries into log/replay_queries.log
spetrunia Apr 20, 2026
8aee7b2
MDEV-39368: Run set optimizer_replay_context='' for cleanup.
spetrunia Apr 20, 2026
cf5615b
Don't display result column name twice.
spetrunia Apr 20, 2026
4a60f86
Kill replay server when mtr exits, in various cases.
spetrunia Apr 20, 2026
0eb9e92
Let the optimizer context have DROP TABLE|VIEW IF EXISTS.
spetrunia Apr 20, 2026
c9bca52
Temporarily? disable assert for DBUG_ASSERT(*freq > 0) in infuse_tabl…
spetrunia Apr 21, 2026
35437c6
Enable replay for any EXPLAIN query, do not require "FORMAT=JSON".
spetrunia Apr 21, 2026
cb9310f
Remove garbage comment
spetrunia Apr 22, 2026
a8e4c7c
MDEV-39368: Do not try to replay EXPLAIN FOR CONNECTION
spetrunia Apr 22, 2026
f4b6b73
MDEV-39368: Print warnings for replay EXPLAINs.
spetrunia Apr 22, 2026
5156d71
MDEV-39368: Refuse to run with --replay-server and --parallel
spetrunia Apr 22, 2026
8544171
MDEV-39368: Make mysql-test-run check if replay server is alive
spetrunia Apr 22, 2026
b38ebed
MDEV-39368: Fix wrong behavior for empty Replay Context
spetrunia Apr 23, 2026
2b6a91f
MDEV-39368: When replay query fails, print the original query locatio…
spetrunia Apr 23, 2026
e509e11
MDEV-39368: When replay query fails, print "*** REPLAY FAILED ***" in…
spetrunia Apr 23, 2026
fca1fd6
MDEV-39368: Disable main/extra_server_example.test
spetrunia Apr 23, 2026
21dc118
MDEV-39368: Improve error reporting.
spetrunia Apr 23, 2026
ae78876
MDEV-39368: Add disable_replay command, first variant.
spetrunia Apr 24, 2026
5014ede
MDEV-39368: Add "--disable_replay testfile reason" support.
spetrunia Apr 24, 2026
959bcda
MDEV-39368: Print errors for context preparation queries into query o…
spetrunia Apr 24, 2026
418dc35
MDEV-39416: Context Replay for MRG_MyISAM tables: Table is read-only …
spetrunia Apr 24, 2026
cd95c0c
MDEV-39368: Test coverage for "--disable_replay next_query"
spetrunia Apr 24, 2026
6ba9658
Add --disable_replay in custom_aggregates_i_s, selectivity_notembedde…
spetrunia Apr 24, 2026
317f0b9
MDEV-39368: Make is_explain_query() reject EXPLAIN ...FOR CONNECTION,
spetrunia Apr 24, 2026
f2d1f14
Add --disable_replay next_query in join_outer and opt_trace_index_mer…
spetrunia Apr 24, 2026
7cafa3b
More --disable_replay commands.
spetrunia Apr 24, 2026
f6b1adb
More --disable_replay commands (2)
spetrunia Apr 24, 2026
d6f0035
More --disable_replay commands (3).
spetrunia Apr 24, 2026
4291390
MDEV-39368: Make --replay-server-manual also provide a gdb include file.
spetrunia Apr 24, 2026
7283371
MDEV-39435: Context Replay : Assertion `table_records || !head->file-…
spetrunia Apr 26, 2026
17f4dd8
More --disable_replay for queries where we don't support it.
spetrunia Apr 26, 2026
a27a8cf
MDEV-39409: Context replay doesn't handle MIN/MAX optimization
spetrunia Apr 26, 2026
8b325e8
MDEV-39447: Context Replay: "Field doesn't have default value" error
spetrunia Apr 26, 2026
4b91938
[No MDEV#] Fix charset/collation mismatch errors
spetrunia Apr 26, 2026
e10630c
Add more --disable_replay next_query Don't support SPs
spetrunia Apr 27, 2026
fe13365
Add --disable_replay next_query Will try to create table for sequence…
spetrunia Apr 27, 2026
e6427ad
Test result update.
spetrunia Apr 27, 2026
e3b0ca2
Cherry-pick lost commit: Improve comments and readability.
spetrunia Mar 13, 2026
5f9a4a8
Cherry-pick lost commit: Rename dump_XXXX() functions and make them m…
spetrunia Mar 13, 2026
037174e
Cherry-pick lost commit: Coding style renames: Saved_index_stats, Sav…
spetrunia Mar 13, 2026
6e1c732
Cherry-pick lost commit: Fixup to previous commit
spetrunia Mar 13, 2026
0af4790
Cherry-pick lost commit: Fixup (2)
spetrunia Mar 13, 2026
bf90ff4
Cherry-pick lost commit: JSON parsing: rename classes to cleaner names
spetrunia Mar 13, 2026
676bfa7
Cherry-pick lost commit: Add unit test for json_read_object.
spetrunia Mar 14, 2026
560d95f
Cherry-pick lost commit: Make JSON parsing helpers accept MEM_ROOT* a…
spetrunia Mar 15, 2026
467b06c
Cherry-pick lost commit: Rename: Read_list_of_ranges to Read_array_of…
spetrunia Mar 15, 2026
b100fbf
MDEV-39412: parse error reading tabs in ranges
bsrikanth-mariadb Apr 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
738 changes: 736 additions & 2 deletions client/mysqltest.cc

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions mariadb-plugin-columnstore.install.generated
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#File is generated by ColumnstoreLibrary.cmake, do not edit
etc/mysql/columnstore.cnf # added in dbcon/mysql/CMakeLists.txt
usr/local/mysql/lib/plugin/ha_columnstore.so # added in dbcon/mysql/CMakeLists.txt
89 changes: 89 additions & 0 deletions mysql-test/EXTRA_SERVER_QUICKSTART.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
================================================================================
EXTRA SERVER QUICK START GUIDE
================================================================================

This feature allows you to start additional MariaDB server instances during
test execution while mysql-test-run is already running.

BASIC USAGE
-----------

1. In your test file (.test):

# Start extra server
--let $extra_server_num= 1
--source include/start_extra_server.inc

# Connect to it
--connect (extra1, 127.0.0.1, root, , test, $EXTRA_SERVER_PORT)
CREATE TABLE t1 (id INT);
SELECT * FROM t1;

# Stop it
--disconnect extra1
--let $extra_server_num= 1
--source include/stop_extra_server.inc

2. Run the test:

cd mysql-test
./mysql-test-run main.extra_server_example

WHAT IT DOES
------------

✓ Creates new data directory: var/extra_server_N/data (copied from install.db)
✓ Picks non-conflicting port: MASTER_MYPORT + 10 + N
✓ Creates unique socket: var/tmp/extra_server_N.sock
✓ Starts mysqld with --skip-grant-tables (no password needed)
✓ Exports connection info: $EXTRA_SERVER_PORT, $EXTRA_SERVER_SOCKET, etc.

AVAILABLE VARIABLES AFTER START
--------------------------------

$EXTRA_SERVER_PORT - Port number (e.g., 10011 for server 1)
$EXTRA_SERVER_SOCKET - Socket path
$EXTRA_SERVER_DATADIR - Data directory path
$EXTRA_SERVER_PID - Process ID

CUSTOM PORT/SOCKET
------------------

--let $extra_server_num= 2
--let $extra_server_port= 15000
--let $extra_server_socket= /tmp/my_custom.sock
--source include/start_extra_server.inc

MULTIPLE SERVERS
----------------

--let $extra_server_num= 1
--source include/start_extra_server.inc

--let $extra_server_num= 2
--source include/start_extra_server.inc

# Now you have two extra servers running!

FILES CREATED
-------------

lib/start_extra_server.pl - Perl script (main implementation)
include/start_extra_server.inc - Test include to start server
include/stop_extra_server.inc - Test include to stop server
main/extra_server_example.test - Example test
lib/EXTRA_SERVER_README.md - Full documentation

TROUBLESHOOTING
---------------

If server fails to start, check:
var/log/extra_server_N.err

Connection info is stored in:
var/tmp/extra_server_N.info

Direct invocation (from Perl or shell):
perl lib/start_extra_server.pl <server_num> [port] [socket]

================================================================================
4 changes: 2 additions & 2 deletions mysql-test/include/get_rec_idx_ranges_from_opt_ctx.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ set @opt_context=
'(?<=set @opt_context=\')([\n\r].*)*(?=\'\;#opt_context_ends)')
from information_schema.optimizer_context);
set @records=
(select JSON_DETAILED(JSON_EXTRACT(@opt_context, '$**.num_of_records')));
(select JSON_DETAILED(JSON_EXTRACT(@opt_context, '$**.file_stat_records')));
select *from json_table(@records,
'$[*]' columns(num_of_records text path '$')) as jt;
'$[*]' columns(file_stat_records text path '$')) as jt;
set @file_stat_records=
(select JSON_DETAILED(JSON_EXTRACT(@opt_context, '$**.file_stat_records')));
select *from json_table(@file_stat_records,
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/include/opt_context_schema.inc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let $opt_context_schema=
"type": "string",
"minLength": 1
},
"num_of_records": {
"file_stat_records": {
"type": "number"
},
"file_stat_records": {
Expand Down
105 changes: 105 additions & 0 deletions mysql-test/include/start_extra_server.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# ==== Purpose ====
#
# Start an additional mysqld server instance while mysql-test-run is running.
# This creates a new data directory (copied from var/install.db), picks a
# non-conflicting port and socket, and starts the server.
#
# ==== Usage ====
#
# --let $extra_server_num= 1
# [--let $extra_server_port= 13307]
# [--let $extra_server_socket= /path/to/socket]
# --source include/start_extra_server.inc
#
# After sourcing this file, the following variables will be set:
# $EXTRA_SERVER_PORT - Port number of the extra server
# $EXTRA_SERVER_SOCKET - Socket path of the extra server
# $EXTRA_SERVER_DATADIR - Data directory of the extra server
# $EXTRA_SERVER_PID - Process ID of the extra server
#
# You can then connect to the server using:
# --connect (conn_name, 127.0.0.1, root, , test, $EXTRA_SERVER_PORT)
#
# ==== Parameters ====
#
# $extra_server_num
# Required. A unique number identifying this extra server instance.
# Must be unique across all extra servers started in the same test.
#
# $extra_server_port
# Optional. Custom port number for the server. If not specified,
# the port will be auto-calculated as MASTER_MYPORT + 10 + server_num.
#
# $extra_server_socket
# Optional. Custom socket path. If not specified, will use
# $MYSQLTEST_VARDIR/tmp/extra_server_N.sock
#

if (!$extra_server_num)
{
--die extra_server_num must be set before sourcing start_extra_server.inc
}

--let $include_filename= start_extra_server.inc [server $extra_server_num]
--source include/begin_include_file.inc

# Export mysqltest variables to environment for Perl
--let extra_server_num_env= $extra_server_num
--let extra_server_port_env= $extra_server_port
--let extra_server_socket_env= $extra_server_socket

--perl
use strict;
use warnings;

my $server_num = $ENV{extra_server_num_env} or die "extra_server_num not set";
my $port = $ENV{extra_server_port_env} || "";
my $socket = $ENV{extra_server_socket_env} || "";

my $script = "$ENV{MYSQL_TEST_DIR}/lib/start_extra_server.pl";
die "Script not found: $script\n" unless -f $script;

my $cmd = "perl $script $server_num";
$cmd .= " $port" if $port;
$cmd .= " $socket" if $socket;

print "Executing: $cmd\n";
my $result = system($cmd);
if ($result != 0) {
die "Failed to start extra server $server_num (exit code: $result)\n";
}
EOF

# Read connection info from the info file
--let $extra_server_info_file= $MYSQLTEST_VARDIR/tmp/extra_server_$extra_server_num.info

--perl
use strict;
use warnings;

my $file = $ENV{extra_server_info_file};
die "Info file not found: $file\n" unless -f $file;

open my $fh, '<', $file or die "Cannot read $file: $!";
my %info;
while (<$fh>) {
chomp;
if (/^(\w+)=(.+)/) {
$info{$1} = $2;
}
}
close $fh;

# Export to environment for mysqltest
$ENV{EXTRA_SERVER_PORT} = $info{PORT} if $info{PORT};
$ENV{EXTRA_SERVER_SOCKET} = $info{SOCKET} if $info{SOCKET};
$ENV{EXTRA_SERVER_DATADIR} = $info{DATADIR} if $info{DATADIR};
$ENV{EXTRA_SERVER_PID} = $info{PID} if $info{PID};

print "Extra server $ENV{extra_server_num_env} connection info:\n";
print " PORT=$info{PORT}\n" if $info{PORT};
print " SOCKET=$info{SOCKET}\n" if $info{SOCKET};
EOF

--let $include_filename= start_extra_server.inc [server $extra_server_num]
--source include/end_include_file.inc
98 changes: 98 additions & 0 deletions mysql-test/include/stop_extra_server.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# ==== Purpose ====
#
# Stop an extra server instance that was started with start_extra_server.inc
#
# ==== Usage ====
#
# --let $extra_server_num= 1
# --source include/stop_extra_server.inc
#
# ==== Parameters ====
#
# $extra_server_num
# Required. The number of the extra server to stop (same number used
# when starting it with start_extra_server.inc).
#

if (!$extra_server_num)
{
--die extra_server_num must be set before sourcing stop_extra_server.inc
}

--let $include_filename= stop_extra_server.inc [server $extra_server_num]
--source include/begin_include_file.inc

# Export mysqltest variable to environment for Perl
--let extra_server_num_env= $extra_server_num

--perl
use strict;
use warnings;
use POSIX ":sys_wait_h";

my $server_num = $ENV{extra_server_num_env} or die "extra_server_num not set";
my $vardir = $ENV{MYSQLTEST_VARDIR} or die "MYSQLTEST_VARDIR not set";
my $info_file = "$vardir/tmp/extra_server_$server_num.info";

unless (-f $info_file) {
print "Warning: Info file not found: $info_file\n";
print "Server may not be running or already stopped.\n";
exit 0;
}

# Read PID and other info
open my $fh, '<', $info_file or die "Cannot read $info_file: $!";
my ($pid, $pid_file, $socket);
while (<$fh>) {
chomp;
$pid = $1 if /^PID=(.+)/;
$pid_file = $1 if /^PID_FILE=(.+)/;
$socket = $1 if /^SOCKET=(.+)/;
}
close $fh;

unless ($pid) {
print "Warning: No PID found in $info_file\n";
unlink $info_file;
exit 0;
}

print "Stopping extra server $server_num (PID: $pid)...\n";

# Send SIGTERM to server
if (kill 0, $pid) {
kill 'TERM', $pid;

# Wait for process to exit (up to 10 seconds)
my $max_wait = 10;
my $waited = 0;
while ($waited < $max_wait) {
my $result = waitpid($pid, WNOHANG);
if ($result == $pid || $result == -1) {
print "Server process $pid has exited\n";
last;
}
sleep 1;
$waited++;
}

# If still running, send SIGKILL
if ($waited >= $max_wait && kill 0, $pid) {
print "Server did not stop gracefully, sending SIGKILL...\n";
kill 'KILL', $pid;
sleep 1;
}
} else {
print "Process $pid is not running\n";
}

# Cleanup files
unlink $info_file if -f $info_file;
unlink $pid_file if $pid_file && -f $pid_file;
unlink $socket if $socket && -S $socket;

print "Extra server $server_num stopped\n";
EOF

--let $include_filename= stop_extra_server.inc [server $extra_server_num]
--source include/end_include_file.inc
Loading
Loading