1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

9621 Commits

Author SHA1 Message Date
Marko Mäkelä
bff2c4e547 Merge 13.1 to main 2026-10-13 09:56:55 +03:00
Marko Mäkelä
0b24391c0b Merge 12.3 to 13.1 2026-10-13 08:39:01 +03:00
Monty
c17f00dce5 Added --debug-dbug option to mysqltest.cc
This was to get rid of warnings when using mtr --debug
2026-10-09 15:46:32 +03:00
Sergei Golubchik
b2bc6c2f70 Merge branch '11.8' into 12.3 2026-10-07 22:10:46 +02:00
Sergei Golubchik
f21444cd03 Merge branch '11.4' into 11.8 2026-10-07 10:57:35 +02:00
Khaled Riyad
d45cf75cf8 MDEV-40551 Copy/Paste friendly output format for MariaDB Command Line Client
Copy/paste friendly output was only reachable by starting the client with
--silent --skip-column-names, which cannot be done from a running
interactive session.

Add \S, a statement terminator which prints the result of one statement in
the tab separated format without column names.

com_silent() sets output_plain, opt_silent and column_names around
com_go(), then restores them, the same way com_ego() handles vertical.
output_plain selects print_tab_data() ahead of the vertical and table
branches, so \S gives the same output whether the session was started
plainly or with --table, --vertical or --silent. --html and --xml still
win, matching \G.
2026-09-30 12:49:19 +03:00
Marko Mäkelä
07b8693fee MDEV-15736 fixup: clang -Wunused-but-set-global 2026-09-16 14:44:00 +03:00
Oleksandr Byelkin
b140f801e6 Merge branch '13.0' into 13.1 2026-09-04 12:21:02 +02:00
ParadoxV5
ba0d134749 MDEV-39880: Reïmplement MDEV-37146 to include MDEV-39519
MDEV-39519 added MySQL 8 compatibility to `mariadb-dump --dump-slave`
by attempting `SHOW REPLICA STATUS` first and then `SHOW SLAVE STATUS`.
This conflicted with MDEV-37146, where `mariadb-dump --dump-slave`
queries either `SELECT … FROM information_schema.SLAVE_STATUS`
or `SHOW ALL SLAVES STATUS` depending on the server version.

This commit merges MDEV-37146 and MDEV-39519:
* Use MDEV-39519’s strategy based on syntax error handling.
* Use MDEV-37146’s preference order:
  1. `SELECT … FROM information_schema.SLAVE_STATUS`
  2. `SHOW ALL SLAVES STATUS`
  3. `SHOW REPLICA STATUS` (for MySQL compatibility _only_)
* Send `STOP`/`START REPLICA SQL_THREAD FOR CHANNEL '…'`
  commands for both MariaDB 10.7+ and MySQL.
* Refactor column indices to variables set when a query succeeds.
* Partially revert MDEV-37146’s removal of `--dump-slave`’s support for
  pre-GTID & pre-multi-source, but tailored for MySQL compatibility;
  coverage for MariaDB pre-10.0 is not fully restored.

Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
2026-09-04 12:15:36 +02:00
Oleksandr Byelkin
71dd635f68 Merge tag '12.3' into 13.0 2026-09-04 12:14:15 +02:00
Kristian Nielsen
fb216395ed Fix mariadb-binlog for InnoDB binlog in Windows
Do not use the dup() call from the IO-cache fd to initialize the
binlog reader, it does not work on Windows. This was probably intended
to easily open the binlog file both from a filename and from stdin.

However, reading InnoDB binlog files requires a seekable fd for
pread() anyway and access to other binlog files from their original
filename in case of OOB references, reading from stdin via a pipe eg.
does not work anyway.

