Skip to content

Commit

Permalink
Merge 10.6 into 10.11
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Dec 20, 2023
2 parents 9d2c3d3 + f9ae553 commit 2b99e5f
Show file tree
Hide file tree
Showing 74 changed files with 1,078 additions and 239 deletions.
7 changes: 6 additions & 1 deletion client/mysql_upgrade.c
Expand Up @@ -1477,7 +1477,12 @@ int main(int argc, char **argv)
open_mysql_upgrade_file();

if (opt_check_upgrade)
exit(upgrade_already_done(0) == 0);
{
int upgrade_needed = upgrade_already_done(0);
free_used_memory();
my_end(my_end_arg);
exit(upgrade_needed == 0);
}

/* Find mysqlcheck */
find_tool(mysqlcheck_path, IF_WIN("mariadb-check.exe", "mariadb-check"), self_name);
Expand Down
31 changes: 18 additions & 13 deletions client/mysqltest.cc
Expand Up @@ -91,6 +91,8 @@ static my_bool non_blocking_api_enabled= 0;

#define CLOSED_CONNECTION "-closed_connection-"

#define dynstr_append DO_NO_USE

#ifndef HAVE_SETENV
static int setenv(const char *name, const char *value, int overwrite);
#endif
Expand Down Expand Up @@ -1878,7 +1880,7 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
if (strncmp(arg, "--", 2) == 0)
dynstr_append_os_quoted(&ds_cmdline, arg, NullS);
else
dynstr_append(&ds_cmdline, arg);
dynstr_append_mem(&ds_cmdline, arg, strlen(arg));
dynstr_append_mem(&ds_cmdline, STRING_WITH_LEN(" "));
}

