Skip to content

Commit 55bb933

Browse files
committed
Merge branch 10.4 into 10.5
2 parents be20b3b + 681b778 commit 55bb933

File tree

89 files changed

+1619
-451
lines changed

Some content is hidden

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

89 files changed

+1619
-451
lines changed

appveyor.yml

Lines changed: 4 additions & 0 deletions
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

Lines changed: 3 additions & 8 deletions
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
@@ -4202,11 +4202,6 @@ com_nopager(String *buffer __attribute__((unused)),
42024202
}
42034203
#endif
42044204

4205-
4206-
/*
4207-
Sorry, you can't send the result to an editor in Win32
4208-
*/
4209-
42104205
#ifdef USE_POPEN
42114206
static int
42124207
com_edit(String *buffer,char *line __attribute__((unused)))
@@ -4227,7 +4222,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))
42274222

42284223
if (!(editor = (char *)getenv("EDITOR")) &&
42294224
!(editor = (char *)getenv("VISUAL")))
4230-
editor = "vi";
4225+
editor = IF_WIN("notepad","vi");
42314226
strxmov(buff,editor," ",filename,NullS);
42324227
if ((error= system(buff)))
42334228
{
@@ -4242,7 +4237,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))
42424237
if ((fd = my_open(filename,O_RDONLY, MYF(MY_WME))) < 0)
42434238
goto err;
42444239
(void) buffer->alloc((uint) stat_arg.st_size);
4245-
if ((tmp=read(fd,(char*) buffer->ptr(),buffer->alloced_length())) >= 0L)
4240+
if ((tmp=(int)my_read(fd,(uchar*) buffer->ptr(),buffer->alloced_length(),MYF(0))) >= 0)
42464241
buffer->length((uint) tmp);
42474242
else
42484243
buffer->length(0);

