Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä 2020-04-22 14:45:55 +03:00
commit 455cf6196c
24 changed files with 352 additions and 215 deletions

View File

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

View File

@ -3628,6 +3628,11 @@ xb_register_exclude_filter_entry(
&tables_exclude_hash); &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. */ Register new table for the filter. */
static static
@ -3690,26 +3695,24 @@ xb_register_exclude_regex(
typedef void (*insert_entry_func_t)(const char*); typedef void (*insert_entry_func_t)(const char*);
/*********************************************************************** /* Scan string and load filter entries from it.
Scan string and load filter entries from it. */ @param[in] list string representing a list
static @param[in] delimiters delimiters of entries
void @param[in] ins callback to add entry */
xb_load_list_string( void xb_load_list_string(char *list, const char *delimiters,
/*================*/ insert_entry_func_t ins)
char* list, /*!< in: string representing a list */
const char* delimiters, /*!< in: delimiters of entries */
insert_entry_func_t ins) /*!< in: callback to add entry */
{ {
char* p; char *p;
char* saveptr; char *saveptr;
p = strtok_r(list, delimiters, &saveptr); p= strtok_r(list, delimiters, &saveptr);
while (p) { while (p)
{
ins(p); ins(p);
p = strtok_r(NULL, delimiters, &saveptr); p= strtok_r(NULL, delimiters, &saveptr);
} }
} }
/*********************************************************************** /***********************************************************************

View File

@ -194,4 +194,14 @@ void mdl_lock_init();
void mdl_lock_table(ulint space_id); void mdl_lock_table(ulint space_id);
void mdl_unlock_all(); void mdl_unlock_all();
bool ends_with(const char *str, const char *suffix); 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 */ #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}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", {"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 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}, &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"numeric-dump-file", 'n', "Read the dump from specified file.", {"numeric-dump-file", 'n', "Read the dump from specified file.",
&dump_fname, &dump_fname, 0, GET_STR, REQUIRED_ARG, &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 verify_sort();
static void clean_up();
static void print_version(void) static void print_version(void)
{ {
@ -97,9 +97,18 @@ static void die(const char* fmt, ...)
vfprintf(stderr, fmt, args); vfprintf(stderr, fmt, args);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
va_end(args); va_end(args);
clean_up();
my_end(0);
exit(1); exit(1);
} }
void local_exit(int error)
{
clean_up();
my_end(0);
exit(error);
}
static my_bool static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)), 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) { switch(optid) {
case 'V': case 'V':
print_version(); print_version();
exit(0); local_exit(0);
break;
case '?': case '?':
usage(); usage();
exit(0); local_exit(0);
break;
} }
return 0; return 0;
} }
@ -122,7 +133,7 @@ static int parse_args(int argc, char **argv)
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) 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 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 else
{ {
usage(); usage();
exit(1); local_exit(1);
} }
} }
else if (argc != 0 || !sym_fname) else if (argc != 0 || !sym_fname)
{ {
usage(); usage();
exit(1); local_exit(1);
} }
return 0; return 0;
} }
@ -242,6 +253,10 @@ static void init_sym_table()
static void clean_up() static void clean_up()
{ {
delete_dynamic(&sym_table); 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() 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?) Skip '_end' as this is an indication of a wrong symbol (stack?)
*/ */
@ -299,9 +314,7 @@ static void do_resolve()
found= 3; found= 3;
if (p[0] == '(' && p[1] == '+' && p[2] == '0' && p[3] == 'x') if (p[0] == '(' && p[1] == '+' && p[2] == '0' && p[3] == 'x')
found= 4; found= 4;
if (p[0] == '0' && p[1] == 'x')
/* For stdin */
if (p == buf && p[0] == '0' && p[1] == 'x')
found= 2; found= 2;
if (found) if (found)
@ -312,14 +325,15 @@ static void do_resolve()
addr= (uchar*)read_addr(&tmp); addr= (uchar*)read_addr(&tmp);
if (resolve_addr(addr, &se) && strcmp(se.symbol, "_end")) if (resolve_addr(addr, &se) && strcmp(se.symbol, "_end"))
{ {
fprintf(fp_out, "%c%p %s + %d", *p, addr, se.symbol, found-= 2; /* Don't print 0x as it's added by %p */
(int) (addr - se.addr)); while (found--)
fputc(*p++, stdout);
fprintf(fp_out, "%p %s + %d", addr,
se.symbol, (int) (addr - se.addr));
p= tmp-1; p= tmp-1;
} }
else else
{
fputc(*p, stdout); fputc(*p, stdout);
}
} }
else else
fputc(*p, stdout); fputc(*p, stdout);
@ -336,5 +350,6 @@ int main(int argc, char** argv)
init_sym_table(); init_sym_table();
do_resolve(); do_resolve();
clean_up(); clean_up();
my_end(0);
return 0; return 0;
} }