Expand Down Expand Up @@ -2035,11 +2037,11 @@ void show_diff(DYNAMIC_STRING* ds,
dynstr_append_mem(&ds_tmp, message, sizeof(message));

dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" --- "));
dynstr_append(&ds_tmp, filename1);
dynstr_append_mem(&ds_tmp, filename1, strlen(filename1));
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" >>>\n"));
cat_file(&ds_tmp, filename1);
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN("<<<\n --- "));
dynstr_append(&ds_tmp, filename1);
dynstr_append_mem(&ds_tmp, filename1, strlen(filename1));
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" >>>\n"));
cat_file(&ds_tmp, filename2);
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN("<<<<\n"));
Expand Down Expand Up @@ -3295,13 +3297,15 @@ static int replace(DYNAMIC_STRING *ds_str,
{
DYNAMIC_STRING ds_tmp;
const char *start= strstr(ds_str->str, search_str);
size_t prefixlen= start - ds_str->str;
if (!start)
return 1;
init_dynamic_string(&ds_tmp, "",
ds_str->length + replace_len, 256);
dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str);
dynstr_append_mem(&ds_tmp, ds_str->str, prefixlen);
dynstr_append_mem(&ds_tmp, replace_str, replace_len);
dynstr_append(&ds_tmp, start + search_len);
dynstr_append_mem(&ds_tmp, start + search_len,
ds_str->length - prefixlen - search_len);
dynstr_set(ds_str, ds_tmp.str);
dynstr_free(&ds_tmp);
return 0;
Expand Down Expand Up @@ -3806,7 +3810,7 @@ void do_remove_files_wildcard(struct st_command *command)
wild_compare(file->name, ds_wild.str, 0))
continue;
ds_file_to_remove.length= directory_length;
dynstr_append(&ds_file_to_remove, file->name);
dynstr_append_mem(&ds_file_to_remove, file->name, strlen(file->name));
DBUG_PRINT("info", ("removing file: %s", ds_file_to_remove.str));
if ((error= (my_delete(ds_file_to_remove.str, MYF(MY_WME)) != 0)))
sys_errno= my_errno;
Expand Down Expand Up @@ -7685,7 +7689,7 @@ void append_field(DYNAMIC_STRING *ds, uint col_idx, MYSQL_FIELD* field,
}
else
{
dynstr_append(ds, field->name);
dynstr_append_mem(ds, field->name, strlen(field->name));
dynstr_append_mem(ds, "\t", 1);
replace_dynstr_append_mem(ds, val, len);
dynstr_append_mem(ds, "\n", 1);
Expand Down Expand Up @@ -7858,12 +7862,12 @@ void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows,
const char *info)
{
char buf[40], buff2[21];
sprintf(buf,"affected rows: %s\n", llstr(affected_rows, buff2));
dynstr_append(ds, buf);
size_t len= sprintf(buf,"affected rows: %s\n", llstr(affected_rows, buff2));
dynstr_append_mem(ds, buf, len);
if (info)
{
dynstr_append_mem(ds, STRING_WITH_LEN("info: "));
dynstr_append(ds, info);
dynstr_append_mem(ds, info, strlen(info));
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
}
}
Expand Down Expand Up @@ -7913,7 +7917,8 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
dynstr_append_mem(ds, STRING_WITH_LEN("-- "));
if (type <= SESSION_TRACK_END)
{
dynstr_append(ds, trking_info_desc[type]);
dynstr_append_mem(ds, trking_info_desc[type],
strlen(trking_info_desc[type]));
}
else
{
Expand Down Expand Up @@ -9805,7 +9810,7 @@ void mark_progress(struct st_command* command __attribute__((unused)),
dynstr_append_mem(&ds_progress, "\t", 1);

/* Filename */
dynstr_append(&ds_progress, cur_file->file_name);
dynstr_append_mem(&ds_progress, cur_file->file_name, strlen(cur_file->file_name));
dynstr_append_mem(&ds_progress, ":", 1);

/* Line in file */
Expand Down Expand Up @@ -12105,7 +12110,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input,
for (i= 0; i < lines.elements ; i++)
{
const char **line= dynamic_element(&lines, i, const char**);
dynstr_append(ds, *line);
dynstr_append_mem(ds, *line, strlen(*line));
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
}

Expand Down
7 changes: 5 additions & 2 deletions extra/mariabackup/xtrabackup.cc
Expand Up @@ -1695,8 +1695,11 @@ struct my_option xb_server_options[] =
"Path to InnoDB log files.", &srv_log_group_home_dir,
&srv_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT,
"Percentage of dirty pages allowed in bufferpool.", (G_PTR*) &srv_max_buf_pool_modified_pct,
(G_PTR*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0},
"Percentage of dirty pages allowed in bufferpool.",
(G_PTR*) &srv_max_buf_pool_modified_pct,
(G_PTR*) &srv_max_buf_pool_modified_pct, 0, GET_DOUBLE, REQUIRED_ARG,
(longlong)getopt_double2ulonglong(90), (longlong)getopt_double2ulonglong(0),
getopt_double2ulonglong(100), 0, 0, 0},
{"innodb_use_native_aio", OPT_INNODB_USE_NATIVE_AIO,
"Use native AIO if supported on this platform.",
(G_PTR*) &srv_use_native_aio,
Expand Down
1 change: 1 addition & 0 deletions extra/my_print_defaults.c
Expand Up @@ -175,6 +175,7 @@ int main(int argc, char **argv)
if ((error= load_defaults(config_file, (const char **) load_default_groups,
&count, &arguments)))
{
my_free(load_default_groups);
my_end(0);
if (error == 4)
return 0;
Expand Down
15 changes: 15 additions & 0 deletions mysql-test/main/derived_split_innodb.result
Expand Up @@ -862,5 +862,20 @@ SELECT * FROM t1 JOIN t2 WHERE (t1.a, t2.b) IN (SELECT * FROM v);
a b
DROP VIEW v;
DROP TABLE t1, t2, t3;
#
# MDEV-31279 Crash when lateral derived is guaranteed to return no rows
#
CREATE TABLE t1 (a CHAR(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1'),('2');
CREATE TABLE t2 (b INT, KEY(b)) ENGINE=MyISAM;
ALTER TABLE t2 DISABLE KEYS;
INSERT INTO t2 VALUES (1),(2),(3);
ALTER TABLE t2 ENABLE KEYS;
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
INSERT INTO t3 (c) SELECT seq FROM seq_1_to_101;
SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM
(SELECT t2.b FROM t2 WHERE NOT EXISTS (SELECT 1 FROM t3) GROUP BY b) sq);
a
DROP TABLE t1, t2, t3;
# End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;
18 changes: 18 additions & 0 deletions mysql-test/main/derived_split_innodb.test
Expand Up @@ -487,6 +487,24 @@ SELECT * FROM t1 JOIN t2 WHERE (t1.a, t2.b) IN (SELECT * FROM v);
DROP VIEW v;
DROP TABLE t1, t2, t3;

--echo #
--echo # MDEV-31279 Crash when lateral derived is guaranteed to return no rows
--echo #

CREATE TABLE t1 (a CHAR(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1'),('2');
CREATE TABLE t2 (b INT, KEY(b)) ENGINE=MyISAM;
ALTER TABLE t2 DISABLE KEYS;
INSERT INTO t2 VALUES (1),(2),(3);
ALTER TABLE t2 ENABLE KEYS;
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
INSERT INTO t3 (c) SELECT seq FROM seq_1_to_101;

SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM
(SELECT t2.b FROM t2 WHERE NOT EXISTS (SELECT 1 FROM t3) GROUP BY b) sq);

DROP TABLE t1, t2, t3;

--echo # End of 10.4 tests

SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;
8 changes: 8 additions & 0 deletions mysql-test/main/mysql_upgrade.result
Expand Up @@ -2505,6 +2505,14 @@ Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK
set global sql_safe_updates=@orig_sql_safe_updates;
#
# MDEV-32043 Remove plugins previously external that are now built in (unix_socket)
#
INSERT INTO mysql.plugin SELECT 'unix_socket', 'auth_socket.so'
FROM dual WHERE convert(@@version_compile_os using latin1) not in ('Win32', 'Win64', 'Windows');
# mariadb-upgrade --force --silent 2>&1
SELECT * FROM mysql.plugin WHERE name='unix_socket';
name dl
# End of 10.4 tests
#
# Check that mysql_upgrade can be run on mysqldump
Expand Down
11 changes: 11 additions & 0 deletions mysql-test/main/mysql_upgrade.test
Expand Up @@ -496,6 +496,17 @@ set global sql_safe_updates=ON;
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
set global sql_safe_updates=@orig_sql_safe_updates;

--echo #
--echo # MDEV-32043 Remove plugins previously external that are now built in (unix_socket)
--echo #

INSERT INTO mysql.plugin SELECT 'unix_socket', 'auth_socket.so'
FROM dual WHERE convert(@@version_compile_os using latin1) not in ('Win32', 'Win64', 'Windows');
--echo # mariadb-upgrade --force --silent 2>&1
--exec $MYSQL_UPGRADE --force --silent 2>&1
SELECT * FROM mysql.plugin WHERE name='unix_socket';
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info

--echo # End of 10.4 tests

#
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/main/mysql_upgrade_file_leak.result
@@ -0,0 +1,4 @@
Running mysql_upgrade with --check-if-upgrade-is-needed
Checking for absence of temporary files by mysql_upgrade
No temporary files found
End of 10.4 tests
24 changes: 24 additions & 0 deletions mysql-test/main/mysql_upgrade_file_leak.test
@@ -0,0 +1,24 @@
-- source include/mysql_upgrade_preparation.inc

#
# MDEV-31925 mysqld_upgrade --check-if-upgrade-is-needed leaks files
#

# Run mysql_upgrade with --check-if-upgrade-is-needed
--echo Running mysql_upgrade with --check-if-upgrade-is-needed
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed 2>&1

# Check if temporary files related to mysql_upgrade are cleared
--echo Checking for absence of temporary files by mysql_upgrade
--perl

# Use the temporary directory path from the MySQL configuration
my $tmpdir = "$ENV{MYSQL_TMP_DIR}";

die "Test failed: Found temporary file left by mysql_upgrade\n" if (glob("$tmpdir/mysql_upgrade-*"));
print "No temporary files found\n";
EOF

let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
--echo End of 10.4 tests
10 changes: 10 additions & 0 deletions mysql-test/main/ps.result
Expand Up @@ -5802,5 +5802,15 @@ END;
$
ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
#
# MDEV-32965: Assertion `thd->active_stmt_arena_to_use()-> is_stmt_prepare_or_first_sp_execute() || thd->active_stmt_arena_to_use()-> is_conventional() || thd->active_stmt_arena_to_use()->state == Query_arena::STMT_SP_QUERY_ARGUMENTS' failed
#
CREATE TABLE t (f VARCHAR(8)) CHARACTER SET utf8;
INSERT INTO t VALUES ('foo'),('bar');
EXECUTE IMMEDIATE 'SELECT GROUP_CONCAT(@x) FROM t GROUP BY @x := f';
GROUP_CONCAT(@x)
0
0
DROP TABLE t;
#
# End of 10.4 tests
#
12 changes: 12 additions & 0 deletions mysql-test/main/ps.test
Expand Up @@ -5236,6 +5236,18 @@ $

delimiter ;$

--echo #
--echo # MDEV-32965: Assertion `thd->active_stmt_arena_to_use()-> is_stmt_prepare_or_first_sp_execute() || thd->active_stmt_arena_to_use()-> is_conventional() || thd->active_stmt_arena_to_use()->state == Query_arena::STMT_SP_QUERY_ARGUMENTS' failed
--echo #
CREATE TABLE t (f VARCHAR(8)) CHARACTER SET utf8;

INSERT INTO t VALUES ('foo'),('bar');
EXECUTE IMMEDIATE 'SELECT GROUP_CONCAT(@x) FROM t GROUP BY @x := f';

# Cleanup

DROP TABLE t;

--echo #
--echo # End of 10.4 tests
--echo #
Binary file added mysql-test/std_data/mysql80/t2.cfg
Binary file not shown.
Binary file added mysql-test/std_data/mysql80/t2.ibd
Binary file not shown.
7 changes: 7 additions & 0 deletions mysql-test/suite/binlog_encryption/rpl_gtid_basic.result
Expand Up @@ -188,6 +188,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
NULL
Warnings:
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
SET sql_log_bin= 0;
CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
SELECT BINLOG_GTID_POS(@binlog_file, 4);
BINLOG_GTID_POS(@binlog_file, 4)
NULL
DROP TABLE t1;
SET sql_log_bin= 1;
*** Some tests of @@GLOBAL.gtid_binlog_state ***
connection server_2;
include/sync_with_master_gtid.inc
Expand Down
@@ -1,6 +1,8 @@
SELECT variable_value into @old_encrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) INTO @old_encrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
SELECT variable_value into @old_decrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) INTO @old_decrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB;
INSERT INTO t1 (f1,f2) SELECT '', '' FROM seq_1_to_8192;
Expand All @@ -12,11 +14,13 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
8192
SELECT variable_value > @old_encrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) > @old_encrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
variable_value > @old_encrypted
CAST(variable_value AS INT) > @old_encrypted
1
SELECT variable_value > @old_decrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) > @old_decrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
variable_value > @old_decrypted
CAST(variable_value AS INT) > @old_decrypted
1

0 comments on commit 2b99e5f

Please sign in to comment.