So just open the binlog by name and disallow reading from stdin explicitly.

Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2026-09-02 23:00:14 +02:00
Kristian Nielsen
35c17e9d2e Merge 10.11 -> 11.4 2026-08-30 17:39:50 +02:00
Oleksandr Byelkin
1a4be9dcd3 Merge branch '10.11' into mariadb-10.11.19 2026-08-26 09:37:54 +02:00
Abdelrahman Hedia
eeb8cb8587 MDEV-29803: Change mariadb-binlog --gtid-strict-mode default to OFF
The --gtid-strict-mode option in mariadb-binlog was introduced in MDEV-4989
with a default of ON. This causes mariadb-binlog to refuse to display
events when it encounters out-of-order GTIDs, which commonly happens
when replaying a remote binlog into a server and then reading back the
resulting local binlog files.

This is overly restrictive for a diagnostic/display tool. While the
server's gtid_strict_mode makes sense as a safety mechanism, applying
the same strict validation by default in the client tool prevents users
from even inspecting problematic binlog files.

Change the default to OFF so that mariadb-binlog processes binlog files
without erroring on out-of-order GTIDs by default. Users who want strict
validation can still explicitly pass --gtid-strict-mode.

Added regression test binlog.mdev_29803 that verifies:
- Default (OFF): reading binlog files with replayed events succeeds
- Explicit --gtid-strict-mode: still produces the expected error
2026-08-25 12:16:02 +03:00
Oleksandr Byelkin
f860f2a937 Merge branch '11.8' into 12.3 2026-08-20 08:27:14 +02:00
Oleksandr Byelkin
3b8db45403 Merge branch '11.4' into 11.8 2026-08-19 11:28:01 +02:00
Oleksandr Byelkin
170b1d7073 Merge branch '10.11' into 11.4 2026-08-19 08:40:05 +02:00
Oleksandr Byelkin
e2b15641ec Merge branch '10.6' into 10.11 2026-08-19 08:13:54 +02:00
monthdev
2129804256 MDEV-20749 Improve mysqlbinlog --flashback error reporting
Handle corrupted row events by reporting whether the field length could
not be determined from metadata or whether the field extends past the
row buffer instead of falling out through debug-only assertion paths
or ad hoc exits during flashback row conversion. Propagate flashback
conversion failures through the normal mysqlbinlog error path so debug
builds produce the intended diagnostics cleanly.

Add replication tests covering corrupted BLOB metadata and corrupted
BLOB length prefixes using server-side debug injection to write broken
binlog contents and mysqltest-friendly mysqlbinlog invocation patterns.

Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
Reviewed-by: Georgi Kodinov <joro@mariadb.org>
2026-08-17 13:46:32 +03:00
Sergei Golubchik
c28b4efdd4 cleanup: mariadb-dump
remove dead code, handling of MariaDB/MySQL servers that didn't
have SQL_QUOTE_SHOW_CREATE.

SQL_QUOTE_SHOW_CREATE was added in 2000
(commit 5762523b78, MySQL 3.23.25-beta)
2026-08-14 17:30:08 +02:00
Sergei Golubchik
0e46653911 cleanup: remove buggy str2int, replace with a template
remove one str->int implementation (we still have 10+ more),
replace with a convenience template that calls my_strntoll_8bit()
2026-08-14 17:30:08 +02:00
Alexander Barkov
0ee34e07bd MDEV-39587 Package-wide TYPE for variable declarations
SET sql_mode=ORACLE;
DELIMITER $$
CREATE OR REPLACE PACKAGE pkg AS
  -- Declare a package public data type
  TYPE varchar_array IS TABLE OF VARCHAR(2000) INDEX BY INTEGER;
END;
$$
DELIMITER ;
DELIMITER $$

CREATE OR REPLACE PROCEDURE p1 AS
  v pkg.varchar_array; -- Use the package public data type
BEGIN
  v(0):='test';
  SELECT v(0);
END;
$$
DELIMITER ;

Note, the change is done only for sql_mode=ORACLE, because the TYPE
declaration is not available for the default mode.

Where package-wide types are available
--------------------------------------
- Variabe list type:
    DECLARE var pkg1.type1;

- RETURN type for a package routine:
    CREATE FUNCTION .. RETURN pkg1.type1 ...

- Parameter type for a package routine:
    PROCEDURE p1(param1 pkg1.type1);

- Assoc array element type:
    TYPE assoc1_t IS TABLE OF pkg1.type1 ...

