Skip to content

Commit 15b1426

Browse files
committed
Merge branch '10.11' into bb-11.4-release
2 parents 7e76a58 + fe59b4c commit 15b1426

File tree

186 files changed

+1683
-683
lines changed

Some content is hidden

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

186 files changed

+1683
-683
lines changed

BUILD/compile-pentium64-ubsan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ path=`dirname $0`
3131
# the destination
3232
#
3333

34-
extra_flags="$pentium64_cflags $debug_cflags -fsanitize=undefined -DWITH_UBSAN -Wno-conversion -Wno-uninitialized"
34+
extra_flags="$pentium64_cflags $debug_cflags -fsanitize=undefined -DWITH_UBSAN -Wno-conversion -Wno-uninitialized -Wno-unused-parameter"
3535
extra_configs="$pentium_configs $debug_configs -DWITH_UBSAN=ON -DMYSQL_MAINTAINER_MODE=NO --without-spider"
3636

3737
. "$path/FINISH.sh"

client/mysql.cc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,18 +3207,31 @@ static int reconnect(void)
32073207
}
32083208

32093209
#ifndef EMBEDDED_LIBRARY
3210-
static void status_info_cb(void *data, enum enum_mariadb_status_info type,
3211-
enum enum_session_state_type state_type, MARIADB_CONST_STRING *val)
3210+
#ifdef __clang__
3211+
#pragma clang diagnostic push
3212+
#pragma clang diagnostic ignored "-Wvarargs"
3213+
/* CONC-789 */
3214+
#endif
3215+
3216+
static void status_info_cb(void *data, enum enum_mariadb_status_info type, ...)
32123217
{
3213-
if (type == SESSION_TRACK_TYPE && state_type == SESSION_TRACK_SCHEMA)
3218+
va_list ap;
3219+
va_start(ap, type);
3220+
if (type == SESSION_TRACK_TYPE && va_arg(ap, int) == SESSION_TRACK_SCHEMA)
32143221
{
3222+
MARIADB_CONST_STRING *val= va_arg(ap, MARIADB_CONST_STRING *);
32153223
my_free(current_db);
32163224
if (val->length)
32173225
current_db= my_strndup(PSI_NOT_INSTRUMENTED, val->str, val->length, MYF(MY_FAE));
32183226
else
32193227
current_db= NULL;
32203228
}
3229+
va_end(ap);
32213230
}
3231+
3232+
#ifdef __clang__
3233+
#pragma clang diagnostic pop
3234+
#endif
32223235
#else
32233236
#define mysql_optionsv(A,B,C,D) do { } while(0)
32243237
#endif

client/mysqldump.cc

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,6 +1865,26 @@ static char *cover_definer_clause(const char *stmt_str,
18651865
return query_str;
18661866
}
18671867

1868+
1869+
static const char* build_path_for_table(char *to, const char *dir,
1870+
const char *table, const char *ext)
1871+
{
1872+
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
1873+
convert_dirname(tmp_path, path, NULL);
1874+
my_load_path(tmp_path, tmp_path, NULL);
1875+
if (check_if_legal_tablename(table))
1876+
strxnmov(filename, sizeof(filename) - 1, table, "@@@", NULL);
1877+
else
1878+
{
1879+
uint errors, len;
1880+
len= my_convert(filename, sizeof(filename) - 1, &my_charset_filename,
1881+
table, (uint32)strlen(table), charset_info, &errors);
1882+
filename[len]= 0;
1883+
}
1884+
return fn_format(to, filename, tmp_path, ext, MYF(MY_UNPACK_FILENAME));
1885+
}
1886+
1887+
18681888
/*
18691889
Open a new .sql file to dump the table or view into
18701890
@@ -1879,12 +1899,9 @@ static char *cover_definer_clause(const char *stmt_str,
18791899
*/
18801900
static FILE* open_sql_file_for_table(const char* table, int flags)
18811901
{
1882-
FILE* res;
1883-
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
1884-
convert_dirname(tmp_path,path,NullS);
1885-
res= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
1886-
flags, MYF(MY_WME));
1887-
return res;
1902+
char filename[FN_REFLEN];
1903+
return my_fopen(build_path_for_table(filename, path, table, ".sql"),
1904+
flags, MYF(MY_WME));
18881905
}
18891906

