Skip to content

Commit

Permalink
Merge branch '10.2' into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Sep 28, 2018
2 parents 7aba6f8 + dcbd51c commit 57e0da5
Show file tree
Hide file tree
Showing 436 changed files with 9,692 additions and 196,647 deletions.
4 changes: 3 additions & 1 deletion CREDITS
Expand Up @@ -10,9 +10,11 @@ Microsoft https://microsoft.com/ (2017)
Tencent Cloud https://cloud.tencent.com (2017)
Development Bank of Singapore https://dbs.com (2016)
IBM https://www.ibm.com (2017)
Tencent Games http://game.qq.com/ (2018)
Visma https://visma.com (2015)
Acronis http://acronis.com (2016)
Acronis https://acronis.com (2016)
Nexedi https://www.nexedi.com (2016)
Percona https://www.percona.com (2018)
Tencent Game DBA http://tencentdba.com/about (2016)
Tencent TDSQL http://tdsql.org (2016)
Verkkokauppa.com https://www.verkkokauppa.com (2015)
Expand Down
34 changes: 33 additions & 1 deletion cmake/CPackRPM.cmake
Expand Up @@ -2,6 +2,11 @@
# Wrapper for CPackRPM.cmake
#

#
# Support for per-component LICENSE and VENDOR
#
# per component values, if present, are copied into global CPACK_RPM_PACKAGE_xxx
#
macro(set_from_component WHAT)
set(orig_CPACK_RPM_PACKAGE_${WHAT} ${CPACK_RPM_PACKAGE_${WHAT}})
if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT})
Expand All @@ -15,6 +20,33 @@ endmacro()
set_from_component(LICENSE)
set_from_component(VENDOR)

#
# Support for the %posttrans scriptlet
#
# the scriptlet, if present, is appended (together with the %posttrans tag)
# to the pre-uninstall scriptlet
#
set(base_time "PRE")
set(base_type "UNINSTALL")
set(base_var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}_SCRIPT_FILE)
set(acc)

macro(read_one_file time_ type_ tag_)
set(var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${time_}_${type_}_SCRIPT_FILE)
if (${var})
file(READ ${${var}} content)
set(acc "${tag_}\n${content}\n\n${acc}")
endif()
endmacro()

read_one_file("POST" "TRANS" "%posttrans")
if (acc)
set(orig_${base_var} ${${base_var}})
read_one_file(${base_time} ${base_type} "")
set(${base_var} ${CPACK_TOPLEVEL_DIRECTORY}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}.scriptlet)
file(WRITE ${${base_var}} "${acc}")
endif()

# load the original CPackRPM.cmake
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
unset(CMAKE_MODULE_PATH)
Expand All @@ -23,10 +55,10 @@ set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})

restore(LICENSE)
restore(VENDOR)
set(${base_var} ${orig_${base_var}})

# per-component cleanup
foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV)
unset(TMP_RPM_${_RPM_SPEC_HEADER})
unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP)
endforeach()

3 changes: 3 additions & 0 deletions cmake/cpack_rpm.cmake
Expand Up @@ -81,6 +81,8 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "
%define _bindir ${INSTALL_BINDIRABS}
%define _sbindir ${INSTALL_SBINDIRABS}
%define _sysconfdir ${INSTALL_SYSCONFDIR}
%define restart_flag_dir %{_localstatedir}/lib/rpm-state/mariadb
%define restart_flag %{restart_flag_dir}/need-restart
")

# this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html
Expand Down Expand Up @@ -174,6 +176,7 @@ SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/r
SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh)
SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh)
SET(CPACK_RPM_server_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postun.sh)
SET(CPACK_RPM_server_POST_TRANS_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-posttrans.sh)
SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
SET(CPACK_RPM_compat_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
Expand Down
23 changes: 7 additions & 16 deletions cmake/install_macros.cmake
Expand Up @@ -33,26 +33,17 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS)
SET(targets ${ARG_UNPARSED_ARGUMENTS})
FOREACH(target ${targets})
GET_TARGET_PROPERTY(target_type ${target} TYPE)