View File

@ -776,3 +776,14 @@ CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
Warnings: Warnings:
Note 1061 Duplicate key name 'ft1' Note 1061 Duplicate key name 'ft1'
DROP TABLE t1; 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);
CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title); CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
DROP TABLE t1; 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

@ -2265,6 +2265,13 @@ st_astext(p)
POINT(0 0) POINT(0 0)
drop table t1; 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 # End of 10.2 tests
# #
# #

View File

@ -1795,6 +1795,14 @@ insert into t1 values(default);
select st_astext(p) from t1; select st_astext(p) from t1;
drop table 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 #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #

View File

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

View File

@ -12,6 +12,9 @@ INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT; COMMIT;
--connection node_2 --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; SET AUTOCOMMIT=OFF;
START TRANSACTION; START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before');

View File

@ -9,12 +9,12 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_debug.inc --source include/have_debug.inc
--source include/have_debug_sync.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 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2a --connection node_2a
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/galera_have_debug_sync.inc
# #
# node 1 is native MariaDB server operating as async replication master # node 1 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; CREATE TABLE t1(i INT) ENGINE INNODB;
INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(1);
CREATE TABLE t2(i int) ENGINE INNODB; CREATE TABLE t2(i int) ENGINE INNODB;

View File

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

View File

@ -235,7 +235,9 @@ wsrep_recover_position() {
fi fi
if [ -f $wr_logfile ]; then 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 chmod 600 $wr_logfile
else else
log_error "WSREP: mktemp failed" log_error "WSREP: mktemp failed"
@ -250,6 +252,11 @@ wsrep_recover_position() {
eval "$mysqld_cmd --wsrep_recover $wr_options 2> $wr_logfile" 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)" local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)"
if [ -z "$rp" ]; then if [ -z "$rp" ]; then
local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')" local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')"

View File

@ -9049,7 +9049,7 @@ int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs)
my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0), my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
Geometry::ci_collection[geom_type]->m_name.str, 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()-> (ulong) table->in_use->get_stmt_da()->
current_row_for_warning()); current_row_for_warning());

View File

