summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-01-31 10:53:56 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-01-31 10:53:56 +0200
commit2daf3b14fe2aa9f0f126420beffcc8cb12b87d5e (patch)
tree1a4e5184577cba470e4c325112a86046ddd5d24c
parentf37a56de3cb795883f5a799f6de9fc475d5feaae (diff)
parent0b36c27e0c06b798b7322ab07d8464b69a7b716c (diff)
downloadmariadb-git-2daf3b14fe2aa9f0f126420beffcc8cb12b87d5e.tar.gz
Merge 10.1 into 10.2
-rw-r--r--.gitignore2
-rw-r--r--man/CMakeLists.txt7
-rw-r--r--sql/log.cc30
-rw-r--r--sql/log.h15
-rw-r--r--storage/innobase/dict/dict0dict.cc7
-rw-r--r--storage/innobase/fil/fil0crypt.cc49
-rw-r--r--storage/xtradb/dict/dict0dict.cc7
-rw-r--r--storage/xtradb/fil/fil0crypt.cc45
-rw-r--r--support-files/CMakeLists.txt35
9 files changed, 68 insertions, 129 deletions
diff --git a/.gitignore b/.gitignore
index 7974a539ee0..d91bac43dee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -244,6 +244,8 @@ support-files/mysqld_multi.server
support-files/wsrep.cnf
support-files/wsrep_notify
support-files/policy/selinux/mysqld-safe.pp
+support-files/sysusers.conf
+support-files/tmpfiles.conf
support-files/mariadb.pp
tags
tests/async_queries
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index cc3f2701a77..5acec2ede67 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2012, Monty Program Ab
+# Copyright (c) 2012, 2020, MariaDB
#
# 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
@@ -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_tzinfo_to_sql.1 mysql_upgrade.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
mysqld_safe_helper.1 wsrep_sst_common.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
mysql_plugin.1 mysql_embedded.1)
SET(MAN1_DEVEL mysql_config.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 ${MAN8_SERVER} DESTINATION ${INSTALL_MANDIR}/man8 COMPONENT ManPagesServer)
diff --git a/sql/log.cc b/sql/log.cc
index 91dfac07993..64da45bfcea 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
@@ -3211,7 +3211,7 @@ void MYSQL_BIN_LOG::cleanup()
DBUG_ASSERT(!binlog_xid_count_list.head());
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::cleanup(): Removing xid_list_entry "
"for %s (%lu)", b);
- my_free(b);
+ delete b;
}
mysql_mutex_destroy(&LOCK_log);
@@ -3575,18 +3575,9 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
*/
uint off= dirname_length(log_file_name);
uint len= strlen(log_file_name) - off;
- char *entry_mem, *name_mem;
- if (!(new_xid_list_entry = (xid_count_per_binlog *)
- my_multi_malloc(MYF(MY_WME),
- &entry_mem, sizeof(xid_count_per_binlog),
- &name_mem, len,
- NULL)))
+ new_xid_list_entry= new xid_count_per_binlog(log_file_name+off, (int)len);
+ if (!new_xid_list_entry)
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.
@@ -3603,7 +3594,10 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
mysql_mutex_unlock(&LOCK_xid_list);
if (!b)
b= new_xid_list_entry;
- strmake(buf, b->binlog_name, b->binlog_name_len);
+ if (b->binlog_name)
+ strmake(buf, b->binlog_name, b->binlog_name_len);
+ else
+ goto err;
Binlog_checkpoint_log_event ev(buf, len);
DBUG_EXECUTE_IF("crash_before_write_checkpoint_event",
flush_io_cache(&log_file);
@@ -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 "
"%s (%lu)", b);
- my_free(binlog_xid_count_list.get());
+ delete binlog_xid_count_list.get();
}
mysql_cond_broadcast(&COND_xid_list);
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. \
To turn it on again: fix the cause, \
shutdown the MySQL server and restart it.", name, errno);
if (new_xid_list_entry)
- my_free(new_xid_list_entry);
+ delete new_xid_list_entry;
if (file >= 0)
mysql_file_close(file, MYF(0));
close(LOG_CLOSE_INDEX);
@@ -4248,7 +4242,7 @@ err:
DBUG_ASSERT(b->xid_count == 0);
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::reset_logs(): Removing "
"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);
reset_master_pending--;
@@ -9791,7 +9785,7 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint)
break;
WSREP_XID_LIST_ENTRY("TC_LOG_BINLOG::mark_xid_done(): Removing "
"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);
diff --git a/sql/log.h b/sql/log.h
index 391030db81f..0e6b2c895af 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
@@ -589,7 +589,18 @@ public:
long notify_count;
/* For linking in requests to the binlog background thread. */
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;
mysql_mutex_t LOCK_binlog_background_thread;
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 4b1549c419d..cf70047ab15 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
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
the terms of the GNU General Public License as published by the Free Software
@@ -528,7 +528,10 @@ dict_table_close(
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);
}
}
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 2211370ada1..a28c9f63797 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
@@ -655,51 +655,10 @@ fil_space_encrypt(
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);
- byte* tmp = fil_encrypt_buf(crypt_data, space->id, offset, lsn,
- src_frame, page_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];
-
- 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;
+ return fil_encrypt_buf(space->crypt_data, space->id, offset, lsn,
+ src_frame, page_size_t(space->flags),
+ dst_frame);
}
/** Decrypt a page.
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index 2bea154749f..6d0500589b1 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
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
the terms of the GNU General Public License as published by the Free Software
@@ -604,7 +604,10 @@ dict_table_close(
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);
}
}
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index 874c6b4dd2e..7219e641e30 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
@@ -706,47 +706,8 @@ fil_space_encrypt(
fil_space_crypt_t* crypt_data = space->crypt_data;
ut_ad(space->n_pending_ios > 0);
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);
-
-#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;
+ return fil_encrypt_buf(crypt_data, space->id, offset, lsn,
+ src_frame, zip_size, dst_frame);
}
/******************************************************************
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index 6ab84b59b29..92a46b7b12a 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -123,21 +123,6 @@ IF(UNIX)
${CMAKE_CURRENT_BINARY_DIR}/mariadb.service
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
# http://public.kitware.com/Bug/view.php?id=14782
IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM)
@@ -164,6 +149,26 @@ IF(UNIX)
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)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql-log-rotate DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d
RENAME mysql COMPONENT SupportFiles)