Skip to content

Commit 94b4578

Browse files
committed
Merge 10.5 into 10.6
2 parents 66b8edf + 16388f3 commit 94b4578

File tree

326 files changed

+22468
-4108
lines changed

Some content is hidden

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

326 files changed

+22468
-4108
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: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,20 @@ set -e
1818
export DEB_BUILD_OPTIONS="nocheck $DEB_BUILD_OPTIONS"
1919

2020
# Take the files and part of control from MCS directory
21-
if [[ -d storage/columnstore/columnstore/debian ]]; then
21+
if [[ -d storage/columnstore/columnstore/debian ]]
22+
then
2223
cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/
2324
echo >> debian/control
2425
cat storage/columnstore/columnstore/debian/control >> debian/control
26+
27+
# From Debian Bullseye/Ubuntu Hirsute onwards libreadline is gone, so build with it
28+
# only on older releases where it is still available. This can be removed once
29+
# MCOL-4535 lands in MariaDB.
30+
if apt-cache madison libreadline-gplv2-dev | grep 'libreadline-gplv2-dev' >/dev/null 2>&1
31+
then
32+
sed 's/libpcre2-dev,/libpcre2-dev, libreadline-gplv2-dev [amd64],/' -i debian/control
33+
fi
34+
2535
# ColumnStore is explcitly disabled in the native build, so allow it now
2636
# when build it when triggered by autobake-deb.sh
2737
sed '/-DPLUGIN_COLUMNSTORE=NO/d' -i debian/rules
@@ -60,6 +70,13 @@ then
6070
sed "/Package: libmariadbd-dev/,/^$/d" -i debian/control
6171
fi
6272

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+
6380
if [[ $(arch) =~ i[346]86 ]]
6481
then
6582
sed "/Package: mariadb-plugin-rocksdb/,/^$/d" -i debian/control
@@ -75,7 +92,7 @@ then
7592
echo "usr/bin/sst_dump" >> debian/mariadb-plugin-rocksdb.install
7693
fi
7794

78-
# From Debian Buster/Ubuntu Bionic, libcurl4 replaces libcurl3.
95+
# From Debian Buster/Ubuntu Bionic, libcurl4 replaces libcurl3
7996
if ! apt-cache madison libcurl4 | grep 'libcurl4' >/dev/null 2>&1
8097
then
8198
sed 's/libcurl4/libcurl3/g' -i debian/control

debian/control

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Build-Depends: bison,
3535
libnuma-dev [linux-any],
3636
libpam0g-dev,
3737
libpcre2-dev,
38-
libreadline-gplv2-dev [amd64],
3938
libsnappy-dev,
4039
libssl-dev,
4140
libssl-dev:native,

debian/salsa-ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ build:
3737
- apt-get update && eatmydata apt-get install --yes --no-install-recommends aptitude devscripts ccache equivs
3838
- cd ${WORKING_DIR}/${SOURCE_DIR}
3939
- eatmydata install-build-deps.sh .
40+
- |
41+
# From Debian Bullseye/Ubuntu Hirsute onwards libreadline is gone, so build with it
42+
# only on older releases where it is still available. This can be removed once
43+
# MCOL-4535 lands in MariaDB.
44+
if apt-cache madison libreadline-gplv2-dev | grep 'libreadline-gplv2-dev' >/dev/null 2>&1
45+
then
46+
apt-get install --yes libreadline-gplv2-dev
47+
fi
4048
- update-ccache-symlinks; ccache -z # Zero out ccache counters
4149
- while true; do sleep 600; echo "10 minutes passed" >&2; done & # Progress keeper since build is long and silent
4250
- debian/autobake-deb.sh |& tail -n 10000 # Keep Gitlab-CI output under 4 MB
@@ -146,6 +154,12 @@ blhc:
146154
# Prime the apt cache so later apt commands can run
147155
apt-get update
148156

157+
# Readline was removed from Debian Sid (and Bullseye) in Feb 2021. To be able to install older
158+
# versions of MariaDB that depend on it, fetch and install it from Buster.
159+
.test-install-readline-in-sid-for-backwards-compat: &test-install-readline-in-sid-for-backwards-compat |
160+
curl -O http://ftp.de.debian.org/debian/pool/main/r/readline5/libreadline5_5.2+dfsg-3+b13_amd64.deb
161+
apt install -y ./libreadline5_5.2+dfsg-3+b13_amd64.deb
162+
149163
.test-verify-initial: &test-verify-initial |
150164
dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed
151165
service mysql status || service mariadb status # Early MariaDB 10.5 only had 'mariadb'
@@ -664,6 +678,7 @@ mariadb.org-10.5 to mariadb-10.6 upgrade:
664678
- curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
665679
- echo 'deb http://mirror.one.com/mariadb/repo/10.5/debian sid main' > /etc/apt/sources.list.d/mariadb.list
666680
- apt-get update
681+
- *test-install-readline-in-sid-for-backwards-compat
667682
# Package libmariadbclient-dev from mariadb.org conficts with libmariadb-dev in Sid, so cannot use wildcard that would include it
668683
- apt-get install -y 'mariadb*' libmariadb3 'libmariadb-*' 'libmariadbd*'
669684
- *test-verify-initial
@@ -698,6 +713,7 @@ mariadb.org-10.4 to mariadb-10.6 upgrade:
698713
- curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
699714
- echo 'deb http://mirror.one.com/mariadb/repo/10.4/debian sid main' > /etc/apt/sources.list.d/mariadb.list
700715
- apt-get update
716+
- *test-install-readline-in-sid-for-backwards-compat
701717
- apt-get install -y mariadb-server-10.4
702718
# MariaDB.org version of 10.4 and early 10.5 do not install an init file, so
703719
# it must be installed here manually
@@ -731,6 +747,7 @@ mariadb.org-10.3 to mariadb-10.6 upgrade:
731747
- curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
732748
- echo 'deb http://mirror.one.com/mariadb/repo/10.3/debian sid main' > /etc/apt/sources.list.d/mariadb.list
733749
- apt-get update
750+
- *test-install-readline-in-sid-for-backwards-compat
734751
- apt-get install -y mariadb-server-10.3
735752
# Verify initial state before upgrade
736753
- dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed
@@ -767,6 +784,7 @@ mariadb.org-10.2 to mariadb-10.6 upgrade:
767784
- curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
768785
- echo 'deb http://mirror.one.com/mariadb/repo/10.2/debian sid main' > /etc/apt/sources.list.d/mariadb.list
769786
- apt-get update
787+
- *test-install-readline-in-sid-for-backwards-compat
770788
- apt-get install -y mariadb-server-10.2
771789
# Verify initial state before upgrade
772790
- dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed

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

0 commit comments

Comments
 (0)