Commit 2daf3b14 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.1 into 10.2

parents f37a56de 0b36c27e
...@@ -244,6 +244,8 @@ support-files/mysqld_multi.server ...@@ -244,6 +244,8 @@ support-files/mysqld_multi.server
support-files/wsrep.cnf support-files/wsrep.cnf
support-files/wsrep_notify support-files/wsrep_notify
support-files/policy/selinux/mysqld-safe.pp support-files/policy/selinux/mysqld-safe.pp
support-files/sysusers.conf
support-files/tmpfiles.conf
support-files/mariadb.pp support-files/mariadb.pp
tags tags
tests/async_queries tests/async_queries
......
# Copyright (c) 2012, Monty Program Ab # Copyright (c) 2012, 2020, MariaDB
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -21,7 +21,7 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1 ...@@ -21,7 +21,7 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1
mysql_secure_installation.1 mysql_setpermission.1 mysql_secure_installation.1 mysql_setpermission.1
mysql_tzinfo_to_sql.1 mysql_upgrade.1 mysql_tzinfo_to_sql.1 mysql_upgrade.1
mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1 mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1
mysqltest.1 perror.1 replace.1 resolve_stack_dump.1 perror.1 replace.1 resolve_stack_dump.1
resolveip.1 mariadb-service-convert.1 resolveip.1 mariadb-service-convert.1
mysqld_safe_helper.1 wsrep_sst_common.1 mysqld_safe_helper.1 wsrep_sst_common.1
wsrep_sst_mysqldump.1 wsrep_sst_rsync.1 wsrep_sst_mysqldump.1 wsrep_sst_rsync.1
...@@ -37,7 +37,8 @@ SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1 ...@@ -37,7 +37,8 @@ SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysql_plugin.1 mysql_embedded.1) mysql_plugin.1 mysql_embedded.1)
SET(MAN1_DEVEL mysql_config.1) SET(MAN1_DEVEL mysql_config.1)
SET(MAN1_TEST mysql-stress-test.pl.1 mysql-test-run.pl.1 mysql_client_test.1 SET(MAN1_TEST mysql-stress-test.pl.1 mysql-test-run.pl.1 mysql_client_test.1
mysqltest_embedded.1 mysql_client_test_embedded.1 my_safe_process.1) mysqltest.1 mysqltest_embedded.1 mysql_client_test_embedded.1
my_safe_process.1)
INSTALL(FILES ${MAN1_SERVER} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesServer) INSTALL(FILES ${MAN1_SERVER} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesServer)
INSTALL(FILES ${MAN8_SERVER} DESTINATION ${INSTALL_MANDIR}/man8 COMPONENT ManPagesServer) INSTALL(FILES ${MAN8_SERVER} DESTINATION ${INSTALL_MANDIR}/man8 COMPONENT ManPagesServer)
......
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. /* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB Corporation Copyright (c) 2009, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -3211,7 +3211,7 @@ void MYSQL_BIN_LOG::cleanup() ...@@ -3211,7 +3211,7 @@ void MYSQL_BIN_LOG::cleanup()
DBUG_ASSERT(!binlog_xid_count_list.head()); DBUG_ASSERT(!binlog_xid_count_list.head());
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::cleanup(): Removing xid_list_entry " WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::cleanup(): Removing xid_list_entry "
"for %s (%lu)", b); "for %s (%lu)", b);
my_free(b); delete b;
} }
mysql_mutex_destroy(&LOCK_log); mysql_mutex_destroy(&LOCK_log);
...@@ -3575,18 +3575,9 @@ bool MYSQL_BIN_LOG::open(const char *log_name, ...@@ -3575,18 +3575,9 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
*/ */
uint off= dirname_length(log_file_name); uint off= dirname_length(log_file_name);
uint len= strlen(log_file_name) - off; uint len= strlen(log_file_name) - off;
char *entry_mem, *name_mem; new_xid_list_entry= new xid_count_per_binlog(log_file_name+off, (int)len);
if (!(new_xid_list_entry = (xid_count_per_binlog *) if (!new_xid_list_entry)
my_multi_malloc(MYF(MY_WME),
&entry_mem, sizeof(xid_count_per_binlog),
&name_mem, len,
NULL)))
goto err; goto err;
memcpy(name_mem, log_file_name+off, len);
new_xid_list_entry->binlog_name= name_mem;
new_xid_list_entry->binlog_name_len= len;
new_xid_list_entry->xid_count= 0;
new_xid_list_entry->notify_count= 0;
/* /*
Find the name for the Initial binlog checkpoint. Find the name for the Initial binlog checkpoint.
...@@ -3603,7 +3594,10 @@ bool MYSQL_BIN_LOG::open(const char *log_name, ...@@ -3603,7 +3594,10 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
mysql_mutex_unlock(&LOCK_xid_list); mysql_mutex_unlock(&LOCK_xid_list);
if (!b) if (!b)
b= new_xid_list_entry; b= new_xid_list_entry;
if (b->binlog_name)
strmake(buf, b->binlog_name, b->binlog_name_len); strmake(buf, b->binlog_name, b->binlog_name_len);
else
goto err;
Binlog_checkpoint_log_event ev(buf, len); Binlog_checkpoint_log_event ev(buf, len);
DBUG_EXECUTE_IF("crash_before_write_checkpoint_event", DBUG_EXECUTE_IF("crash_before_write_checkpoint_event",
flush_io_cache(&log_file); flush_io_cache(&log_file);
...@@ -3707,7 +3701,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, ...@@ -3707,7 +3701,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
{ {
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::open(): Removing xid_list_entry for " WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::open(): Removing xid_list_entry for "
"%s (%lu)", b); "%s (%lu)", b);
my_free(binlog_xid_count_list.get()); delete binlog_xid_count_list.get();
} }
mysql_cond_broadcast(&COND_xid_list); mysql_cond_broadcast(&COND_xid_list);
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::open(): Adding new xid_list_entry for " WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::open(): Adding new xid_list_entry for "
...@@ -3754,7 +3748,7 @@ Turning logging off for the whole duration of the MySQL server process. \ ...@@ -3754,7 +3748,7 @@ Turning logging off for the whole duration of the MySQL server process. \
To turn it on again: fix the cause, \ To turn it on again: fix the cause, \
shutdown the MySQL server and restart it.", name, errno); shutdown the MySQL server and restart it.", name, errno);
if (new_xid_list_entry) if (new_xid_list_entry)
my_free(new_xid_list_entry); delete new_xid_list_entry;
if (file >= 0) if (file >= 0)
mysql_file_close(file, MYF(0)); mysql_file_close(file, MYF(0));
close(LOG_CLOSE_INDEX); close(LOG_CLOSE_INDEX);
...@@ -4248,7 +4242,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log, ...@@ -4248,7 +4242,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log,
DBUG_ASSERT(b->xid_count == 0); DBUG_ASSERT(b->xid_count == 0);
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::reset_logs(): Removing " WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::reset_logs(): Removing "
"xid_list_entry for %s (%lu)", b); "xid_list_entry for %s (%lu)", b);
my_free(binlog_xid_count_list.get()); delete binlog_xid_count_list.get();
} }
mysql_cond_broadcast(&COND_xid_list); mysql_cond_broadcast(&COND_xid_list);
reset_master_pending--; reset_master_pending--;
...@@ -9791,7 +9785,7 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint) ...@@ -9791,7 +9785,7 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint)
break; break;
WSREP_XID_LIST_ENTRY("TC_LOG_BINLOG::mark_xid_done(): Removing " WSREP_XID_LIST_ENTRY("TC_LOG_BINLOG::mark_xid_done(): Removing "
"xid_list_entry for %s (%lu)", b); "xid_list_entry for %s (%lu)", b);
my_free(binlog_xid_count_list.get()); delete binlog_xid_count_list.get();
} }
mysql_mutex_unlock(&LOCK_xid_list); mysql_mutex_unlock(&LOCK_xid_list);
......
/* Copyright (c) 2005, 2016, Oracle and/or its affiliates. /* Copyright (c) 2005, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB Corporation. Copyright (c) 2009, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -589,7 +589,18 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG ...@@ -589,7 +589,18 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
long notify_count; long notify_count;
/* For linking in requests to the binlog background thread. */ /* For linking in requests to the binlog background thread. */
xid_count_per_binlog *next_in_queue; xid_count_per_binlog *next_in_queue;
xid_count_per_binlog(); /* Give link error if constructor used. */ xid_count_per_binlog(char *log_file_name, uint log_file_name_len)
:binlog_id(0), xid_count(0), notify_count(0)
{
binlog_name_len= log_file_name_len;
binlog_name= (char *) my_malloc(binlog_name_len, MYF(MY_ZEROFILL));
if (binlog_name)
memcpy(binlog_name, log_file_name, binlog_name_len);
}
~xid_count_per_binlog()
{
my_free(binlog_name);
}
}; };
I_List<xid_count_per_binlog> binlog_xid_count_list; I_List<xid_count_per_binlog> binlog_xid_count_list;
mysql_mutex_t LOCK_binlog_background_thread; mysql_mutex_t LOCK_binlog_background_thread;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2019, MariaDB Corporation. Copyright (c) 2013, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -528,7 +528,10 @@ dict_table_close( ...@@ -528,7 +528,10 @@ dict_table_close(
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
if (drop_aborted) { /* dict_table_try_drop_aborted() can generate undo logs.
So it should be avoided after shutdown of background
threads */
if (drop_aborted && !srv_undo_sources) {
dict_table_try_drop_aborted(NULL, table_id, 0); dict_table_try_drop_aborted(NULL, table_id, 0);
} }
} }
......
/***************************************************************************** /*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
Copyright (c) 2014, 2019, MariaDB Corporation. Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -655,51 +655,10 @@ fil_space_encrypt( ...@@ -655,51 +655,10 @@ fil_space_encrypt(
return (src_frame); return (src_frame);
} }
fil_space_crypt_t* crypt_data = space->crypt_data;
const page_size_t page_size(space->flags);
ut_ad(space->n_pending_ios > 0); ut_ad(space->n_pending_ios > 0);
byte* tmp = fil_encrypt_buf(crypt_data, space->id, offset, lsn, return fil_encrypt_buf(space->crypt_data, space->id, offset, lsn,
src_frame, page_size, dst_frame); src_frame, page_size_t(space->flags),
dst_frame);
#ifdef UNIV_DEBUG
if (tmp) {
/* Verify that encrypted buffer is not corrupted */
dberr_t err = DB_SUCCESS;
byte* src = src_frame;
bool page_compressed_encrypted = (mach_read_from_2(tmp+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
byte uncomp_mem[UNIV_PAGE_SIZE_MAX];
byte tmp_mem[UNIV_PAGE_SIZE_MAX];
if (page_compressed_encrypted) {
memcpy(uncomp_mem, src, srv_page_size);
ulint unzipped1 = fil_page_decompress(
tmp_mem, uncomp_mem);
ut_ad(unzipped1);
if (unzipped1 != srv_page_size) {
src = uncomp_mem;
}
}
ut_ad(!buf_page_is_corrupted(true, src, page_size, space));
ut_ad(fil_space_decrypt(crypt_data, tmp_mem, page_size, tmp,
&err));
ut_ad(err == DB_SUCCESS);
/* Need to decompress the page if it was also compressed */
if (page_compressed_encrypted) {
byte buf[UNIV_PAGE_SIZE_MAX];
memcpy(buf, tmp_mem, srv_page_size);
ulint unzipped2 = fil_page_decompress(tmp_mem, buf);
ut_ad(unzipped2);
}
memcpy(tmp_mem + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
src + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 8);
ut_ad(!memcmp(src, tmp_mem, page_size.physical()));
}
#endif /* UNIV_DEBUG */
return tmp;
} }
/** Decrypt a page. /** Decrypt a page.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2019, MariaDB Corporation. Copyright (c) 2013, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -604,7 +604,10 @@ dict_table_close( ...@@ -604,7 +604,10 @@ dict_table_close(
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
if (drop_aborted) { /* dict_table_try_drop_aborted() can generate undo logs.
So it should be avoided after shutdown of background
threads */
if (drop_aborted && srv_undo_sources) {
dict_table_try_drop_aborted(NULL, table_id, 0); dict_table_try_drop_aborted(NULL, table_id, 0);
} }
} }
......
/***************************************************************************** /*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
Copyright (c) 2014, 2019, MariaDB Corporation. Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -706,47 +706,8 @@ fil_space_encrypt( ...@@ -706,47 +706,8 @@ fil_space_encrypt(
fil_space_crypt_t* crypt_data = space->crypt_data; fil_space_crypt_t* crypt_data = space->crypt_data;
ut_ad(space->n_pending_ios > 0); ut_ad(space->n_pending_ios > 0);
ulint zip_size = fsp_flags_get_zip_size(space->flags); ulint zip_size = fsp_flags_get_zip_size(space->flags);
byte* tmp = fil_encrypt_buf(crypt_data, space->id, offset, lsn, src_frame, zip_size, dst_frame); return fil_encrypt_buf(crypt_data, space->id, offset, lsn,
src_frame, zip_size, dst_frame);
#ifdef UNIV_DEBUG
if (tmp) {
/* Verify that encrypted buffer is not corrupted */
dberr_t err = DB_SUCCESS;
byte* src = src_frame;
bool page_compressed_encrypted = (mach_read_from_2(tmp+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
byte uncomp_mem[UNIV_PAGE_SIZE_MAX];
byte tmp_mem[UNIV_PAGE_SIZE_MAX];
ulint size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
if (page_compressed_encrypted) {
memcpy(uncomp_mem, src, srv_page_size);
ulint unzipped1 = fil_page_decompress(
tmp_mem, uncomp_mem);
ut_ad(unzipped1);
if (unzipped1 != srv_page_size) {
src = uncomp_mem;
}
}
ut_ad(!buf_page_is_corrupted(true, src, zip_size, space));
ut_ad(fil_space_decrypt(crypt_data, tmp_mem, size, tmp, &err));
ut_ad(err == DB_SUCCESS);
/* Need to decompress the page if it was also compressed */
if (page_compressed_encrypted) {
byte buf[UNIV_PAGE_SIZE_MAX];
memcpy(buf, tmp_mem, srv_page_size);
ulint unzipped2 = fil_page_decompress(tmp_mem, buf);
ut_ad(unzipped2);
}
memcpy(tmp_mem + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
src + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 8);
ut_ad(!memcmp(src, tmp_mem, size));
}
#endif /* UNIV_DEBUG */
return tmp;
} }
/****************************************************************** /******************************************************************
......
...@@ -123,21 +123,6 @@ IF(UNIX) ...@@ -123,21 +123,6 @@ IF(UNIX)
${CMAKE_CURRENT_BINARY_DIR}/mariadb.service ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service
DESTINATION ${inst_location}/systemd COMPONENT SupportFiles) DESTINATION ${inst_location}/systemd COMPONENT SupportFiles)
IF(INSTALL_SYSTEMD_SYSUSERSDIR)
CONFIGURE_FILE(sysusers.conf.in
${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf
DESTINATION ${INSTALL_SYSTEMD_SYSUSERSDIR} COMPONENT Server)
ENDIF()
IF(INSTALL_SYSTEMD_TMPFILESDIR)
get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY)
CONFIGURE_FILE(tmpfiles.conf.in
${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf
DESTINATION ${INSTALL_SYSTEMD_TMPFILESDIR} COMPONENT Server)
ENDIF()
# @ in directory name broken between CMake version 2.8.12.2 and 3.3 # @ in directory name broken between CMake version 2.8.12.2 and 3.3
# http://public.kitware.com/Bug/view.php?id=14782 # http://public.kitware.com/Bug/view.php?id=14782
IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM) IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM)
...@@ -164,6 +149,26 @@ IF(UNIX) ...@@ -164,6 +149,26 @@ IF(UNIX)
ENDIF() ENDIF()
ENDIF() ENDIF()
# Allow installing sysusers and tmpusers without requiring SYSTEMD on the
# system. This is useful for distributions running other init systems to
# parse these files and create appropriate users & tmpfiles.
IF((HAVE_SYSTEMD OR INSTALL_SYSTEMD_SYSUSERS) AND INSTALL_SYSTEMD_SYSUSERSDIR)
CONFIGURE_FILE(sysusers.conf.in
${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf
DESTINATION ${INSTALL_SYSTEMD_SYSUSERSDIR}
RENAME mariadb.conf COMPONENT Server)
ENDIF()
IF((HAVE_SYSTEMD OR INSTALL_SYSTEMD_TMPUSERS) AND INSTALL_SYSTEMD_TMPFILESDIR)
get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY)
CONFIGURE_FILE(tmpfiles.conf.in
${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf
DESTINATION ${INSTALL_SYSTEMD_TMPFILESDIR}
RENAME mariadb.conf COMPONENT Server)
ENDIF()
IF (INSTALL_SYSCONFDIR) IF (INSTALL_SYSCONFDIR)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql-log-rotate DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql-log-rotate DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d
RENAME mysql COMPONENT SupportFiles) RENAME mysql COMPONENT SupportFiles)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment