Skip to content

Commit 5a92ccb

Browse files
committed
Merge 10.3 into 10.4
Disable MDEV-20576 assertions until MDEV-20595 has been fixed.
2 parents c997af7 + c016ea6 commit 5a92ccb

File tree

101 files changed

+1291
-775
lines changed

Some content is hidden

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

101 files changed

+1291
-775
lines changed

client/mysqldump.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
3-
Copyright (c) 2010, 2017, MariaDB Corporation.
3+
Copyright (c) 2010, 2019, MariaDB Corporation.
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -1074,7 +1074,7 @@ static int get_options(int *argc, char ***argv)
10741074
my_progname_short);
10751075
return(EX_USAGE);
10761076
}
1077-
if (strcmp(default_charset, charset_info->csname) &&
1077+
if (strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME) &&
10781078
!(charset_info= get_charset_by_csname(default_charset,
10791079
MY_CS_PRIMARY, MYF(MY_WME))))
10801080
exit(1);
@@ -1539,6 +1539,9 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
15391539
char query_buffer[QUERY_LENGTH];
15401540
size_t query_length;
15411541

1542+
if (!strcmp(cs_name, MYSQL_AUTODETECT_CHARSET_NAME))
1543+
cs_name= (char *)my_default_csname();
1544+
15421545
/* Server lacks facility. This is not an error, by arbitrary decision . */
15431546
if (!server_supports_switching_charsets)
15441547
return FALSE;

cmake/sign.cmake.in

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
1+
# If timestamping is used, it can (rarely) fail, when public timestamping service has issues.
2+
#
3+
# To handle the error gracefully and tranparently, we'll retry the signtool command,
4+
# second time without "/t URL" parameter
5+
SET(SIGNTOOL_PARAMETERS_NO_TIMESTAMP "@SIGNTOOL_PARAMETERS@")
6+
LIST(FIND SIGNTOOL_PARAMETERS_NO_TIMESTAMP /t idx)
7+
IF(NOT(idx EQUAL -1))
8+
LIST(REMOVE_AT SIGNTOOL_PARAMETERS_NO_TIMESTAMP ${idx})
9+
#remove the URL following /t , as well
10+
LIST(REMOVE_AT SIGNTOOL_PARAMETERS_NO_TIMESTAMP ${idx})
11+
ENDIF()
12+
13+
GET_FILENAME_COMPONENT(SIGNTOOL_DIR "@SIGNTOOL_EXECUTABLE@" DIRECTORY)
14+
GET_FILENAME_COMPONENT(SIGNTOOL_NAME "@SIGNTOOL_EXECUTABLE@" NAME)
15+
116
FILE(GLOB_RECURSE files "@CMAKE_BINARY_DIR@/*.signme")
217
MESSAGE(STATUS "signing files")
18+
19+
320
FOREACH(f ${files})
421
STRING(REPLACE ".signme" "" exe_location "${f}")
522

623
string (REPLACE ";" " " params "@SIGNTOOL_PARAMETERS@")
7-
#MESSAGE("@SIGNTOOL_EXECUTABLE@" sign ${params} "${exe_location}")
824

925
EXECUTE_PROCESS(COMMAND
10-
"@SIGNTOOL_EXECUTABLE@" sign @SIGNTOOL_PARAMETERS@ "${exe_location}"
26+
cmd /c "${SIGNTOOL_NAME}" sign @SIGNTOOL_PARAMETERS@ "${exe_location}" 2>NUL
27+
|| "${SIGNTOOL_NAME}" sign ${SIGNTOOL_PARAMETERS_NO_TIMESTAMP} "${exe_location}"
28+
WORKING_DIRECTORY ${SIGNTOOL_DIR}
1129
RESULT_VARIABLE ERR)
1230
IF(NOT ${ERR} EQUAL 0)
1331
MESSAGE( "Error ${ERR} signing ${exe_location}")

dbug/dbug.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,6 +2258,16 @@ static int default_my_dbug_sanity(void)
22582258
return 0;
22592259
}
22602260

