Skip to content

Commit d73baa4

Browse files
committed
Merge 10.11 into 11.0
2 parents 125da46 + 4039d86 commit d73baa4

File tree

274 files changed

+6832
-3066
lines changed

Some content is hidden

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

274 files changed

+6832
-3066
lines changed

client/mysqldump.c

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,8 +1266,9 @@ static int get_options(int *argc, char ***argv)
12661266
if (opt_slave_data)
12671267
{
12681268
opt_lock_all_tables= !opt_single_transaction;
1269-
opt_master_data= 0;
12701269
opt_delete_master_logs= 0;
1270+
if (opt_slave_data != MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL)
1271+
opt_master_data= 0;
12711272
}
12721273

12731274
/* Ensure consistency of the set of binlog & locking options */
@@ -1280,10 +1281,7 @@ static int get_options(int *argc, char ***argv)
12801281
return(EX_USAGE);
12811282
}
12821283
if (opt_master_data)
1283-
{
12841284
opt_lock_all_tables= !opt_single_transaction;
1285-
opt_slave_data= 0;
1286-
}
12871285
if (opt_single_transaction || opt_lock_all_tables)
12881286
lock_tables= 0;
12891287
if (enclosed && opt_enclosed)
@@ -6220,17 +6218,12 @@ static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos,
62206218

62216219
}
62226220

6223-
/* SHOW MASTER STATUS reports file and position */
6224-
print_comment(md_result_file, 0,
6225-
"\n--\n-- Position to start replication or point-in-time "
6226-
"recovery from\n--\n\n");
6227-
fprintf(md_result_file,
6228-
"%sCHANGE MASTER TO MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n",
6229-
(use_gtid ? "-- " : comment_prefix), file, offset);
6221+
/* gtid */
62306222
if (have_mariadb_gtid)
62316223
{
62326224
print_comment(md_result_file, 0,
6233-
"\n--\n-- GTID to start replication from\n--\n\n");
6225+
"\n-- Preferably use GTID to start replication from GTID "
6226+
"position:\n\n");
62346227
if (use_gtid)
62356228
fprintf(md_result_file,
62366229
"%sCHANGE MASTER TO MASTER_USE_GTID=slave_pos;\n",
@@ -6239,6 +6232,19 @@ static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos,
62396232
"%sSET GLOBAL gtid_slave_pos='%s';\n",
62406233
(!use_gtid ? "-- " : comment_prefix), gtid_pos);
62416234
}
6235+
6236+
/* SHOW MASTER STATUS reports file and position */
6237+
print_comment(md_result_file, 0,
6238+
"\n--\n-- Alternately, following is the position of the binary "
6239+
"logging from SHOW MASTER STATUS at point of backup."
6240+
"\n-- Use this when creating a replica of the primary server "
6241+
"where the backup was made."
6242+
"\n-- The new server will be connecting to the primary server "
6243+
"where the backup was taken."
6244+
"\n--\n\n");
6245+
fprintf(md_result_file,
6246+
"%sCHANGE MASTER TO MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n",
6247+
(use_gtid ? "-- " : comment_prefix), file, offset);
62426248
check_io(md_result_file);
62436249