18901907

@@ -4157,14 +4174,9 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
41574174

41584175
if (path)
41594176
{
4160-
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
4161-
/*
4162-
Convert the path to native os format
4163-
and resolve to the full filepath.
4164-
*/
4165-
convert_dirname(tmp_path,path,NullS);
4166-
my_load_path(tmp_path, tmp_path, NULL);
4167-
fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME));
4177+
char filename[FN_REFLEN];
4178+
4179+
build_path_for_table(filename, path, table, ".txt");
41684180

41694181
/* Must delete the file that 'INTO OUTFILE' will write to */
41704182
my_delete(filename, MYF(0));
@@ -4173,7 +4185,6 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
41734185
to_unix_path(filename);
41744186

41754187
/* now build the query string */
4176-
41774188
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ ");
41784189
dynstr_append_checked(&query_string, select_field_names.str);
41794190
dynstr_append_checked(&query_string, " INTO OUTFILE '");

client/mysqlimport.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,17 @@ static int write_to_table(char *filename, MYSQL *mysql)
333333
DBUG_ENTER("write_to_table");
334334
DBUG_PRINT("enter",("filename: %s",filename));
335335

336-
fn_format(tablename, filename, "", "", 1 | 2); /* removes path & ext. */
336+
fn_format(tablename, filename, "", "", MYF(MY_REPLACE_DIR | MY_REPLACE_EXT));
337+
if (strchr(tablename, '@'))
338+
{
339+
uint errors, len;
340+
CHARSET_INFO *cs=
341+
get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(0));
342+
len= my_convert(escaped_name, sizeof(escaped_name) - 1, cs, tablename,
343+
(uint32)strlen(tablename), &my_charset_filename, &errors);
344+
if (!errors)
345+
strmake(tablename, escaped_name, len);
346+
}
337347
if (!opt_local_file)
338348
strmov(hard_path,filename);
339349
else
@@ -472,7 +482,7 @@ static MYSQL *db_connect(char *host, char *database,
472482
if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME))
473483
default_charset= (char *)my_default_csname();
474484
my_set_console_cp(default_charset);
475-
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, my_default_csname());
485+
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
476486
mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
477487
mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
478488
"program_name", "mysqlimport");

client/mysqltest.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#endif
5656
#include <signal.h>
5757
#include <my_stacktrace.h>
58+
#include <my_attribute.h>
5859

5960
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
6061

@@ -78,7 +79,7 @@ static my_bool non_blocking_api_enabled= 0;
7879
#define MAX_DELIMITER_LENGTH 16
7980
#define DEFAULT_MAX_CONN 64
8081

81-
#define DIE_BUFF_SIZE 15*1024
82+
#define DIE_BUFF_SIZE 64*1024
8283

8384
#define RESULT_STRING_INIT_MEM 2048
8485
#define RESULT_STRING_INCREMENT_MEM 2048
@@ -1627,6 +1628,8 @@ static void make_error_message(char *buf, size_t len, const char *fmt, va_list a
16271628
s+= my_snprintf(s, end -s, "\n");
16281629
}
16291630

1631+
PRAGMA_DISABLE_CHECK_STACK_FRAME
1632+
16301633
static void die(const char *fmt, ...)
16311634
{
16321635
char buff[DIE_BUFF_SIZE];
@@ -1638,6 +1641,8 @@ static void die(const char *fmt, ...)
16381641
really_die(buff);
16391642
}
16401643

1644+
PRAGMA_REENABLE_CHECK_STACK_FRAME
1645+
16411646
static void really_die(const char *msg)
16421647
{
16431648
static int dying= 0;
@@ -1666,6 +1671,8 @@ static void really_die(const char *msg)
16661671
cleanup_and_exit(1, 1);
16671672
}
16681673

1674+
PRAGMA_DISABLE_CHECK_STACK_FRAME
1675+
16691676
void report_or_die(const char *fmt, ...)
16701677
{
16711678
va_list args;
@@ -1720,6 +1727,7 @@ void abort_not_supported_test(const char *fmt, ...)
17201727
cleanup_and_exit(62, 0);
17211728
}
17221729

