Skip to content

Commit 2b99e5f

Browse files
committed
Merge 10.6 into 10.11
2 parents 9d2c3d3 + f9ae553 commit 2b99e5f

File tree

74 files changed

+1078
-239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1078
-239
lines changed

client/mysql_upgrade.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,12 @@ int main(int argc, char **argv)
14771477
open_mysql_upgrade_file();
14781478

14791479
if (opt_check_upgrade)
1480-
exit(upgrade_already_done(0) == 0);
1480+
{
1481+
int upgrade_needed = upgrade_already_done(0);
1482+
free_used_memory();
1483+
my_end(my_end_arg);
1484+
exit(upgrade_needed == 0);
1485+
}
14811486

14821487
/* Find mysqlcheck */
14831488
find_tool(mysqlcheck_path, IF_WIN("mariadb-check.exe", "mariadb-check"), self_name);

client/mysqltest.cc

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ static my_bool non_blocking_api_enabled= 0;
9191

9292
#define CLOSED_CONNECTION "-closed_connection-"
9393

94+
#define dynstr_append DO_NO_USE
95+
9496
#ifndef HAVE_SETENV
9597
static int setenv(const char *name, const char *value, int overwrite);
9698
#endif
@@ -1878,7 +1880,7 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
18781880
if (strncmp(arg, "--", 2) == 0)
18791881
dynstr_append_os_quoted(&ds_cmdline, arg, NullS);
18801882
else
1881-
dynstr_append(&ds_cmdline, arg);
1883+
dynstr_append_mem(&ds_cmdline, arg, strlen(arg));
18821884
dynstr_append_mem(&ds_cmdline, STRING_WITH_LEN(" "));
18831885
}
18841886

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

