Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä 2020-04-22 18:18:51 +03:00
commit 88cf6f1c7f
26 changed files with 354 additions and 217 deletions

View file

@ -717,7 +717,7 @@ public:
DBUG_ASSERT(ds->str);
#ifdef EXTRA_DEBUG
DBUG_PRINT("extra", ("str: %*b", (int) ds->length, ds->str));
DBUG_DUMP("extra", (uchar*) ds->str, ds->length);
#endif
if (fwrite(ds->str, 1, ds->length, m_file) != ds->length)

View file

@ -327,194 +327,212 @@ check_server_version(unsigned long version_number,
/*********************************************************************//**
Receive options important for XtraBackup from MySQL server.
@return true on success. */
bool
get_mysql_vars(MYSQL *connection)
bool get_mysql_vars(MYSQL *connection)
{
char *gtid_mode_var = NULL;
char *version_var = NULL;
char *version_comment_var = NULL;
char *innodb_version_var = NULL;
char *have_backup_locks_var = NULL;
char *log_bin_var = NULL;
char *lock_wait_timeout_var= NULL;
char *wsrep_on_var = NULL;
char *slave_parallel_workers_var = NULL;
char *gtid_slave_pos_var = NULL;
char *innodb_buffer_pool_filename_var = NULL;
char *datadir_var = NULL;
char *innodb_log_group_home_dir_var = NULL;
char *innodb_log_file_size_var = NULL;
char *innodb_log_files_in_group_var = NULL;
char *innodb_data_file_path_var = NULL;
char *innodb_data_home_dir_var = NULL;
char *innodb_undo_directory_var = NULL;
char *innodb_page_size_var = NULL;
char *innodb_undo_tablespaces_var = NULL;
char *page_zip_level_var = NULL;
char *endptr;
unsigned long server_version = mysql_get_server_version(connection);
char *gtid_mode_var= NULL;
char *version_var= NULL;
char *version_comment_var= NULL;
char *innodb_version_var= NULL;
char *have_backup_locks_var= NULL;
char *log_bin_var= NULL;
char *lock_wait_timeout_var= NULL;
char *wsrep_on_var= NULL;
char *slave_parallel_workers_var= NULL;
char *gtid_slave_pos_var= NULL;
char *innodb_buffer_pool_filename_var= NULL;
char *datadir_var= NULL;
char *innodb_log_group_home_dir_var= NULL;
char *innodb_log_file_size_var= NULL;
char *innodb_log_files_in_group_var= NULL;
char *innodb_data_file_path_var= NULL;
char *innodb_data_home_dir_var= NULL;
char *innodb_undo_directory_var= NULL;
char *innodb_page_size_var= NULL;
char *innodb_undo_tablespaces_var= NULL;
char *page_zip_level_var= NULL;
char *ignore_db_dirs= NULL;
char *endptr;
unsigned long server_version= mysql_get_server_version(connection);
bool ret = true;
bool ret= true;
mysql_variable mysql_vars[] = {
{"have_backup_locks", &have_backup_locks_var},
{"log_bin", &log_bin_var},
{"lock_wait_timeout", &lock_wait_timeout_var},
{"gtid_mode", &gtid_mode_var},
{"version", &version_var},
{"version_comment", &version_comment_var},
{"innodb_version", &innodb_version_var},
{"wsrep_on", &wsrep_on_var},
{"slave_parallel_workers", &slave_parallel_workers_var},
{"gtid_slave_pos", &gtid_slave_pos_var},
{"innodb_buffer_pool_filename",
&innodb_buffer_pool_filename_var},
{"datadir", &datadir_var},
{"innodb_log_group_home_dir", &innodb_log_group_home_dir_var},
{"innodb_log_file_size", &innodb_log_file_size_var},
{"innodb_log_files_in_group", &innodb_log_files_in_group_var},
{"innodb_data_file_path", &innodb_data_file_path_var},
{"innodb_data_home_dir", &innodb_data_home_dir_var},
{"innodb_undo_directory", &innodb_undo_directory_var},
{"innodb_page_size", &innodb_page_size_var},
{"innodb_undo_tablespaces", &innodb_undo_tablespaces_var},
{"innodb_compression_level", &page_zip_level_var},
{NULL, NULL}
};
mysql_variable mysql_vars[]= {
{"have_backup_locks", &have_backup_locks_var},
{"log_bin", &log_bin_var},
{"lock_wait_timeout", &lock_wait_timeout_var},
{"gtid_mode", &gtid_mode_var},
{"version", &version_var},
{"version_comment", &version_comment_var},
{"innodb_version", &innodb_version_var},
{"wsrep_on", &wsrep_on_var},
{"slave_parallel_workers", &slave_parallel_workers_var},
{"gtid_slave_pos", &gtid_slave_pos_var},
{"innodb_buffer_pool_filename", &innodb_buffer_pool_filename_var},
{"datadir", &datadir_var},
{"innodb_log_group_home_dir", &innodb_log_group_home_dir_var},
{"innodb_log_file_size", &innodb_log_file_size_var},
{"innodb_log_files_in_group", &innodb_log_files_in_group_var},
{"innodb_data_file_path", &innodb_data_file_path_var},
{"innodb_data_home_dir", &innodb_data_home_dir_var},
{"innodb_undo_directory", &innodb_undo_directory_var},
{"innodb_page_size", &innodb_page_size_var},
{"innodb_undo_tablespaces", &innodb_undo_tablespaces_var},
{"innodb_compression_level", &page_zip_level_var},
{"ignore_db_dirs", &ignore_db_dirs},
{NULL, NULL}};
read_mysql_variables(connection, "SHOW VARIABLES",
mysql_vars, true);
read_mysql_variables(connection, "SHOW VARIABLES", mysql_vars, true);
if (have_backup_locks_var != NULL && !opt_no_backup_locks) {
have_backup_locks = true;
}
if (have_backup_locks_var != NULL && !opt_no_backup_locks)
{
have_backup_locks= true;
}
if (opt_binlog_info == BINLOG_INFO_AUTO) {
if (log_bin_var != NULL && !strcmp(log_bin_var, "ON"))
opt_binlog_info = BINLOG_INFO_ON;
else
opt_binlog_info = BINLOG_INFO_OFF;
}
if (opt_binlog_info == BINLOG_INFO_AUTO)
{
if (log_bin_var != NULL && !strcmp(log_bin_var, "ON"))
opt_binlog_info= BINLOG_INFO_ON;
else
opt_binlog_info= BINLOG_INFO_OFF;
}
if (lock_wait_timeout_var != NULL) {
have_lock_wait_timeout = true;
}
if (lock_wait_timeout_var != NULL)
{
have_lock_wait_timeout= true;
}
if (wsrep_on_var != NULL) {
have_galera_enabled = true;
}
if (wsrep_on_var != NULL)
{
have_galera_enabled= true;
}
/* Check server version compatibility and detect server flavor */
/* Check server version compatibility and detect server flavor */
if (!(ret = check_server_version(server_version, version_var,
version_comment_var,
innodb_version_var))) {
goto out;
}
if (!(ret= check_server_version(server_version, version_var,
version_comment_var, innodb_version_var)))
{
goto out;
}
if (server_version > 50500) {
have_flush_engine_logs = true;
}
if (server_version > 50500)
{
have_flush_engine_logs= true;
}
if (slave_parallel_workers_var != NULL
&& atoi(slave_parallel_workers_var) > 0) {
have_multi_threaded_slave = true;
}
if (slave_parallel_workers_var != NULL &&
atoi(slave_parallel_workers_var) > 0)
{
have_multi_threaded_slave= true;
}
if (innodb_buffer_pool_filename_var != NULL) {
buffer_pool_filename = strdup(innodb_buffer_pool_filename_var);
}
if (innodb_buffer_pool_filename_var != NULL)
{
buffer_pool_filename= strdup(innodb_buffer_pool_filename_var);
}
if ((gtid_mode_var && strcmp(gtid_mode_var, "ON") == 0) ||
(gtid_slave_pos_var && *gtid_slave_pos_var)) {
have_gtid_slave = true;
}
if ((gtid_mode_var && strcmp(gtid_mode_var, "ON") == 0) ||
(gtid_slave_pos_var && *gtid_slave_pos_var))
{
have_gtid_slave= true;
}
msg("Using server version %s", version_var);
msg("Using server version %s", version_var);
if (!(ret = detect_mysql_capabilities_for_backup())) {
goto out;
}
if (!(ret= detect_mysql_capabilities_for_backup()))
{
goto out;
}
/* make sure datadir value is the same in configuration file */
if (check_if_param_set("datadir")) {
if (!directory_exists(mysql_data_home, false)) {
msg("Warning: option 'datadir' points to "
"nonexistent directory '%s'", mysql_data_home);
}
if (!directory_exists(datadir_var, false)) {
msg("Warning: MySQL variable 'datadir' points to "
"nonexistent directory '%s'", datadir_var);
}
if (!equal_paths(mysql_data_home, datadir_var)) {
msg("Warning: option 'datadir' has different "
"values:\n"
" '%s' in defaults file\n"
" '%s' in SHOW VARIABLES",
mysql_data_home, datadir_var);
}
}
/* make sure datadir value is the same in configuration file */
if (check_if_param_set("datadir"))
{
if (!directory_exists(mysql_data_home, false))
{
msg("Warning: option 'datadir' points to "
"nonexistent directory '%s'",
mysql_data_home);
}
if (!directory_exists(datadir_var, false))
{
msg("Warning: MySQL variable 'datadir' points to "
"nonexistent directory '%s'",
datadir_var);
}
if (!equal_paths(mysql_data_home, datadir_var))
{
msg("Warning: option 'datadir' has different "
"values:\n"
" '%s' in defaults file\n"
" '%s' in SHOW VARIABLES",
mysql_data_home, datadir_var);
}
}
/* get some default values is they are missing from my.cnf */
if (datadir_var && *datadir_var) {
strmake(mysql_real_data_home, datadir_var, FN_REFLEN - 1);
mysql_data_home= mysql_real_data_home;
}
/* get some default values is they are missing from my.cnf */
if (datadir_var && *datadir_var)
{
strmake(mysql_real_data_home, datadir_var, FN_REFLEN - 1);
mysql_data_home= mysql_real_data_home;
}
if (innodb_data_file_path_var && *innodb_data_file_path_var) {
innobase_data_file_path = my_strdup(
innodb_data_file_path_var, MYF(MY_FAE));
}
if (innodb_data_file_path_var && *innodb_data_file_path_var)
{
innobase_data_file_path= my_strdup(innodb_data_file_path_var, MYF(MY_FAE));
}
if (innodb_data_home_dir_var) {
innobase_data_home_dir = my_strdup(
innodb_data_home_dir_var, MYF(MY_FAE));
}
if (innodb_data_home_dir_var)
{
innobase_data_home_dir= my_strdup(innodb_data_home_dir_var, MYF(MY_FAE));
}
if (innodb_log_group_home_dir_var
&& *innodb_log_group_home_dir_var) {
srv_log_group_home_dir = my_strdup(
innodb_log_group_home_dir_var, MYF(MY_FAE));
}
if (innodb_log_group_home_dir_var && *innodb_log_group_home_dir_var)
{
srv_log_group_home_dir=
my_strdup(innodb_log_group_home_dir_var, MYF(MY_FAE));
}
if (innodb_undo_directory_var && *innodb_undo_directory_var) {
srv_undo_dir = my_strdup(
innodb_undo_directory_var, MYF(MY_FAE));
}
if (innodb_undo_directory_var && *innodb_undo_directory_var)
{
srv_undo_dir= my_strdup(innodb_undo_directory_var, MYF(MY_FAE));
}
if (innodb_log_files_in_group_var) {
srv_n_log_files = strtol(
innodb_log_files_in_group_var, &endptr, 10);
ut_ad(*endptr == 0);
}
if (innodb_log_files_in_group_var)
{
srv_n_log_files= strtol(innodb_log_files_in_group_var, &endptr, 10);
ut_ad(*endptr == 0);
}
if (innodb_log_file_size_var) {
srv_log_file_size = strtoll(
innodb_log_file_size_var, &endptr, 10);
ut_ad(*endptr == 0);
}
if (innodb_log_file_size_var)
{
srv_log_file_size= strtoll(innodb_log_file_size_var, &endptr, 10);
ut_ad(*endptr == 0);
}
if (innodb_page_size_var) {
innobase_page_size = strtoll(
innodb_page_size_var, &endptr, 10);
ut_ad(*endptr == 0);
}
if (innodb_page_size_var)
{
innobase_page_size= strtoll(innodb_page_size_var, &endptr, 10);
ut_ad(*endptr == 0);
}
if (innodb_undo_tablespaces_var) {
srv_undo_tablespaces = strtoul(innodb_undo_tablespaces_var,
&endptr, 10);
ut_ad(*endptr == 0);
}
if (innodb_undo_tablespaces_var)
{
srv_undo_tablespaces= strtoul(innodb_undo_tablespaces_var, &endptr, 10);
ut_ad(*endptr == 0);
}
if (page_zip_level_var != NULL) {
page_zip_level = strtoul(page_zip_level_var, &endptr, 10);
ut_ad(*endptr == 0);
}
if (page_zip_level_var != NULL)
{
page_zip_level= strtoul(page_zip_level_var, &endptr, 10);
ut_ad(*endptr == 0);
}
if (ignore_db_dirs)
xb_load_list_string(ignore_db_dirs, ",", register_ignore_db_dirs_filter);
out:
free_mysql_variables(mysql_vars);
free_mysql_variables(mysql_vars);
return(ret);
return (ret);
}
/*********************************************************************//**

View file

@ -3643,6 +3643,11 @@ xb_register_exclude_filter_entry(
&tables_exclude_hash);
}
void register_ignore_db_dirs_filter(const char *name)
{
xb_add_filter(name, &databases_exclude_hash);
}
/***********************************************************************
Register new table for the filter. */
static
@ -3705,26 +3710,24 @@ xb_register_exclude_regex(
typedef void (*insert_entry_func_t)(const char*);
/***********************************************************************
Scan string and load filter entries from it. */
static
void
xb_load_list_string(
/*================*/
char* list, /*!< in: string representing a list */
const char* delimiters, /*!< in: delimiters of entries */
insert_entry_func_t ins) /*!< in: callback to add entry */
/* Scan string and load filter entries from it.
@param[in] list string representing a list
@param[in] delimiters delimiters of entries
@param[in] ins callback to add entry */
void xb_load_list_string(char *list, const char *delimiters,
insert_entry_func_t ins)
{
char* p;
char* saveptr;
char *p;
char *saveptr;
p = strtok_r(list, delimiters, &saveptr);
while (p) {
p= strtok_r(list, delimiters, &saveptr);
while (p)
{
ins(p);
ins(p);
p = strtok_r(NULL, delimiters, &saveptr);
}
p= strtok_r(NULL, delimiters, &saveptr);
}
}
/***********************************************************************

View file

@ -195,4 +195,14 @@ void mdl_lock_init();
void mdl_lock_table(ulint space_id);
void mdl_unlock_all();
bool ends_with(const char *str, const char *suffix);
typedef void (*insert_entry_func_t)(const char*);
/* Scan string and load filter entries from it.
@param[in] list string representing a list
@param[in] delimiters delimiters of entries
@param[in] ins callback to add entry */
void xb_load_list_string(char *list, const char *delimiters,
insert_entry_func_t ins);
void register_ignore_db_dirs_filter(const char *name);
#endif /* XB_XTRABACKUP_H */

View file

@ -53,7 +53,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"symbols-file", 's', "Use specified symbols file.", &sym_fname,
{"symbols-file", 's', "Use specified symbols file", &sym_fname,
&sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"numeric-dump-file", 'n', "Read the dump from specified file.",
&dump_fname, &dump_fname, 0, GET_STR, REQUIRED_ARG,
@ -63,7 +63,7 @@ static struct my_option my_long_options[] =
static void verify_sort();
static void clean_up();
static void print_version(void)
{
@ -97,9 +97,18 @@ static void die(const char* fmt, ...)
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
va_end(args);
clean_up();
my_end(0);
exit(1);
}
void local_exit(int error)
{
clean_up();
my_end(0);
exit(error);
}
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
@ -108,10 +117,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
switch(optid) {
case 'V':
print_version();
exit(0);
local_exit(0);
break;
case '?':
usage();
exit(0);
local_exit(0);
break;
}
return 0;
}
@ -122,7 +133,7 @@ static int parse_args(int argc, char **argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
local_exit(ho_error);
/*
The following code is to make the command compatible with the old
@ -143,13 +154,13 @@ static int parse_args(int argc, char **argv)
else
{
usage();
exit(1);
local_exit(1);
}
}
else if (argc != 0 || !sym_fname)
{
usage();
exit(1);
local_exit(1);
}
return 0;
}
@ -242,6 +253,10 @@ static void init_sym_table()
static void clean_up()
{
delete_dynamic(&sym_table);
if (fp_dump && fp_dump != stdin)
my_fclose(fp_dump, MYF(0));
if (fp_sym)
my_fclose(fp_sym, MYF(0));
}
static void verify_sort()
@ -283,7 +298,7 @@ static SYM_ENTRY* resolve_addr(uchar* addr, SYM_ENTRY* se)
/*
Resolve anything that starts with [0x or (+0x or start of line and 0x
Resolve anything that starts with [0x or (+0x or 0x
Skip '_end' as this is an indication of a wrong symbol (stack?)
*/
@ -299,9 +314,7 @@ static void do_resolve()
found= 3;
if (p[0] == '(' && p[1] == '+' && p[2] == '0' && p[3] == 'x')
found= 4;
/* For stdin */
if (p == buf && p[0] == '0' && p[1] == 'x')
if (p[0] == '0' && p[1] == 'x')
found= 2;
if (found)
@ -312,14 +325,15 @@ static void do_resolve()
addr= (uchar*)read_addr(&tmp);
if (resolve_addr(addr, &se) && strcmp(se.symbol, "_end"))
{
fprintf(fp_out, "%c%p %s + %d", *p, addr, se.symbol,
(int) (addr - se.addr));
found-= 2; /* Don't print 0x as it's added by %p */
while (found--)
fputc(*p++, stdout);
fprintf(fp_out, "%p %s + %d", addr,
se.symbol, (int) (addr - se.addr));
p= tmp-1;
}
else
{
fputc(*p, stdout);
}
}
else
fputc(*p, stdout);
@ -336,5 +350,6 @@ int main(int argc, char** argv)
init_sym_table();
do_resolve();
clean_up();
my_end(0);
return 0;
}

View file

@ -776,3 +776,14 @@ CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
Warnings:
Note 1061 Duplicate key name 'ft1'
DROP TABLE t1;
#
# MDEV-22275 (Memory leak)
#
CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=MyISAM;
ALTER TABLE tmp ADD FULLTEXT (a);
INSERT INTO tmp VALUES ('foo');
DROP TABLE tmp;
CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=Aria;
ALTER TABLE tmp ADD FULLTEXT (a);
INSERT INTO tmp VALUES ('foo');
DROP TABLE tmp;

View file

@ -716,3 +716,17 @@ CREATE TABLE t1 (
CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
DROP TABLE t1;
--echo #
--echo # MDEV-22275 (Memory leak)
--echo #
CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=MyISAM;
ALTER TABLE tmp ADD FULLTEXT (a);
INSERT INTO tmp VALUES ('foo');
DROP TABLE tmp;
CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=Aria;
ALTER TABLE tmp ADD FULLTEXT (a);
INSERT INTO tmp VALUES ('foo');
DROP TABLE tmp;

View file

@ -1681,7 +1681,7 @@ a
2
9
Warnings:
Note 1105 DBUG: Item_subselect::exec (select max(`test`.`t1`.`a`) from `test`.`t...
Note 1105 DBUG: Item_subselect::exec (select max(`test`.`t1`.`a`) from `test`.`t1`)
DROP TABLE t1;
SET SESSION debug_dbug="-d,Item_subselect";
#

View file

@ -2265,6 +2265,13 @@ st_astext(p)
POINT(0 0)
drop table t1;
#
# MDEV-21056 Memory leak after query with DEFAULT on a geometry field
#
CREATE TABLE t1 (f POINT DEFAULT ST_GEOMFROMTEXT('Point(0 0)'));
SELECT ST_GEOMFROMTEXT('Point(1 1)') IN ( DEFAULT( `f` ), ST_GEOMFROMTEXT('Point(2 2)') ) AS x FROM t1;
x
DROP TABLE t1;
#
# End of 10.2 tests
#
#

View file

@ -1795,6 +1795,14 @@ insert into t1 values(default);
select st_astext(p) from t1;
drop table t1;
--echo #
--echo # MDEV-21056 Memory leak after query with DEFAULT on a geometry field
--echo #
CREATE TABLE t1 (f POINT DEFAULT ST_GEOMFROMTEXT('Point(0 0)'));
SELECT ST_GEOMFROMTEXT('Point(1 1)') IN ( DEFAULT( `f` ), ST_GEOMFROMTEXT('Point(2 2)') ) AS x FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #

View file

@ -3597,8 +3597,11 @@ sub do_before_run_mysqltest($)
# to be able to distinguish them from manually created
# version-controlled results, and to ignore them in git.
my $dest = "$base_file$suites.result~";
my @cmd = ($exe_patch, qw/--binary -r - -f -s -o/,
$dest, $base_result, $resfile);
my @cmd = ($exe_patch);
if ($^O eq "MSWin32") {
push @cmd, '--binary';
}
push @cmd, (qw/-r - -f -s -o/, $dest, $base_result, $resfile);
if (-w $resdir) {
# don't rebuild a file if it's up to date
unless (-e $dest and -M $dest < -M $resfile

View file

@ -12,6 +12,9 @@ INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');

View file

@ -9,12 +9,12 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/galera_have_debug_sync.inc
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2a
--source include/galera_cluster.inc
--source include/galera_have_debug_sync.inc
#
# node 3 is native MariaDB server operating as async replication master

View file

@ -0,0 +1,2 @@
--ignore-db-dirs=db3
--ignore-db-dirs=db4

View file

@ -1,3 +1,6 @@
select @@ignore_db_dirs;
@@ignore_db_dirs
db3,db4
CREATE TABLE t1(i INT) ENGINE INNODB;
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(i int) ENGINE INNODB;

View file

@ -1,6 +1,13 @@
#--source include/innodb_page_size.inc
# Test --databases-exclude and --tables-exclude feature of xtrabackup 2.3.8
select @@ignore_db_dirs;
let $MYSQLD_DATADIR= `select @@datadir`;
mkdir $MYSQLD_DATADIR/db3;
mkdir $MYSQLD_DATADIR/db4;
mkdir $MYSQLD_DATADIR/db5;
CREATE TABLE t1(i INT) ENGINE INNODB;
INSERT INTO t1 VALUES(1);
@ -24,8 +31,19 @@ list_files $targetdir/test *.ibd;
# check that db2 database is not in the backup (excluded)
--error 1
list_files $targetdir/db2 *.ibd;
# check that db3 database is not in the backup (excluded)
--error 1
list_files $targetdir/db3 *.ibd;
# check that db4 database is not in the backup (excluded)
--error 1
list_files $targetdir/db4 *.ibd;
# check that db5 database is in the backup
list_files $targetdir/db5 *.ibd;
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db2;
rmdir $MYSQLD_DATADIR/db3;
rmdir $MYSQLD_DATADIR/db4;
rmdir $MYSQLD_DATADIR/db5;
rmdir $targetdir;

View file

@ -235,7 +235,9 @@ wsrep_recover_position() {
fi
if [ -f $wr_logfile ]; then
[ "$euid" = "0" ] && chown $user $wr_logfile
# NOTE! Do not change ownership of the temporary file, as on newer kernel
# versions fs.protected_regular is set to '2' and redirecting output with >
# as root to a file not owned by root will fail with "Permission denied"
chmod 600 $wr_logfile
else
log_error "WSREP: mktemp failed"
@ -250,6 +252,11 @@ wsrep_recover_position() {
eval "$mysqld_cmd --wsrep_recover $wr_options 2> $wr_logfile"
if [ ! -s "$wr_logfile" ]; then
log_error "Log file $wr_logfile was empty, cannot proceed. Is system running fs.protected_regular?"
exit 1
fi
local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)"
if [ -z "$rp" ]; then
local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')"

View file

@ -9100,7 +9100,7 @@ int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs)
my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
Geometry::ci_collection[geom_type]->m_name.str,
wkt.c_ptr(), db, tab_name, field_name.str,
wkt.c_ptr_safe(), db, tab_name, field_name.str,
(ulong) table->in_use->get_stmt_da()->
current_row_for_warning());

View file

@ -9245,8 +9245,10 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
}
if (!(def_field= (Field*) thd->alloc(field_arg->field->size_of())))
goto error;
cached_field= def_field;
memcpy((void *)def_field, (void *)field_arg->field,
field_arg->field->size_of());
def_field->reset_fields();
// If non-constant default value expression
if (def_field->default_value && def_field->default_value->flags)
{
@ -9274,6 +9276,12 @@ error:
return TRUE;
}
void Item_default_value::cleanup()
{
delete cached_field; // Free cached blob data
cached_field= 0;
Item_field::cleanup();
}
void Item_default_value::print(String *str, enum_query_type query_type)
{

View file

@ -2,7 +2,7 @@
#define SQL_ITEM_INCLUDED
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB Corporation.
Copyright (c) 2009, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -6254,21 +6254,23 @@ class Item_default_value : public Item_field
void calculate();
public:
Item *arg;
Field *cached_field;
Item_default_value(THD *thd, Name_resolution_context *context_arg)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
&null_clex_str),
arg(NULL) {}
arg(NULL), cached_field(NULL) {}
Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
&null_clex_str),
arg(a) {}
arg(a), cached_field(NULL) {}
Item_default_value(THD *thd, Name_resolution_context *context_arg, Field *a)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
&null_clex_str),
arg(NULL) {}
arg(NULL), cached_field(NULL) {}
enum Type type() const { return DEFAULT_VALUE_ITEM; }
bool eq(const Item *item, bool binary_cmp) const;
bool fix_fields(THD *, Item **);
void cleanup();
void print(String *str, enum_query_type query_type);
String *val_str(String *str);
double val_real();

View file

@ -727,7 +727,7 @@ bool Item_subselect::exec()
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_UNKNOWN_ERROR, "DBUG: Item_subselect::exec %.*s",
print.length(),print.ptr());
print.length(),print.c_ptr());
);
/*
Do not execute subselect in case of a fatal error

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2019, MariaDB Corporation.
Copyright (c) 2008, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1933,11 +1933,7 @@ static void mysqld_exit(int exit_code)
shutdown_performance_schema(); // we do it as late as possible
#endif
set_malloc_size_cb(NULL);
if (opt_endinfo && global_status_var.global_memory_used)
fprintf(stderr, "Warning: Memory not freed: %ld\n",
(long) global_status_var.global_memory_used);
if (!opt_debugging && !my_disable_leak_check && exit_code == 0 &&
debug_assert_on_not_freed_memory)
if (global_status_var.global_memory_used)
{
#ifdef SAFEMALLOC
sf_report_leaked_memory(0);

View file

@ -5044,8 +5044,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
double roru_index_costs;
ha_rows roru_total_records;
double roru_intersect_part= 1.0;
double limit_read_time= read_time;
size_t n_child_scans;
double limit_read_time= read_time;
THD *thd= param->thd;
DBUG_ENTER("get_best_disjunct_quick");
DBUG_PRINT("info", ("Full table scan cost: %g", read_time));
@ -5072,6 +5072,10 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
sizeof(TRP_RANGE*)*
n_child_scans)))
DBUG_RETURN(NULL);
const bool only_ror_scans_required= !optimizer_flag(param->thd,
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION);
Json_writer_object trace_best_disjunct(thd);
Json_writer_array to_merge(thd, "indexes_to_merge");
/*
@ -5087,7 +5091,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
"tree in SEL_IMERGE"););
Json_writer_object trace_idx(thd);
if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE,
read_time, TRUE)))
read_time,
only_ror_scans_required)))
{
/*
One of index scans in this index_merge is more expensive than entire
@ -5449,7 +5454,7 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
index merge retrievals are not well calibrated
*/
trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE,
read_time, TRUE);
read_time, FALSE);
}
DBUG_RETURN(trp);
@ -7333,7 +7338,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
index_read_must_be_used if TRUE, assume 'index only' option will be set
(except for clustered PK indexes)
read_time don't create read plans with cost > read_time.
ror_scans_required set to TRUE for index merge
only_ror_scans_required set to TRUE when we are only interested
in ROR scan
RETURN
Best range read plan
NULL if no plan found or error occurred
@ -7343,7 +7349,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
bool index_read_must_be_used,
bool update_tbl_stats,
double read_time,
bool ror_scans_required)
bool only_ror_scans_required)
{
uint idx, UNINIT_VAR(best_idx);
SEL_ARG *key_to_read= NULL;
@ -7397,8 +7403,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
found_records= check_quick_select(param, idx, read_index_only, key,
update_tbl_stats, &mrr_flags,
&buf_size, &cost, &is_ror_scan);
if (ror_scans_required && !is_ror_scan &&
!optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION))
if (only_ror_scans_required && !is_ror_scan)
continue;
if (found_records != HA_POS_ERROR && tree->index_scans &&

View file

@ -20,7 +20,7 @@
to open other files during the time we flush the cache and close this file
*/
#include "maria_def.h"
#include "ma_ftdefs.h"
#include "ma_crypt.h"
int maria_close(register MARIA_HA *info)
@ -86,6 +86,7 @@ int maria_close(register MARIA_HA *info)
share->open_list= list_delete(share->open_list, &info->share_list);
}
maria_ftparser_call_deinitializer(info);
my_free(info->rec_buff);
(*share->end)(info);

View file

@ -251,7 +251,8 @@ my_bool maria_page_crc_check_index(int res, PAGECACHE_IO_HOOK_ARGS *args)
if (length > share->block_size - CRC_SIZE)
{
DBUG_PRINT("error", ("Wrong page length: %u", length));
return (my_errno= HA_ERR_WRONG_CRC);
my_errno= HA_ERR_WRONG_CRC;
return 1;
}
return maria_page_crc_check(page, (uint32) page_no, share,
MARIA_NO_CRC_NORMAL_PAGE,

View file

@ -20,7 +20,7 @@
to open other files during the time we flush the cache and close this file
*/
#include "myisamdef.h"
#include "ftdefs.h"
int mi_close(register MI_INFO *info)
{
@ -60,6 +60,8 @@ int mi_close(register MI_INFO *info)
mysql_mutex_unlock(&share->intern_lock);
my_free(mi_get_rec_buff_ptr(info, info->rec_buff));
ftparser_call_deinitializer(info);
if (flag)
{
DBUG_EXECUTE_IF("crash_before_flush_keys",