Skip to content

Commit

Permalink
Merge bb-10.2-ext into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Nov 30, 2017
2 parents 51b3058 + 5b697c5 commit 7cb3520
Show file tree
Hide file tree
Showing 2,034 changed files with 179,789 additions and 110,318 deletions.
5 changes: 3 additions & 2 deletions client/mysqlbinlog.cc
Expand Up @@ -2955,10 +2955,11 @@ int main(int argc, char** argv)

if (!argc || opt_version)
{
if (!argc)
usage();
if (!opt_version)
{
usage();
retval= ERROR_STOP;
}
goto err;
}

Expand Down
3 changes: 2 additions & 1 deletion cmake/dtrace.cmake
Expand Up @@ -42,7 +42,8 @@ MACRO(CHECK_DTRACE)
# On FreeBSD, dtrace does not handle userland tracing yet
IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
AND NOT BUGGY_GCC_NO_DTRACE_MODULES
AND NOT BUGGY_LINUX_DTRACE)
AND NOT BUGGY_LINUX_DTRACE
AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")
SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace")
ENDIF()
SET(HAVE_DTRACE ${ENABLE_DTRACE})
Expand Down
2 changes: 1 addition & 1 deletion cmake/wsrep.cmake
Expand Up @@ -26,7 +26,7 @@ ENDIF()
OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})

# Set the patch version
SET(WSREP_PATCH_VERSION "20")
SET(WSREP_PATCH_VERSION "21")

# Obtain wsrep API version
FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION
Expand Down
13 changes: 6 additions & 7 deletions extra/mariabackup/backup_copy.cc
Expand Up @@ -252,9 +252,8 @@ datadir_iter_next_database(datadir_iter_t *it)
it->dbpath = static_cast<char*>(
malloc(it->dbpath_len));
}
ut_snprintf(it->dbpath, it->dbpath_len,
"%s/%s", it->datadir_path,
it->dbinfo.name);
snprintf(it->dbpath, it->dbpath_len, "%s/%s",
it->datadir_path, it->dbinfo.name);
os_normalize_path(it->dbpath);

