Skip to content

Commit 3f57267

Browse files
committed
Merge 10.5 into 10.6
2 parents c410f7a + 4c3ad24 commit 3f57267

File tree

112 files changed

+1741
-570
lines changed

Some content is hidden

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

112 files changed

+1741
-570
lines changed

appveyor.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ init:
66

77
version: build-{build}~branch-{branch}
88

9+
cache:
10+
- C:\ProgramData\chocolatey\bin -> appveyor.yml
11+
- C:\ProgramData\chocolatey\lib -> appveyor.yml
12+
913
clone_depth: 1
1014

1115
build_script:

client/mysql.cc

+3-8
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ extern "C" {
100100
# endif
101101
# endif
102102
#define HAVE_READLINE
103-
#define USE_POPEN
104103
#endif
104+
#define USE_POPEN
105105
}
106106

107107
#ifdef HAVE_VIDATTR
@@ -4269,11 +4269,6 @@ com_nopager(String *buffer __attribute__((unused)),
42694269
}
42704270
#endif
42714271

4272-
4273-
/*
4274-
Sorry, you can't send the result to an editor in Win32
4275-
*/
4276-
42774272
#ifdef USE_POPEN
42784273
static int
42794274
com_edit(String *buffer,char *line __attribute__((unused)))
@@ -4294,7 +4289,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))
42944289

42954290
if (!(editor = (char *)getenv("EDITOR")) &&
42964291
!(editor = (char *)getenv("VISUAL")))
4297-
editor = "vi";
4292+
editor = IF_WIN("notepad","vi");
42984293
strxmov(buff,editor," ",filename,NullS);
42994294
if ((error= system(buff)))
43004295
{
@@ -4309,7 +4304,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))
43094304
if ((fd = my_open(filename,O_RDONLY, MYF(MY_WME))) < 0)
43104305
goto err;
43114306
(void) buffer->alloc((uint) stat_arg.st_size);
4312-
if ((tmp=read(fd,(char*) buffer->ptr(),buffer->alloced_length())) >= 0L)
4307+
if ((tmp=(int)my_read(fd,(uchar*) buffer->ptr(),buffer->alloced_length(),MYF(0))) >= 0)
43134308
buffer->length((uint) tmp);
43144309
else
43154310
buffer->length(0);

client/mysqltest.cc