IF(target_type MATCHES "STATIC")
RETURN()
ENDIF()
set(comp "")

IF(target MATCHES "mysqld" OR type MATCHES "MODULE")
#MESSAGE("PDB: ${targets}")

IF((target STREQUAL "mysqld"))
SET(comp Server)
ENDIF()

IF(NOT comp MATCHES Server)
IF(ARG_COMPONENT MATCHES Development
OR ARG_COMPONENT MATCHES SharedLibraries
OR ARG_COMPONENT MATCHES Embedded)
SET(comp Debuginfo)
ENDIF()
ENDIF()

IF(NOT comp)
SET(comp Debuginfo_archive_only) # not in MSI
ENDIF()
IF(NOT target_type MATCHES "STATIC")
INSTALL(FILES $<TARGET_PDB_FILE:${target}> DESTINATION symbols COMPONENT Debuginfo)
IF(comp)
INSTALL(FILES $<TARGET_PDB_FILE:${target}> DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp})
ENDIF()
ENDFOREACH()
Expand Down
4 changes: 3 additions & 1 deletion cmake/plugin.cmake
Expand Up @@ -238,11 +238,13 @@ MACRO(MYSQL_ADD_PLUGIN)
SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} PARENT_SCOPE)
IF(NOT ARG_CLIENT AND UNIX)
IF (NOT ARG_CONFIG)
SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${target}.cnf")
SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.cnf")
FILE(WRITE ${ARG_CONFIG} "[mariadb]\nplugin-load-add=${ARG_MODULE_OUTPUT_NAME}.so\n")
ENDIF()
INSTALL(FILES ${ARG_CONFIG} COMPONENT ${ARG_COMPONENT} DESTINATION ${INSTALL_SYSCONF2DIR})
SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*" PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/plugin-postin.sh PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_POST_TRANS_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-posttrans.sh PARENT_SCOPE)
ENDIF()
ENDIF()
ELSE()
Expand Down
8 changes: 2 additions & 6 deletions config.h.cmake
Expand Up @@ -559,12 +559,8 @@
#cmakedefine WSREP_PROC_INFO 1
#endif

#ifdef _AIX
/*
AIX includes inttypes.h from sys/types.h
Explicitly request format macros before the first inclusion of inttypes.h
*/
#if !defined(__STDC_FORMAT_MACROS)
#define __STDC_FORMAT_MACROS
#endif
#endif // !defined(__STDC_FORMAT_MACROS)

#endif
41 changes: 20 additions & 21 deletions extra/mariabackup/backup_copy.cc
Expand Up @@ -123,7 +123,7 @@ struct datadir_thread_ctxt_t {
datadir_iter_t *it;
uint n_thread;
uint *count;
pthread_mutex_t count_mutex;
pthread_mutex_t* count_mutex;
os_thread_id_t id;
bool ret;
};
Expand Down Expand Up @@ -961,7 +961,7 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n)
data_threads[i].it = it;
data_threads[i].n_thread = i + 1;
data_threads[i].count = &count;
data_threads[i].count_mutex = count_mutex;
data_threads[i].count_mutex = &count_mutex;
os_thread_create(func, data_threads + i, &data_threads[i].id);
}

Expand Down Expand Up @@ -1347,7 +1347,8 @@ backup_files(const char *from, bool prep_mode)
if (rsync_tmpfile == NULL) {
msg("Error: can't open file %s\n",
rsync_tmpfile_name);
return(false);
ret = false;
goto out;
}