if (it->dbinfo.type == OS_FILE_TYPE_FILE) {
Expand Down Expand Up @@ -1034,8 +1033,8 @@ move_file(ds_ctxt_t *datasink,
char dst_dir_abs[FN_REFLEN];
size_t dirname_length;

ut_snprintf(dst_file_path_abs, sizeof(dst_file_path_abs),
"%s/%s", dst_dir, dst_file_path);
snprintf(dst_file_path_abs, sizeof(dst_file_path_abs),
"%s/%s", dst_dir, dst_file_path);

dirname_part(dst_dir_abs, dst_file_path_abs, &dirname_length);

Expand Down Expand Up @@ -1252,8 +1251,8 @@ backup_files(const char *from, bool prep_mode)
} else if (!prep_mode) {
/* backup fake file into empty directory */
char path[FN_REFLEN];
ut_snprintf(path, sizeof(path),
"%s/db.opt", node.filepath);
snprintf(path, sizeof(path),
"%s/db.opt", node.filepath);
if (!(ret = backup_file_printf(
trim_dotslash(path), "%s", ""))) {
msg("Failed to create file %s\n", path);
Expand Down
14 changes: 7 additions & 7 deletions extra/mariabackup/backup_mysql.cc
Expand Up @@ -589,7 +589,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
mysql_real_escape_string(mysql_connection, buf,
opt_incremental_history_name,
(unsigned long)strlen(opt_incremental_history_name));
ut_snprintf(query, sizeof(query),
snprintf(query, sizeof(query),
"SELECT innodb_to_lsn "
"FROM PERCONA_SCHEMA.xtrabackup_history "
"WHERE name = '%s' "
Expand All @@ -602,7 +602,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
mysql_real_escape_string(mysql_connection, buf,
opt_incremental_history_uuid,
(unsigned long)strlen(opt_incremental_history_uuid));
ut_snprintf(query, sizeof(query),
snprintf(query, sizeof(query),
"SELECT innodb_to_lsn "
"FROM PERCONA_SCHEMA.xtrabackup_history "
"WHERE uuid = '%s' "
Expand Down Expand Up @@ -766,7 +766,7 @@ kill_long_queries(MYSQL *connection, time_t timeout)
is_select_query(info))) {
msg_ts("Killing query %s (duration %d sec): %s\n",
id, (int)duration, info);
ut_snprintf(kill_stmt, sizeof(kill_stmt),
snprintf(kill_stmt, sizeof(kill_stmt),
"KILL %s", id);
xb_mysql_query(connection, kill_stmt, false, false);
}
Expand Down Expand Up @@ -1288,8 +1288,8 @@ write_current_binlog_file(MYSQL *connection)
goto cleanup;
}

ut_snprintf(filepath, sizeof(filepath), "%s%c%s",
log_bin_dir, FN_LIBCHAR, log_bin_file);
snprintf(filepath, sizeof(filepath), "%s%c%s",
log_bin_dir, FN_LIBCHAR, log_bin_file);
result = copy_file(ds_data, filepath, log_bin_file, 0);
}

Expand Down Expand Up @@ -1574,8 +1574,8 @@ char *make_argv(char *buf, size_t len, int argc, char **argv)
if (strncmp(*argv, "--password", strlen("--password")) == 0) {
arg = "--password=...";
}
left-= ut_snprintf(buf + len - left, left,
"%s%c", arg, argc > 1 ? ' ' : 0);
left-= snprintf(buf + len - left, left,
"%s%c", arg, argc > 1 ? ' ' : 0);
++argv; --argc;
}

Expand Down
2 changes: 1 addition & 1 deletion extra/mariabackup/changed_page_bitmap.cc
Expand Up @@ -441,7 +441,7 @@ log_online_open_bitmap_file_read_only(

xb_ad(name[0] != '\0');

ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name);
snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name);
bitmap_file->file = os_file_create_simple_no_error_handling(
0, bitmap_file->name,
OS_FILE_OPEN, OS_FILE_READ_ONLY, true, &success);
Expand Down
2 changes: 1 addition & 1 deletion extra/mariabackup/crc/crc_glue.c
Expand Up @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <string.h>
#include <zlib.h>

#if __GNUC__ >= 4 && defined(__x86_64__)
#if defined(__GNUC__) && defined(__x86_64__)
static int pclmul_enabled = 0;
#endif

Expand Down
19 changes: 1 addition & 18 deletions extra/mariabackup/fil_cur.cc
Expand Up @@ -212,24 +212,7 @@ xb_fil_cur_open(

posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);

/* Determine the page size */
ulint flags = xb_get_space_flags(cursor->file);
if (flags == ULINT_UNDEFINED) {
xb_fil_cur_close(cursor);
return(XB_FIL_CUR_SKIP);
}

if (!fsp_flags_is_valid(flags, cursor->space_id)) {
ulint cflags = fsp_flags_convert_from_101(flags);
if (cflags == ULINT_UNDEFINED) {
msg("[%02u] mariabackup: Error: Invalid "
"tablespace flags: %x.\n", thread_n, uint(flags));
return(XB_FIL_CUR_SKIP);
}
flags = cflags;
}

const page_size_t page_size(flags);
const page_size_t page_size(cursor->node->space->flags);
cursor->page_size = page_size;

/* Allocate read buffer */
Expand Down
21 changes: 12 additions & 9 deletions extra/mariabackup/write_filt.cc
Expand Up @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include "write_filt.h"
#include "fil_cur.h"
#include "xtrabackup.h"
#include <os0proc.h>

/************************************************************************
Write-through page write filter. */
Expand Down Expand Up @@ -68,19 +69,22 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
xb_fil_cur_t *cursor)
{
char meta_name[FN_REFLEN];
ulint buf_size;
xb_wf_incremental_ctxt_t *cp =
&(ctxt->u.wf_incremental_ctxt);

ctxt->cursor = cursor;

/* allocate buffer for incremental backup (4096 pages) */
buf_size = (cursor->page_size.physical() / 4 + 1)
* cursor->page_size.physical();
cp->delta_buf_base = static_cast<byte *>(malloc(buf_size));
memset(cp->delta_buf_base, 0, buf_size);
cp->delta_buf = static_cast<byte *>
(ut_align(cp->delta_buf_base, cursor->page_size.physical()));
cp->delta_buf_size = (cursor->page_size.physical() / 4)
* cursor->page_size.physical();
cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size);

if (!cp->delta_buf) {
msg("[%02u] mariabackup: Error: "
"cannot allocate %zu bytes\n",
cursor->thread_n, (size_t) cp->delta_buf_size);
return (FALSE);
}

/* write delta meta info */
snprintf(meta_name, sizeof(meta_name), "%s%s", dst_name,
Expand Down Expand Up @@ -184,8 +188,7 @@ static void
wf_incremental_deinit(xb_write_filt_ctxt_t *ctxt)
{
xb_wf_incremental_ctxt_t *cp = &(ctxt->u.wf_incremental_ctxt);

free(cp->delta_buf_base);
os_mem_free_large(cp->delta_buf, cp->delta_buf_size);
}

/************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion extra/mariabackup/write_filt.h
Expand Up @@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

/* Incremental page filter context */
typedef struct {
byte *delta_buf_base;
ulint delta_buf_size;
byte *delta_buf;
ulint npages;
} xb_wf_incremental_ctxt_t;
Expand Down
61 changes: 29 additions & 32 deletions extra/mariabackup/xtrabackup.cc
Expand Up @@ -2135,28 +2135,6 @@ check_if_skip_table(
return(FALSE);
}

/** @return the tablespace flags from a given data file
@retval ULINT_UNDEFINED if the file is not readable */
ulint xb_get_space_flags(pfs_os_file_t file)
{
byte *buf;
byte *page;
ulint flags;

buf = static_cast<byte *>(malloc(2 * UNIV_PAGE_SIZE));
page = static_cast<byte *>(ut_align(buf, UNIV_PAGE_SIZE));

if (os_file_read(IORequestRead, file, page, 0, UNIV_PAGE_SIZE)) {
flags = fsp_header_get_flags(page);
} else {
flags = ULINT_UNDEFINED;
}

free(buf);

return(flags);
}

const char*
xb_get_copy_action(const char *dflt)
{
Expand Down Expand Up @@ -2683,10 +2661,10 @@ xb_load_single_table_tablespace(
name = static_cast<char*>(ut_malloc_nokey(pathlen));

if (dirname != NULL) {
ut_snprintf(name, pathlen, "%s/%s", dirname, filname);
snprintf(name, pathlen, "%s/%s", dirname, filname);
name[pathlen - 5] = 0;
} else {
ut_snprintf(name, pathlen, "%s", filname);
snprintf(name, pathlen, "%s", filname);
name[pathlen - 5] = 0;
}

Expand Down Expand Up @@ -2804,8 +2782,8 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)

dbpath = static_cast<char*>(ut_malloc_nokey(dbpath_len));
}
ut_snprintf(dbpath, dbpath_len,
"%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
snprintf(dbpath, dbpath_len,
"%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
os_normalize_path(dbpath);

if (check_if_skip_database_by_path(dbpath)) {
Expand Down Expand Up @@ -4311,12 +4289,12 @@ xtrabackup_apply_delta(

page_size = info.page_size.physical();
page_size_shift = get_bit_shift(page_size);
msg("mariabackup: page size for %s is %lu bytes\n",
msg("mariabackup: page size for %s is %zu bytes\n",
src_path, page_size);
if (page_size_shift < 10 ||
page_size_shift > UNIV_PAGE_SIZE_SHIFT_MAX) {
msg("mariabackup: error: invalid value of page_size "
"(%lu bytes) read from %s\n", page_size, meta_path);
"(%zu bytes) read from %s\n", page_size, meta_path);
goto error;
}

Expand Down Expand Up @@ -4418,10 +4396,29 @@ xtrabackup_apply_delta(
if (off == 0) {
/* Read tablespace size from page 0,
and extend the file to specified size.*/
os_offset_t n_pages = mach_read_from_4(buf + FSP_HEADER_OFFSET + FSP_SIZE);
success = os_file_set_size(dst_path, dst_file, n_pages*page_size);
if (!success)
goto error;
os_offset_t n_pages = mach_read_from_4(
buf + FSP_HEADER_OFFSET + FSP_SIZE);
if (mach_read_from_4(buf
+ FIL_PAGE_SPACE_ID)) {
if (!os_file_set_size(
dst_path, dst_file,
n_pages * page_size))
goto error;
} else if (fil_space_t* space
= fil_space_acquire(0)) {
/* The system tablespace can
consist of multiple files. The
first one has full tablespace
size in page 0, but only the last
file should be extended. */
fil_node_t* n = UT_LIST_GET_FIRST(
space->chain);
bool fail = !strcmp(n->name, dst_path)
&& !fil_space_extend(
space, (ulint)n_pages);
fil_space_release(space);
if (fail) goto error;
}
}

success = os_file_write(IORequestWrite,
Expand Down
4 changes: 0 additions & 4 deletions extra/mariabackup/xtrabackup.h
Expand Up @@ -149,10 +149,6 @@ void xtrabackup_io_throttling(void);
my_bool xb_write_delta_metadata(const char *filename,
const xb_delta_info_t *info);

/** @return the tablespace flags from a given data file
@retval ULINT_UNDEFINED if the file is not readable */
ulint xb_get_space_flags(pfs_os_file_t file);

/************************************************************************
Checks if a table specified as a name in the form "database/name" (InnoDB 5.6)
or "./database/name.ibd" (InnoDB 5.5-) should be skipped from backup based on
Expand Down
2 changes: 1 addition & 1 deletion libmariadb
5 changes: 0 additions & 5 deletions mysql-test/include/have_debug.inc
Expand Up @@ -2,8 +2,3 @@
# suite.pm will make sure that all tests including this file
# will be skipped unless this is a debug build.
#
# The test below is redundant

if (`select version() not like '%debug%'`) {
--skip Needs a debug build
}
14 changes: 2 additions & 12 deletions mysql-test/include/have_example_plugin.inc
@@ -1,14 +1,4 @@
#
# Check if server has support for loading plugins
# suite.pm will make sure that all tests including this file
# will be skipped unless dynamic ha_example plugin is available
#
if (`SELECT @@have_dynamic_loading != 'YES'`) {
--skip Example plugin requires dynamic loading
}

#
# Check if the variable EXAMPLE_PLUGIN is set
#
if (!$HA_EXAMPLE_SO) {
--skip Need example plugin
}

6 changes: 0 additions & 6 deletions mysql-test/include/have_innodb.inc
Expand Up @@ -2,9 +2,3 @@
# suite.pm will make sure that all tests including this file
# will be skipped unless innodb is enabled
#
# The test below is redundant

if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
{
--skip Test requires InnoDB.
}
6 changes: 0 additions & 6 deletions mysql-test/include/not_embedded.inc
Expand Up @@ -2,9 +2,3 @@
# suite.pm will make sure that all tests including this file
# will be skipped unless this is an embedded test run
#
# The test below is redundant

if (`select version() like '%embedded%'`) {
This should never happen;
}

8 changes: 4 additions & 4 deletions mysql-test/include/not_windows.inc
@@ -1,4 +1,4 @@
--require r/not_windows.require
disable_query_log;
select convert(@@version_compile_os using latin1) NOT IN ("Win32","Win64","Windows") as "TRUE";
enable_query_log;
#
# suite.pm will make sure that all tests including this file
# will be skipped unless this is on Windows
#

0 comments on commit 7cb3520

Please sign in to comment.