20372039
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" --- "));
2038-
dynstr_append(&ds_tmp, filename1);
2040+
dynstr_append_mem(&ds_tmp, filename1, strlen(filename1));
20392041
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" >>>\n"));
20402042
cat_file(&ds_tmp, filename1);
20412043
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN("<<<\n --- "));
2042-
dynstr_append(&ds_tmp, filename1);
2044+
dynstr_append_mem(&ds_tmp, filename1, strlen(filename1));
20432045
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" >>>\n"));
20442046
cat_file(&ds_tmp, filename2);
20452047
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN("<<<<\n"));
@@ -3295,13 +3297,15 @@ static int replace(DYNAMIC_STRING *ds_str,
32953297
{
32963298
DYNAMIC_STRING ds_tmp;
32973299
const char *start= strstr(ds_str->str, search_str);
3300+
size_t prefixlen= start - ds_str->str;
32983301
if (!start)
32993302
return 1;
33003303
init_dynamic_string(&ds_tmp, "",
33013304
ds_str->length + replace_len, 256);
3302-
dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str);
3305+
dynstr_append_mem(&ds_tmp, ds_str->str, prefixlen);
33033306
dynstr_append_mem(&ds_tmp, replace_str, replace_len);
3304-
dynstr_append(&ds_tmp, start + search_len);
3307+
dynstr_append_mem(&ds_tmp, start + search_len,
3308+
ds_str->length - prefixlen - search_len);
33053309
dynstr_set(ds_str, ds_tmp.str);
33063310
dynstr_free(&ds_tmp);
33073311
return 0;
@@ -3806,7 +3810,7 @@ void do_remove_files_wildcard(struct st_command *command)
38063810
wild_compare(file->name, ds_wild.str, 0))
38073811
continue;
38083812
ds_file_to_remove.length= directory_length;
3809-
dynstr_append(&ds_file_to_remove, file->name);
3813+
dynstr_append_mem(&ds_file_to_remove, file->name, strlen(file->name));
38103814
DBUG_PRINT("info", ("removing file: %s", ds_file_to_remove.str));
38113815
if ((error= (my_delete(ds_file_to_remove.str, MYF(MY_WME)) != 0)))
38123816
sys_errno= my_errno;
@@ -7685,7 +7689,7 @@ void append_field(DYNAMIC_STRING *ds, uint col_idx, MYSQL_FIELD* field,
76857689
}
76867690
else
76877691
{
7688-
dynstr_append(ds, field->name);
7692+
dynstr_append_mem(ds, field->name, strlen(field->name));
76897693
dynstr_append_mem(ds, "\t", 1);
76907694
replace_dynstr_append_mem(ds, val, len);
76917695
dynstr_append_mem(ds, "\n", 1);
@@ -7858,12 +7862,12 @@ void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows,
78587862
const char *info)
78597863
{
78607864
char buf[40], buff2[21];
7861-
sprintf(buf,"affected rows: %s\n", llstr(affected_rows, buff2));
7862-
dynstr_append(ds, buf);
7865+
size_t len= sprintf(buf,"affected rows: %s\n", llstr(affected_rows, buff2));
7866+
dynstr_append_mem(ds, buf, len);
78637867
if (info)
78647868
{
78657869
dynstr_append_mem(ds, STRING_WITH_LEN("info: "));
7866-
dynstr_append(ds, info);
7870+
dynstr_append_mem(ds, info, strlen(info));
78677871
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
78687872
}
78697873
}
@@ -7913,7 +7917,8 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
79137917
dynstr_append_mem(ds, STRING_WITH_LEN("-- "));
79147918
if (type <= SESSION_TRACK_END)
79157919
{
7916-
dynstr_append(ds, trking_info_desc[type]);
7920+
dynstr_append_mem(ds, trking_info_desc[type],
7921+
strlen(trking_info_desc[type]));
79177922
}
79187923
else
79197924
{
@@ -9805,7 +9810,7 @@ void mark_progress(struct st_command* command __attribute__((unused)),
98059810
dynstr_append_mem(&ds_progress, "\t", 1);
98069811

98079812
/* Filename */
9808-
dynstr_append(&ds_progress, cur_file->file_name);
9813+
dynstr_append_mem(&ds_progress, cur_file->file_name, strlen(cur_file->file_name));
98099814
dynstr_append_mem(&ds_progress, ":", 1);
98109815

98119816
/* Line in file */
@@ -12105,7 +12110,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input,
1210512110
for (i= 0; i < lines.elements ; i++)
1210612111
{
1210712112
const char **line= dynamic_element(&lines, i, const char**);
12108-
dynstr_append(ds, *line);
12113+
dynstr_append_mem(ds, *line, strlen(*line));
1210912114
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
1211012115
}
1211112116

extra/mariabackup/xtrabackup.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,8 +1695,11 @@ struct my_option xb_server_options[] =
16951695
"Path to InnoDB log files.", &srv_log_group_home_dir,
16961696
&srv_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
16971697
{"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT,
1698-
"Percentage of dirty pages allowed in bufferpool.", (G_PTR*) &srv_max_buf_pool_modified_pct,
1699-
(G_PTR*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0},
1698+
"Percentage of dirty pages allowed in bufferpool.",
1699+
(G_PTR*) &srv_max_buf_pool_modified_pct,
1700+
(G_PTR*) &srv_max_buf_pool_modified_pct, 0, GET_DOUBLE, REQUIRED_ARG,
1701+
(longlong)getopt_double2ulonglong(90), (longlong)getopt_double2ulonglong(0),
1702+
getopt_double2ulonglong(100), 0, 0, 0},
17001703
{"innodb_use_native_aio", OPT_INNODB_USE_NATIVE_AIO,
17011704
"Use native AIO if supported on this platform.",
17021705
(G_PTR*) &srv_use_native_aio,

extra/my_print_defaults.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ int main(int argc, char **argv)
175175
if ((error= load_defaults(config_file, (const char **) load_default_groups,
176176
&count, &arguments)))
177177
{
178+
my_free(load_default_groups);
178179
my_end(0);
179180
if (error == 4)
180181
return 0;

mysql-test/main/derived_split_innodb.result

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,5 +862,20 @@ SELECT * FROM t1 JOIN t2 WHERE (t1.a, t2.b) IN (SELECT * FROM v);
862862
a b
863863
DROP VIEW v;
864864
DROP TABLE t1, t2, t3;
865+
#
866+
# MDEV-31279 Crash when lateral derived is guaranteed to return no rows
867+
#
868+
CREATE TABLE t1 (a CHAR(1)) ENGINE=MyISAM;
869+
INSERT INTO t1 VALUES ('1'),('2');
870+
CREATE TABLE t2 (b INT, KEY(b)) ENGINE=MyISAM;
871+
ALTER TABLE t2 DISABLE KEYS;
872+
INSERT INTO t2 VALUES (1),(2),(3);
873+
ALTER TABLE t2 ENABLE KEYS;
874+
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
875+
INSERT INTO t3 (c) SELECT seq FROM seq_1_to_101;
876+
SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM
877+
(SELECT t2.b FROM t2 WHERE NOT EXISTS (SELECT 1 FROM t3) GROUP BY b) sq);
878+
a
879+
DROP TABLE t1, t2, t3;
865880
# End of 10.4 tests
866881
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

mysql-test/main/derived_split_innodb.test

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,24 @@ SELECT * FROM t1 JOIN t2 WHERE (t1.a, t2.b) IN (SELECT * FROM v);
487487
DROP VIEW v;
488488
DROP TABLE t1, t2, t3;
489489

490+
--echo #
491+
--echo # MDEV-31279 Crash when lateral derived is guaranteed to return no rows
492+
--echo #
493+
494+
CREATE TABLE t1 (a CHAR(1)) ENGINE=MyISAM;
495+
INSERT INTO t1 VALUES ('1'),('2');
496+
CREATE TABLE t2 (b INT, KEY(b)) ENGINE=MyISAM;
497+
ALTER TABLE t2 DISABLE KEYS;
498+
INSERT INTO t2 VALUES (1),(2),(3);
499+
ALTER TABLE t2 ENABLE KEYS;
500+
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
501+
INSERT INTO t3 (c) SELECT seq FROM seq_1_to_101;
502+
503+
SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM
504+
(SELECT t2.b FROM t2 WHERE NOT EXISTS (SELECT 1 FROM t3) GROUP BY b) sq);
505+
506+
DROP TABLE t1, t2, t3;
507+
490508
--echo # End of 10.4 tests
491509

492510
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

mysql-test/main/mysql_upgrade.result

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2505,6 +2505,14 @@ Phase 7/8: uninstalling plugins
25052505
Phase 8/8: Running 'FLUSH PRIVILEGES'
25062506
OK
25072507
set global sql_safe_updates=@orig_sql_safe_updates;
2508+
#
2509+
# MDEV-32043 Remove plugins previously external that are now built in (unix_socket)
2510+
#
2511+
INSERT INTO mysql.plugin SELECT 'unix_socket', 'auth_socket.so'
2512+
FROM dual WHERE convert(@@version_compile_os using latin1) not in ('Win32', 'Win64', 'Windows');
2513+
# mariadb-upgrade --force --silent 2>&1
2514+
SELECT * FROM mysql.plugin WHERE name='unix_socket';
2515+
name dl
25082516
# End of 10.4 tests
25092517
#
25102518
# Check that mysql_upgrade can be run on mysqldump

mysql-test/main/mysql_upgrade.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,17 @@ set global sql_safe_updates=ON;
496496
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
497497
set global sql_safe_updates=@orig_sql_safe_updates;
498498

499+
--echo #
500+
--echo # MDEV-32043 Remove plugins previously external that are now built in (unix_socket)
501+
--echo #
502+
503+
INSERT INTO mysql.plugin SELECT 'unix_socket', 'auth_socket.so'
504+
FROM dual WHERE convert(@@version_compile_os using latin1) not in ('Win32', 'Win64', 'Windows');
505+
--echo # mariadb-upgrade --force --silent 2>&1
506+
--exec $MYSQL_UPGRADE --force --silent 2>&1
507+
SELECT * FROM mysql.plugin WHERE name='unix_socket';
508+
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
509+
499510
--echo # End of 10.4 tests
500511

501512
#
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Running mysql_upgrade with --check-if-upgrade-is-needed
2+
Checking for absence of temporary files by mysql_upgrade
3+
No temporary files found
4+
End of 10.4 tests
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-- source include/mysql_upgrade_preparation.inc
2+
3+
#
4+
# MDEV-31925 mysqld_upgrade --check-if-upgrade-is-needed leaks files
5+
#
6+
7+
# Run mysql_upgrade with --check-if-upgrade-is-needed
8+
--echo Running mysql_upgrade with --check-if-upgrade-is-needed
9+
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed 2>&1
10+
11+
# Check if temporary files related to mysql_upgrade are cleared
12+
--echo Checking for absence of temporary files by mysql_upgrade
13+
--perl
14+
15+
# Use the temporary directory path from the MySQL configuration
16+
my $tmpdir = "$ENV{MYSQL_TMP_DIR}";
17+
18+
die "Test failed: Found temporary file left by mysql_upgrade\n" if (glob("$tmpdir/mysql_upgrade-*"));
19+
print "No temporary files found\n";
20+
EOF
21+
22+
let $MYSQLD_DATADIR= `select @@datadir`;
23+
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
24+
--echo End of 10.4 tests

0 commit comments

Comments
 (0)