while (fgets(path, sizeof(path), rsync_tmpfile)) {
Expand Down Expand Up @@ -1386,24 +1387,22 @@ backup_files(const char *from, bool prep_mode)

void backup_fix_ddl(void);

#define LSN_PREFIX_IN_SHOW_STATUS "\nLog sequence number "
static lsn_t get_current_lsn(MYSQL *connection) {
MYSQL_RES *res = xb_mysql_query(connection, "SHOW ENGINE INNODB STATUS", true, false);
if (!res)
return 0;
MYSQL_ROW row = mysql_fetch_row(res);
DBUG_ASSERT(row);
if (row) {
const char *p = strstr(row[2],LSN_PREFIX_IN_SHOW_STATUS);
DBUG_ASSERT(p);
if (p)
{
p += sizeof(LSN_PREFIX_IN_SHOW_STATUS) - 1;
return (lsn_t)strtoll(p, NULL, 10);
static lsn_t get_current_lsn(MYSQL *connection)
{
static const char lsn_prefix[] = "\nLog sequence number ";
lsn_t lsn = 0;
if (MYSQL_RES *res = xb_mysql_query(connection,
"SHOW ENGINE INNODB STATUS",
true, false)) {
if (MYSQL_ROW row = mysql_fetch_row(res)) {
if (const char *p = strstr(row[2], lsn_prefix)) {
p += sizeof lsn_prefix - 1;
lsn = lsn_t(strtoll(p, NULL, 10));
}
}
mysql_free_result(res);
}
mysql_free_result(res);
return 0;
return lsn;
}

lsn_t server_lsn_after_lock;
Expand Down Expand Up @@ -2038,9 +2037,9 @@ decrypt_decompress_thread_func(void *arg)

datadir_node_free(&node);

pthread_mutex_lock(&ctxt->count_mutex);
pthread_mutex_lock(ctxt->count_mutex);
--(*ctxt->count);
pthread_mutex_unlock(&ctxt->count_mutex);
pthread_mutex_unlock(ctxt->count_mutex);

ctxt->ret = ret;

Expand Down
1 change: 1 addition & 0 deletions extra/mariabackup/backup_mysql.cc
Expand Up @@ -917,6 +917,7 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *))
exit(EXIT_FAILURE);
}
}
mysql_free_result(result);
}

mysql_close(mysql);
Expand Down
66 changes: 33 additions & 33 deletions extra/mariabackup/fil_cur.cc
Expand Up @@ -343,39 +343,39 @@ xb_fil_cur_read(
page += page_size, i++) {
ulint page_no = cursor->buf_page_no + i;

if (cursor->space_id == TRX_SYS_SPACE &&
page_no >= FSP_EXTENT_SIZE &&
page_no < FSP_EXTENT_SIZE * 3) {
/* We ignore the doublewrite buffer pages */
} else if (!fil_space_verify_crypt_checksum(
page, cursor->page_size, space->id, page_no)
&& buf_page_is_corrupted(true, page,
cursor->page_size,
space)) {
retry_count--;
if (retry_count == 0) {
msg("[%02u] mariabackup: "
"Error: failed to read page after "
"10 retries. File %s seems to be "
"corrupted.\n", cursor->thread_n,
cursor->abs_path);
ret = XB_FIL_CUR_ERROR;
break;
}

if (retry_count == 9) {
msg("[%02u] mariabackup: "
"Database page corruption detected at page "
ULINTPF ", retrying...\n",
cursor->thread_n, page_no);
}

os_thread_sleep(100000);

goto read_retry;
}
cursor->buf_read += page_size;
cursor->buf_npages++;
if (cursor->space_id == TRX_SYS_SPACE &&
page_no >= FSP_EXTENT_SIZE &&
page_no < FSP_EXTENT_SIZE * 3) {
/* We ignore the doublewrite buffer pages */
} else if (!fil_space_verify_crypt_checksum(
page, cursor->page_size, space->id, page_no)
&& buf_page_is_corrupted(true, page,
cursor->page_size,
space)) {
retry_count--;
if (retry_count == 0) {
msg("[%02u] mariabackup: "
"Error: failed to read page after "
"10 retries. File %s seems to be "
"corrupted.\n", cursor->thread_n,
cursor->abs_path);
ret = XB_FIL_CUR_ERROR;
break;
}

if (retry_count == 9) {
msg("[%02u] mariabackup: "
"Database page corruption detected at page "
ULINTPF ", retrying...\n",
cursor->thread_n, page_no);
}

os_thread_sleep(100000);

goto read_retry;
}
cursor->buf_read += page_size;
cursor->buf_npages++;
}

posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED);
Expand Down

0 comments on commit 57e0da5

Please sign in to comment.