2261+
extern my_bool my_assert;
2262+
ATTRIBUTE_COLD
2263+
my_bool _db_my_assert(const char *file, int line, const char *msg)
2264+
{
2265+
my_bool a = my_assert;
2266+
_db_flush_();
2267+
if (!a)
2268+
fprintf(stderr, "%s:%d: assert: %s\n", file, line, msg);
2269+
return a;
2270+
}
22612271
#else
22622272

22632273
/*

debian/mariadb-server-10.4.postinst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
. /usr/share/debconf/confmodule
44

5-
# assume the filename is /path/to/mariadb-server-##.#.postinst
6-
VER=${0: -13:4}
5+
# Automatically set version to ease maintenance of this file
6+
MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}"
77

88
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
99
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
1010

1111
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
1212

1313
# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
14-
ERR_LOGGER="logger -p daemon.err -t mariadb-server-$VER.postinst -i"
14+
ERR_LOGGER="logger -p daemon.err -t mariadb-server-$MAJOR_VER.postinst -i"
1515
# This will make an error in a logged command immediately apparent by aborting
1616
# the install, rather than failing silently and leaving a broken install.
1717
set -o pipefail
@@ -117,8 +117,8 @@ EOF
117117
set -e
118118

119119
# To avoid downgrades.
120-
touch $mysql_statedir/debian-$VER.flag
121-
120+
touch $mysql_statedir/debian-$MAJOR_VER.flag
121+
122122
# On new installations root user can connect via unix_socket.
123123
# But on upgrades, scripts rely on debian-sys-maint user and
124124
# credentials in /etc/mysql/debian.cnf

extra/mariabackup/backup_copy.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,8 @@ bool backup_finish()
16071607
return(false);
16081608
}
16091609

1610-
if (!write_xtrabackup_info(mysql_connection, XTRABACKUP_INFO, opt_history != 0)) {
1610+
if (!write_xtrabackup_info(mysql_connection, XTRABACKUP_INFO,
1611+
opt_history != 0, true)) {
16111612
return(false);
16121613
}
16131614

extra/mariabackup/backup_mysql.cc

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,9 +1367,12 @@ PERCONA_SCHEMA.xtrabackup_history and writes a new history record to the
13671367
table containing all the history info particular to the just completed
13681368
backup. */
13691369
bool
1370-
write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
1370+
write_xtrabackup_info(MYSQL *connection, const char * filename, bool history,
1371+
bool stream)
13711372
{
13721373

1374+
bool result = true;
1375+
FILE *fp = NULL;
13731376
char *uuid = NULL;
13741377
char *server_version = NULL;
13751378
char buf_start_time[100];
@@ -1395,7 +1398,8 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
13951398
|| xtrabackup_databases_exclude
13961399
);
13971400