62446250
if (!consistent_binlog_pos)
@@ -6317,7 +6323,6 @@ static int do_show_slave_status(MYSQL *mysql_con, int use_gtid,
63176323
(opt_slave_data == MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL) ? "-- " : "";
63186324
const char *gtid_comment_prefix= (use_gtid ? comment_prefix : "-- ");
63196325
const char *nogtid_comment_prefix= (!use_gtid ? comment_prefix : "-- ");
6320-
int set_gtid_done= 0;
63216326

63226327
if (mysql_query_with_error_report(mysql_con, &slave,
63236328
multi_source ?
@@ -6333,23 +6338,36 @@ static int do_show_slave_status(MYSQL *mysql_con, int use_gtid,
63336338
return 1;
63346339
}
63356340

6336-
while ((row= mysql_fetch_row(slave)))
6341+
print_comment(md_result_file, 0,
6342+
"\n--\n-- The following is the SQL position of the replication "
6343+
"taken from SHOW SLAVE STATUS at the time of backup.\n"
6344+
"-- Use this position when creating a clone of, or replacement "
6345+
"server, from where the backup was taken."
6346+
"\n-- This new server will connects to the same primary "
6347+
"server%s.\n--\n",
6348+
multi_source ? "(s)" : "");
6349+
6350+
if (multi_source)
63376351
{
6338-
if (multi_source && !set_gtid_done)
6352+
char gtid_pos[MAX_GTID_LENGTH];
6353+
if (have_mariadb_gtid && get_gtid_pos(gtid_pos, 0))
63396354
{
6340-
char gtid_pos[MAX_GTID_LENGTH];
6341-
if (have_mariadb_gtid && get_gtid_pos(gtid_pos, 0))
6342-
{
6343-
mysql_free_result(slave);
6344-
return 1;
6345-
}
6346-
if (opt_comments)
6347-
fprintf(md_result_file, "\n--\n-- Gtid position to start replication "
6348-
"from\n--\n\n");
6349-
fprintf(md_result_file, "%sSET GLOBAL gtid_slave_pos='%s';\n",
6350-
gtid_comment_prefix, gtid_pos);
6351-
set_gtid_done= 1;
6355+
mysql_free_result(slave);
6356+
return 1;
63526357
}
6358+
print_comment(md_result_file, 0,
6359+
"-- GTID position to start replication:\n");
6360+
fprintf(md_result_file, "%sSET GLOBAL gtid_slave_pos='%s';\n",
6361+
gtid_comment_prefix, gtid_pos);
6362+
}
6363+
if (use_gtid)
6364+
print_comment(md_result_file, 0,
6365+
"\n-- Use only the MASTER_USE_GTID=slave_pos or "
6366+
"MASTER_LOG_FILE/MASTER_LOG_POS in the statements below."
6367+
"\n\n");
6368+
6369+
while ((row= mysql_fetch_row(slave)))
6370+
{
63536371
if (row[9 + multi_source] && row[21 + multi_source])
63546372
{
63556373
if (use_gtid)
@@ -6363,11 +6381,6 @@ static int do_show_slave_status(MYSQL *mysql_con, int use_gtid,
63636381
}
63646382

63656383
/* SHOW MASTER STATUS reports file and position */
6366-
if (opt_comments)
6367-
fprintf(md_result_file,
6368-
"\n--\n-- Position to start replication or point-in-time "
6369-
"recovery from (the master of this slave)\n--\n\n");
6370-
63716384
if (multi_source)
63726385
fprintf(md_result_file, "%sCHANGE MASTER '%.80s' TO ",
63736386
nogtid_comment_prefix, row[0]);
@@ -6388,6 +6401,7 @@ static int do_show_slave_status(MYSQL *mysql_con, int use_gtid,
63886401
check_io(md_result_file);
63896402
}
63906403
}
6404+
fprintf(md_result_file, "\n");
63916405
mysql_free_result(slave);
63926406
return 0;
63936407
}

cmake/pcre.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ SET(WITH_PCRE "auto" CACHE STRING
44
"Which pcre to use (possible values are 'bundled', 'system', or 'auto')")
55

66
MACRO(BUNDLE_PCRE2)
7+
SET(WITH_PCRE "bundled" CACHE STRING
8+
"Which pcre to use (possible values are 'bundled', 'system', or 'auto')")
9+
710
SET(dir "${CMAKE_BINARY_DIR}/extra/pcre2")
811
SET(PCRE_INCLUDE_DIRS ${dir}/src/pcre2-build ${dir}/src/pcre2/src)
912
MESSAGE(STATUS "Will download and bundle pcre2")

debian/autobake-deb.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ then
3232
# build is not running on Gitlab-CI.
3333
sed '/-DPLUGIN_COLUMNSTORE=NO/d' -i debian/rules
3434
# Take the files and part of control from MCS directory
35-
if [ ! -f debian/mariadb-plugin-columnstore.install ]
36-
then
37-
cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/
38-
echo >> debian/control
39-
sed "s/-10.6//" <storage/columnstore/columnstore/debian/control >> debian/control
40-
fi
35+
cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/
36+
# idempotent, except for the blank line, but that can be tolerated.
37+
sed -e '/Package: mariadb-plugin-columnstore/,/^$/d' -i debian/control
38+
echo >> debian/control
39+
sed "s/-10.6//" <storage/columnstore/columnstore/debian/control >> debian/control
4140
fi
4241

4342
# Look up distro-version specific stuff

debian/mariadb-server.install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ usr/share/man/man1/myisam_ftdump.1
7070
usr/share/man/man1/myisamchk.1
7171
usr/share/man/man1/myisamlog.1
7272
usr/share/man/man1/myisampack.1
73+
usr/share/man/man1/wsrep_sst_backup.1
7374
usr/share/man/man1/wsrep_sst_common.1
7475
usr/share/man/man1/wsrep_sst_mariabackup.1
7576
usr/share/man/man1/wsrep_sst_mysqldump.1

debian/mariadb-server.mariadb.init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ sanity_checks() {
8888
# If datadir location is not changed int configuration
8989
# then it's not printed with /usr/sbin/mariadbd --print-defaults
9090
# then we use 'sane' default.
91-
if [ -z "$datadir"]
91+
if [ -z "$datadir" ]
9292
then
9393
datadir="/var/lib/mysql"
9494
fi

debian/rules

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ endif
9898
-DCOMPILATION_COMMENT="mariadb.org binary distribution" \
9999
-DMYSQL_SERVER_SUFFIX="-$(DEB_VERSION_REVISION)" \
100100
-DSYSTEM_TYPE="debian-$(DEB_HOST_GNU_SYSTEM)" \
101-
-DCMAKE_SYSTEM_PROCESSOR=$(DEB_HOST_ARCH) \
102101
-DBUILD_CONFIG=mysql_release \
103102
-DCONC_DEFAULT_CHARSET=utf8mb4 \
104103
-DPLUGIN_AWS_KEY_MANAGEMENT=NO \

extra/mariabackup/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ ENDIF()
5656
MYSQL_ADD_EXECUTABLE(mariadb-backup
5757
xtrabackup.cc
5858
innobackupex.cc
59-
changed_page_bitmap.cc
6059
datasink.cc
6160
ds_buffer.cc
6261
ds_compress.cc

extra/mariabackup/backup_mysql.cc

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
4747
#include <stdlib.h>
4848
#include <string.h>
4949
#include <limits>
50+
#ifdef HAVE_PWD_H
51+
#ifdef HAVE_SYS_TYPES_H
52+
#include <sys/types.h>
53+
#endif
54+
#include <pwd.h>
55+
#endif
5056
#include "common.h"
5157
#include "xtrabackup.h"
5258
#include "srv0srv.h"
@@ -65,7 +71,6 @@ char tool_args[2048];
6571
ulong mysql_server_version;
6672

6773
/* server capabilities */
68-
bool have_changed_page_bitmaps = false;
6974
bool have_backup_locks = false;
7075
bool have_lock_wait_timeout = false;
7176
bool have_galera_enabled = false;
@@ -92,11 +97,54 @@ MYSQL *mysql_connection;
9297

9398
extern my_bool opt_ssl_verify_server_cert, opt_use_ssl;
9499

100+
101+
/*
102+
get_os_user()
103+
Ressemles read_user_name() from libmariadb/libmariadb/mariadb_lib.c.
104+
*/
105+
106+
#if !defined(_WIN32)
107+
108+
#if defined(HAVE_GETPWUID) && defined(NO_GETPWUID_DECL)
109+
struct passwd *getpwuid(uid_t);
110+
char* getlogin(void);
111+
#endif
112+
113+
static const char *get_os_user() // Posix
114+
{
115+
if (!geteuid())
116+
return "root";
117+
#ifdef HAVE_GETPWUID
118+
struct passwd *pw;
119+
const char *str;
120+
if ((pw= getpwuid(geteuid())) != NULL)
121+
return pw->pw_name;
122+
if ((str= getlogin()) != NULL)
123+
return str;
124+
#endif
125+
if ((str= getenv("USER")) ||
126+
(str= getenv("LOGNAME")) ||
127+
(str= getenv("LOGIN")))
128+
return str;
129+
return NULL;
130+
}
131+
132+
#else
133+
134+
static const char *get_os_user() // Windows
135+
{
136+
return getenv("USERNAME");
137+
}
138+
139+
#endif // _WIN32
140+
141+
95142
MYSQL *
96143
xb_mysql_connect()
97144
{
98145
MYSQL *connection = mysql_init(NULL);
99146
char mysql_port_str[std::numeric_limits<int>::digits10 + 3];
147+
const char *user= opt_user ? opt_user : get_os_user();
100148

101149
sprintf(mysql_port_str, "%d", opt_port);
102150

@@ -126,7 +174,7 @@ xb_mysql_connect()
126174

127175
msg("Connecting to MariaDB server host: %s, user: %s, password: %s, "
128176
"port: %s, socket: %s", opt_host ? opt_host : "localhost",
129-
opt_user ? opt_user : "not set",
177+
user ? user : "not set",
130178
opt_password ? "set" : "not set",
131179
opt_port != 0 ? mysql_port_str : "not set",
132180
opt_socket ? opt_socket : "not set");
@@ -147,7 +195,7 @@ xb_mysql_connect()
147195

148196
if (!mysql_real_connect(connection,
149197
opt_host ? opt_host : "localhost",
150-
opt_user,
198+
user,
151199
opt_password,
152200
"" /*database*/, opt_port,
153201
opt_socket, 0)) {
@@ -512,24 +560,6 @@ Query the server to find out what backup capabilities it supports.
512560
bool
513561
detect_mysql_capabilities_for_backup()
514562
{
515-
const char *query = "SELECT 'INNODB_CHANGED_PAGES', COUNT(*) FROM "
516-
"INFORMATION_SCHEMA.PLUGINS "
517-
"WHERE PLUGIN_NAME LIKE 'INNODB_CHANGED_PAGES'";
518-
char *innodb_changed_pages = NULL;
519-
mysql_variable vars[] = {
520-
{"INNODB_CHANGED_PAGES", &innodb_changed_pages}, {NULL, NULL}};
521-
522-
if (xtrabackup_incremental) {
523-
524-
read_mysql_variables(mysql_connection, query, vars, true);
525-
526-
ut_ad(innodb_changed_pages != NULL);
527-
528-
have_changed_page_bitmaps = (atoi(innodb_changed_pages) == 1);
529-
530-
free_mysql_variables(vars);
531-
}
532-
533563
/* do some sanity checks */
534564
if (opt_galera_info && !have_galera_enabled) {
535565
msg("--galera-info is specified on the command "
@@ -1882,18 +1912,6 @@ select_history()
18821912
return(true);
18831913
}
18841914

1885-
bool
1886-
flush_changed_page_bitmaps()
1887-
{
1888-
if (xtrabackup_incremental && have_changed_page_bitmaps &&
1889-
!xtrabackup_incremental_force_scan) {
1890-
xb_mysql_query(mysql_connection,
1891-
"FLUSH NO_WRITE_TO_BINLOG CHANGED_PAGE_BITMAPS", false);
1892-
}
1893-
return(true);
1894-
}
1895-
1896-
18971915
/*********************************************************************//**
18981916
Deallocate memory, disconnect from server, etc.
18991917
@return true on success. */

extra/mariabackup/backup_mysql.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
extern ulong mysql_server_version;
88

99
/* server capabilities */
10-
extern bool have_changed_page_bitmaps;
1110
extern bool have_backup_locks;
1211
extern bool have_lock_wait_timeout;
1312
extern bool have_galera_enabled;
@@ -35,9 +34,6 @@ capture_tool_command(int argc, char **argv);
3534
bool
3635
select_history();
3736

38-
bool
39-
flush_changed_page_bitmaps();
40-
4137
void
4238
backup_cleanup();
4339

0 commit comments

Comments
 (0)