client/mysqltest.cc

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ static my_bool disable_info= 1;
133133
static my_bool abort_on_error= 1, opt_continue_on_error= 0;
134134
static my_bool server_initialized= 0;
135135
static my_bool is_windows= 0;
136+
static my_bool optimizer_trace_active= 0;
136137
static char **default_argv;
137138
static const char *load_default_groups[]=
138139
{ "mysqltest", "mariadb-test", "client", "client-server", "client-mariadb",
@@ -389,6 +390,7 @@ enum enum_commands {
389390
Q_MOVE_FILE, Q_REMOVE_FILES_WILDCARD, Q_SEND_EVAL,
390391
Q_ENABLE_PREPARE_WARNINGS, Q_DISABLE_PREPARE_WARNINGS,
391392
Q_RESET_CONNECTION,
393+
Q_OPTIMIZER_TRACE,
392394
Q_UNKNOWN, /* Unknown command. */
393395
Q_COMMENT, /* Comments, ignored. */
394396
Q_COMMENT_WITH_COMMAND,
@@ -499,7 +501,7 @@ const char *command_names[]=
499501
"enable_prepare_warnings",
500502
"disable_prepare_warnings",
501503
"reset_connection",
502-
504+
"optimizer_trace",
503505
0
504506
};
505507

@@ -644,6 +646,9 @@ void free_all_replace(){
644646
}
645647

646648
void var_set_int(const char* name, int value);
649+
void enable_optimizer_trace(struct st_connection *con);
650+
void display_optimizer_trace(struct st_connection *con,
651+
DYNAMIC_STRING *ds);
647652

648653

649654
class LogFile {
@@ -1542,6 +1547,8 @@ static void die(const char *fmt, ...)
15421547
{
15431548
char buff[DIE_BUFF_SIZE];
15441549
va_list args;
1550+
DBUG_ENTER("die");
1551+
15451552
va_start(args, fmt);
15461553
make_error_message(buff, sizeof(buff), fmt, args);
15471554
really_die(buff);
@@ -7893,7 +7900,7 @@ static void handle_no_active_connection(struct st_command *command,
78937900
*/
78947901

78957902
void run_query_normal(struct st_connection *cn, struct st_command *command,
7896-
int flags, char *query, size_t query_len,
7903+
int flags, const char *query, size_t query_len,
78977904
DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings)
78987905
{
78997906
MYSQL_RES *res= 0;
@@ -8012,6 +8019,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
80128019

80138020
/* If we come here the query is both executed and read successfully */
80148021
handle_no_error(command);
8022+
display_optimizer_trace(cn, ds);
80158023
revert_properties();
80168024

80178025
end:
@@ -9632,6 +9640,9 @@ int main(int argc, char **argv)
96329640
case Q_RESET_CONNECTION:
96339641
do_reset_connection();
96349642
break;
9643+
case Q_OPTIMIZER_TRACE:
9644+
enable_optimizer_trace(cur_con);
9645+
break;
96359646
case Q_SEND_SHUTDOWN:
96369647
handle_command_error(command,
96379648
mysql_shutdown(cur_con->mysql,
@@ -11294,3 +11305,90 @@ char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,
1129411305

1129511306
return buf;
1129611307
}
11308+
11309+
/*
11310+
Enable optimizer trace for the next command
11311+
*/
11312+
11313+
LEX_CSTRING enable_optimizer_trace_query=
11314+
{
11315+
STRING_WITH_LEN("set @mysqltest_save_optimzer_trace=@@optimizer_trace,@@optimizer_trace=\"enabled=on\"")
11316+
};
11317+
11318+
LEX_CSTRING restore_optimizer_trace_query=
11319+
{
11320+
STRING_WITH_LEN("set @@optimizer_trace=@mysqltest_save_optimzer_trace")
11321+
};
11322+
11323+
11324+
LEX_CSTRING display_optimizer_trace_query
11325+
{
11326+
STRING_WITH_LEN("SELECT * from information_schema.optimizer_trace")
11327+
};
11328+
11329+
11330+
void enable_optimizer_trace(struct st_connection *con)
11331+
{
11332+
MYSQL *mysql= con->mysql;
11333+
my_bool save_ps_protocol_enabled= ps_protocol_enabled;
11334+
my_bool save_view_protocol_enabled= view_protocol_enabled;
11335+
DYNAMIC_STRING ds_result;
11336+
DYNAMIC_STRING ds_warnings;
11337+
struct st_command command;
11338+
DBUG_ENTER("enable_optimizer_trace");
11339+
11340+
if (!mysql)
11341+
DBUG_VOID_RETURN;
11342+
ps_protocol_enabled= view_protocol_enabled= 0;
11343+
11344+
init_dynamic_string(&ds_result, NULL, 0, 256);
11345+
init_dynamic_string(&ds_warnings, NULL, 0, 256);
11346+
bzero(&command, sizeof(command));
11347+
11348+
run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
11349+
enable_optimizer_trace_query.str,
11350+
enable_optimizer_trace_query.length,
11351+
&ds_result, &ds_warnings);
11352+
dynstr_free(&ds_result);
11353+
dynstr_free(&ds_warnings);
11354+
ps_protocol_enabled= save_ps_protocol_enabled;
11355+
view_protocol_enabled= save_view_protocol_enabled;
11356+
optimizer_trace_active= 1;
11357+
DBUG_VOID_RETURN;
11358+
}
11359+
11360+
11361+
void display_optimizer_trace(struct st_connection *con,
11362+
DYNAMIC_STRING *ds)
11363+
{
11364+
my_bool save_ps_protocol_enabled= ps_protocol_enabled;
11365+
my_bool save_view_protocol_enabled= view_protocol_enabled;
11366+
DYNAMIC_STRING ds_result;
11367+
DYNAMIC_STRING ds_warnings;
11368+
struct st_command command;
11369+
DBUG_ENTER("display_optimizer_trace");
11370+
11371+
if (!optimizer_trace_active)
11372+
DBUG_VOID_RETURN;
11373+
11374+
optimizer_trace_active= 0;
11375+
ps_protocol_enabled= view_protocol_enabled= 0;
11376+
11377+
init_dynamic_string(&ds_result, NULL, 0, 256);
11378+
init_dynamic_string(&ds_warnings, NULL, 0, 256);
11379+
bzero(&command, sizeof(command));
11380+
11381+
run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
11382+
display_optimizer_trace_query.str,
11383+
display_optimizer_trace_query.length,
11384+
ds, &ds_warnings);
11385+
run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
11386+
restore_optimizer_trace_query.str,
11387+
restore_optimizer_trace_query.length,
11388+
ds, &ds_warnings);
11389+
dynstr_free(&ds_result);
11390+
dynstr_free(&ds_warnings);
11391+
ps_protocol_enabled= save_ps_protocol_enabled;
11392+
view_protocol_enabled= save_view_protocol_enabled;
11393+
DBUG_VOID_RETURN;
11394+
}

include/mysql/service_wsrep.h

Lines changed: 4 additions & 0 deletions
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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
if (WSREP(thd) && wsrep_thd_is_local(thd) && \
4141
wsrep_to_isolation_begin(thd, db_, table_, \
4242
table_list_, alter_info_, \
43-
fk_tables_, create_info_)) \
44-
goto wsrep_error_label;
43+
fk_tables_, create_info_))
4544

4645
#define WSREP_TO_ISOLATION_END \
4746
if ((WSREP(thd) && wsrep_thd_is_local_toi(thd)) || \
Lines changed: 4 additions & 0 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)|
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--character-set-server=utf8mb4,latin1 --collation-server=utf8mb4_unicode_ci

0 commit comments

Comments
 (0)