+100-2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ static my_bool disable_info= 1;
132132
static my_bool abort_on_error= 1, opt_continue_on_error= 0;
133133
static my_bool server_initialized= 0;
134134
static my_bool is_windows= 0;
135+
static my_bool optimizer_trace_active= 0;
135136
static char **default_argv;
136137
static const char *load_default_groups[]=
137138
{ "mysqltest", "mariadb-test", "client", "client-server", "client-mariadb",
@@ -388,6 +389,7 @@ enum enum_commands {
388389
Q_MOVE_FILE, Q_REMOVE_FILES_WILDCARD, Q_SEND_EVAL,
389390
Q_ENABLE_PREPARE_WARNINGS, Q_DISABLE_PREPARE_WARNINGS,
390391
Q_RESET_CONNECTION,
392+
Q_OPTIMIZER_TRACE,
391393
Q_UNKNOWN, /* Unknown command. */
392394
Q_COMMENT, /* Comments, ignored. */
393395
Q_COMMENT_WITH_COMMAND,
@@ -498,7 +500,7 @@ const char *command_names[]=
498500
"enable_prepare_warnings",
499501
"disable_prepare_warnings",
500502
"reset_connection",
501-
503+
"optimizer_trace",
502504
0
503505
};
504506

@@ -643,6 +645,9 @@ void free_all_replace(){
643645
}
644646

645647
void var_set_int(const char* name, int value);
648+
void enable_optimizer_trace(struct st_connection *con);
649+
void display_optimizer_trace(struct st_connection *con,
650+
DYNAMIC_STRING *ds);
646651

647652

648653
class LogFile {
@@ -1551,6 +1556,8 @@ static void die(const char *fmt, ...)
15511556
{
15521557
char buff[DIE_BUFF_SIZE];
15531558
va_list args;
1559+
DBUG_ENTER("die");
1560+
15541561
va_start(args, fmt);
15551562
make_error_message(buff, sizeof(buff), fmt, args);
15561563
really_die(buff);
@@ -7901,7 +7908,7 @@ static void handle_no_active_connection(struct st_command *command,
79017908
*/
79027909

79037910
void run_query_normal(struct st_connection *cn, struct st_command *command,
7904-
int flags, char *query, size_t query_len,
7911+
int flags, const char *query, size_t query_len,
79057912
DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings)
79067913
{
79077914
MYSQL_RES *res= 0;
@@ -8020,6 +8027,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
80208027

80218028
/* If we come here the query is both executed and read successfully */
80228029
handle_no_error(command);
8030+
display_optimizer_trace(cn, ds);
80238031
revert_properties();
80248032

80258033
end:
@@ -9678,6 +9686,9 @@ int main(int argc, char **argv)
96789686
case Q_RESET_CONNECTION:
96799687
do_reset_connection();
96809688
break;
9689+
case Q_OPTIMIZER_TRACE:
9690+
enable_optimizer_trace(cur_con);
9691+
break;
96819692
case Q_SEND_SHUTDOWN:
96829693
handle_command_error(command,
96839694
mysql_shutdown(cur_con->mysql,
@@ -11358,3 +11369,90 @@ char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,
1135811369

1135911370
return buf;
1136011371
}
11372+
11373+
/*
11374+
Enable optimizer trace for the next command
11375+
*/
11376+
11377+
LEX_CSTRING enable_optimizer_trace_query=
11378+
{
11379+
STRING_WITH_LEN("set @mysqltest_save_optimzer_trace=@@optimizer_trace,@@optimizer_trace=\"enabled=on\"")
11380+
};
11381+
11382+
LEX_CSTRING restore_optimizer_trace_query=
11383+
{
11384+
STRING_WITH_LEN("set @@optimizer_trace=@mysqltest_save_optimzer_trace")
11385+
};
11386+
11387+
11388+
LEX_CSTRING display_optimizer_trace_query
11389+
{
11390+
STRING_WITH_LEN("SELECT * from information_schema.optimizer_trace")
11391+
};
11392+
11393+
11394+
void enable_optimizer_trace(struct st_connection *con)
11395+
{
11396+
MYSQL *mysql= con->mysql;
11397+
my_bool save_ps_protocol_enabled= ps_protocol_enabled;
11398+
my_bool save_view_protocol_enabled= view_protocol_enabled;
11399+
DYNAMIC_STRING ds_result;
11400+
DYNAMIC_STRING ds_warnings;
11401+
struct st_command command;
11402+
DBUG_ENTER("enable_optimizer_trace");
11403+
11404+
if (!mysql)
11405+
DBUG_VOID_RETURN;
11406+
ps_protocol_enabled= view_protocol_enabled= 0;
11407+
11408+
init_dynamic_string(&ds_result, NULL, 0, 256);
11409+
init_dynamic_string(&ds_warnings, NULL, 0, 256);
11410+
bzero(&command, sizeof(command));
11411+
11412+
run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
11413+
enable_optimizer_trace_query.str,
11414+
enable_optimizer_trace_query.length,
11415+
&ds_result, &ds_warnings);
11416+
dynstr_free(&ds_result);
11417+
dynstr_free(&ds_warnings);
11418+
ps_protocol_enabled= save_ps_protocol_enabled;
11419+
view_protocol_enabled= save_view_protocol_enabled;
11420+
optimizer_trace_active= 1;
11421+
DBUG_VOID_RETURN;
11422+
}
11423+
11424+
11425+
void display_optimizer_trace(struct st_connection *con,
11426+
DYNAMIC_STRING *ds)
11427+
{
11428+
my_bool save_ps_protocol_enabled= ps_protocol_enabled;
11429+
my_bool save_view_protocol_enabled= view_protocol_enabled;
11430+
DYNAMIC_STRING ds_result;
11431+
DYNAMIC_STRING ds_warnings;
11432+
struct st_command command;
11433+
DBUG_ENTER("display_optimizer_trace");
11434+
11435+
if (!optimizer_trace_active)
11436+
DBUG_VOID_RETURN;
11437+
11438+
optimizer_trace_active= 0;
11439+
ps_protocol_enabled= view_protocol_enabled= 0;
11440+
11441+
init_dynamic_string(&ds_result, NULL, 0, 256);
11442+
init_dynamic_string(&ds_warnings, NULL, 0, 256);
11443+
bzero(&command, sizeof(command));
11444+
11445+
run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
11446+
display_optimizer_trace_query.str,
11447+
display_optimizer_trace_query.length,
11448+
ds, &ds_warnings);
11449+
run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
11450+
restore_optimizer_trace_query.str,
11451+
restore_optimizer_trace_query.length,
11452+
ds, &ds_warnings);
11453+
dynstr_free(&ds_result);
11454+
dynstr_free(&ds_warnings);
11455+
ps_protocol_enabled= save_ps_protocol_enabled;
11456+
view_protocol_enabled= save_view_protocol_enabled;
11457+
DBUG_VOID_RETURN;
11458+
}

debian/salsa-ci.yml

+5-44
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ build:
3232
# Run Salsa-CI .build-before-script equivalent
3333
- mkdir -p ${WORKING_DIR} ${CCACHE_WORK_DIR}
3434
- mv ${CCACHE_WORK_DIR} ${CCACHE_TMP_DIR}
35-
# Run Salsa-CI .build-script equivalent
36-
- export CCACHE_DIR="${CCACHE_TMP_DIR}"
37-
- apt-get update && eatmydata apt-get install --yes --no-install-recommends aptitude devscripts ccache equivs
35+
# Run Salsa-CI .build-script equivalent, with extra devscripts so autobake-deb.sh can run 'dch'
36+
- export CCACHE_DIR=${CCACHE_TMP_DIR}
37+
- apt-get update && eatmydata apt-get install --no-install-recommends -y ccache fakeroot build-essential devscripts
3838
- cd ${WORKING_DIR}/${SOURCE_DIR}
39-
- eatmydata install-build-deps.sh .
39+
- eatmydata apt-get build-dep --no-install-recommends -y .
4040
- update-ccache-symlinks; ccache -z # Zero out ccache counters
4141
- while true; do sleep 600; echo "10 minutes passed" >&2; done & # Progress keeper since build is long and silent
4242
- debian/autobake-deb.sh |& tail -n 10000 # Keep Gitlab-CI output under 4 MB
4343
- cd ${WORKING_DIR}
4444
- rm -rf ${WORKING_DIR}/${SOURCE_DIR}
4545
- du -shc ${WORKING_DIR}/* # Show total file size of artifacts. Must stay are under 100 MB.
4646
- ccache -s # Show ccache stats to validate it worked
47-
- mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR} || true
47+
- mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR}
4848

4949
build bullseye-backports:
5050
extends: .build-package
@@ -70,45 +70,6 @@ build i386:
7070

7171
build native deb:
7272
extends: .build-package
73-
script: &buildpackage-script |
74-
mkdir -p ${WORKING_DIR} ${CCACHE_WORK_DIR}
75-
mv ${CCACHE_WORK_DIR} ${CCACHE_TMP_DIR}
76-
export CCACHE_DIR=${CCACHE_TMP_DIR}
77-
# Add deb-src entries
78-
sed -n '/^deb\s/s//deb-src /p' /etc/apt/sources.list > /etc/apt/sources.list.d/deb-src.list
79-
apt-get update && eatmydata apt-get install --no-install-recommends -y \
80-
aptitude \
81-
devscripts \
82-
ccache \
83-
equivs \
84-
build-essential \
85-
python3
86-
# Enter source package dir
87-
cd ${WORKING_DIR}/${SOURCE_DIR}
88-
# Install package build dependencies
89-
eatmydata install-build-deps.sh .
90-
# Generate ccache links
91-
dpkg-reconfigure ccache
92-
PATH="/usr/lib/ccache/:${PATH}"
93-
# Reset ccache stats
94-
ccache -z
95-
# Create salsaci user and fix permissions
96-
useradd salsaci
97-
chown -R salsaci. ${WORKING_DIR} ${CCACHE_DIR}
98-
# Define buildlog filename
99-
BUILD_LOGFILE_SOURCE=$(dpkg-parsechangelog -S Source)
100-
BUILD_LOGFILE_VERSION=$(dpkg-parsechangelog -S Version)
101-
BUILD_LOGFILE_VERSION=${BUILD_LOGFILE_VERSION#*:}
102-
BUILD_LOGFILE_ARCH=$(dpkg --print-architecture)
103-
BUILD_LOGFILE="${WORKING_DIR}/${BUILD_LOGFILE_SOURCE}_${BUILD_LOGFILE_VERSION}_${BUILD_LOGFILE_ARCH}.build"
104-
# Build package as user salsaci
105-
su salsaci -c "eatmydata dpkg-buildpackage ${DB_BUILD_PARAM}" |& OUTPUT_FILENAME=${BUILD_LOGFILE} filter-output
106-
# Restore PWD to ${WORKING_DIR}
107-
cd ${WORKING_DIR}
108-
rm -rf ${WORKING_DIR}/${SOURCE_DIR}
109-
# Print ccache stats on job log
110-
ccache -s
111-
mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR}
11273

11374
piuparts:
11475
extends: .test-piuparts

include/mysql/service_wsrep.h

+4
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ extern struct wsrep_service_st {
9191
unsigned long long trx_id);
9292
void (*wsrep_thd_kill_LOCK_func)(const MYSQL_THD thd);
9393
void (*wsrep_thd_kill_UNLOCK_func)(const MYSQL_THD thd);
94+
void (*wsrep_thd_set_wsrep_PA_unsafe_func)(MYSQL_THD thd);
9495
} *wsrep_service;
9596

9697
#define MYSQL_SERVICE_WSREP_INCLUDED
@@ -137,6 +138,7 @@ extern struct wsrep_service_st {
137138
#define wsrep_thd_set_ignored_error(T,V) wsrep_service->wsrep_thd_set_ignored_error_func(T,V)
138139
#define wsrep_thd_set_wsrep_aborter(T) wsrep_service->wsrep_thd_set_wsrep_aborter_func(T1, T2)
139140
#define wsrep_report_bf_lock_wait(T,I) wsrep_service->wsrep_report_bf_lock_wait(T,I)
141+
#define wsrep_thd_set_PA_unsafe(T) wsrep_service->wsrep_thd_set_PA_unsafe_func(T)
140142
#else
141143

142144
#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED
@@ -238,5 +240,7 @@ extern "C" void wsrep_thd_set_ignored_error(MYSQL_THD thd, my_bool val);
238240
extern "C" bool wsrep_thd_set_wsrep_aborter(MYSQL_THD bf_thd, MYSQL_THD victim_thd);
239241
extern "C" void wsrep_report_bf_lock_wait(const THD *thd,
240242
unsigned long long trx_id);
243+
/* declare parallel applying unsafety for the THD */
244+
extern "C" void wsrep_thd_set_PA_unsafe(MYSQL_THD thd);
241245
#endif
242246
#endif /* MYSQL_SERVICE_WSREP_INCLUDED */

include/wsrep.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
if (WSREP(thd) && \
4242
wsrep_to_isolation_begin(thd, db_, table_, \
4343
table_list_, alter_info_, \
44-
fk_tables_, create_info_)) \
45-
goto wsrep_error_label;
44+
fk_tables_, create_info_))
4645

4746
/*
4847
Checks if lex->no_write_to_binlog is set for statements that use LOCAL or
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if (`select version() like '%valgrind%'`)
2+
{
3+
skip Does not run with binaries built with valgrind;
4+
}

mysql-test/main/backup_lock_binlog.result

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
# MDEV-25334 FTWRL/Backup blocks DDL on temporary tables with binlog
33
# enabled assertion fails in Diagnostics_area::set_error_status
44
#
5-
select @@binlog_format;
6-
@@binlog_format
7-
MIXED
85
connect con1,localhost,root,,;
96
connection default;
107
#

mysql-test/main/backup_lock_binlog.test

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
--echo # enabled assertion fails in Diagnostics_area::set_error_status
1010
--echo #
1111

12-
select @@binlog_format;
1312
--connect (con1,localhost,root,,)
1413
connection default;
1514

mysql-test/main/compound.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# MDEV-5317 Compound statement / anonymous blocks
33
#
4-
source include/have_log_bin.inc;
4+
source include/have_binlog_format_mixed_or_statement.inc;
55
delimiter |;
66

77
CREATE TABLE t1 (a INT PRIMARY KEY)|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--character-set-server=utf8mb4,latin1 --collation-server=utf8mb4_unicode_ci
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Start of 10.3 tests
3+
#
4+
#
5+
# MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields
6+
#
7+
CREATE TABLE t1 ENGINE=MyISAM WITH SYSTEM VERSIONING AS SELECT 0;
8+
DROP TABLE t1;
9+
#
10+
# End of 10.3 tests
11+
#
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--echo #
2+
--echo # Start of 10.3 tests
3+
--echo #
4+
5+
--echo #
6+
--echo # MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields
7+
--echo #
8+
9+
CREATE TABLE t1 ENGINE=MyISAM WITH SYSTEM VERSIONING AS SELECT 0;
10+
DROP TABLE t1;
11+
12+
13+
--echo #
14+
--echo # End of 10.3 tests
15+
--echo #

0 commit comments

Comments
 (0)