Skip to content

Commit

Permalink
Merge 10.5 into 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Jan 4, 2022
2 parents c410f7a + 4c3ad24 commit 3f57267
Show file tree
Hide file tree
Showing 112 changed files with 1,741 additions and 570 deletions.
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ init:

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

cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml

clone_depth: 1

build_script:
Expand Down
11 changes: 3 additions & 8 deletions client/mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ extern "C" {
# endif
# endif
#define HAVE_READLINE
#define USE_POPEN
#endif
#define USE_POPEN
}

#ifdef HAVE_VIDATTR
Expand Down Expand Up @@ -4269,11 +4269,6 @@ com_nopager(String *buffer __attribute__((unused)),
}
#endif


/*
Sorry, you can't send the result to an editor in Win32
*/

#ifdef USE_POPEN
static int
com_edit(String *buffer,char *line __attribute__((unused)))
Expand All @@ -4294,7 +4289,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))

if (!(editor = (char *)getenv("EDITOR")) &&
!(editor = (char *)getenv("VISUAL")))
editor = "vi";
editor = IF_WIN("notepad","vi");
strxmov(buff,editor," ",filename,NullS);
if ((error= system(buff)))
{
Expand All @@ -4309,7 +4304,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))
if ((fd = my_open(filename,O_RDONLY, MYF(MY_WME))) < 0)
goto err;
(void) buffer->alloc((uint) stat_arg.st_size);
if ((tmp=read(fd,(char*) buffer->ptr(),buffer->alloced_length())) >= 0L)
if ((tmp=(int)my_read(fd,(uchar*) buffer->ptr(),buffer->alloced_length(),MYF(0))) >= 0)
buffer->length((uint) tmp);
else
buffer->length(0);
Expand Down
102 changes: 100 additions & 2 deletions client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ static my_bool disable_info= 1;
static my_bool abort_on_error= 1, opt_continue_on_error= 0;
static my_bool server_initialized= 0;
static my_bool is_windows= 0;
static my_bool optimizer_trace_active= 0;
static char **default_argv;
static const char *load_default_groups[]=
{ "mysqltest", "mariadb-test", "client", "client-server", "client-mariadb",
Expand Down Expand Up @@ -388,6 +389,7 @@ enum enum_commands {
Q_MOVE_FILE, Q_REMOVE_FILES_WILDCARD, Q_SEND_EVAL,
Q_ENABLE_PREPARE_WARNINGS, Q_DISABLE_PREPARE_WARNINGS,
Q_RESET_CONNECTION,
Q_OPTIMIZER_TRACE,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
Q_COMMENT_WITH_COMMAND,
Expand Down Expand Up @@ -498,7 +500,7 @@ const char *command_names[]=
"enable_prepare_warnings",
"disable_prepare_warnings",
"reset_connection",

"optimizer_trace",
0
};

Expand Down Expand Up @@ -643,6 +645,9 @@ void free_all_replace(){
}

void var_set_int(const char* name, int value);
void enable_optimizer_trace(struct st_connection *con);
void display_optimizer_trace(struct st_connection *con,
DYNAMIC_STRING *ds);


class LogFile {
Expand Down Expand Up @@ -1551,6 +1556,8 @@ static void die(const char *fmt, ...)
{
char buff[DIE_BUFF_SIZE];
va_list args;
DBUG_ENTER("die");

va_start(args, fmt);
make_error_message(buff, sizeof(buff), fmt, args);
really_die(buff);
Expand Down Expand Up @@ -7901,7 +7908,7 @@ static void handle_no_active_connection(struct st_command *command,
*/

void run_query_normal(struct st_connection *cn, struct st_command *command,
int flags, char *query, size_t query_len,
int flags, const char *query, size_t query_len,
DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings)
{
MYSQL_RES *res= 0;
Expand Down Expand Up @@ -8020,6 +8027,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,

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

end:
Expand Down Expand Up @@ -9678,6 +9686,9 @@ int main(int argc, char **argv)
case Q_RESET_CONNECTION:
do_reset_connection();
break;
case Q_OPTIMIZER_TRACE:
enable_optimizer_trace(cur_con);
break;
case Q_SEND_SHUTDOWN:
handle_command_error(command,
mysql_shutdown(cur_con->mysql,
Expand Down Expand Up @@ -11358,3 +11369,90 @@ char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,

return buf;
}

/*
Enable optimizer trace for the next command
*/

LEX_CSTRING enable_optimizer_trace_query=
{
STRING_WITH_LEN("set @mysqltest_save_optimzer_trace=@@optimizer_trace,@@optimizer_trace=\"enabled=on\"")
};

LEX_CSTRING restore_optimizer_trace_query=
{
STRING_WITH_LEN("set @@optimizer_trace=@mysqltest_save_optimzer_trace")
};


LEX_CSTRING display_optimizer_trace_query
{
STRING_WITH_LEN("SELECT * from information_schema.optimizer_trace")
};


void enable_optimizer_trace(struct st_connection *con)
{
MYSQL *mysql= con->mysql;
my_bool save_ps_protocol_enabled= ps_protocol_enabled;
my_bool save_view_protocol_enabled= view_protocol_enabled;
DYNAMIC_STRING ds_result;
DYNAMIC_STRING ds_warnings;
struct st_command command;
DBUG_ENTER("enable_optimizer_trace");

if (!mysql)
DBUG_VOID_RETURN;
ps_protocol_enabled= view_protocol_enabled= 0;

init_dynamic_string(&ds_result, NULL, 0, 256);
init_dynamic_string(&ds_warnings, NULL, 0, 256);
bzero(&command, sizeof(command));

run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
enable_optimizer_trace_query.str,
enable_optimizer_trace_query.length,
&ds_result, &ds_warnings);
dynstr_free(&ds_result);
dynstr_free(&ds_warnings);
ps_protocol_enabled= save_ps_protocol_enabled;
view_protocol_enabled= save_view_protocol_enabled;
optimizer_trace_active= 1;
DBUG_VOID_RETURN;
}


void display_optimizer_trace(struct st_connection *con,
DYNAMIC_STRING *ds)
{
my_bool save_ps_protocol_enabled= ps_protocol_enabled;
my_bool save_view_protocol_enabled= view_protocol_enabled;
DYNAMIC_STRING ds_result;
DYNAMIC_STRING ds_warnings;
struct st_command command;
DBUG_ENTER("display_optimizer_trace");

if (!optimizer_trace_active)
DBUG_VOID_RETURN;

optimizer_trace_active= 0;
ps_protocol_enabled= view_protocol_enabled= 0;

init_dynamic_string(&ds_result, NULL, 0, 256);
init_dynamic_string(&ds_warnings, NULL, 0, 256);
bzero(&command, sizeof(command));

run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
display_optimizer_trace_query.str,
display_optimizer_trace_query.length,
ds, &ds_warnings);
run_query_normal(con, &command, QUERY_SEND_FLAG | QUERY_REAP_FLAG,
restore_optimizer_trace_query.str,
restore_optimizer_trace_query.length,
ds, &ds_warnings);
dynstr_free(&ds_result);
dynstr_free(&ds_warnings);
ps_protocol_enabled= save_ps_protocol_enabled;
view_protocol_enabled= save_view_protocol_enabled;
DBUG_VOID_RETURN;
}
49 changes: 5 additions & 44 deletions debian/salsa-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ build:
# Run Salsa-CI .build-before-script equivalent
- mkdir -p ${WORKING_DIR} ${CCACHE_WORK_DIR}
- mv ${CCACHE_WORK_DIR} ${CCACHE_TMP_DIR}
# Run Salsa-CI .build-script equivalent
- export CCACHE_DIR="${CCACHE_TMP_DIR}"
- apt-get update && eatmydata apt-get install --yes --no-install-recommends aptitude devscripts ccache equivs
# Run Salsa-CI .build-script equivalent, with extra devscripts so autobake-deb.sh can run 'dch'
- export CCACHE_DIR=${CCACHE_TMP_DIR}
- apt-get update && eatmydata apt-get install --no-install-recommends -y ccache fakeroot build-essential devscripts
- cd ${WORKING_DIR}/${SOURCE_DIR}
- eatmydata install-build-deps.sh .
- eatmydata apt-get build-dep --no-install-recommends -y .
- update-ccache-symlinks; ccache -z # Zero out ccache counters
- while true; do sleep 600; echo "10 minutes passed" >&2; done & # Progress keeper since build is long and silent
- debian/autobake-deb.sh |& tail -n 10000 # Keep Gitlab-CI output under 4 MB
- cd ${WORKING_DIR}
- rm -rf ${WORKING_DIR}/${SOURCE_DIR}
- du -shc ${WORKING_DIR}/* # Show total file size of artifacts. Must stay are under 100 MB.
- ccache -s # Show ccache stats to validate it worked
- mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR} || true
- mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR}

build bullseye-backports:
extends: .build-package
Expand All @@ -70,45 +70,6 @@ build i386:

build native deb:
extends: .build-package
script: &buildpackage-script |
mkdir -p ${WORKING_DIR} ${CCACHE_WORK_DIR}
mv ${CCACHE_WORK_DIR} ${CCACHE_TMP_DIR}
export CCACHE_DIR=${CCACHE_TMP_DIR}
# Add deb-src entries
sed -n '/^deb\s/s//deb-src /p' /etc/apt/sources.list > /etc/apt/sources.list.d/deb-src.list
apt-get update && eatmydata apt-get install --no-install-recommends -y \
aptitude \
devscripts \
ccache \
equivs \
build-essential \
python3
# Enter source package dir
cd ${WORKING_DIR}/${SOURCE_DIR}
# Install package build dependencies
eatmydata install-build-deps.sh .
# Generate ccache links
dpkg-reconfigure ccache
PATH="/usr/lib/ccache/:${PATH}"
# Reset ccache stats
ccache -z
# Create salsaci user and fix permissions
useradd salsaci
chown -R salsaci. ${WORKING_DIR} ${CCACHE_DIR}
# Define buildlog filename
BUILD_LOGFILE_SOURCE=$(dpkg-parsechangelog -S Source)
BUILD_LOGFILE_VERSION=$(dpkg-parsechangelog -S Version)
BUILD_LOGFILE_VERSION=${BUILD_LOGFILE_VERSION#*:}
BUILD_LOGFILE_ARCH=$(dpkg --print-architecture)
BUILD_LOGFILE="${WORKING_DIR}/${BUILD_LOGFILE_SOURCE}_${BUILD_LOGFILE_VERSION}_${BUILD_LOGFILE_ARCH}.build"
# Build package as user salsaci
su salsaci -c "eatmydata dpkg-buildpackage ${DB_BUILD_PARAM}" |& OUTPUT_FILENAME=${BUILD_LOGFILE} filter-output
# Restore PWD to ${WORKING_DIR}
cd ${WORKING_DIR}
rm -rf ${WORKING_DIR}/${SOURCE_DIR}
# Print ccache stats on job log
ccache -s
mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR}

piuparts:
extends: .test-piuparts
Expand Down
4 changes: 4 additions & 0 deletions include/mysql/service_wsrep.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ extern struct wsrep_service_st {
unsigned long long trx_id);
void (*wsrep_thd_kill_LOCK_func)(const MYSQL_THD thd);
void (*wsrep_thd_kill_UNLOCK_func)(const MYSQL_THD thd);
void (*wsrep_thd_set_wsrep_PA_unsafe_func)(MYSQL_THD thd);
} *wsrep_service;

#define MYSQL_SERVICE_WSREP_INCLUDED
Expand Down Expand Up @@ -137,6 +138,7 @@ extern struct wsrep_service_st {
#define wsrep_thd_set_ignored_error(T,V) wsrep_service->wsrep_thd_set_ignored_error_func(T,V)
#define wsrep_thd_set_wsrep_aborter(T) wsrep_service->wsrep_thd_set_wsrep_aborter_func(T1, T2)
#define wsrep_report_bf_lock_wait(T,I) wsrep_service->wsrep_report_bf_lock_wait(T,I)
#define wsrep_thd_set_PA_unsafe(T) wsrep_service->wsrep_thd_set_PA_unsafe_func(T)
#else

#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED
Expand Down Expand Up @@ -238,5 +240,7 @@ extern "C" void wsrep_thd_set_ignored_error(MYSQL_THD thd, my_bool val);
extern "C" bool wsrep_thd_set_wsrep_aborter(MYSQL_THD bf_thd, MYSQL_THD victim_thd);
extern "C" void wsrep_report_bf_lock_wait(const THD *thd,
unsigned long long trx_id);
/* declare parallel applying unsafety for the THD */
extern "C" void wsrep_thd_set_PA_unsafe(MYSQL_THD thd);
#endif
#endif /* MYSQL_SERVICE_WSREP_INCLUDED */
3 changes: 1 addition & 2 deletions include/wsrep.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
if (WSREP(thd) && \
wsrep_to_isolation_begin(thd, db_, table_, \
table_list_, alter_info_, \
fk_tables_, create_info_)) \
goto wsrep_error_label;
fk_tables_, create_info_))

/*
Checks if lex->no_write_to_binlog is set for statements that use LOCAL or
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/include/not_valgrind_build.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if (`select version() like '%valgrind%'`)
{
skip Does not run with binaries built with valgrind;
}
3 changes: 0 additions & 3 deletions mysql-test/main/backup_lock_binlog.result
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# MDEV-25334 FTWRL/Backup blocks DDL on temporary tables with binlog
# enabled assertion fails in Diagnostics_area::set_error_status
#
select @@binlog_format;
@@binlog_format
MIXED
connect con1,localhost,root,,;
connection default;
#
Expand Down
1 change: 0 additions & 1 deletion mysql-test/main/backup_lock_binlog.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
--echo # enabled assertion fails in Diagnostics_area::set_error_status
--echo #

select @@binlog_format;
--connect (con1,localhost,root,,)
connection default;

Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/compound.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MDEV-5317 Compound statement / anonymous blocks
#
source include/have_log_bin.inc;
source include/have_binlog_format_mixed_or_statement.inc;
delimiter |;

CREATE TABLE t1 (a INT PRIMARY KEY)|
Expand Down
1 change: 1 addition & 0 deletions mysql-test/main/ctype_utf8mb4_unicode_ci_def.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--character-set-server=utf8mb4,latin1 --collation-server=utf8mb4_unicode_ci
11 changes: 11 additions & 0 deletions mysql-test/main/ctype_utf8mb4_unicode_ci_def.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Start of 10.3 tests
#
#
# MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields
#
CREATE TABLE t1 ENGINE=MyISAM WITH SYSTEM VERSIONING AS SELECT 0;
DROP TABLE t1;
#
# End of 10.3 tests
#
15 changes: 15 additions & 0 deletions mysql-test/main/ctype_utf8mb4_unicode_ci_def.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--echo #
--echo # Start of 10.3 tests
--echo #

--echo #
--echo # MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields
--echo #

CREATE TABLE t1 ENGINE=MyISAM WITH SYSTEM VERSIONING AS SELECT 0;
DROP TABLE t1;


--echo #
--echo # End of 10.3 tests
--echo #

0 comments on commit 3f57267

Please sign in to comment.