- REF CURSOR RETURN type:
    TYPE cur1_t IS REF CURSOR RETURN pkg1.type1;

Change details
--------------

- Adding a member Lex_length_and_dec_st::m_foreign_module_type
  It's set to true when the data type was initialized from a TYPE
  in foreign routine (e.g. in PACKAGE spec).
  It's needed to prevent use of qualified identifiers in public contexts,
  i.e. in schema public routine parameter types and schema publuc function
  RETURN types.
  Adding a helper method sp_head::check_applicability() which prevents
  use of qualified types in public context.

- Adding a helper method sp_head::raise_unknown_data_type().

- Adding methods LEX::set_field_type_typedef_package_spec() for
  2-step and 3-step qualified indentifiers.
  It's used in field_type_all_with_typedefs which covers cases:
  - Variabe list type        : DECLARE var pkg1.type1;
  - RETURN type              : CREATE FUNCTION .. RETURN pkg1.type1 ...
  - Parameter type           : PROCEDURE p1(param1 pkg1.type1);
  - Assoc array element type : TYPE assoc1_t IS TABLE OF pkg1.type1 ...

- Adding a method LEX::declare_type_ref_cursor_return_typedef().
  It handles cases when a new TYPE REF CURSOR RETURN is declared,
  for both for qualified RETURN types and non-qualified RETURN types:
  - TYPE cur0_t IS REF CURSOR RETURN rec1_t;
  - TYPE cur0_t IS REF CURSOR RETURN pkg1.rec1_t;
  - TYPE cur0_t IS REF CURSOR RETURN db1.pkg1.rec1_t;

  The code was moved from LEX::declare_type_ref_cursor() into
  LEX::declare_type_ref_cursor_return_typedef() and extended
  to cover qualified RETURN types.

- Adding a method Sql_path::find_package_spec_type().
  It iterates through all schemas specified in @@path and searches
  for the given type in the given package.

- Adding a helper method sp_pcontext::type_defs_add_ref_cursor()
  to reuse the code.

- Adding a new method sp_package::get_typedef() to search
  for TYPE definitions in PACKAGE specifications.

- Adding a new method sp_head::get_typedef_package_spec()
  to search for TYPE definitions used by a PROCEDURE or FUNCTION.

- Adding a helper method
    Sp_handler::sp_cache_routine_reentrant_suppress_errors
  Adding a method Sp_handler::find_package_spec().
2026-08-13 23:15:53 +04:00
Sergei Petrunia
80de6a791d Make mtr accept and ignore "--disable_replay next_query|test_file text" command 2026-08-12 14:31:57 +03:00
Sergei Petrunia
bc5a978668 Revert the --replay-server mtr feature 2026-08-12 14:31:57 +03:00
bsrikanth-mariadb
dfb1a1e24a clear optimizer_record_context after error/warning has occured during
replay

If not done, then context recording is performed for subsequent
non-explain queries. This could result in counter mismatches.
2026-08-12 14:31:56 +03:00
Sergei Petrunia
2940645031 Make --replay-server --replay-server-trace delete old traces at start. 2026-08-12 14:31:56 +03:00
Sergei Petrunia
2a86ebd553 Make --replay-server support "Optimizer Context Stopword": subquery_runs
If a stopword is present in the optimizer context, we do not try to
replay it.
2026-08-12 14:31:55 +03:00
Sergei Petrunia
3205c23a6f Add --replay-server-trace option.
Using

  ./mtr --replay-server --replay-server-trace

will now create files:

1.  mysql-test/main/$test_name.opt_trace.original
2.  mysql-test/main/$test_name.opt_trace.replay

