Skip to content

Commit 16388f3

Browse files
committed
Merge mariadb-10.5.9
2 parents d82386b + 9d7dc1f commit 16388f3

File tree

322 files changed

+22314
-4101
lines changed

Some content is hidden

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

322 files changed

+22314
-4101
lines changed

client/mysqldump.c

Lines changed: 86 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
/* on merge conflict, bump to a higher version again */
4343
#define DUMP_VERSION "10.19"
4444

45+
/**
46+
First mysql version supporting sequences.
47+
*/
48+
#define FIRST_SEQUENCE_VERSION 100300
49+
4550
#include <my_global.h>
4651
#include <my_sys.h>
4752
#include <my_user.h>
@@ -93,6 +98,11 @@
9398
/* Max length GTID position that we will output. */
9499
#define MAX_GTID_LENGTH 1024
95100

101+
/* Dump sequence/tables control */
102+
#define DUMP_TABLE_ALL -1
103+
#define DUMP_TABLE_TABLE 0
104+
#define DUMP_TABLE_SEQUENCE 1
105+
96106
static my_bool ignore_table_data(const uchar *hash_key, size_t len);
97107
static void add_load_option(DYNAMIC_STRING *str, const char *option,
98108
const char *option_value);
@@ -1079,6 +1089,22 @@ static int get_options(int *argc, char ***argv)
10791089
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
10801090
return(ho_error);
10811091

1092+
/*
1093+
Dumping under --system=stats with --replace or --inser-ignore is safe and will not
1094+
retult into race condition. Otherwise dump only structure and ignore data by default
1095+
while dumping.
1096+
*/
1097+
if (!(opt_system & OPT_SYSTEM_STATS) && !(opt_ignore || opt_replace_into))
1098+
{
1099+
if (my_hash_insert(&ignore_data,
1100+
(uchar*) my_strdup(PSI_NOT_INSTRUMENTED,
1101+
"mysql.innodb_index_stats", MYF(MY_WME))) ||
1102+
my_hash_insert(&ignore_data,
1103+
(uchar*) my_strdup(PSI_NOT_INSTRUMENTED,
1104+
"mysql.innodb_table_stats", MYF(MY_WME))))
1105+
return(EX_EOM);
1106+
}
1107+
10821108
if (opt_system & OPT_SYSTEM_ALL)
10831109
opt_system|= ~0;
10841110

@@ -3931,14 +3957,6 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
39313957
MYSQL_ROW row;
39323958
DBUG_ENTER("dump_table");
39333959

3934-
/*
3935-
Check does table has a sequence structure and if has apply different sql queries
3936-
*/
3937-
if (check_if_ignore_table(table, table_type) & IGNORE_SEQUENCE_TABLE)
3938-
{
3939-
get_sequence_structure(table, db);
3940-
DBUG_VOID_RETURN;
3941-
}
39423960
/*
39433961
Make sure you get the create table info before the following check for
39443962
--no-data flag below. Otherwise, the create table info won't be printed.
@@ -4440,18 +4458,36 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
44404458
} /* dump_table */
44414459

44424460

4443-
static char *getTableName(int reset)
4461+
static char *getTableName(int reset, int want_sequences)
44444462
{
44454463
MYSQL_ROW row;
44464464

44474465
if (!get_table_name_result)
44484466
{
4449-
if (!(get_table_name_result= mysql_list_tables(mysql,NullS)))
4450-
return(NULL);
4467+
if (mysql_get_server_version(mysql) >= FIRST_SEQUENCE_VERSION)
4468+
{
4469+
const char *query= "SHOW FULL TABLES";
4470+
if (mysql_query_with_error_report(mysql, 0, query))
4471+
return (NULL);
4472+
4473+
if (!(get_table_name_result= mysql_store_result(mysql)))
4474+
return (NULL);
4475+
}
4476+
else
4477+
{
4478+
if (!(get_table_name_result= mysql_list_tables(mysql,NullS)))
4479+
return(NULL);
4480+
}
44514481
}
44524482
if ((row= mysql_fetch_row(get_table_name_result)))
4453-
return((char*) row[0]);
4483+
{
4484+
if (want_sequences != DUMP_TABLE_ALL)
4485+
while (row && MY_TEST(strcmp(row[1], "SEQUENCE")) == want_sequences)
4486+
row= mysql_fetch_row(get_table_name_result);
44544487

4488+
if (row)
4489+
return((char*) row[0]);
4490+
}
44554491
if (reset)
44564492
mysql_data_seek(get_table_name_result,0); /* We want to read again */
44574493
else
@@ -4844,14 +4880,16 @@ static int dump_all_servers()
48444880

48454881
static int dump_all_stats()
48464882
{
4847-
my_bool prev_no_create_info;
4883+
my_bool prev_no_create_info, prev_opt_replace_into;
48484884

48494885
if (mysql_select_db(mysql, "mysql"))
48504886
{
48514887
DB_error(mysql, "when selecting the database");
48524888
return 1; /* If --force */
48534889
}
48544890
fprintf(md_result_file,"\nUSE mysql;\n");
4891+
prev_opt_replace_into= opt_replace_into;
4892+
opt_replace_into|= !opt_ignore;
48554893
prev_no_create_info= opt_no_create_info;
48564894
opt_no_create_info= 1; /* don't overwrite recreate tables */
48574895
/* EITS added in 10.0.1 */
@@ -4870,6 +4908,7 @@ static int dump_all_stats()
48704908
dump_table("innodb_table_stats", "mysql", NULL, 0);
48714909
}
48724910
opt_no_create_info= prev_no_create_info;
4911+
opt_replace_into= prev_opt_replace_into;
48734912
return 0;
48744913
}
48754914

@@ -4880,12 +4919,14 @@ static int dump_all_stats()
48804919

48814920
static int dump_all_timezones()
48824921
{
4883-
my_bool opt_prev_no_create_info;
4922+
my_bool opt_prev_no_create_info, opt_prev_replace_into;
48844923
if (mysql_select_db(mysql, "mysql"))
48854924
{
48864925
DB_error(mysql, "when selecting the database");
48874926
return 1; /* If --force */
48884927
}
4928+
opt_prev_replace_into= opt_replace_into;
4929+
opt_replace_into|= !opt_ignore;
48894930
opt_prev_no_create_info= opt_no_create_info;
48904931
opt_no_create_info= 1;
48914932
fprintf(md_result_file,"\nUSE mysql;\n");
@@ -4895,6 +4936,7 @@ static int dump_all_timezones()
48954936
dump_table("time_zone_transition", "mysql", NULL, 0);
48964937
dump_table("time_zone_transition_type", "mysql", NULL, 0);
48974938
opt_no_create_info= opt_prev_no_create_info;
4939+
opt_replace_into= opt_prev_replace_into;
48984940
return 0;
48994941
}
49004942

@@ -5384,7 +5426,7 @@ static int dump_all_tables_in_db(char *database)
53845426
{
53855427
DYNAMIC_STRING query;
53865428
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
5387-
for (numrows= 0 ; (table= getTableName(1)) ; )
5429+
for (numrows= 0 ; (table= getTableName(1, DUMP_TABLE_ALL)) ; )
53885430
{
53895431
char *end= strmov(afterdot, table);
53905432
if (include_table((uchar*) hash_key,end - hash_key))
@@ -5418,7 +5460,19 @@ static int dump_all_tables_in_db(char *database)
54185460
DBUG_RETURN(1);
54195461
}
54205462
}
5421-
while ((table= getTableName(0)))
5463+
5464+
if (mysql_get_server_version(mysql) >= FIRST_SEQUENCE_VERSION &&
5465+
!opt_no_create_info)
5466+
{
5467+
// First process sequences
5468+
while ((table= getTableName(1, DUMP_TABLE_SEQUENCE)))
5469+
{
5470+
char *end= strmov(afterdot, table);
5471+
if (include_table((uchar*) hash_key, end - hash_key))
5472+
get_sequence_structure(table, database);
5473+
}
5474+
}
5475+
while ((table= getTableName(0, DUMP_TABLE_TABLE)))
54225476
{
54235477
char *end= strmov(afterdot, table);
54245478
if (include_table((uchar*) hash_key, end - hash_key))
@@ -5567,7 +5621,7 @@ static my_bool dump_all_views_in_db(char *database)
55675621
{
55685622
DYNAMIC_STRING query;
55695623
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
5570-
for (numrows= 0 ; (table= getTableName(1)); )
5624+
for (numrows= 0 ; (table= getTableName(1, DUMP_TABLE_TABLE)); )
55715625
{
55725626
char *end= strmov(afterdot, table);
55735627
if (include_table((uchar*) hash_key,end - hash_key))
@@ -5590,7 +5644,7 @@ static my_bool dump_all_views_in_db(char *database)
55905644
else
55915645
verbose_msg("-- dump_all_views_in_db : logs flushed successfully!\n");
55925646
}
5593-
while ((table= getTableName(0)))
5647+
while ((table= getTableName(0, DUMP_TABLE_TABLE)))
55945648
{
55955649
char *end= strmov(afterdot, table);
55965650
if (include_table((uchar*) hash_key, end - hash_key))
@@ -5720,7 +5774,7 @@ static int get_sys_var_lower_case_table_names()
57205774

57215775
static int dump_selected_tables(char *db, char **table_names, int tables)
57225776
{
5723-
char table_buff[NAME_LEN*2+3];
5777+
char table_buff[NAME_LEN*2+3], table_type[NAME_LEN];
57245778
DYNAMIC_STRING lock_tables_query;
57255779
char **dump_tables, **pos, **end;
57265780
int lower_case_table_names;
@@ -5817,9 +5871,22 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
58175871
DBUG_RETURN(1);
58185872
}
58195873
}
5874+
5875+
if (mysql_get_server_version(mysql) >= FIRST_SEQUENCE_VERSION)
5876+
{
5877+
/* Dump Sequence first */
5878+
for (pos= dump_tables; pos < end; pos++)
5879+
{
5880+
DBUG_PRINT("info",("Dumping sequence(?) %s", *pos));
5881+
if (check_if_ignore_table(*pos, table_type) & IGNORE_SEQUENCE_TABLE)
5882+
get_sequence_structure(*pos, db);
5883+
}
5884+
}
58205885
/* Dump each selected table */
58215886
for (pos= dump_tables; pos < end; pos++)
58225887
{
5888+
if (check_if_ignore_table(*pos, table_type) & IGNORE_SEQUENCE_TABLE)
5889+
continue;
58235890
DBUG_PRINT("info",("Dumping table %s", *pos));
58245891
dump_table(*pos, db, NULL, 0);
58255892
if (opt_dump_triggers &&

cmake/pcre.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ MACRO(BUNDLE_PCRE2)
3636
ExternalProject_Add(
3737
pcre2
3838
PREFIX "${dir}"
39-
URL "http://ftp.pcre.org/pub/pcre/pcre2-10.34.zip"
40-
URL_MD5 fdb10dba7f3be43730966bebdd3755ef
39+
URL "http://ftp.pcre.org/pub/pcre/pcre2-10.36.zip"
40+
URL_MD5 ba9e743af42aac5642f7504b12af4116
4141
INSTALL_COMMAND ""
4242
CMAKE_ARGS
4343
"-DPCRE2_BUILD_TESTS=OFF"

debian/autobake-deb.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ then
7070
sed "/Package: libmariadbd-dev/,/^$/d" -i debian/control
7171
fi
7272

73+
## Skip TokuDB if arch is not amd64
74+
if [[ ! $(dpkg-architecture -q DEB_BUILD_ARCH) =~ amd64 ]]
75+
then
76+
sed '/Package: mariadb-plugin-tokudb/,/^$/d' -i debian/control
77+
fi
78+
79+
7380
if [[ $(arch) =~ i[346]86 ]]
7481
then
7582
sed "/Package: mariadb-plugin-rocksdb/,/^$/d" -i debian/control

include/mysql/service_wsrep.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ extern struct wsrep_service_st {
9090
bool (*wsrep_thd_set_wsrep_aborter_func)(MYSQL_THD bf_thd, MYSQL_THD thd);
9191
void (*wsrep_report_bf_lock_wait_func)(const MYSQL_THD thd,
9292
unsigned long long trx_id);
93+
void (*wsrep_thd_kill_LOCK_func)(const MYSQL_THD thd);
94+
void (*wsrep_thd_kill_UNLOCK_func)(const MYSQL_THD thd);
9395
} *wsrep_service;
9496

9597
#define MYSQL_SERVICE_WSREP_INCLUDED
@@ -107,6 +109,8 @@ extern struct wsrep_service_st {
107109
#define wsrep_prepare_key_for_innodb(A,B,C,D,E,F,G) wsrep_service->wsrep_prepare_key_for_innodb_func(A,B,C,D,E,F,G)
108110
#define wsrep_thd_LOCK(T) wsrep_service->wsrep_thd_LOCK_func(T)
109111
#define wsrep_thd_UNLOCK(T) wsrep_service->wsrep_thd_UNLOCK_func(T)
112+
#define wsrep_thd_kill_LOCK(T) wsrep_service->wsrep_thd_kill_LOCK_func(T)
113+
#define wsrep_thd_kill_UNLOCK(T) wsrep_service->wsrep_thd_kill_UNLOCK_func(T)
110114
#define wsrep_thd_query(T) wsrep_service->wsrep_thd_query_func(T)
111115
#define wsrep_thd_retry_counter(T) wsrep_service->wsrep_thd_retry_counter_func(T)
112116
#define wsrep_thd_ignore_table(T) wsrep_service->wsrep_thd_ignore_table_func(T)
@@ -170,6 +174,9 @@ extern "C" void wsrep_thd_LOCK(const MYSQL_THD thd);
170174
/* Unlock thd wsrep lock */
171175
extern "C" void wsrep_thd_UNLOCK(const MYSQL_THD thd);
172176

177+
extern "C" void wsrep_thd_kill_LOCK(const MYSQL_THD thd);
178+
extern "C" void wsrep_thd_kill_UNLOCK(const MYSQL_THD thd);
179+
173180
/* Return thd client state string */
174181
extern "C" const char* wsrep_thd_client_state_str(const MYSQL_THD thd);
175182
/* Return thd client mode string */

include/mysql_com.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "my_decimal_limits.h"
2525

2626
#define HOSTNAME_LENGTH 60
27+
#define HOSTNAME_LENGTH_STR STRINGIFY_ARG(HOSTNAME_LENGTH)
2728
#define SYSTEM_CHARSET_MBMAXLEN 3
2829
#define NAME_CHAR_LEN 64 /* Field/table name length */
2930
#define USERNAME_CHAR_LENGTH 128

include/service_versions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@
4141
#define VERSION_thd_specifics 0x0100
4242
#define VERSION_thd_timezone 0x0100
4343
#define VERSION_thd_wait 0x0100
44-
#define VERSION_wsrep 0x0202
44+
#define VERSION_wsrep 0x0203
4545
#define VERSION_json 0x0100
4646
#define VERSION_thd_mdl 0x0100

libmariadb

libmysqld/lib_sql.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,8 @@ int init_embedded_server(int argc, char **argv, char **groups)
625625

626626
(void) thr_setconcurrency(concurrency); // 10 by default
627627

628-
start_handle_manager();
628+
if (flush_time && flush_time != ~(ulong) 0L)
629+
start_handle_manager();
629630

630631
// FIXME initialize binlog_filter and rpl_filter if not already done
631632
// corresponding delete is in clean_up()

man/mysqldump.1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,7 +2277,7 @@ servers \- remote (federated) servers as \fBCREATE SERVER\fR\&.
22772277
.sp -1
22782278
.IP \(bu 2.3
22792279
.\}
2280-
stats \- statistics tables, InnoDB and Engine Independent Table Statistics (EITS), are dumped as \fBINSERT\fR/\fBREPLACE INFO\fR statements without (re)creating tables\&.
2280+
stats \- statistics tables, InnoDB and Engine Independent Table Statistics (EITS), are dumped as \fBREPLACE INTO\fR (or \fBINSERT IGNORE\fR if \fB\-\-insert\-into\fR is specified) statements without (re)creating tables\&.
22812281
.RE
22822282
.RS 4
22832283
.ie n \{\
@@ -2287,7 +2287,7 @@ stats \- statistics tables, InnoDB and Engine Independent Table Statistics (EITS
22872287
.sp -1
22882288
.IP \(bu 2.3
22892289
.\}
2290-
timezones \- timezone related system tables dumped as \fBINSERT\fR/\fBREPLACE INTO\fR statements without (re)creating tables\&.
2290+
timezones \- timezone related system tables dumped as \fBREPLACE INTO\fR (or \fBINSERT IGNORE\fR if \fB\-\-insert\-into\fR is specified) statements without (re)creating tables\&.
22912291
.RE
22922292
.sp
22932293
The format of the output is affected by \fB\-\-replace\fR and \fB\-\-insert\-into\fR\&. The \fB\-\-replace\fR option will output \fBCREATE OR REPLACE\fR
@@ -2297,12 +2297,11 @@ With \fB\-\-system=user\fR (or \fBall\fR), and \fB\-\-replace\fR, SQL is generat
22972297
.sp
22982298
The \fB\-\-insert\-into\fR option will cause \fBCREATE IF NOT EXIST\fR forms of SQL to generated if available.
22992299
.sp
2300-
For stats, and timezones, \fB\-\-replace\fR and \fB\-\-insert\-info\fR have the usual effects.
2300+
For stats, and timezones, \fB\-\-replace\fR and \fB\-\-insert\-into\fR have the usual effects.
23012301
.sp
23022302
Enabling specific options here will cause the relevant tables in the mysql database to be ignored when dumping the mysql database or \fB\-\-all\-databases\fR\&.
23032303
.sp
2304-
Experimentally this option is designed to be able to dump system information from MySQL-5\&.7 and 8\&.0 servers\&. SQL generated is also
2305-
experimentally compatible with MySQL-5\&.7/8\&.0\&. Mappings of implemenation specific grants/plugins isn't always one-to-one however\&.
2304+
To help in migrating from MySQL to MariaDB, this option is designed to be able to dump system information from MySQL-5\&.7 and 8\&.0 servers\&. SQL generated is also experimentally compatible with MySQL-5\&.7/8\&.0. Mappings of implementation specific grants/plugins isn't always one-to-one however between MariaDB and MySQL and will require manual changes\&.
23062305
.sp
23072306
.RE
23082307
.RS 4

mysql-test/main/check_constraint.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,15 @@ a b
235235
insert t1 (b) values (1);
236236
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
237237
drop table t1;
238+
#
239+
# MDEV-24274 ALTER TABLE with CHECK CONSTRAINTS gives "Out of Memory" error
240+
#
241+
create table t1 (id varchar(2), constraint id check (id regexp '[a-z]'));
242+
alter table t1 force;
243+
show create table t1;
244+
Table Create Table
245+
t1 CREATE TABLE `t1` (
246+
`id` varchar(2) DEFAULT NULL,
247+
CONSTRAINT `id` CHECK (`id` regexp '[a-z]')
248+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
249+
drop table t1;

0 commit comments

Comments
 (0)