@ -9349,8 +9349,10 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
} }
if (!(def_field= (Field*) thd->alloc(field_arg->field->size_of()))) if (!(def_field= (Field*) thd->alloc(field_arg->field->size_of())))
goto error; goto error;
cached_field= def_field;
memcpy((void *)def_field, (void *)field_arg->field, memcpy((void *)def_field, (void *)field_arg->field,
field_arg->field->size_of()); field_arg->field->size_of());
def_field->reset_fields();
// If non-constant default value expression // If non-constant default value expression
if (def_field->default_value && def_field->default_value->flags) if (def_field->default_value && def_field->default_value->flags)
{ {
@ -9378,6 +9380,12 @@ error:
return TRUE; 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) void Item_default_value::print(String *str, enum_query_type query_type)
{ {

View File

@ -2,7 +2,7 @@
#define SQL_ITEM_INCLUDED #define SQL_ITEM_INCLUDED
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. /* 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 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 it under the terms of the GNU General Public License as published by
@ -5773,21 +5773,23 @@ class Item_default_value : public Item_field
void calculate(); void calculate();
public: public:
Item *arg; Item *arg;
Field *cached_field;
Item_default_value(THD *thd, Name_resolution_context *context_arg) Item_default_value(THD *thd, Name_resolution_context *context_arg)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL, :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
&null_clex_str), &null_clex_str),
arg(NULL) {} arg(NULL), cached_field(NULL) {}
Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a) Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL, :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
&null_clex_str), &null_clex_str),
arg(a) {} arg(a), cached_field(NULL) {}
Item_default_value(THD *thd, Name_resolution_context *context_arg, Field *a) Item_default_value(THD *thd, Name_resolution_context *context_arg, Field *a)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL, :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
&null_clex_str), &null_clex_str),
arg(NULL) {} arg(NULL), cached_field(NULL) {}
enum Type type() const { return DEFAULT_VALUE_ITEM; } enum Type type() const { return DEFAULT_VALUE_ITEM; }
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
bool fix_fields(THD *, Item **); bool fix_fields(THD *, Item **);
void cleanup();
void print(String *str, enum_query_type query_type); void print(String *str, enum_query_type query_type);
String *val_str(String *str); String *val_str(String *str);
double val_real(); double val_real();

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* 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 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 it under the terms of the GNU General Public License as published by
@ -2189,11 +2189,7 @@ static void mysqld_exit(int exit_code)
shutdown_performance_schema(); // we do it as late as possible shutdown_performance_schema(); // we do it as late as possible
#endif #endif
set_malloc_size_cb(NULL); set_malloc_size_cb(NULL);
if (opt_endinfo && global_status_var.global_memory_used) if (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)
{ {
#ifdef SAFEMALLOC #ifdef SAFEMALLOC
sf_report_leaked_memory(0); sf_report_leaked_memory(0);

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB Copyright (c) 2008, 2020, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -4696,6 +4696,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
double roru_index_costs; double roru_index_costs;
ha_rows roru_total_records; ha_rows roru_total_records;
double roru_intersect_part= 1.0; double roru_intersect_part= 1.0;
bool only_ror_scans_required= FALSE;
size_t n_child_scans; size_t n_child_scans;
DBUG_ENTER("get_best_disjunct_quick"); DBUG_ENTER("get_best_disjunct_quick");
DBUG_PRINT("info", ("Full table scan cost: %g", read_time)); DBUG_PRINT("info", ("Full table scan cost: %g", read_time));
@ -4722,6 +4723,9 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
sizeof(TRP_RANGE*)* sizeof(TRP_RANGE*)*
n_child_scans))) n_child_scans)))
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
only_ror_scans_required= !optimizer_flag(param->thd,
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION);
/* /*
Collect best 'range' scan for each of disjuncts, and, while doing so, Collect best 'range' scan for each of disjuncts, and, while doing so,
analyze possibility of ROR scans. Also calculate some values needed by analyze possibility of ROR scans. Also calculate some values needed by
@ -4734,7 +4738,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
DBUG_EXECUTE("info", print_sel_tree(param, *ptree, &(*ptree)->keys_map, DBUG_EXECUTE("info", print_sel_tree(param, *ptree, &(*ptree)->keys_map,
"tree in SEL_IMERGE");); "tree in SEL_IMERGE"););
if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE, 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 One of index scans in this index_merge is more expensive than entire
@ -5056,7 +5061,7 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
index merge retrievals are not well calibrated index merge retrievals are not well calibrated
*/ */
trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE, trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE,
read_time, TRUE); read_time, FALSE);
} }
DBUG_RETURN(trp); DBUG_RETURN(trp);
@ -6784,7 +6789,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 index_read_must_be_used if TRUE, assume 'index only' option will be set
(except for clustered PK indexes) (except for clustered PK indexes)
read_time don't create read plans with cost > read_time. 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 RETURN
Best range read plan Best range read plan
NULL if no plan found or error occurred NULL if no plan found or error occurred
@ -6794,7 +6800,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
bool index_read_must_be_used, bool index_read_must_be_used,
bool update_tbl_stats, bool update_tbl_stats,
double read_time, double read_time,
bool ror_scans_required) bool only_ror_scans_required)
{ {
uint idx, UNINIT_VAR(best_idx); uint idx, UNINIT_VAR(best_idx);
SEL_ARG *key_to_read= NULL; SEL_ARG *key_to_read= NULL;
@ -6842,8 +6848,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
update_tbl_stats, &mrr_flags, update_tbl_stats, &mrr_flags,
&buf_size, &cost); &buf_size, &cost);
if (ror_scans_required && !param->is_ror_scan && if (only_ror_scans_required && !param->is_ror_scan)
!optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION))
{ {
/* The scan is not a ROR-scan, just skip it */ /* The scan is not a ROR-scan, just skip it */
continue; continue;

View File

@ -20,7 +20,7 @@
to open other files during the time we flush the cache and close this file 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" #include "ma_crypt.h"
int maria_close(register MARIA_HA *info) 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); share->open_list= list_delete(share->open_list, &info->share_list);
} }
maria_ftparser_call_deinitializer(info);
my_free(info->rec_buff); my_free(info->rec_buff);
(*share->end)(info); (*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) if (length > share->block_size - CRC_SIZE)
{ {
DBUG_PRINT("error", ("Wrong page length: %u", length)); 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, return maria_page_crc_check(page, (uint32) page_no, share,
MARIA_NO_CRC_NORMAL_PAGE, 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 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) int mi_close(register MI_INFO *info)
{ {
@ -60,6 +60,8 @@ int mi_close(register MI_INFO *info)
mysql_mutex_unlock(&share->intern_lock); mysql_mutex_unlock(&share->intern_lock);
my_free(mi_get_rec_buff_ptr(info, info->rec_buff)); my_free(mi_get_rec_buff_ptr(info, info->rec_buff));
ftparser_call_deinitializer(info);
if (flag) if (flag)
{ {
DBUG_EXECUTE_IF("crash_before_flush_keys", DBUG_EXECUTE_IF("crash_before_flush_keys",