1730+
PRAGMA_REENABLE_CHECK_STACK_FRAME
17231731

17241732
void abort_not_in_this_version()
17251733
{
@@ -5796,8 +5804,12 @@ void do_close_connection(struct st_command *command)
57965804
DBUG_PRINT("info", ("Closing connection %s", con->name));
57975805
#ifndef EMBEDDED_LIBRARY
57985806
if (command->type == Q_DIRTY_CLOSE)
5799-
{
58005807
mariadb_cancel(con->mysql);
5808+
else
5809+
{
5810+
simple_command(con->mysql,COM_QUIT,0,0,0);
5811+
if (con->util_mysql)
5812+
simple_command(con->util_mysql,COM_QUIT,0,0,0);
58015813
}
58025814
#endif /*!EMBEDDED_LIBRARY*/
58035815
if (con->stmt)

extra/mariabackup/aria_backup_client.cc

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -399,21 +399,19 @@ bool Table::copy(ds_ctxt_t *ds, bool is_index, unsigned thread_num) {
399399

400400
for (ulonglong block= 0 ; ; block++) {
401401
size_t length = m_cap.block_size;
402-
if (is_index) {
403-
if ((error= aria_read_index(
404-
partition.m_index_file, &m_cap, block, copy_buffer) ==
405-
HA_ERR_END_OF_FILE))
406-
break;
407-
} else {
408-
if ((error= aria_read_data(
409-
partition.m_data_file, &m_cap, block, copy_buffer, &length) ==
410-
HA_ERR_END_OF_FILE))
411-
break;
412-
}
413-
if (error) {
414-
msg(thread_num, "error: aria_read %s failed: %d",
415-
is_index ? "index" : "data", error);
416-
goto err;
402+
if (is_index)
403+
error= aria_read_index(partition.m_index_file, &m_cap,
404+
block, copy_buffer);
405+
else
406+
error= aria_read_data(partition.m_data_file, &m_cap,
407+
block, copy_buffer, &length);
408+
if (error)
409+
{
410+
if (error == HA_ERR_END_OF_FILE)
411+
break;
412+
msg(thread_num, "error: aria_read %s failed: %d",
413+
is_index ? "index" : "data", error);
414+
goto err;
417415
}
418416
xtrabackup_io_throttling();
419417
if ((error = ds_write(dst_file, copy_buffer, length))) {

extra/mariabackup/backup_mysql.cc

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ bool have_lock_wait_timeout = false;
7777
bool have_galera_enabled = false;
7878
bool have_multi_threaded_slave = false;
7979
bool have_gtid_slave = false;
80+
bool innobase_data_file_path_allocated= false;
8081

8182
/* Kill long selects */
8283
static mysql_mutex_t kill_query_thread_mutex;
@@ -500,21 +501,19 @@ bool get_mysql_vars(MYSQL *connection)
500501
}
501502

502503
if (innodb_data_file_path_var && *innodb_data_file_path_var)
503-
innobase_data_file_path= my_strdup(PSI_NOT_INSTRUMENTED,
504-
innodb_data_file_path_var, MYF(MY_FAE));
504+
innobase_data_file_path= my_once_strdup(innodb_data_file_path_var,
505+
MYF(MY_FAE));
505506

506507
if (innodb_data_home_dir_var)
507-
innobase_data_home_dir= my_strdup(PSI_NOT_INSTRUMENTED,
508-
innodb_data_home_dir_var, MYF(MY_FAE));
508+
innobase_data_home_dir= my_once_strdup(innodb_data_home_dir_var,
509+
MYF(MY_FAE));
509510

510511
if (innodb_log_group_home_dir_var && *innodb_log_group_home_dir_var)
511-
srv_log_group_home_dir= my_strdup(PSI_NOT_INSTRUMENTED,
512-
innodb_log_group_home_dir_var,
513-
MYF(MY_FAE));
512+
srv_log_group_home_dir= my_once_strdup(innodb_log_group_home_dir_var,
513+
MYF(MY_FAE));
514514

515515
if (innodb_undo_directory_var && *innodb_undo_directory_var)
516-
srv_undo_dir= my_strdup(PSI_NOT_INSTRUMENTED, innodb_undo_directory_var,
517-
MYF(MY_FAE));
516+
srv_undo_dir= my_once_strdup(innodb_undo_directory_var, MYF(MY_FAE));
518517

519518
if (innodb_log_file_size_var)
520519
{
@@ -536,10 +535,7 @@ bool get_mysql_vars(MYSQL *connection)
536535
}
537536

538537
if (aria_log_dir_path_var)
539-
{
540-
aria_log_dir_path= my_strdup(PSI_NOT_INSTRUMENTED,
541-
aria_log_dir_path_var, MYF(MY_FAE));
542-
}
538+
aria_log_dir_path= my_once_strdup(aria_log_dir_path_var, MYF(MY_FAE));
543539

544540
if (page_zip_level_var != NULL)
545541
{
@@ -552,11 +548,11 @@ bool get_mysql_vars(MYSQL *connection)
552548
xb_load_list_string(ignore_db_dirs, ",", register_ignore_db_dirs_filter);
553549

554550
out:
555-
free_mysql_variables(mysql_vars);
556551

557552
return (ret);
558553
}
559554

555+
560556
static
561557
bool
562558
select_incremental_lsn_from_history(lsn_t *incremental_lsn)
@@ -932,7 +928,7 @@ lock_for_backup_stage_flush(MYSQL *connection) {
932928
if (opt_kill_long_queries_timeout) {
933929
start_query_killer();
934930
}
935-
xb_mysql_query(connection, "BACKUP STAGE FLUSH", true);
931+
xb_mysql_query(connection, "BACKUP STAGE FLUSH", false);
936932
if (opt_kill_long_queries_timeout) {
937933
stop_query_killer();
938934
}
@@ -944,7 +940,7 @@ lock_for_backup_stage_block_ddl(MYSQL *connection) {
944940
if (opt_kill_long_queries_timeout) {
945941
start_query_killer();
946942
}
947-
xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", true);
943+
xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", false);
948944
DBUG_MARIABACKUP_EVENT("after_backup_stage_block_ddl", {});
949945
if (opt_kill_long_queries_timeout) {
950946
stop_query_killer();
@@ -957,7 +953,7 @@ lock_for_backup_stage_commit(MYSQL *connection) {
957953
if (opt_kill_long_queries_timeout) {
958954
start_query_killer();
959955
}
960-
xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", true);
956+
xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", false);
961957
DBUG_MARIABACKUP_EVENT("after_backup_stage_block_commit", {});
962958
if (opt_kill_long_queries_timeout) {
963959
stop_query_killer();
@@ -968,12 +964,12 @@ lock_for_backup_stage_commit(MYSQL *connection) {
968964
bool backup_lock(MYSQL *con, const char *table_name) {
969965
static const std::string backup_lock_prefix("BACKUP LOCK ");
970966
std::string backup_lock_query = backup_lock_prefix + table_name;
971-
xb_mysql_query(con, backup_lock_query.c_str(), true);
967+
xb_mysql_query(con, backup_lock_query.c_str(), false);
972968
return true;
973969
}
974970

975971
bool backup_unlock(MYSQL *con) {
976-
xb_mysql_query(con, "BACKUP UNLOCK", true);
972+
xb_mysql_query(con, "BACKUP UNLOCK", false);
977973
return true;
978974
}
979975

@@ -987,6 +983,8 @@ get_tables_in_use(MYSQL *con) {
987983
msg("Table %s is in use", tk.c_str());
988984
result.insert(std::move(tk));
989985
}
986+
if (q_res)
987+
mysql_free_result(q_res);
990988
return result;
991989
}
992990

extra/mariabackup/backup_mysql.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,4 @@ bool
9797
write_slave_info(ds_ctxt *datasink, MYSQL *connection);
9898

9999
ulonglong get_current_lsn(MYSQL *connection);
100-
101100
#endif

0 commit comments

Comments
 (0)