1398-
backup_file_printf(filename,
1401+
char *buf = NULL;
1402+
int buf_len = asprintf(&buf,
13991403
"uuid = %s\n"
14001404
"name = %s\n"
14011405
"tool_name = %s\n"
@@ -1407,8 +1411,8 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
14071411
"end_time = %s\n"
14081412
"lock_time = %d\n"
14091413
"binlog_pos = %s\n"
1410-
"innodb_from_lsn = %llu\n"
1411-
"innodb_to_lsn = %llu\n"
1414+
"innodb_from_lsn = " LSN_PF "\n"
1415+
"innodb_to_lsn = " LSN_PF "\n"
14121416
"partial = %s\n"
14131417
"incremental = %s\n"
14141418
"format = %s\n"
@@ -1425,12 +1429,34 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
14251429
(int)history_lock_time, /* lock_time */
14261430
mysql_binlog_position ?
14271431
mysql_binlog_position : "", /* binlog_pos */
1428-
incremental_lsn, /* innodb_from_lsn */
1429-
metadata_to_lsn, /* innodb_to_lsn */
1432+
incremental_lsn,
1433+
/* innodb_from_lsn */
1434+
metadata_to_lsn,
1435+
/* innodb_to_lsn */
14301436
is_partial? "Y" : "N",
14311437
xtrabackup_incremental ? "Y" : "N", /* incremental */
14321438
xb_stream_name[xtrabackup_stream_fmt], /* format */
14331439
xtrabackup_compress ? "compressed" : "N"); /* compressed */
1440+
if (buf_len < 0) {
1441+
msg("Error: cannot generate xtrabackup_info");
1442+
result = false;
1443+
goto cleanup;
1444+
}
1445+
1446+
if (stream) {
1447+
backup_file_printf(filename, "%s", buf);
1448+
} else {
1449+
fp = fopen(filename, "w");
1450+
if (!fp) {
1451+
msg("Error: cannot open %s", filename);
1452+
result = false;
1453+
goto cleanup;
1454+
}
1455+
if (fwrite(buf, buf_len, 1, fp) < 1) {
1456+
result = false;
1457+
goto cleanup;
1458+
}
1459+
}
14341460

14351461
if (!history) {
14361462
goto cleanup;
@@ -1492,8 +1518,11 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
14921518

14931519
free(uuid);
14941520
free(server_version);
1521+
free(buf);
1522+
if (fp)
1523+
fclose(fp);
14951524

1496-
return(true);
1525+
return(result);
14971526
}
14981527

14991528
extern const char *innodb_checksum_algorithm_names[];

extra/mariabackup/backup_mysql.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ bool
6868
write_binlog_info(MYSQL *connection);
6969

7070
bool
71-
write_xtrabackup_info(MYSQL *connection, const char * filename, bool history);
71+
write_xtrabackup_info(MYSQL *connection, const char * filename, bool history,
72+
bool stream);
7273

7374
bool
7475
write_backup_config_file();

extra/mariabackup/xtrabackup.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3982,7 +3982,7 @@ static bool xtrabackup_backup_low()
39823982
}
39833983
sprintf(filename, "%s/%s", xtrabackup_extra_lsndir,
39843984
XTRABACKUP_INFO);
3985-
if (!write_xtrabackup_info(mysql_connection, filename, false)) {
3985+
if (!write_xtrabackup_info(mysql_connection, filename, false, false)) {
39863986
msg("Error: failed to write info "
39873987
"to '%s'.", filename);
39883988
return false;

include/my_dbug.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ struct _db_stack_frame_ {
3535
};
3636

3737
struct _db_code_state_;
38-
extern MYSQL_PLUGIN_IMPORT my_bool my_assert;
3938
extern my_bool _dbug_on_;
4039
extern my_bool _db_keyword_(struct _db_code_state_ *, const char *, int);
4140
extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
@@ -59,6 +58,8 @@ extern void _db_dump_(uint _line_,const char *keyword,
5958
extern void _db_end_(void);
6059
extern void _db_lock_file_(void);
6160
extern void _db_unlock_file_(void);
61+
ATTRIBUTE_COLD
62+
extern my_bool _db_my_assert(const char *file, int line, const char *msg);
6263
extern FILE *_db_fp_(void);
6364
extern void _db_flush_(void);
6465
extern void dbug_swap_code_state(void **code_state_store);
@@ -104,10 +105,9 @@ extern int (*dbug_sanity)(void);
104105
#define DBUG_END() _db_end_ ()
105106
#define DBUG_LOCK_FILE _db_lock_file_()
106107
#define DBUG_UNLOCK_FILE _db_unlock_file_()
107-
#define DBUG_ASSERT(A) do { if (!(A)) { _db_flush_(); \
108-
if (my_assert) assert(A); \
109-
else fprintf(stderr, "%s:%d: assert: %s\n", __FILE__, __LINE__, #A); \
110-
}} while (0)
108+
#define DBUG_ASSERT(A) do { \
109+
if (unlikely(!(A)) && _db_my_assert(__FILE__, __LINE__, #A)) assert(A); \
110+
} while (0)
111111
#define DBUG_SLOW_ASSERT(A) DBUG_ASSERT(A)
112112
#define DBUG_ASSERT_EXISTS
113113
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))

include/my_sys.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ extern ulong my_sync_count;
266266
extern uint mysys_usage_id;
267267
extern int32 my_file_opened;
268268
extern my_bool my_init_done, my_thr_key_mysys_exists;
269-
extern MYSQL_PLUGIN_IMPORT my_bool my_assert;
269+
extern my_bool my_assert;
270270
extern my_bool my_assert_on_error;
271271
extern myf my_global_flags; /* Set to MY_WME for more error messages */
272272
/* Point to current my_message() */

0 commit comments

Comments
 (0)