The files show queries and optimizer trace outputs for the queries where:
1. We did try replaying in the server.
2. EXPLAIN output on the primary server and replay were different.
2026-08-12 14:31:55 +03:00
Sergei Petrunia
5395da104b Fix --replay-server error reporting: print query that caused error 2026-08-12 14:31:55 +03:00
Sergei Petrunia
ad402fb9ab MDEV-39368: Run "SET foreign_key_checks=0" on the replay server.
This is to avoid FK mismatch errors.
2026-08-12 14:31:55 +03:00
bsrikanth-mariadb
87b243dc9f MDEV-39368: fix warnings in mysqltest.cc
Compiling mysqltest.cc produced size conversion warnings and they were treated
as errors in windows. Fixing them as part of this commit.
2026-08-12 14:31:54 +03:00
Sergei Petrunia
6128c1d906 MDEV-39368: Make is_explain_query() reject EXPLAIN ...FOR CONNECTION,
Also make it use regexes
2026-08-12 14:31:54 +03:00
Sergei Petrunia
21323c89a5 MDEV-39368: Print errors for context preparation queries into query output.
I don't think we can print warnings, we would get spurious test failures.
2026-08-12 14:31:54 +03:00
Sergei Petrunia
c1580a4895 MDEV-39368: Add "--disable_replay testfile reason" support.
Disable replay use for the whole file.
2026-08-12 14:31:54 +03:00
Sergei Petrunia
5ec27db5ca MDEV-39368: Add disable_replay command, first variant.
Usage:
--disable_replay next_query <arbitrary reason text>

If the next query after this is an EXPLAIN, its processing will be disabled.
2026-08-12 14:31:54 +03:00
Sergei Petrunia
fc926f8b5d MDEV-39368: Improve error reporting.
A whole class of errors were not printed to the test output.
2026-08-12 14:31:54 +03:00
Sergei Petrunia
74e6822a96 MDEV-39368: When replay query fails, print "*** REPLAY FAILED ***" instead of EXPLAIN output. 2026-08-12 14:31:53 +03:00
Sergei Petrunia
6d859f2a76 MDEV-39368: When replay query fails, print the original query location in test file 2026-08-12 14:31:53 +03:00
Sergei Petrunia
cffd73443c MDEV-39368: Fix wrong behavior for empty Replay Context
If the previous command was EXPLAIN, it would use its context.
If the previous command was not an EXPLAIN, nothing would be printed.
2026-08-12 14:31:53 +03:00
Sergei Petrunia
27756fba9b MDEV-39368: Print warnings for replay EXPLAINs. 2026-08-12 14:31:53 +03:00
Sergei Petrunia
a69878afae MDEV-39368: Do not try to replay EXPLAIN FOR CONNECTION 2026-08-12 14:31:53 +03:00
Sergei Petrunia
399f45a5d2 Remove garbage comment 2026-08-12 14:31:53 +03:00
Sergei Petrunia
596c09031a Enable replay for any EXPLAIN query, do not require "FORMAT=JSON". 2026-08-12 14:31:53 +03:00
Sergei Petrunia
837457ade9 Don't display result column name twice. 2026-08-12 14:31:53 +03:00
Sergei Petrunia
e9849b7c02 MDEV-39368: Run set optimizer_replay_context='' for cleanup. 2026-08-12 14:31:53 +03:00
Sergei Petrunia
2177acc02e MDEV-39368: Make mtr write queries into log/replay_queries.log 2026-08-12 14:31:53 +03:00
Sergei Petrunia
d24d431dfd MDEV-39368: Make --replay-server[-manual] save the output of last EXPLAIN in the replay.
The last command is set "optimizer_replay_context=null"...
2026-08-12 14:31:53 +03:00
Sergei Petrunia
bc35e4d615 MDEV-39368: Trace replay: add --extra-server support, part 1. 2026-08-12 14:31:53 +03:00
Sergei Golubchik
ee74a71df6 mariadb-test: don't use strlen/strend, support lines with embedded \0
add a test
2026-08-07 22:54:50 +02:00
Teemu Ollakka
d29da23e13 mysqltest: fix do_exec() status decoding for signal-killed processes
WEXITSTATUS() only produces a meaningful value when the process
exited normally. If the command was killed by a signal, it silently
returned status 0, hiding the failure. Check WIFEXITED/WIFSIGNALED
and map signal deaths to the shell's 128+signal convention.
2026-08-05 09:05:20 +02:00