Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä 2019-01-06 17:43:02 +02:00
commit 734510a44d
155 changed files with 2039 additions and 2610 deletions

2
.gitignore vendored
View File

@ -129,8 +129,6 @@ scripts/wsrep_sst_mysqldump
scripts/wsrep_sst_rsync scripts/wsrep_sst_rsync
scripts/wsrep_sst_rsync_wan scripts/wsrep_sst_rsync_wan
scripts/wsrep_sst_mariabackup scripts/wsrep_sst_mariabackup
scripts/wsrep_sst_xtrabackup
scripts/wsrep_sst_xtrabackup-v2
scripts/maria_add_gis_sp.sql scripts/maria_add_gis_sp.sql
scripts/maria_add_gis_sp_bootstrap.sql scripts/maria_add_gis_sp_bootstrap.sql
scripts/galera_new_cluster scripts/galera_new_cluster

View File

@ -342,6 +342,7 @@ MYSQL_CHECK_SSL()
MYSQL_CHECK_READLINE() MYSQL_CHECK_READLINE()
SET(MALLOC_LIBRARY "system") SET(MALLOC_LIBRARY "system")
SET(PYTHON_SHEBANG "/usr/bin/env python")
CHECK_PCRE() CHECK_PCRE()

View File

@ -60,7 +60,7 @@ CONTENTS:
Wsrep API developed by Codership Oy is a modern generic (database-agnostic) Wsrep API developed by Codership Oy is a modern generic (database-agnostic)
replication API for transactional databases with a goal to make database replication API for transactional databases with a goal to make database
replication/logging subsystem completely modular and pluggable. It is developed replication/logging subsystem completely modular and pluggable. It is developed
with flexibility and completeness in mind to satisfy broad range of modern with flexibility and completeness in mind to satisfy a broad range of modern
replication scenarios. It is equally suitable for synchronous and asynchronous, replication scenarios. It is equally suitable for synchronous and asynchronous,
master-slave and multi-master replication. master-slave and multi-master replication.
@ -87,7 +87,7 @@ Upgrade from mysql-server-5.0 to mysql-wsrep is not supported yet, please
upgrade to mysql-server-5.1 first. upgrade to mysql-server-5.1 first.
If you're installing over an existing mysql installation, mysql-server-wsrep If you're installing over an existing mysql installation, mysql-server-wsrep
will conflict with mysql-server-5.1 package, so remove it first: will conflict with the mysql-server-5.1 package, so remove it first:
$ sudo apt-get remove mysql-server-5.1 mysql-server-core-5.1 $ sudo apt-get remove mysql-server-5.1 mysql-server-core-5.1
@ -105,7 +105,7 @@ For example, installation of required packages on Debian Lenny:
$ sudo apt-get install psmisc $ sudo apt-get install psmisc
$ sudo apt-get -t lenny-backports install mysql-client-5.1 $ sudo apt-get -t lenny-backports install mysql-client-5.1
Now you should be able to install mysql-wsrep package: Now you should be able to install the mysql-wsrep package:
$ sudo dpkg -i <mysql-server-wsrep DEB> $ sudo dpkg -i <mysql-server-wsrep DEB>
@ -137,7 +137,7 @@ Additional packages to consider (if not yet installed):
* galera (multi-master replication provider, https://launchpad.net/galera) * galera (multi-master replication provider, https://launchpad.net/galera)
* MySQL-client-community (for connecting to server and mysqldump-based SST) * MySQL-client-community (for connecting to server and mysqldump-based SST)
* rsync (for rsync-based SST) * rsync (for rsync-based SST)
* xtrabackup and nc (for xtrabackup-based SST) * mariabackup and nc (for mariabackup-based SST)
2.2 Upgrade system tables. 2.2 Upgrade system tables.
@ -150,7 +150,7 @@ and can be ignored unless specific functionality is needed.
3. FIRST TIME SETUP 3. FIRST TIME SETUP
Unless you're upgrading an already installed mysql-wsrep package, you will need Unless you're upgrading an already installed mysql-wsrep package, you will need
to set up a few things to prepare server for operation. to set up a few things to prepare the server for operation.
3.1 CONFIGURATION FILES 3.1 CONFIGURATION FILES
@ -162,7 +162,7 @@ to set up a few things to prepare server for operation.
* Make sure system-wide my.cnf contains "!includedir /etc/mysql/conf.d/" line. * Make sure system-wide my.cnf contains "!includedir /etc/mysql/conf.d/" line.
* Edit /etc/mysql/conf.d/wsrep.cnf and set wsrep_provider option by specifying * Edit /etc/mysql/conf.d/wsrep.cnf and set wsrep_provider option by specifying
a path to provider library. If you don't have a provider, leave it as it is. a path to the provider library. If you don't have a provider, leave it as it is.
* When a new node joins the cluster it'll have to receive a state snapshot from * When a new node joins the cluster it'll have to receive a state snapshot from
one of the peers. This requires a privileged MySQL account with access from one of the peers. This requires a privileged MySQL account with access from
@ -267,7 +267,7 @@ innodb_autoinc_lock_mode=2
This is a required parameter. Without it INSERTs into tables with This is a required parameter. Without it INSERTs into tables with
AUTO_INCREMENT column may fail. AUTO_INCREMENT column may fail.
autoinc lock modes 0 and 1 can cause unresolved deadlock, and make autoinc lock modes 0 and 1 can cause unresolved deadlock, and make
system unresponsive. the system unresponsive.
innodb_locks_unsafe_for_binlog=1 innodb_locks_unsafe_for_binlog=1
This option is required for parallel applying. This option is required for parallel applying.
@ -299,14 +299,14 @@ wsrep_node_address=
results (multiple network interfaces, NAT, etc.) results (multiple network interfaces, NAT, etc.)
If not explicitly overridden by wsrep_sst_receive_address, the <address> part If not explicitly overridden by wsrep_sst_receive_address, the <address> part
will be used to listen for SST (see below). And the whole <address>[:port] will be used to listen for SST (see below). And the whole <address>[:port]
will be passed to wsrep provider to be used as a base address in its will be passed to the wsrep provider to be used as a base address in its
communications. communications.
wsrep_node_name= wsrep_node_name=
Human readable node name (for easier log reading only). Defaults to hostname. Human readable node name (for easier log reading only). Defaults to hostname.
wsrep_slave_threads=1 wsrep_slave_threads=1
Number of threads dedicated to processing of writesets from other nodes. The number of threads dedicated to the processing of writesets from other nodes.
For best performance should be few per CPU core. For best performance should be few per CPU core.
wsrep_dbug_option wsrep_dbug_option
@ -326,7 +326,7 @@ wsrep_convert_LOCK_to_trx=0
wsrep_retry_autocommit=1 wsrep_retry_autocommit=1
Retry autocommit queries and single statement transactions should they fail Retry autocommit queries and single statement transactions should they fail
certification test. This is analogous to rescheduling an autocommit query certification test. This is analogous to rescheduling an autocommit query
should it go into deadlock with other transactions in the database lock should it go into a deadlock with other transactions in the database lock
manager. manager.
wsrep_auto_increment_control=1 wsrep_auto_increment_control=1
@ -357,7 +357,7 @@ wsrep_OSU_method=TOI
is not replicating and may be unable to process replication events (due to is not replicating and may be unable to process replication events (due to
table lock). Once DDL operation is complete, the node will catch up and sync table lock). Once DDL operation is complete, the node will catch up and sync
with the cluster to become fully operational again. The DDL statement or with the cluster to become fully operational again. The DDL statement or
its effects are not replicated, so it is user's responsibility to manually its effects are not replicated, so it is the user's responsibility to manually
perform this operation on each of the nodes. perform this operation on each of the nodes.
wsrep_forced_binlog_format=none wsrep_forced_binlog_format=none
@ -380,14 +380,14 @@ to join or start a cluster.
wsrep_sst_method=rsync wsrep_sst_method=rsync
What method to use to copy database state to a newly joined node. Supported What method to use to copy database state to a newly joined node. Supported
methods: methods:
- mysqldump: slow (except for small datasets) but allows for upgrade - mysqldump: slow (except for small datasets) but allows for upgrade
between major MySQL versions or InnoDB features. between major MySQL versions or InnoDB features.
- rsync: much faster on large datasets (default). - rsync: much faster on large datasets (default).
- rsync_wan: same as rsync but with deltaxfer to minimize network traffic. - rsync_wan: same as rsync but with deltaxfer to minimize network traffic.
- xtrabackup: very fast and practically non-blocking SST method based on - mariabackup: very fast and practically non-blocking SST method based on
Percona's xtrabackup tool. mariabackup tool (enhanced version of Percona's xtrabackup).
(for xtrabackup to work the following settings must be present in my.cnf (for mariabackup to work the following settings must be present in my.cnf
on all nodes: on all nodes:
[mysqld] [mysqld]
wsrep_sst_auth=root:<root password> wsrep_sst_auth=root:<root password>
@ -412,8 +412,8 @@ wsrep_sst_auth=
wsrep_sst_donor= wsrep_sst_donor=
A name of the node which should serve as state snapshot donor. This allows A name of the node which should serve as state snapshot donor. This allows
to control which node will serve state snapshot request. By default the controlling which node will serve the state snapshot request. By default the
most suitable node is chosen by wsrep provider. This is the same as given in most suitable node is chosen by the wsrep provider. This is the same as given in
wsrep_node_name. wsrep_node_name.
@ -423,7 +423,7 @@ wsrep_sst_donor=
for the database. They change the database structure and are non- for the database. They change the database structure and are non-
transactional. transactional.
Release 22.3 brings a new method for performing schema upgrades. User can Release 22.3 brings a new method for performing schema upgrades. A user can
now choose whether to use the traditional total order isolation or new now choose whether to use the traditional total order isolation or new
rolling schema upgrade method. The OSU method choice is done by global rolling schema upgrade method. The OSU method choice is done by global
parameter: 'wsrep_OSU_method'. parameter: 'wsrep_OSU_method'.
@ -439,7 +439,7 @@ wsrep_sst_donor=
6.2 Rolling Schema Upgrade (RSU) 6.2 Rolling Schema Upgrade (RSU)
Rolling schema upgrade is new DDL processing method, where DDL will be Rolling schema upgrade is a new DDL processing method, where DDL will be
processed locally for the node. The node is disconnected of the replication processed locally for the node. The node is disconnected of the replication
for the duration of the DDL processing, so that there is only DDL statement for the duration of the DDL processing, so that there is only DDL statement
processing in the node and it does not block the rest of the cluster. When processing in the node and it does not block the rest of the cluster. When
@ -468,7 +468,7 @@ wsrep_sst_donor=
* LOCK/UNLOCK TABLES cannot be supported in multi-master setups. * LOCK/UNLOCK TABLES cannot be supported in multi-master setups.
* lock functions (GET_LOCK(), RELEASE_LOCK()... ) * lock functions (GET_LOCK(), RELEASE_LOCK()... )
4) Query log cannot be directed to table. If you enable query logging, 4) Query log cannot be directed to a table. If you enable query logging,
you must forward the log to a file: you must forward the log to a file:
log_output = FILE log_output = FILE
Use general_log and general_log_file to choose query logging and the Use general_log and general_log_file to choose query logging and the
@ -480,7 +480,7 @@ wsrep_sst_donor=
6) Due to cluster level optimistic concurrency control, transaction issuing 6) Due to cluster level optimistic concurrency control, transaction issuing
COMMIT may still be aborted at that stage. There can be two transactions. COMMIT may still be aborted at that stage. There can be two transactions.
writing to same rows and committing in separate cluster nodes, and only one writing to same rows and committing in separate cluster nodes, and only one
of the them can successfully commit. The failing one will be aborted. of them can successfully commit. The failing one will be aborted.
For cluster level aborts, MySQL/galera cluster gives back deadlock error. For cluster level aborts, MySQL/galera cluster gives back deadlock error.
code (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)). code (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)).

View File

@ -214,6 +214,8 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
ALTERNATIVE_NAME("server" "mariadb-server") ALTERNATIVE_NAME("server" "mariadb-server")
ALTERNATIVE_NAME("server" "mysql-compat-server") ALTERNATIVE_NAME("server" "mysql-compat-server")
ALTERNATIVE_NAME("test" "mariadb-test") ALTERNATIVE_NAME("test" "mariadb-test")
ELSEIF(RPM MATCHES "(rhel|centos)8")
SET(PYTHON_SHEBANG "/usr/bin/python3")
ENDIF() ENDIF()
# workaround for lots of perl dependencies added by rpmbuild # workaround for lots of perl dependencies added by rpmbuild

View File

@ -6,10 +6,7 @@ ENDIF()
SET(CONC_WITH_SIGNCODE ${SIGNCODE}) SET(CONC_WITH_SIGNCODE ${SIGNCODE})
SET(SIGN_OPTIONS ${SIGNTOOL_PARAMETERS}) SET(SIGN_OPTIONS ${SIGNTOOL_PARAMETERS})
SET(CONC_WITH_EXTERNAL_ZLIB ON)
IF(NOT TARGET zlib)
SET(CONC_WITH_EXTERNAL_ZLIB ON)
ENDIF()
IF(SSL_DEFINES MATCHES "YASSL") IF(SSL_DEFINES MATCHES "YASSL")
IF(WIN32) IF(WIN32)

View File

@ -34,11 +34,6 @@ ENDMACRO()
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS) MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
# For NDBCLUSTER: Use bundled zlib by default
IF (NOT WITH_ZLIB)
SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
ENDIF()
IF(WITH_ZLIB STREQUAL "bundled") IF(WITH_ZLIB STREQUAL "bundled")
MYSQL_USE_BUNDLED_ZLIB() MYSQL_USE_BUNDLED_ZLIB()
ELSE() ELSE()

View File

@ -102,7 +102,7 @@ fi
# AWS SDK also requires the build machine to have network access and git, so # AWS SDK also requires the build machine to have network access and git, so
# it cannot be part of the base version included in Linux distros, but a pure # it cannot be part of the base version included in Linux distros, but a pure
# custom built plugin. # custom built plugin.
if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && wget --timeout 15 --tries 1 --quiet --output-document /dev/null https://github.com/ if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && [[ -x "$(command -v git)" ]] && timeout 3s bash -c 'sed -n q </dev/tcp/github.com/22'
then then
cat <<EOF >> debian/control cat <<EOF >> debian/control

2
debian/control vendored
View File

@ -594,7 +594,7 @@ Description: OQGraph storage engine for MariaDB
Package: mariadb-plugin-tokudb Package: mariadb-plugin-tokudb
Architecture: amd64 Architecture: amd64
Depends: libjemalloc1 (>= 3.0.0~), Depends: libjemalloc1 (>= 3.0.0~) | libjemalloc2,
mariadb-server-10.4 (= ${binary:Version}), mariadb-server-10.4 (= ${binary:Version}),
${misc:Depends}, ${misc:Depends},
${shlibs:Depends} ${shlibs:Depends}

View File

@ -36,8 +36,6 @@ usr/bin/wsrep_sst_common
usr/bin/wsrep_sst_mariabackup usr/bin/wsrep_sst_mariabackup
usr/bin/wsrep_sst_mysqldump usr/bin/wsrep_sst_mysqldump
usr/bin/wsrep_sst_rsync usr/bin/wsrep_sst_rsync
usr/bin/wsrep_sst_xtrabackup
usr/bin/wsrep_sst_xtrabackup-v2
usr/lib/mysql/plugin/auth_ed25519.so usr/lib/mysql/plugin/auth_ed25519.so
usr/lib/mysql/plugin/auth_pam.so usr/lib/mysql/plugin/auth_pam.so
usr/lib/mysql/plugin/auth_pam_tool_dir/auth_pam_tool usr/lib/mysql/plugin/auth_pam_tool_dir/auth_pam_tool

View File

@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include "fil_cur.h" #include "fil_cur.h"
#include "fil0crypt.h" #include "fil0crypt.h"
#include "fil0pagecompress.h"
#include "common.h" #include "common.h"
#include "read_filt.h" #include "read_filt.h"
#include "xtrabackup.h" #include "xtrabackup.h"
@ -260,6 +261,8 @@ xb_fil_cur_open(
mutex_exit(&fil_system.mutex); mutex_exit(&fil_system.mutex);
} }
/*msg("crypt: %s,%u\n", node->name, node->space->crypt_data->type);*/
cursor->space_size = (ulint)(cursor->statinfo.st_size cursor->space_size = (ulint)(cursor->statinfo.st_size
/ page_size.physical()); / page_size.physical());
@ -270,6 +273,107 @@ xb_fil_cur_open(
return(XB_FIL_CUR_SUCCESS); return(XB_FIL_CUR_SUCCESS);
} }
static bool page_is_corrupted(const byte *page, ulint page_no,
const xb_fil_cur_t *cursor,
const fil_space_t *space)
{
byte tmp_frame[UNIV_PAGE_SIZE_MAX];
byte tmp_page[UNIV_PAGE_SIZE_MAX];
const ulint page_size = cursor->page_size.physical();
ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
/* We ignore the doublewrite buffer pages.*/
if (cursor->space_id == TRX_SYS_SPACE
&& page_no >= FSP_EXTENT_SIZE
&& page_no < FSP_EXTENT_SIZE * 3) {
return false;
}
/* Validate page number. */
if (mach_read_from_4(page + FIL_PAGE_OFFSET) != page_no
&& cursor->space_id != TRX_SYS_SPACE) {
/* On pages that are not all zero, the
page number must match.
There may be a mismatch on tablespace ID,
because files may be renamed during backup.
We disable the page number check
on the system tablespace, because it may consist
of multiple files, and here we count the pages
from the start of each file.)
The first 38 and last 8 bytes are never encrypted. */
const ulint* p = reinterpret_cast<const ulint*>(page);
const ulint* const end = reinterpret_cast<const ulint*>(
page + page_size);
do {
if (*p++) {
return true;
}
} while (p != end);
/* Whole zero page is valid. */
return false;
}
/* Validate encrypted pages. The first page is never encrypted.
In the system tablespace, the first page would be written with
FIL_PAGE_FILE_FLUSH_LSN at shutdown, and if the LSN exceeds
4,294,967,295, the mach_read_from_4() below would wrongly
interpret the page as encrypted. We prevent that by checking
page_no first. */
if (page_no
&& mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
&& (opt_backup_encrypted
|| (space->crypt_data
&& space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED))) {
if (!fil_space_verify_crypt_checksum(page, cursor->page_size))
return true;
/* Compressed encrypted need to be decrypted
and decompressed for verification. */
if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
&& !opt_extended_validation)
return false;
memcpy(tmp_page, page, page_size);
bool decrypted = false;
if (!space->crypt_data
|| space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED
|| !fil_space_decrypt(space, tmp_frame, tmp_page,
&decrypted)) {
return true;
}
if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
return buf_page_is_corrupted(true, tmp_page,
cursor->page_size, space);
}
}
if (page_type == FIL_PAGE_PAGE_COMPRESSED) {
memcpy(tmp_page, page, page_size);
}
if (page_type == FIL_PAGE_PAGE_COMPRESSED
|| page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
ulint decomp = fil_page_decompress(tmp_frame, tmp_page);
page_type = mach_read_from_2(tmp_page + FIL_PAGE_TYPE);
return (!decomp
|| (decomp != srv_page_size
&& cursor->page_size.is_compressed())
|| page_type == FIL_PAGE_PAGE_COMPRESSED
|| page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
|| buf_page_is_corrupted(true, tmp_page,
cursor->page_size, space));
}
return buf_page_is_corrupted(true, page, cursor->page_size, space);
}
/************************************************************************ /************************************************************************
Reads and verifies the next block of pages from the source Reads and verifies the next block of pages from the source
file. Positions the cursor after the last read non-corrupted page. file. Positions the cursor after the last read non-corrupted page.
@ -288,8 +392,6 @@ xb_fil_cur_read(
xb_fil_cur_result_t ret; xb_fil_cur_result_t ret;
ib_int64_t offset; ib_int64_t offset;
ib_int64_t to_read; ib_int64_t to_read;
byte tmp_frame[UNIV_PAGE_SIZE_MAX];
byte tmp_page[UNIV_PAGE_SIZE_MAX];
const ulint page_size = cursor->page_size.physical(); const ulint page_size = cursor->page_size.physical();
xb_ad(!cursor->is_system() || page_size == srv_page_size); xb_ad(!cursor->is_system() || page_size == srv_page_size);
@ -327,7 +429,7 @@ xb_fil_cur_read(
xb_a((to_read & (page_size - 1)) == 0); xb_a((to_read & (page_size - 1)) == 0);
npages = (ulint) (to_read / cursor->page_size.physical()); npages = (ulint) (to_read / page_size);
retry_count = 10; retry_count = 10;
ret = XB_FIL_CUR_SUCCESS; ret = XB_FIL_CUR_SUCCESS;
@ -344,7 +446,7 @@ read_retry:
cursor->buf_read = 0; cursor->buf_read = 0;
cursor->buf_npages = 0; cursor->buf_npages = 0;
cursor->buf_offset = offset; cursor->buf_offset = offset;
cursor->buf_page_no = (ulint)(offset / cursor->page_size.physical()); cursor->buf_page_no = (ulint)(offset / page_size);
if (!os_file_read(IORequestRead, cursor->file, cursor->buf, offset, if (!os_file_read(IORequestRead, cursor->file, cursor->buf, offset,
(ulint) to_read)) { (ulint) to_read)) {
@ -357,58 +459,29 @@ read_retry:
page += page_size, i++) { page += page_size, i++) {
ulint page_no = cursor->buf_page_no + i; ulint page_no = cursor->buf_page_no + i;
if (cursor->space_id == TRX_SYS_SPACE && if (page_is_corrupted(page, page_no, cursor, space)){
page_no >= FSP_EXTENT_SIZE && retry_count--;
page_no < FSP_EXTENT_SIZE * 3) {
/* We ignore the doublewrite buffer pages */
} else if (mach_read_from_4(
page
+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
&& space->crypt_data
&& space->crypt_data->type
!= CRYPT_SCHEME_UNENCRYPTED
&& fil_space_verify_crypt_checksum(
page, cursor->page_size)) {
ut_ad(mach_read_from_4(page + FIL_PAGE_SPACE_ID)
== space->id);
bool decrypted = false; if (retry_count == 0) {
msg("[%02u] mariabackup: "
memcpy(tmp_page, page, page_size); "Error: failed to read page after "
"10 retries. File %s seems to be "
if (!fil_space_decrypt(space, tmp_frame, "corrupted.\n", cursor->thread_n,
tmp_page, &decrypted) cursor->abs_path);
|| buf_page_is_corrupted(true, tmp_page, ret = XB_FIL_CUR_ERROR;
cursor->page_size, buf_page_print(page, cursor->page_size);
space)) { break;
goto corrupted;
} }
} else if (buf_page_is_corrupted(true, page, cursor->page_size, msg("[%02u] mariabackup: "
space)) { "Database page corruption detected at page "
corrupted: ULINTPF ", retrying...\n", cursor->thread_n,
retry_count--; page_no);
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) { os_thread_sleep(100000);
msg("[%02u] mariabackup: " goto read_retry;
"Database page corruption detected at page " }
ULINTPF ", retrying...\n", cursor->buf_read += page_size;
cursor->thread_n, page_no); cursor->buf_npages++;
}
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); posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED);

View File

@ -200,6 +200,8 @@ static char* log_ignored_opt;
extern my_bool opt_use_ssl; extern my_bool opt_use_ssl;
my_bool opt_ssl_verify_server_cert; my_bool opt_ssl_verify_server_cert;
my_bool opt_extended_validation;
my_bool opt_backup_encrypted;
/* === metadata of backup === */ /* === metadata of backup === */
#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints" #define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
@ -759,6 +761,8 @@ enum options_xtrabackup
OPT_XTRA_DATABASES, OPT_XTRA_DATABASES,
OPT_XTRA_DATABASES_FILE, OPT_XTRA_DATABASES_FILE,
OPT_XTRA_PARALLEL, OPT_XTRA_PARALLEL,
OPT_XTRA_EXTENDED_VALIDATION,
OPT_XTRA_BACKUP_ENCRYPTED,
OPT_XTRA_STREAM, OPT_XTRA_STREAM,
OPT_XTRA_COMPRESS, OPT_XTRA_COMPRESS,
OPT_XTRA_COMPRESS_THREADS, OPT_XTRA_COMPRESS_THREADS,
@ -1216,6 +1220,22 @@ struct my_option xb_server_options[] =
(G_PTR*) &xtrabackup_parallel, (G_PTR*) &xtrabackup_parallel, 0, GET_INT, (G_PTR*) &xtrabackup_parallel, (G_PTR*) &xtrabackup_parallel, 0, GET_INT,
REQUIRED_ARG, 1, 1, INT_MAX, 0, 0, 0}, REQUIRED_ARG, 1, 1, INT_MAX, 0, 0, 0},
{"extended_validation", OPT_XTRA_EXTENDED_VALIDATION,
"Enable extended validation for Innodb data pages during backup phase. "
"Will slow down backup considerably, in case encryption is used. "
"May fail if tables are created during the backup.",
(G_PTR*)&opt_extended_validation,
(G_PTR*)&opt_extended_validation,
0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0},
{"backup_encrypted", OPT_XTRA_BACKUP_ENCRYPTED,
"In --backup, assume that nonzero key_version implies that the page"
" is encrypted. Use --backup --skip-backup-encrypted to allow"
" copying unencrypted that were originally created before MySQL 5.1.48.",
(G_PTR*)&opt_backup_encrypted,
(G_PTR*)&opt_backup_encrypted,
0, GET_BOOL, NO_ARG, TRUE, 0, 0, 0, 0, 0},
{"log", OPT_LOG, "Ignored option for MySQL option compatibility", {"log", OPT_LOG, "Ignored option for MySQL option compatibility",
(G_PTR*) &log_ignored_opt, (G_PTR*) &log_ignored_opt, 0, (G_PTR*) &log_ignored_opt, (G_PTR*) &log_ignored_opt, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -1452,7 +1472,7 @@ debug_sync_point(const char *name)
} }
static std::vector<std::string> tables_for_export; static std::set<std::string> tables_for_export;
static void append_export_table(const char *dbname, const char *tablename, bool is_remote) static void append_export_table(const char *dbname, const char *tablename, bool is_remote)
{ {
@ -1464,7 +1484,15 @@ static void append_export_table(const char *dbname, const char *tablename, bool
char *p=strrchr(buf, '.'); char *p=strrchr(buf, '.');
if (p) *p=0; if (p) *p=0;
tables_for_export.push_back(ut_get_name(0,buf)); std::string name=ut_get_name(0, buf);
/* Strip partition name comment from table name, if any */
if (ends_with(name.c_str(), "*/"))
{
size_t pos= name.rfind("/*");
if (pos != std::string::npos)
name.resize(pos);
}
tables_for_export.insert(name);
} }
} }
@ -1479,9 +1507,10 @@ static int create_bootstrap_file()
fputs("SET NAMES UTF8;\n",f); fputs("SET NAMES UTF8;\n",f);
enumerate_ibd_files(append_export_table); enumerate_ibd_files(append_export_table);
for (size_t i= 0; i < tables_for_export.size(); i++) for (std::set<std::string>::iterator it = tables_for_export.begin();
it != tables_for_export.end(); it++)
{ {
const char *tab = tables_for_export[i].c_str(); const char *tab = it->c_str();
fprintf(f, fprintf(f,
"BEGIN NOT ATOMIC " "BEGIN NOT ATOMIC "
"DECLARE CONTINUE HANDLER FOR NOT FOUND,SQLEXCEPTION BEGIN END;" "DECLARE CONTINUE HANDLER FOR NOT FOUND,SQLEXCEPTION BEGIN END;"
@ -1511,7 +1540,7 @@ static int prepare_export()
snprintf(cmdline, sizeof cmdline, snprintf(cmdline, sizeof cmdline,
IF_WIN("\"","") "\"%s\" --mysqld \"%s\" " IF_WIN("\"","") "\"%s\" --mysqld \"%s\" "
" --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0" " --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu" " --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
" --console --skip-log-error --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""), " --console --skip-log-error --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""),
mariabackup_exe, mariabackup_exe,
@ -1523,7 +1552,7 @@ static int prepare_export()
sprintf(cmdline, sprintf(cmdline,
IF_WIN("\"","") "\"%s\" --mysqld" IF_WIN("\"","") "\"%s\" --mysqld"
" --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0" " --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu" " --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
" --console --log-error= --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""), " --console --log-error= --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""),
mariabackup_exe, mariabackup_exe,
@ -3354,8 +3383,15 @@ xb_load_tablespaces()
return(DB_ERROR); return(DB_ERROR);
} }
err = srv_sys_space.open_or_create(false, false, &sum_of_new_sizes, for (int i= 0; i < 10; i++) {
&flush_lsn); err = srv_sys_space.open_or_create(false, false, &sum_of_new_sizes,
&flush_lsn);
if (err == DB_PAGE_CORRUPTED || err == DB_CORRUPTION) {
my_sleep(1000);
}
else
break;
}
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
msg("mariabackup: Could not open data files.\n"); msg("mariabackup: Could not open data files.\n");
@ -6413,3 +6449,12 @@ static int get_exepath(char *buf, size_t size, const char *argv0)
return my_realpath(buf, argv0, 0); return my_realpath(buf, argv0, 0);
} }
#if defined (__SANITIZE_ADDRESS__) && defined (__linux__)
/* Avoid LeakSanitizer's false positives. */
const char* __asan_default_options()
{
return "detect_leaks=0";
}
#endif

View File

@ -111,6 +111,8 @@ extern my_bool opt_noversioncheck;
extern my_bool opt_no_backup_locks; extern my_bool opt_no_backup_locks;
extern my_bool opt_decompress; extern my_bool opt_decompress;
extern my_bool opt_remove_original; extern my_bool opt_remove_original;
extern my_bool opt_extended_validation;
extern my_bool opt_backup_encrypted;
extern my_bool opt_lock_ddl_per_table; extern my_bool opt_lock_ddl_per_table;
extern char *opt_incremental_history_name; extern char *opt_incremental_history_name;

@ -1 +1 @@
Subproject commit 334964f0711c3fd027f634a239eee57bc912f7ff Subproject commit 34f8887af03d022416dd6593de91d0706e57f46b

View File

@ -13,4 +13,6 @@ wsrep_sst_xtrabackup-v2 \- xtrabackup\-based state snapshot transfer
.SH DESCRIPTION .SH DESCRIPTION
Use: xtrabackup-based state snapshot transfer\. Use: xtrabackup-based state snapshot transfer\.
.PP .PP
Note that the xtrabackup-v2 method is deprecated after version 10\.1, with newer versions you should use mariabackup instead\.
.PP
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/ For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/

View File

@ -13,4 +13,6 @@ wsrep_sst_xtrabackup \- xtrabackup\-based state snapshot transfer
.SH DESCRIPTION .SH DESCRIPTION
Use: xtrabackup-based state snapshot transfer\. Use: xtrabackup-based state snapshot transfer\.
.PP .PP
Note that the xtrabackup method is deprecated after version 10\.1, with newer versions you should use mariabackup instead\.
.PP
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/ For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/

View File

@ -8,3 +8,22 @@ t CREATE TABLE `t` (
`v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t; drop table t;
create temporary table t1 (a int, v int as (a));
alter table t1 change column a b int, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) DEFAULT NULL,
`v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create temporary table t2 (a int, v int as (a));
lock table t2 write;
alter table t2 change column a b int, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
show create table t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) DEFAULT NULL,
`v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1

View File

@ -8,3 +8,14 @@ create table t (a int, v int as (a)) engine=innodb;
alter table t change column a b tinyint, algorithm=inplace; alter table t change column a b tinyint, algorithm=inplace;
show create table t; show create table t;
drop table t; drop table t;
create temporary table t1 (a int, v int as (a));
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t1 change column a b int, algorithm=inplace;
show create table t1;
create temporary table t2 (a int, v int as (a));
lock table t2 write;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t2 change column a b int, algorithm=inplace;
show create table t2;

View File

@ -85,3 +85,13 @@ t1 CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL `c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
create temporary table t1 (
id int not null auto_increment primary key,
f int not null default 0
);
insert into t1 () values ();
alter ignore table t1 add constraint check (f > 0);
Warnings:
Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
alter table t1;
drop table t1;

View File

@ -103,3 +103,15 @@ CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`; ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table
#
create temporary table t1 (
id int not null auto_increment primary key,
f int not null default 0
);
insert into t1 () values ();
alter ignore table t1 add constraint check (f > 0);
alter table t1;
drop table t1;

View File

@ -246,4 +246,28 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL b 263 NULL 2 Using index for group-by 1 SIMPLE t1 range NULL b 263 NULL 2 Using index for group-by
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field
#
CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2),
KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC;
INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go');
explain
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
MIN(t1.v1)
king
drop table t1;
CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1 VALUES ('king'), ('bad');
explain
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
MIN(x.v1)
NULL
drop table t1;
End of 5.5 tests End of 5.5 tests

View File

@ -192,4 +192,23 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field
--echo #
CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2),
KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC;
INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go');
explain
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
drop table t1;
CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1 VALUES ('king'), ('bad');
explain
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
drop table t1;
--echo End of 5.5 tests --echo End of 5.5 tests

View File

@ -3753,6 +3753,24 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
#
SET sql_mode='';
CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED);
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 AS SELECT
IFNULL(SLEEP(0.01), NULL DIV d) AS f0,
IFNULL(SLEEP(0.01), '' DIV d) AS f1
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`f0` decimal(1,0) DEFAULT NULL,
`f1` decimal(1,0) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
SET sql_mode=DEFAULT;
#
# End of 10.3 tests # End of 10.3 tests
# #
# #

View File

@ -611,6 +611,22 @@ CREATE TABLE t1 AS SELECT
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
--echo #
SET sql_mode='';
CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED);
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 AS SELECT
IFNULL(SLEEP(0.01), NULL DIV d) AS f0,
IFNULL(SLEEP(0.01), '' DIV d) AS f1
FROM t1;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
SET sql_mode=DEFAULT;
--echo # --echo #
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #

View File

@ -1285,3 +1285,36 @@ E59B9BE4BA94E585AD 2914501801
E4B883E585ABE4B99D 2374586519 E4B883E585ABE4B99D 2374586519
DROP TABLE t1; DROP TABLE t1;
SET NAMES default; SET NAMES default;
#
# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
#
SET sql_mode='';
CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED);
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 AS SELECT
NULL DIV d AS d_null,
'' DIV d AS d_empty_string,
X'32' DIV d AS d_hex_string2,
X'3232' DIV d AS d_hex_string4,
TIME(0) DIV d AS d_time,
CURRENT_DATE DIV d AS d_date,
CURRENT_TIMESTAMP DIV d AS d_datetime
FROM t1;
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ''
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`d_null` int(1) unsigned DEFAULT NULL,
`d_empty_string` int(1) unsigned DEFAULT NULL,
`d_hex_string2` int(1) unsigned DEFAULT NULL,
`d_hex_string4` int(2) unsigned DEFAULT NULL,
`d_time` int(7) unsigned DEFAULT NULL,
`d_date` int(8) unsigned DEFAULT NULL,
`d_datetime` bigint(14) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
SET sql_mode=DEFAULT;
#
# End of 10.3 tests
#

View File

@ -897,3 +897,28 @@ LOAD DATA INFILE '../../std_data/loaddata_utf8.dat' INTO TABLE t1 CHARACTER SET
SELECT HEX(a), CRC32(a) from t1; SELECT HEX(a), CRC32(a) from t1;
DROP TABLE t1; DROP TABLE t1;
SET NAMES default; SET NAMES default;
--echo #
--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT
--echo #
SET sql_mode='';
CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED);
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 AS SELECT
NULL DIV d AS d_null,
'' DIV d AS d_empty_string,
X'32' DIV d AS d_hex_string2,
X'3232' DIV d AS d_hex_string4,
TIME(0) DIV d AS d_time,
CURRENT_DATE DIV d AS d_date,
CURRENT_TIMESTAMP DIV d AS d_datetime
FROM t1;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
SET sql_mode=DEFAULT;
--echo #
--echo # End of 10.3 tests
--echo #

View File

@ -18,6 +18,13 @@ ERROR 42000: Access denied for user 'test'@'%' to database 'mysql'
connection default; connection default;
drop user test, foo; drop user test, foo;
drop role foo; drop role foo;
CREATE TABLE t1 (a INT);
LOCK TABLE t1 WRITE;
REVOKE EXECUTE ON PROCEDURE sp FROM u;
ERROR HY000: Table 'procs_priv' was not locked with LOCK TABLES
REVOKE PROCESS ON *.* FROM u;
ERROR HY000: Table 'db' was not locked with LOCK TABLES
DROP TABLE t1;
create user u1@h identified with 'mysql_native_password' using 'pwd'; create user u1@h identified with 'mysql_native_password' using 'pwd';
ERROR HY000: Password hash should be a 41-digit hexadecimal number ERROR HY000: Password hash should be a 41-digit hexadecimal number
create user u1@h identified with 'mysql_native_password' using password('pwd'); create user u1@h identified with 'mysql_native_password' using password('pwd');

View File

@ -23,6 +23,17 @@ show grants for foo@'%'; # user
drop user test, foo; drop user test, foo;
drop role foo; drop role foo;
#
# MDEV-17975 Assertion `! is_set()' or `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon REVOKE under LOCK TABLE
#
CREATE TABLE t1 (a INT);
LOCK TABLE t1 WRITE;
--error ER_TABLE_NOT_LOCKED
REVOKE EXECUTE ON PROCEDURE sp FROM u;
--error ER_TABLE_NOT_LOCKED
REVOKE PROCESS ON *.* FROM u;
DROP TABLE t1;
# #
# MDEV-12321 authentication plugin: SET PASSWORD support # MDEV-12321 authentication plugin: SET PASSWORD support
# #

View File

@ -1091,6 +1091,7 @@ from
t0 A, t0 B, t0 C; t0 A, t0 B, t0 C;
drop table t0,t1; drop table t0,t1;
# #
#
# MDEV-10360: Extended keys: index properties depend on index order # MDEV-10360: Extended keys: index properties depend on index order
# #
create table t0 (a int); create table t0 (a int);

View File

@ -725,6 +725,7 @@ if ($rows < 2)
drop table t0,t1; drop table t0,t1;
--echo #
--echo # --echo #
--echo # MDEV-10360: Extended keys: index properties depend on index order --echo # MDEV-10360: Extended keys: index properties depend on index order
--echo # --echo #

View File

@ -4335,12 +4335,12 @@ second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL E
show create event ee1; show create event ee1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci
create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5;
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
show events; show events;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci second ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
drop database second; drop database second;
create database third; create database third;
@ -4348,7 +4348,7 @@ use third;
show events; show events;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci third ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
drop database third; drop database third;
set time_zone = 'SYSTEM'; set time_zone = 'SYSTEM';

View File

@ -1810,7 +1810,7 @@ show create event ee1;
## prove three works (with spaces and tabs on the end) ## prove three works (with spaces and tabs on the end)
# start with one from the previous restore # start with one from the previous restore
create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5;
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
show events; show events;
--exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql --exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql

View File

@ -79,7 +79,6 @@ partition p1 values less than ('2016-10-18'),
partition p2 values less than ('2020-10-19')); partition p2 values less than ('2020-10-19'));
insert t1 values (0, '2000-01-02', 0); insert t1 values (0, '2000-01-02', 0);
insert t1 values (1, '2020-01-02', 10); insert t1 values (1, '2020-01-02', 10);
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CONSTRAINT_FAILED --error ER_CONSTRAINT_FAILED
alter table t1 add check (b in (0, 1)); alter table t1 add check (b in (0, 1));
alter table t1 add check (b in (0, 10)); alter table t1 add check (b in (0, 10));
@ -96,7 +95,6 @@ partition p1 values less than ('2016-10-18'),
partition p2 values less than ('2020-10-19')); partition p2 values less than ('2020-10-19'));
insert t1 values (0, '2000-01-02', 0); insert t1 values (0, '2000-01-02', 0);
insert t1 values (1, '2020-01-02', 10); insert t1 values (1, '2020-01-02', 10);
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CONSTRAINT_FAILED --error ER_CONSTRAINT_FAILED
alter table t1 add check (b in (0, 1)); alter table t1 add check (b in (0, 1));
alter table t1 add check (b in (0, 10)); alter table t1 add check (b in (0, 10));

View File

@ -955,6 +955,26 @@ test_jfg test_jfg11
test_jfg test_jfg12#P#p1000 test_jfg test_jfg12#P#p1000
test_jfg test_jfg12#P#pmax test_jfg test_jfg12#P#pmax
DROP DATABASE test_jfg; DROP DATABASE test_jfg;
create table t1 (a int) engine=innodb;
create table t2 (
b int,
c int,
d bit not null default 0,
v bit as (d) virtual,
key (b,v)
) engine=innodb partition by hash (b);
insert into t1 values (1),(2);
insert into t2 (b,c,d) values (1,1,0),(2,2,0);
explain select t1.* from t1 join t2 on (v = a);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 index NULL b 7 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
select t1.* from t1 join t2 on (v = a);
a
drop table t1, t2;
#
# End of 10.2 tests
#
# #
# MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end()
# #
@ -966,3 +986,6 @@ SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
COUNT(*) COUNT(*)
2 2
DROP TABLE t1; DROP TABLE t1;
#
# End of 10.3 tests
#

View File

@ -1048,6 +1048,27 @@ database_name = 'test_jfg';
DROP DATABASE test_jfg; DROP DATABASE test_jfg;
#
# MDEV-17755 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column
#
create table t1 (a int) engine=innodb;
create table t2 (
b int,
c int,
d bit not null default 0,
v bit as (d) virtual,
key (b,v)
) engine=innodb partition by hash (b);
insert into t1 values (1),(2);
insert into t2 (b,c,d) values (1,1,0),(2,2,0);
explain select t1.* from t1 join t2 on (v = a);
select t1.* from t1 join t2 on (v = a);
drop table t1, t2;
--echo #
--echo # End of 10.2 tests
--echo #
--echo # --echo #
--echo # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() --echo # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end()
--echo # --echo #
@ -1057,3 +1078,7 @@ PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT);
INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL); INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL);
SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #

View File

@ -0,0 +1,73 @@
#
# MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS
#
SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
SELECT a FROM t1 GROUP BY NULL WITH ROLLUP;
a
DROP TABLE t1;
SET sql_mode=DEFAULT;
SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ;
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS
#
SET SQL_MODE='STRICT_ALL_TABLES';
PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
SELECT 'All done';
All done
All done
SET SQL_MODE=DEFAULT;
SET SQL_MODE='STRICT_ALL_TABLES';
PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
DEALLOCATE PREPARE stmt;
SELECT 'All done';
All done
All done
SET SQL_MODE=DEFAULT;
SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
SELECT a FROM t1 GROUP BY a;
a
SELECT * FROM t1;
a
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
SELECT a FROM t1 GROUP BY a;
a
INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;

View File

@ -0,0 +1,66 @@
#
# Tests related to PS returning errors rather than doing successfull execution
#
--echo #
--echo # MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS
--echo #
SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
--error ER_TRUNCATED_WRONG_VALUE
EXECUTE stmt;
SELECT a FROM t1 GROUP BY NULL WITH ROLLUP;
DROP TABLE t1;
SET sql_mode=DEFAULT;
SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
--error ER_TRUNCATED_WRONG_VALUE
EXECUTE stmt;
SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ;
DROP TABLE t1;
SET sql_mode=DEFAULT;
--echo #
--echo # MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS
--echo #
SET SQL_MODE='STRICT_ALL_TABLES';
PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
--error ER_TRUNCATED_WRONG_VALUE
EXECUTE stmt;
--source include/restart_mysqld.inc
SELECT 'All done';
SET SQL_MODE=DEFAULT;
SET SQL_MODE='STRICT_ALL_TABLES';
PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
--error ER_TRUNCATED_WRONG_VALUE
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SELECT 'All done';
SET SQL_MODE=DEFAULT;
SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
--error ER_TRUNCATED_WRONG_VALUE
EXECUTE stmt;
SELECT a FROM t1 GROUP BY a;
SELECT * FROM t1;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
--error ER_TRUNCATED_WRONG_VALUE
EXECUTE stmt;
SELECT a FROM t1 GROUP BY a;
INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;

View File

@ -38,3 +38,21 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 1 SIMPLE t0 ALL NULL NULL NULL NULL 10
1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join)
drop table t0,t1,t2; drop table t0,t1,t2;
CREATE TABLE t1 (
pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
KEY(f1), KEY(f2)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL),
(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL),
(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL),
(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL);
CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB;
INSERT INTO t2 VALUES (4,'q'),(NULL,'j');
SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2
WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 );
pk f1 f2 f3 pk f1 f2 f3 f4 f5
1 4 v NULL 14 1 q NULL 4 q
2 6 v NULL 14 1 q NULL 4 q
3 7 c NULL 14 1 q NULL 4 q
drop table t1,t2;

View File

@ -45,3 +45,20 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
drop table t0,t1,t2; drop table t0,t1,t2;
CREATE TABLE t1 (
pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
KEY(f1), KEY(f2)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL),
(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL),
(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL),
(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL);
CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB;
INSERT INTO t2 VALUES (4,'q'),(NULL,'j');
SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2
WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 );
drop table t1,t2;

View File

@ -170,11 +170,24 @@ flush privileges;
drop database mysqltest_db1; drop database mysqltest_db1;
set global read_only= @start_read_only; set global read_only= @start_read_only;
# #
# MDEV-16987 - ALTER DATABASE possible in read-only mode
#
CREATE USER user1@localhost;
GRANT ALTER ON test1.* TO user1@localhost;
CREATE DATABASE test1;
SET GLOBAL read_only=1;
ALTER DATABASE test1 CHARACTER SET utf8;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
SET GLOBAL read_only=0;
DROP DATABASE test1;
DROP USER user1@localhost;
USE test;
# End of 5.5 tests
#
# WL#5968 Implement START TRANSACTION READ (WRITE|ONLY); # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
# #
# #
# Test interaction with read_only system variable. # Test interaction with read_only system variable.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT); CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
CREATE USER user1; CREATE USER user1;
@ -211,3 +224,4 @@ connection default;
DROP USER user1; DROP USER user1;
SET GLOBAL read_only= 0; SET GLOBAL read_only= 0;
DROP TABLE t1; DROP TABLE t1;
# End of 10.0 tests

View File

@ -283,6 +283,23 @@ flush privileges;
drop database mysqltest_db1; drop database mysqltest_db1;
set global read_only= @start_read_only; set global read_only= @start_read_only;
--echo #
--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode
--echo #
CREATE USER user1@localhost;
GRANT ALTER ON test1.* TO user1@localhost;
CREATE DATABASE test1;
SET GLOBAL read_only=1;
change_user user1;
--error ER_OPTION_PREVENTS_STATEMENT
ALTER DATABASE test1 CHARACTER SET utf8;
change_user root;
SET GLOBAL read_only=0;
DROP DATABASE test1;
DROP USER user1@localhost;
USE test;
--echo # End of 5.5 tests
--echo # --echo #
--echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY); --echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
@ -291,10 +308,6 @@ set global read_only= @start_read_only;
--echo # --echo #
--echo # Test interaction with read_only system variable. --echo # Test interaction with read_only system variable.
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1(a INT); CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
@ -344,3 +357,5 @@ DROP TABLE t1;
# Wait till all disconnects are completed # Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
--echo # End of 10.0 tests

View File

@ -8708,3 +8708,38 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
DROP FUNCTION f1; DROP FUNCTION f1;
#
# MDEV-16036: Debug assertion failed in resignal on create
# temporary table
#
set @save_sql_mode= @@sql_mode;
set sql_mode='ORACLE';
CREATE or replace procedure p4()
AS
CONTINUE HANDLER FOR SQLWARNING
BEGIN
NULL;
END;
EXIT HANDLER FOR OTHERS -- SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
SELECT @sqlstate, @errno, @text;
SHOW WARNINGS;
RESIGNAL; -- cause DBG_ASSERT failed
END;
BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL);
END
/
call p4();
call p4();
@sqlstate @errno @text
42S01 1050 Table 't1' already exists
Level Code Message
Note 1050 Table 't1' already exists
Warnings:
Note 1050 Table 't1' already exists
drop procedure p4;
drop table t1;
set @@sql_mode=@save_sql_mode;
# End of 10.3 tests

View File

@ -10239,3 +10239,37 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
DROP FUNCTION f1; DROP FUNCTION f1;
--echo #
--echo # MDEV-16036: Debug assertion failed in resignal on create
--echo # temporary table
--echo #
set @save_sql_mode= @@sql_mode;
set sql_mode='ORACLE';
delimiter /;
CREATE or replace procedure p4()
AS
CONTINUE HANDLER FOR SQLWARNING
BEGIN
NULL;
END;
EXIT HANDLER FOR OTHERS -- SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
SELECT @sqlstate, @errno, @text;
SHOW WARNINGS;
RESIGNAL; -- cause DBG_ASSERT failed
END;
BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL);
END
/
delimiter ;/
call p4();
call p4();
drop procedure p4;
drop table t1;
set @@sql_mode=@save_sql_mode;
--echo # End of 10.3 tests

View File

@ -465,6 +465,20 @@ a b
Hello HL Hello HL
DROP FUNCTION METAPHON; DROP FUNCTION METAPHON;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-15424: Unreasonal SQL Error (1356) on select from view
#
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
create table t1(a int , b int);
insert into t1 values(100, 54), (200, 199);
create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1;
select * from v1;
myfunc_int(max(a) over (order by b) , b)
154
399
drop view v1;
drop function myfunc_int;
drop table t1;
MDEV-15073: Generic UDAF parser code in server for windows functions MDEV-15073: Generic UDAF parser code in server for windows functions

View File

@ -529,6 +529,19 @@ DROP FUNCTION METAPHON;
#SELECT * FROM t1; #SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view
--echo #
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
create table t1(a int , b int);
insert into t1 values(100, 54), (200, 199);
create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1;
select * from v1;
drop view v1;
drop function myfunc_int;
drop table t1;
--echo --echo
--echo MDEV-15073: Generic UDAF parser code in server for windows functions --echo MDEV-15073: Generic UDAF parser code in server for windows functions
--echo --echo

View File

@ -3471,7 +3471,25 @@ MIN(b1) OVER ()
1 1
drop table t1; drop table t1;
# #
# Start of 10.3 tests # MDEV-15424: Unreasonal SQL Error (1356) on select from view
#
create table t1 (id int, n1 int);
insert into t1 values (1,1), (2,1), (3,2), (4,4);
create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1;
explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using temporary
select * from v1;
ifnull(max(n1) over (partition by n1),'aaa')
1
1
2
4
drop table t1;
drop view v1;
#
# End of 10.2 tests
# #
# #
# MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]' # MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]'
@ -3491,6 +3509,9 @@ d x
00:00:02 NULL 00:00:02 NULL
DROP TABLE t1; DROP TABLE t1;
# #
# End of 10.3 tests
#
#
# MDEV-16722: Assertion `type() != NULL_ITEM' failed # MDEV-16722: Assertion `type() != NULL_ITEM' failed
# #
create table t1 (a int); create table t1 (a int);

View File

@ -2229,7 +2229,20 @@ SELECT DISTINCT MIN(b1) OVER () FROM t1;
drop table t1; drop table t1;
--echo # --echo #
--echo # Start of 10.3 tests --echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view
--echo #
create table t1 (id int, n1 int);
insert into t1 values (1,1), (2,1), (3,2), (4,4);
create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1;
explain select * from v1;
select * from v1;
drop table t1;
drop view v1;
--echo #
--echo # End of 10.2 tests
--echo # --echo #
--echo # --echo #
@ -2246,6 +2259,10 @@ INSERT INTO t1 VALUES ('00:00:01'),('00:00:02');
SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1; SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
--echo # --echo #
--echo # MDEV-16722: Assertion `type() != NULL_ITEM' failed --echo # MDEV-16722: Assertion `type() != NULL_ITEM' failed
--echo # --echo #

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,6 +3,7 @@ call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
# Start server with keys2.txt # Start server with keys2.txt
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;

View File

@ -1,6 +1,7 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[15].ibd looks corrupted; key_version=1");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
create table t5 ( create table t5 (
`intcol1` int(32) DEFAULT NULL, `intcol1` int(32) DEFAULT NULL,

View File

@ -1,6 +1,7 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1");
# Start server with keys2.txt # Start server with keys2.txt
CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19; CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19;
CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1; CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1;

View File

@ -13,6 +13,7 @@ call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
--echo # Start server with keys2.txt --echo # Start server with keys2.txt

View File

@ -10,6 +10,7 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[15].ibd looks corrupted; key_version=1");
# Suppression for builds where file_key_management plugin is linked statically # Suppression for builds where file_key_management plugin is linked statically
call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management");

View File

@ -10,6 +10,7 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1");
--echo # Start server with keys2.txt --echo # Start server with keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt

View File

@ -1,4 +1,6 @@
connection node_1; connection node_1;
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
CREATE PROCEDURE p1 () CREATE PROCEDURE p1 ()
BEGIN BEGIN

View File

@ -0,0 +1,204 @@
Performing State Transfer on a server that has been killed and restarted
connection node_1;
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
Killing server ...
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
INSERT INTO t1 VALUES ('node1_committed_during');
INSERT INTO t1 VALUES ('node1_committed_during');
INSERT INTO t1 VALUES ('node1_committed_during');
INSERT INTO t1 VALUES ('node1_committed_during');
COMMIT;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
connection node_2;
Performing --wsrep-recover ...
Starting server ...
Using --wsrep-start-position when starting mysqld ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
INSERT INTO t1 VALUES ('node2_committed_after');
COMMIT;
connection node_1;
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
INSERT INTO t1 VALUES ('node1_to_be_committed_after');
COMMIT;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
INSERT INTO t1 VALUES ('node1_committed_after');
COMMIT;
connection node_1a_galera_st_kill_slave;
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
SELECT COUNT(*) = 35 FROM t1;
COUNT(*) = 35
1
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
COMMIT;
SET AUTOCOMMIT=ON;
connection node_1;
SELECT COUNT(*) = 35 FROM t1;
COUNT(*) = 35
1
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
Performing State Transfer on a server that has been killed and restarted
while a DDL was in progress on it
connection node_1;
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
connection node_2;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
connection node_2;
SET wsrep_sync_wait = 0;
Killing server ...
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (f1) VALUES ('node1_committed_during');
INSERT INTO t1 (f1) VALUES ('node1_committed_during');
INSERT INTO t1 (f1) VALUES ('node1_committed_during');
INSERT INTO t1 (f1) VALUES ('node1_committed_during');
INSERT INTO t1 (f1) VALUES ('node1_committed_during');
COMMIT;
START TRANSACTION;
INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
connection node_2;
Performing --wsrep-recover ...
connection node_2;
Starting server ...
Using --wsrep-start-position when starting mysqld ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (f1) VALUES ('node2_committed_after');
INSERT INTO t1 (f1) VALUES ('node2_committed_after');
INSERT INTO t1 (f1) VALUES ('node2_committed_after');
INSERT INTO t1 (f1) VALUES ('node2_committed_after');
INSERT INTO t1 (f1) VALUES ('node2_committed_after');
COMMIT;
connection node_1;
INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
COMMIT;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (f1) VALUES ('node1_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_committed_after');
INSERT INTO t1 (f1) VALUES ('node1_committed_after');
COMMIT;
connection node_1a_galera_st_kill_slave_ddl;
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
COUNT(*) = 2
1
SELECT COUNT(*) = 35 FROM t1;
COUNT(*) = 35
1
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
COMMIT;
SET AUTOCOMMIT=ON;
connection node_1;
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
COUNT(*) = 2
1
SELECT COUNT(*) = 35 FROM t1;
COUNT(*) = 35
1
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
SET GLOBAL debug_dbug = $debug_orig;

View File

@ -9,4 +9,3 @@ wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore
[mysqld.2] [mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'

View File

@ -8,6 +8,10 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_mariabackup.inc --source include/have_mariabackup.inc
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1 --connection node_1
--let $connection_id = `SELECT CONNECTION_ID()` --let $connection_id = `SELECT CONNECTION_ID()`
@ -94,3 +98,7 @@ DROP TABLE t1;
CALL mtr.add_suppression("gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)"); CALL mtr.add_suppression("gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)");
CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0"); CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0");
--let $node_1=node_1a
--let $node_2=node_2a
--source include/auto_increment_offset_restore.inc

View File

@ -0,0 +1,13 @@
!include ../galera_2nodes.cnf
[mysqld]
wsrep_sst_method=mariabackup
wsrep_sst_auth=root:
innodb_flush_log_at_trx_commit=0
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'

View File

@ -0,0 +1,13 @@
#
# This test performs server kill and IST while innodb_flush_logs_on_trx_commit = 0
# This confirms that IST can properly catch up even in the face of relaxed single-node durability
#
#
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_mariabackup.inc
--source suite/galera/include/galera_st_kill_slave.inc
--source suite/galera/include/galera_st_kill_slave_ddl.inc

View File

@ -7,6 +7,7 @@
--source include/big_test.inc --source include/big_test.inc
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_mariabackup.inc
--source suite/galera/include/galera_st_kill_slave.inc --source suite/galera/include/galera_st_kill_slave.inc
--source suite/galera/include/galera_st_kill_slave_ddl.inc --source suite/galera/include/galera_st_kill_slave_ddl.inc

View File

@ -11,3 +11,4 @@
############################################################################## ##############################################################################
create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails
alter_inplace_perfschema : MDEV-17748 nnodb.alter_inplace_perfschema fails in buildbot with wrong result

View File

@ -0,0 +1,33 @@
# The following is Public Domain / Creative Commons CC0 from
# http://billauer.co.il/blog/2011/05/perl-crc32-crc-xs-module/
sub mycrc32 {
my ($input, $init_value, $polynomial) = @_;
$init_value = 0 unless (defined $init_value);
$polynomial = 0xedb88320 unless (defined $polynomial);
my @lookup_table;
for (my $i=0; $i<256; $i++) {
my $x = $i;
for (my $j=0; $j<8; $j++) {
if ($x & 1) {
$x = ($x >> 1) ^ $polynomial;
} else {
$x = $x >> 1;
}
}
push @lookup_table, $x;
}
my $crc = $init_value ^ 0xffffffff;
foreach my $x (unpack ('C*', $input)) {
$crc = (($crc >> 8) & 0xffffff) ^ $lookup_table[ ($crc ^ $x) & 0xff ];
}
$crc = $crc ^ 0xffffffff;
return $crc;
}

View File

@ -77,7 +77,9 @@ t1_VARCHAR_500_BINARY VARCHAR(500) BINARY,
t1_YEAR_2 YEAR(2), t1_YEAR_2 YEAR(2),
t1_YEAR_4 YEAR(4), t1_YEAR_4 YEAR(4),
t1_CHAR_0 CHAR(0), t1_CHAR_0 CHAR(0),
t1_MYSQL_0 CHAR(0) CHARACTER SET utf8 t1_MYSQL_0 CHAR(0) CHARACTER SET utf8,
t1_VARCHAR_0 VARCHAR(0),
t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8
) ENGINE=InnoDB; ) ENGINE=InnoDB;
Warnings: Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
@ -151,10 +153,12 @@ t1_TINYINT DATA_INT
t1_TINYINT_UNSIGNED DATA_INT UNSIGNED t1_TINYINT_UNSIGNED DATA_INT UNSIGNED
t1_TINYTEXT DATA_BLOB t1_TINYTEXT DATA_BLOB
t1_VARBINARY_100 DATA_BINARY t1_VARBINARY_100 DATA_BINARY
t1_VARCHAR_0 DATA_VARCHAR
t1_VARCHAR_10 DATA_VARCHAR t1_VARCHAR_10 DATA_VARCHAR
t1_VARCHAR_10_BINARY DATA_VARMYSQL t1_VARCHAR_10_BINARY DATA_VARMYSQL
t1_VARCHAR_500 DATA_VARCHAR t1_VARCHAR_500 DATA_VARCHAR
t1_VARCHAR_500_BINARY DATA_VARMYSQL t1_VARCHAR_500_BINARY DATA_VARMYSQL
t1_VARMYSQL_0 DATA_VARMYSQL
t1_YEAR_2 DATA_INT UNSIGNED t1_YEAR_2 DATA_INT UNSIGNED
t1_YEAR_4 DATA_INT UNSIGNED t1_YEAR_4 DATA_INT UNSIGNED
DROP TABLE t1; DROP TABLE t1;
@ -164,3 +168,9 @@ DROP TABLE t1;
CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB; CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (''); INSERT INTO t1 VALUES ('');
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0)
#
CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('');
DROP TABLE t1;

View File

@ -75,3 +75,26 @@ connection default;
ERROR 23000: Duplicate entry '1' for key 'a' ERROR 23000: Duplicate entry '1' for key 'a'
SET DEBUG_SYNC='RESET'; SET DEBUG_SYNC='RESET';
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-17470 Orphan temporary files after interrupted ALTER
# cause InnoDB: Operating system error number 17 and eventual
# fatal error 71
#
CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8);
INSERT INTO t1 SELECT NULL, i FROM t1;
INSERT INTO t1 SELECT NULL, i FROM t1;
INSERT INTO t1 SELECT NULL, i FROM t1;
INSERT INTO t1 SELECT NULL, i FROM t1;
INSERT INTO t1 SELECT NULL, i FROM t1;
LOCK TABLE t1 READ;
connect con1,localhost,root,,test;
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
connection default;
kill query @id;
connection con1;
ERROR 70100: Query execution was interrupted
disconnect con1;
connection default;
UNLOCK TABLES;
DROP TABLE t1;

View File

@ -881,6 +881,27 @@ NAME
a a
b b
DROP TABLE t1; DROP TABLE t1;
# and an MDEV-18041 regression related to indexes prefixes
create table `test` (
`test_old` varchar(255) NOT NULL,
`other` varchar(255) NOT NULL,
PRIMARY KEY (`test_old`,`other`),
UNIQUE KEY uk (`test_old`(100), `other`)
) ENGINE=InnoDB;
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
name pos
test_old 0
other 1
test_old 0
other 1
alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL;
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
name pos
test_new 0
other 1
test_new 0
other 1
drop table `test`;
# #
# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
# DICT_MEM_TABLE_COL_RENAME_LOW # DICT_MEM_TABLE_COL_RENAME_LOW

View File

@ -90,7 +90,9 @@ CREATE TABLE t1
t1_YEAR_2 YEAR(2), t1_YEAR_2 YEAR(2),
t1_YEAR_4 YEAR(4), t1_YEAR_4 YEAR(4),
t1_CHAR_0 CHAR(0), t1_CHAR_0 CHAR(0),
t1_MYSQL_0 CHAR(0) CHARACTER SET utf8 t1_MYSQL_0 CHAR(0) CHARACTER SET utf8,
t1_VARCHAR_0 VARCHAR(0),
t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8
) ENGINE=InnoDB; ) ENGINE=InnoDB;
INSERT INTO t1 () VALUES (); INSERT INTO t1 () VALUES ();
@ -127,3 +129,10 @@ DROP TABLE t1;
CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB; CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (''); INSERT INTO t1 VALUES ('');
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0)
--echo #
CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('');
DROP TABLE t1;

View File

@ -98,5 +98,37 @@ SET DEBUG_SYNC='RESET';
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-17470 Orphan temporary files after interrupted ALTER
--echo # cause InnoDB: Operating system error number 17 and eventual
--echo # fatal error 71
--echo #
CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8);
INSERT INTO t1 SELECT NULL, i FROM t1;
INSERT INTO t1 SELECT NULL, i FROM t1;
INSERT INTO t1 SELECT NULL, i FROM t1;
INSERT INTO t1 SELECT NULL, i FROM t1;
INSERT INTO t1 SELECT NULL, i FROM t1;
LOCK TABLE t1 READ;
--connect (con1,localhost,root,,test)
let $ID= `SELECT @id := CONNECTION_ID()`;
send ALTER TABLE t1 FORCE, ALGORITHM=COPY;
--connection default
let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
source include/wait_condition.inc;
let $ignore= `SELECT @id := $ID`;
kill query @id;
--connection con1
--error ER_QUERY_INTERRUPTED
reap;
--disconnect con1
--connection default
UNLOCK TABLES;
DROP TABLE t1;
# Wait till all disconnects are completed # Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc

View File

@ -545,6 +545,19 @@ SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
WHERE T.NAME='test/t1'; WHERE T.NAME='test/t1';
DROP TABLE t1; DROP TABLE t1;
--echo # and an MDEV-18041 regression related to indexes prefixes
create table `test` (
`test_old` varchar(255) NOT NULL,
`other` varchar(255) NOT NULL,
PRIMARY KEY (`test_old`,`other`),
UNIQUE KEY uk (`test_old`(100), `other`)
) ENGINE=InnoDB;
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL;
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
drop table `test`;
--echo # --echo #
--echo # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN --echo # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN

View File

@ -0,0 +1,6 @@
--innodb-encryption-rotate-key-age=2
--innodb-encryption-threads=4
--innodb-tablespaces-encryption
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
--loose-file-key-management
--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt

View File

@ -0,0 +1,7 @@
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes;
insert into t1(b, c) values("mariadb", "mariabackup");
# Corrupt the table
# xtrabackup backup
FOUND 1 /Database page corruption detected.*/ in backup.log
drop table t1;

View File

@ -0,0 +1,48 @@
source include/have_file_key_management.inc;
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes;
insert into t1(b, c) values("mariadb", "mariabackup");
let $MYSQLD_DATADIR=`select @@datadir`;
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
--source include/shutdown_mysqld.inc
--echo # Corrupt the table
perl;
use strict;
use warnings;
use Fcntl qw(:DEFAULT :seek);
my $ibd_file = $ENV{'t1_IBD'};
my $chunk;
my $page_size = $ENV{'INNODB_PAGE_SIZE'};
sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
sysseek IBD_FILE, $page_size * 3 + 75, SEEK_CUR;
$chunk = '\xAA\xAA\xAA\xAA';
syswrite IBD_FILE, $chunk, 4;
close IBD_FILE;
EOF
--source include/start_mysqld.inc
echo # xtrabackup backup;
--disable_result_log
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
--error 1
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
--enable_result_log
--let SEARCH_PATTERN=Database page corruption detected.*
--let SEARCH_FILE=$backuplog
--source include/search_pattern_in_file.inc
remove_file $backuplog;
drop table t1;
rmdir $targetdir;

View File

@ -1,8 +1,8 @@
call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted."); call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page");
CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes; CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes;
insert into t1 select repeat('a',100); insert into t1 select repeat('a',100);
# Corrupt the table # Corrupt the table
# xtrabackup backup # xtrabackup backup
FOUND 1 /Database page corruption detected/ in backup.log FOUND 1 /Database page corruption detected.*/ in backup.log
drop table t1; drop table t1;

View File

@ -1,12 +1,13 @@
--source include/have_file_key_management.inc --source include/have_file_key_management.inc
--source include/innodb_page_size.inc
call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted."); call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page");
CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes; CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes;
insert into t1 select repeat('a',100); insert into t1 select repeat('a',100);
let $MYSQLD_DATADIR=`select @@datadir`; let MYSQLD_DATADIR=`select @@datadir`;
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd; let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
--source include/shutdown_mysqld.inc --source include/shutdown_mysqld.inc
@ -16,17 +17,29 @@ perl;
use strict; use strict;
use warnings; use warnings;
use Fcntl qw(:DEFAULT :seek); use Fcntl qw(:DEFAULT :seek);
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
my $ibd_file = $ENV{'t1_IBD'}; my $page_size = $ENV{INNODB_PAGE_SIZE};
my $chunk; sysopen IBD_FILE, "$ENV{MYSQLD_DATADIR}/test/t1.ibd", O_RDWR
my $len; || die "Cannot open t1.ibd\n";
sysread(IBD_FILE, $_, 38) || die "Cannot read t1.ibd\n";
my $space = unpack("x[34]N", $_);
sysseek(IBD_FILE, $page_size * 3, SEEK_SET) || die "Cannot seek t1.ibd\n";
sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file"; my $head = pack("Nx[18]", 3); # better to have a valid page number
sysseek IBD_FILE, 16384 * 3, SEEK_CUR; my $body = chr(0) x ($page_size - 38 - 8);
$chunk = '\xAA\xAA\xAA\xAA';
syswrite IBD_FILE, $chunk, 4;
# Calculate innodb_checksum_algorithm=crc32 for the unencrypted page.
# The following bytes are excluded:
# bytes 0..3 (the checksum is stored there)
# bytes 26..37 (encryption key version, post-encryption checksum, tablespace id)
# bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN)
my $polynomial = 0x82f63b78; # CRC-32C
my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
my $page= pack("N",$ck).$head.pack("NNN",1,$ck,$space).$body.pack("Nx[4]",$ck);
die unless syswrite(IBD_FILE, $page, $page_size) == $page_size;
close IBD_FILE; close IBD_FILE;
EOF EOF
@ -38,14 +51,20 @@ let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
--disable_result_log --disable_result_log
--error 1 --error 1
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog; exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --extended-validation --target-dir=$targetdir > $backuplog;
--enable_result_log --enable_result_log
--let SEARCH_PATTERN=Database page corruption detected --let SEARCH_PATTERN=Database page corruption detected.*
--let SEARCH_FILE=$backuplog --let SEARCH_FILE=$backuplog
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
remove_file $backuplog; remove_file $backuplog;
rmdir $targetdir;
# Due to very constructed nature of the "corruption" (faking checksums), the "corruption" won't be found without --extended-validation
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
--enable_result_log
drop table t1; drop table t1;
rmdir $targetdir; rmdir $targetdir;

View File

@ -1,4 +1,8 @@
--innodb-encrypt-log=ON --innodb-encrypt-log=ON
--innodb-tablespaces-encryption
--innodb-encrypt-tables=ON
--innodb-encryption-rotate-key-age=1
--innodb-encryption-threads=4
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO --plugin-load-add=$FILE_KEY_MANAGEMENT_SO
--loose-file-key-management --loose-file-key-management
--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key --loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key

View File

@ -0,0 +1 @@
--innodb --loose-partition

View File

@ -0,0 +1,31 @@
CREATE TABLE t1(i INT) ENGINE INNODB
PARTITION BY RANGE (i)
(PARTITION p1 VALUES LESS THAN (100),
PARTITION p2 VALUES LESS THAN (200),
PARTITION p3 VALUES LESS THAN (300),
PARTITION p4 VALUES LESS THAN (400));
INSERT INTO t1 VALUES (1), (101), (201), (301);
# xtrabackup backup
INSERT INTO t1 VALUES (1), (101), (201), (301);
# xtrabackup prepare
CREATE TABLE t1_placeholder (i INT) ENGINE INNODB;
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
ALTER TABLE t1 EXCHANGE PARTITION p4 WITH TABLE t1_placeholder;
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
ALTER TABLE t1 EXCHANGE PARTITION p3 WITH TABLE t1_placeholder;
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t1_placeholder;
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t1_placeholder;
SELECT * FROM t1;
i
1
101
201
301
DROP TABLE t1;
DROP TABLE t1_placeholder;

View File

@ -0,0 +1,44 @@
#--source include/innodb_page_size.inc
# import partitioned table from table from partial backup
CREATE TABLE t1(i INT) ENGINE INNODB
PARTITION BY RANGE (i)
(PARTITION p1 VALUES LESS THAN (100),
PARTITION p2 VALUES LESS THAN (200),
PARTITION p3 VALUES LESS THAN (300),
PARTITION p4 VALUES LESS THAN (400));
INSERT INTO t1 VALUES (1), (101), (201), (301);
echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.t1" --target-dir=$targetdir;
--enable_result_log
INSERT INTO t1 VALUES (1), (101), (201), (301);
echo # xtrabackup prepare;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir;
--enable_result_log
let $MYSQLD_DATADIR= `select @@datadir`;
CREATE TABLE t1_placeholder (i INT) ENGINE INNODB;
let $i=4;
while($i)
{
eval ALTER TABLE t1_placeholder DISCARD TABLESPACE;
copy_file $targetdir/test/t1#P#p$i.cfg $MYSQLD_DATADIR/test/t1_placeholder.cfg;
copy_file $targetdir/test/t1#P#p$i.ibd $MYSQLD_DATADIR/test/t1_placeholder.ibd;
eval ALTER TABLE t1_placeholder IMPORT TABLESPACE;
eval ALTER TABLE t1 EXCHANGE PARTITION p$i WITH TABLE t1_placeholder;
dec $i;
}
SELECT * FROM t1;
DROP TABLE t1;
DROP TABLE t1_placeholder;
rmdir $targetdir;

View File

@ -0,0 +1,11 @@
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
insert into t1(b, c) values("mariadb", "mariabackup");
InnoDB 0 transactions not purged
# Corrupt the table
# xtrabackup backup
FOUND 1 /Database page corruption detected.*/ in backup.log
drop table t1;
Warnings:
Warning 192 Table test/t1 in file ./test/t1.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.

View File

@ -0,0 +1,50 @@
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
insert into t1(b, c) values("mariadb", "mariabackup");
--source ../innodb/include/wait_all_purged.inc
let $MYSQLD_DATADIR=`select @@datadir`;
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
--source include/shutdown_mysqld.inc
--echo # Corrupt the table
perl;
use strict;
use warnings;
use Fcntl qw(:DEFAULT :seek);
my $ibd_file = $ENV{'t1_IBD'};
my $chunk;
my $page_size = $ENV{'INNODB_PAGE_SIZE'};
sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
sysseek IBD_FILE, 16384 * 3 + 75, SEEK_CUR;
$chunk = '\xAA\xAA\xAA\xAA';
syswrite IBD_FILE, $chunk, 4;
close IBD_FILE;
EOF
--let $restart_parameters= --skip-innodb-buffer-pool-load-at-startup
--source include/start_mysqld.inc
echo # xtrabackup backup;
--disable_result_log
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
--error 1
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
--enable_result_log
--let SEARCH_PATTERN=Database page corruption detected.*
--let SEARCH_FILE=$backuplog
--source include/search_pattern_in_file.inc
remove_file $backuplog;
drop table t1;
rmdir $targetdir;

View File

@ -79,8 +79,25 @@ a
-3 -3
1 1
include/check_slave_no_error.inc include/check_slave_no_error.inc
connection slave;
drop table t1, t2;
connection master; connection master;
DROP TABLE t1, t2; DROP TABLE t1, t2;
connection slave; connection slave;
include/check_slave_no_error.inc
create database d;
create database e;
connection master;
create database d;
create database if not exists e;
connection slave;
include/check_slave_no_error.inc
drop database d;
drop database e;
connection master;
drop database d;
drop database if exists e;
connection slave;
include/check_slave_no_error.inc
SET @@global.slave_exec_mode= @old_slave_exec_mode; SET @@global.slave_exec_mode= @old_slave_exec_mode;
include/rpl_end.inc include/rpl_end.inc

View File

@ -77,9 +77,30 @@ SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a; SELECT * FROM t2 ORDER BY a;
--source include/check_slave_no_error.inc --source include/check_slave_no_error.inc
connection slave;
drop table t1, t2;
connection master; connection master;
DROP TABLE t1, t2; DROP TABLE t1, t2;
sync_slave_with_master; sync_slave_with_master;
--source include/check_slave_no_error.inc
create database d;
create database e;
connection master;
create database d;
create database if not exists e;
sync_slave_with_master;
--source include/check_slave_no_error.inc
drop database d;
drop database e;
connection master;
drop database d;
drop database if exists e;
sync_slave_with_master;
--source include/check_slave_no_error.inc
SET @@global.slave_exec_mode= @old_slave_exec_mode; SET @@global.slave_exec_mode= @old_slave_exec_mode;

View File

@ -42,8 +42,8 @@ b1 b2
0 0 0 0
INSERT INTO t1 (b1,b2) VALUES ('a','b'); INSERT INTO t1 (b1,b2) VALUES ('a','b');
Warnings: Warnings:
Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1 Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`b1` at row 1
Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1 Warning 1366 Incorrect integer value: 'b' for column `test`.`t1`.`b2` at row 1
SELECT b1,b2 FROM t1; SELECT b1,b2 FROM t1;
b1 b2 b1 b2
-1 -2 -1 -2

View File

@ -33,6 +33,10 @@ SET @@global.wsrep_sst_method="xtrabackup-v2";
SELECT @@global.wsrep_sst_method; SELECT @@global.wsrep_sst_method;
@@global.wsrep_sst_method @@global.wsrep_sst_method
xtrabackup-v2 xtrabackup-v2
SET @@global.wsrep_sst_method="mariabackup";
SELECT @@global.wsrep_sst_method;
@@global.wsrep_sst_method
mariabackup
SET @@global.wsrep_sst_method=default; SET @@global.wsrep_sst_method=default;
SELECT @@global.wsrep_sst_method; SELECT @@global.wsrep_sst_method;
@@global.wsrep_sst_method @@global.wsrep_sst_method

View File

@ -23,10 +23,15 @@ SET @@global.wsrep_sst_method=rsync;
SELECT @@global.wsrep_sst_method; SELECT @@global.wsrep_sst_method;
SET @@global.wsrep_sst_method=mysqldump; SET @@global.wsrep_sst_method=mysqldump;
SELECT @@global.wsrep_sst_method; SELECT @@global.wsrep_sst_method;
# The xtrabackup and xtrabackup-v2 methods are obsolete,
# but we can still select them (they will be automatically
# replaced to mariabackup):
SET @@global.wsrep_sst_method=xtrabackup; SET @@global.wsrep_sst_method=xtrabackup;
SELECT @@global.wsrep_sst_method; SELECT @@global.wsrep_sst_method;
SET @@global.wsrep_sst_method="xtrabackup-v2"; SET @@global.wsrep_sst_method="xtrabackup-v2";
SELECT @@global.wsrep_sst_method; SELECT @@global.wsrep_sst_method;
SET @@global.wsrep_sst_method="mariabackup";
SELECT @@global.wsrep_sst_method;
SET @@global.wsrep_sst_method=default; SET @@global.wsrep_sst_method=default;
SELECT @@global.wsrep_sst_method; SELECT @@global.wsrep_sst_method;

View File

@ -16,3 +16,19 @@ select * from vcol_autoinc;
pk v3 pk v3
1 1 1 1
drop table vcol_autoinc; drop table vcol_autoinc;
check table t1 for upgrade;
Table Op Msg_type Msg_text
test.t1 check status OK
flush tables;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`Date` datetime(6) NOT NULL,
`Data` varbinary(2000) NOT NULL,
`a` varchar(100) GENERATED ALWAYS AS (column_get(`Data`,1 as char(100) charset latin1)) VIRTUAL,
PRIMARY KEY (`Date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (to_days(`Date`))
(PARTITION `p20181029` VALUES LESS THAN (737361) ENGINE = MyISAM,
PARTITION `p20181128` VALUES LESS THAN (737391) ENGINE = MyISAM)
drop table t1;

View File

@ -11,3 +11,18 @@ select * from vcol_autoinc;
insert vcol_autoinc (pk) values (1); insert vcol_autoinc (pk) values (1);
select * from vcol_autoinc; select * from vcol_autoinc;
drop table vcol_autoinc; drop table vcol_autoinc;
#
# MDEV-17909 Problem by MariaDB Update 10.1.32 -> 10.2.19 (Incorrect information in file: .frm)
#
source include/have_partition.inc;
copy_file std_data/mdev17909#P#p20181029.MYD $datadir/test/t1#P#p20181029.MYD;
copy_file std_data/mdev17909#P#p20181029.MYI $datadir/test/t1#P#p20181029.MYI;
copy_file std_data/mdev17909#P#p20181128.MYD $datadir/test/t1#P#p20181128.MYD;
copy_file std_data/mdev17909#P#p20181128.MYI $datadir/test/t1#P#p20181128.MYI;
copy_file std_data/mdev17909.frm $datadir/test/t1.frm;
copy_file std_data/mdev17909.par $datadir/test/t1.par;
check table t1 for upgrade;
flush tables;
show create table t1;
drop table t1;

View File

@ -274,8 +274,6 @@ ELSE()
SET(WSREP_SCRIPTS SET(WSREP_SCRIPTS
wsrep_sst_mysqldump wsrep_sst_mysqldump
wsrep_sst_rsync wsrep_sst_rsync
wsrep_sst_xtrabackup
wsrep_sst_xtrabackup-v2
wsrep_sst_mariabackup wsrep_sst_mariabackup
) )
# The following script is sourced from other SST scripts, so it should # The following script is sourced from other SST scripts, so it should

File diff suppressed because it is too large Load Diff

View File

@ -1,692 +0,0 @@
#!/bin/bash -ue
# Copyright (C) 2013 Percona Inc
#
# 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 Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
# MA 02110-1301 USA.
# Optional dependencies and options documented here: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
# Make sure to read that before proceeding!
. $(dirname $0)/wsrep_sst_common
ealgo=""
ekey=""
ekeyfile=""
encrypt=0
nproc=1
ecode=0
XTRABACKUP_PID=""
tcert=""
tpem=""
sockopt=""
progress=""
ttime=0
totime=0
lsn="${WSREP_SST_OPT_LSN}"
incremental=0
ecmd=""
rlimit=""
sfmt="tar"
strmcmd=""
tfmt=""
tcmd=""
rebuild=0
rebuildcmd=""
payload=0
pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p' "
pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE "
uextra=0
if pv --help 2>/dev/null | grep -q FORMAT;then
pvopts+=$pvformat
fi
pcmd="pv $pvopts"
declare -a RC
INNOBACKUPEX_BIN=innobackupex
DATA="${WSREP_SST_OPT_DATA}"
INFO_FILE="xtrabackup_galera_info"
IST_FILE="xtrabackup_ist"
MAGIC_FILE="${DATA}/${INFO_FILE}"
# Setting the path for ss and ip
export PATH="/usr/sbin:/sbin:$PATH"
timeit(){
local stage=$1
shift
local cmd="$@"
local x1 x2 took extcode
if [[ $ttime -eq 1 ]];then
x1=$(date +%s)
wsrep_log_info "Evaluating $cmd"
eval "$cmd"
extcode=$?
x2=$(date +%s)
took=$(( x2-x1 ))
wsrep_log_info "NOTE: $stage took $took seconds"
totime=$(( totime+took ))
else
wsrep_log_info "Evaluating $cmd"
eval "$cmd"
extcode=$?
fi
return $extcode
}
get_keys()
{
if [[ $encrypt -eq 2 ]];then
return
fi
if [[ $encrypt -eq 0 ]];then
if $MY_PRINT_DEFAULTS xtrabackup | grep -q encrypt;then
wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html "
fi
return
fi
if [[ $sfmt == 'tar' ]];then
wsrep_log_info "NOTE: Xtrabackup-based encryption - encrypt=1 - cannot be enabled with tar format"
encrypt=0
return
fi
wsrep_log_info "Xtrabackup based encryption enabled in my.cnf - Supported only from Xtrabackup 2.1.4"
if [[ -z $ealgo ]];then
wsrep_log_error "FATAL: Encryption algorithm empty from my.cnf, bailing out"
exit 3
fi
if [[ -z $ekey && ! -r $ekeyfile ]];then
wsrep_log_error "FATAL: Either key or keyfile must be readable"
exit 3
fi
if [[ -z $ekey ]];then
ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile"
else
ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey"
fi
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
ecmd+=" -d"
fi
}
get_transfer()
{
TSST_PORT=${WSREP_SST_OPT_PORT:-4444}
if [[ $tfmt == 'nc' ]];then
wsrep_check_programs nc
wsrep_log_info "Using netcat as streamer"
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
if nc -h 2>&1 | grep -q ncat;then
# Ncat
tcmd="nc -l ${TSST_PORT}"
elif nc -h 2>&1 | grep -q -- '-d\>';then
# Debian netcat
tcmd="nc -dl ${TSST_PORT}"
else
# traditional netcat
tcmd="nc -l -p ${TSST_PORT}"
fi
else
if nc -h 2>&1 | grep -q ncat;then
# Ncat
tcmd="nc ${REMOTEIP} ${TSST_PORT}"
elif nc -h 2>&1 | grep -q -- '-d\>';then
# Debian netcat
tcmd="nc ${REMOTEIP} ${TSST_PORT}"
else
# traditional netcat
tcmd="nc -q0 ${REMOTEIP} ${TSST_PORT}"
fi
fi
else
tfmt='socat'
wsrep_check_programs socat
wsrep_log_info "Using socat as streamer"
if [[ $encrypt -eq 2 ]] && ! socat -V | grep -q OPENSSL;then
wsrep_log_info "NOTE: socat is not openssl enabled, falling back to plain transfer"
encrypt=0
fi
if [[ $encrypt -eq 2 ]];then
wsrep_log_info "Using openssl based encryption with socat"
if [[ -z $tpem || -z $tcert ]];then
wsrep_log_error "Both PEM and CRT files required"
exit 22
fi
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
wsrep_log_info "Decrypting with PEM $tpem, CA: $tcert"
tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio"
else
wsrep_log_info "Encrypting with PEM $tpem, CA: $tcert"
tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}"
fi
else
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio"
else
tcmd="socat -u stdio TCP:${WSREP_SST_OPT_HOST}:${TSST_PORT}${sockopt}"
fi
fi
fi
}
get_footprint()
{
pushd $WSREP_SST_OPT_DATA 1>/dev/null
payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }')
if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then
# QuickLZ has around 50% compression ratio
# When compression/compaction used, the progress is only an approximate.
payload=$(( payload*1/2 ))
fi
popd 1>/dev/null
pcmd+=" -s $payload"
adjust_progress
}
adjust_progress()
{
if [[ -n $progress && $progress != '1' ]];then
if [[ -e $progress ]];then
pcmd+=" 2>>$progress"
else
pcmd+=" 2>$progress"
fi
elif [[ -z $progress && -n $rlimit ]];then
# When rlimit is non-zero
pcmd="pv -q"
fi
if [[ -n $rlimit && "$WSREP_SST_OPT_ROLE" == "donor" ]];then
wsrep_log_info "Rate-limiting SST to $rlimit"
pcmd+=" -L \$rlimit"
fi
}
read_cnf()
{
sfmt=$(parse_cnf sst streamfmt "tar")
tfmt=$(parse_cnf sst transferfmt "socat")
tcert=$(parse_cnf sst tca "")
tpem=$(parse_cnf sst tcert "")
encrypt=$(parse_cnf sst encrypt 0)
sockopt=$(parse_cnf sst sockopt "")
progress=$(parse_cnf sst progress "")
rebuild=$(parse_cnf sst rebuild 0)
ttime=$(parse_cnf sst time 0)
incremental=$(parse_cnf sst incremental 0)
ealgo=$(parse_cnf xtrabackup encrypt "")
ekey=$(parse_cnf xtrabackup encrypt-key "")
ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "")
# Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
if [[ -z $ealgo ]];then
ealgo=$(parse_cnf sst encrypt-algo "")
ekey=$(parse_cnf sst encrypt-key "")
ekeyfile=$(parse_cnf sst encrypt-key-file "")
fi
rlimit=$(parse_cnf sst rlimit "")
uextra=$(parse_cnf sst use_extra 0)
}
get_stream()
{
if [[ $sfmt == 'xbstream' ]];then
wsrep_log_info "Streaming with xbstream"
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
strmcmd="xbstream -x"
else
strmcmd="xbstream -c \${INFO_FILE} \${IST_FILE}"
fi
else
sfmt="tar"
wsrep_log_info "Streaming with tar"
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
strmcmd="tar xfi - --recursive-unlink -h"
else
strmcmd="tar cf - \${INFO_FILE} \${IST_FILE}"
fi
fi
}
get_proc()
{
set +e
nproc=$(grep -c processor /proc/cpuinfo)
[[ -z $nproc || $nproc -eq 0 ]] && nproc=1
set -e
}
sig_joiner_cleanup()
{
wsrep_log_error "Removing $MAGIC_FILE file due to signal"
rm -f "$MAGIC_FILE"
}
cleanup_joiner()
{
# Since this is invoked just after exit NNN
local estatus=$?
if [[ $estatus -ne 0 ]];then
wsrep_log_error "Cleanup after exit with status:$estatus"
fi
if [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then
wsrep_log_info "Removing the sst_in_progress file"
wsrep_cleanup_progress_file
fi
if [[ -n $progress && -p $progress ]];then
wsrep_log_info "Cleaning up fifo file $progress"
rm $progress
fi
}
check_pid()
{
local pid_file="$1"
[ -r "$pid_file" ] && ps -p $(cat "$pid_file") >/dev/null 2>&1
}
cleanup_donor()
{
# Since this is invoked just after exit NNN
local estatus=$?
if [[ $estatus -ne 0 ]];then
wsrep_log_error "Cleanup after exit with status:$estatus"
fi
if [[ -n $XTRABACKUP_PID ]];then
if check_pid $XTRABACKUP_PID
then
wsrep_log_error "xtrabackup process is still running. Killing... "
kill_xtrabackup
fi
rm -f $XTRABACKUP_PID
fi
rm -f ${DATA}/${IST_FILE}
if [[ -n $progress && -p $progress ]];then
wsrep_log_info "Cleaning up fifo file $progress"
rm $progress
fi
}
kill_xtrabackup()
{
local PID=$(cat $XTRABACKUP_PID)
[ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || :
rm -f "$XTRABACKUP_PID"
}
# waits ~10 seconds for nc to open the port and then reports ready
# (regardless of timeout)
wait_for_listen()
{
local PORT=$1
local ADDR=$2
local MODULE=$3
for i in {1..50}
do
ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break
sleep 0.2
done
if [[ $incremental -eq 1 ]];then
echo "ready ${ADDR}/${MODULE}/$lsn"
else
echo "ready ${ADDR}/${MODULE}"
fi
}
check_extra()
{
local use_socket=1
if [[ $uextra -eq 1 ]];then
if [ $(parse_cnf --mysqld thread-handling) = 'pool-of-threads'];then
local eport=$(parse_cnf --mysqld extra-port)
if [[ -n $eport ]];then
# Xtrabackup works only locally.
# Hence, setting host to 127.0.0.1 unconditionally.
wsrep_log_info "SST through extra_port $eport"
INNOEXTRA+=" --host=127.0.0.1 --port=$eport "
use_socket=0
else
wsrep_log_error "Extra port $eport null, failing"
exit 1
fi
else
wsrep_log_info "Thread pool not set, ignore the option use_extra"
fi
fi
if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then
INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}"
fi
}
wsrep_check_programs "innobackupex"
rm -f "${MAGIC_FILE}"
if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then
wsrep_log_error "Invalid role ${WSREP_SST_OPT_ROLE}"
exit 22
fi
read_cnf
get_stream
get_transfer
INNOEXTRA=""
INNOAPPLY="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log"
INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} \$INNOEXTRA --galera-info --stream=\$sfmt \${TMPDIR} 2>\${DATA}/innobackup.backup.log"
if [ "$WSREP_SST_OPT_ROLE" = "donor" ]
then
trap cleanup_donor EXIT
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]
then
usrst=0
TMPDIR="${TMPDIR:-/tmp}"
if [[ -n "${WSREP_SST_OPT_USER:-}" && "$WSREP_SST_OPT_USER" != "(null)" ]]; then
INNOEXTRA+=" --user=$WSREP_SST_OPT_USER"
usrst=1
fi
if [ -n "${WSREP_SST_OPT_PSWD:-}" ]; then
INNOEXTRA+=" --password=$WSREP_SST_OPT_PSWD"
elif [[ $usrst -eq 1 ]];then
# Empty password, used for testing, debugging etc.
INNOEXTRA+=" --password="
fi
get_keys
if [[ $encrypt -eq 1 ]];then
if [[ -n $ekey ]];then
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey "
else
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile "
fi
fi
if [[ -n $lsn ]];then
INNOEXTRA+=" --incremental --incremental-lsn=$lsn "
fi
check_extra
wsrep_log_info "Streaming the backup to joiner at ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT}"
if [[ -n $progress ]];then
get_footprint
tcmd="$pcmd | $tcmd"
elif [[ -n $rlimit ]];then
adjust_progress
tcmd="$pcmd | $tcmd"
fi
set +e
timeit "Donor-Transfer" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )"
set -e
if [ ${RC[0]} -ne 0 ]; then
wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \
"Check ${DATA}/innobackup.backup.log"
exit 22
elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then
wsrep_log_error "$tcmd finished with error: ${RC[1]}"
exit 22
fi
# innobackupex implicitly writes PID to fixed location in ${TMPDIR}
XTRABACKUP_PID="${TMPDIR}/xtrabackup_pid"
else # BYPASS FOR IST
wsrep_log_info "Bypassing the SST for IST"
echo "continue" # now server can resume updating data
# Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
# (separated by a space)
echo "${WSREP_SST_OPT_GTID} ${WSREP_SST_OPT_GTID_DOMAIN_ID}" > "${MAGIC_FILE}"
echo "1" > "${DATA}/${IST_FILE}"
get_keys
pushd ${DATA} 1>/dev/null
set +e
if [[ $encrypt -eq 1 ]];then
tcmd=" $ecmd | $tcmd"
fi
timeit "Donor-IST-Unencrypted-transfer" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )"
set -e
popd 1>/dev/null
for ecode in "${RC[@]}";do
if [[ $ecode -ne 0 ]];then
wsrep_log_error "Error while streaming data to joiner node: " \
"exit codes: ${RC[@]}"
exit 1
fi
done
fi
echo "done ${WSREP_SST_OPT_GTID}"
wsrep_log_info "Total time on donor: $totime seconds"
elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ]
then
[[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE"
touch $SST_PROGRESS_FILE
if [[ ! -e ${DATA}/ibdata1 ]];then
incremental=0
fi
if [[ $incremental -eq 1 ]];then
wsrep_log_info "Incremental SST enabled"
#lsn=$(/pxc/bin/mysqld $WSREP_SST_OPT_CONF --basedir=/pxc --wsrep-recover 2>&1 | grep -o 'log sequence number .*' | cut -d " " -f 4 | head -1)
lsn=$(grep to_lsn xtrabackup_checkpoints | cut -d= -f2 | tr -d ' ')
wsrep_log_info "Recovered LSN: $lsn"
fi
sencrypted=1
nthreads=1
MODULE="xtrabackup_sst"
# May need xtrabackup_checkpoints later on
rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile
ADDR="${WSREP_SST_OPT_HOST}:${WSREP_SST_OPT_PORT:-4444}"
wait_for_listen ${WSREP_SST_OPT_PORT:-4444} ${ADDR} ${MODULE} &
trap sig_joiner_cleanup HUP PIPE INT TERM
trap cleanup_joiner EXIT
if [[ -n $progress ]];then
adjust_progress
tcmd+=" | $pcmd"
fi
if [[ $incremental -eq 1 ]];then
BDATA=$DATA
DATA=$(mktemp -d)
MAGIC_FILE="${DATA}/${INFO_FILE}"
fi
get_keys
set +e
if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then
strmcmd=" $ecmd | $strmcmd"
fi
pushd ${DATA} 1>/dev/null
timeit "Joiner-Recv-Unencrypted" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )"
popd 1>/dev/null
set -e
if [[ $sfmt == 'xbstream' ]];then
# Special handling till lp:1193240 is fixed"
if [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then
wsrep_log_error "Xbstream failed"
wsrep_log_error "Data directory ${DATA} may not be empty: lp:1193240" \
"Manual intervention required in that case"
exit 32
fi
fi
wait %% # join for wait_for_listen thread
for ecode in "${RC[@]}";do
if [[ $ecode -ne 0 ]];then
wsrep_log_error "Error while getting data from donor node: " \
"exit codes: ${RC[@]}"
exit 32
fi
done
if [ ! -r "${MAGIC_FILE}" ]
then
# this message should cause joiner to abort
wsrep_log_error "xtrabackup process ended without creating '${MAGIC_FILE}'"
wsrep_log_info "Contents of datadir"
wsrep_log_info "$(ls -l ${DATA}/**/*)"
exit 32
fi
if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null
then
wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
exit 32
fi
if [ ! -r "${DATA}/${IST_FILE}" ]
then
wsrep_log_info "Proceeding with SST"
wsrep_log_info "Removing existing ib_logfile files"
if [[ $incremental -ne 1 ]];then
rm -f ${DATA}/ib_logfile*
else
rm -f ${BDATA}/ib_logfile*
fi
get_proc
# Rebuild indexes for compact backups
if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then
wsrep_log_info "Index compaction detected"
rebuild=1
fi
if [[ $rebuild -eq 1 ]];then
nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc)
wsrep_log_info "Rebuilding during prepare with $nthreads threads"
rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads"
fi
if test -n "$(find ${DATA} -maxdepth 1 -type f -name '*.qp' -print -quit)";then
wsrep_log_info "Compressed qpress files found"
if ! command -v qpress >/dev/null;then
wsrep_log_error "qpress not found in path: $PATH"
exit 22
fi
if [[ -n $progress ]] && pv --help | grep -q 'line-mode';then
count=$(find ${DATA} -type f -name '*.qp' | wc -l)
count=$(( count*2 ))
if pv --help | grep -q FORMAT;then
pvopts="-f -s $count -l -N Decompression -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'"
else
pvopts="-f -s $count -l -N Decompression"
fi
pcmd="pv $pvopts"
adjust_progress
dcmd="$pcmd | xargs -n 2 qpress -T${nproc}d"
else
dcmd="xargs -n 2 qpress -T${nproc}d"
fi
wsrep_log_info "Removing existing ibdata1 file"
rm -f ${DATA}/ibdata1
# Decompress the qpress files
wsrep_log_info "Decompression with $nproc threads"
timeit "Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd"
extcode=$?
if [[ $extcode -eq 0 ]];then
wsrep_log_info "Removing qpress files after decompression"
find ${DATA} -type f -name '*.qp' -delete
if [[ $? -ne 0 ]];then
wsrep_log_error "Something went wrong with deletion of qpress files. Investigate"
fi
else
wsrep_log_error "Decompression failed. Exit code: $extcode"
exit 22
fi
fi
if [[ $incremental -eq 1 ]];then
# Added --ibbackup=xtrabackup_55 because it fails otherwise citing connection issues.
INNOAPPLY="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} \
--ibbackup=xtrabackup_55 --apply-log $rebuildcmd --redo-only $BDATA --incremental-dir=${DATA} &>>${BDATA}/innobackup.prepare.log"
fi
wsrep_log_info "Preparing the backup at ${DATA}"
timeit "Xtrabackup prepare stage" "$INNOAPPLY"
if [[ $incremental -eq 1 ]];then
wsrep_log_info "Cleaning up ${DATA} after incremental SST"
[[ -d ${DATA} ]] && rm -rf ${DATA}
DATA=$BDATA
fi
if [ $? -ne 0 ];
then
wsrep_log_error "${INNOBACKUPEX_BIN} finished with errors. Check ${DATA}/innobackup.prepare.log"
exit 22
fi
else
wsrep_log_info "${IST_FILE} received from donor: Running IST"
fi
if [[ ! -r ${MAGIC_FILE} ]];then
wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable"
exit 2
fi
cat "${MAGIC_FILE}" # Output : UUID:seqno wsrep_gtid_domain_id
wsrep_log_info "Total time on joiner: $totime seconds"
fi
exit 0

View File

@ -114,7 +114,7 @@ int ha_sequence::open(const char *name, int mode, uint flags)
if (unlikely((error= table->s->sequence->read_initial_values(table)))) if (unlikely((error= table->s->sequence->read_initial_values(table))))
file->ha_close(); file->ha_close();
} }
else else if (!table->s->tmp_table)
table->m_needs_reopen= true; table->m_needs_reopen= true;
/* /*

View File

@ -430,6 +430,12 @@ enum enum_alter_inplace_result {
#define HA_KEY_NULL_LENGTH 1 #define HA_KEY_NULL_LENGTH 1
#define HA_KEY_BLOB_LENGTH 2 #define HA_KEY_BLOB_LENGTH 2
/* Maximum length of any index lookup key, in bytes */
#define MAX_KEY_LENGTH (MAX_DATA_LENGTH_FOR_KEY \
+(MAX_REF_PARTS \
*(HA_KEY_NULL_LENGTH + HA_KEY_BLOB_LENGTH)))
#define HA_LEX_CREATE_TMP_TABLE 1U #define HA_LEX_CREATE_TMP_TABLE 1U
#define HA_CREATE_TMP_ALTER 8U #define HA_CREATE_TMP_ALTER 8U
#define HA_LEX_CREATE_SEQUENCE 16U #define HA_LEX_CREATE_SEQUENCE 16U
@ -3801,14 +3807,14 @@ public:
uint max_key_parts() const uint max_key_parts() const
{ return MY_MIN(MAX_REF_PARTS, max_supported_key_parts()); } { return MY_MIN(MAX_REF_PARTS, max_supported_key_parts()); }
uint max_key_length() const uint max_key_length() const
{ return MY_MIN(MAX_KEY_LENGTH, max_supported_key_length()); } { return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_length()); }
uint max_key_part_length() const uint max_key_part_length() const
{ return MY_MIN(MAX_KEY_LENGTH, max_supported_key_part_length()); } { return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_part_length()); }
virtual uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } virtual uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; }
virtual uint max_supported_keys() const { return 0; } virtual uint max_supported_keys() const { return 0; }
virtual uint max_supported_key_parts() const { return MAX_REF_PARTS; } virtual uint max_supported_key_parts() const { return MAX_REF_PARTS; }
virtual uint max_supported_key_length() const { return MAX_KEY_LENGTH; } virtual uint max_supported_key_length() const { return MAX_DATA_LENGTH_FOR_KEY; }
virtual uint max_supported_key_part_length() const { return 255; } virtual uint max_supported_key_part_length() const { return 255; }
virtual uint min_record_length(uint options) const { return 1; } virtual uint min_record_length(uint options) const { return 1; }

View File

@ -8071,7 +8071,9 @@ void Item_ref::print(String *str, enum_query_type query_type)
{ {
if (ref) if (ref)
{ {
if ((*ref)->type() != Item::CACHE_ITEM && ref_type() != VIEW_REF && if ((*ref)->type() != Item::CACHE_ITEM &&
(*ref)->type() != Item::WINDOW_FUNC_ITEM &&
ref_type() != VIEW_REF &&
!table_name && name.str && alias_name_used) !table_name && name.str && alias_name_used)
{ {
THD *thd= current_thd; THD *thd= current_thd;

View File

@ -1615,13 +1615,9 @@ longlong Item_func_int_div::val_int()
bool Item_func_int_div::fix_length_and_dec() bool Item_func_int_div::fix_length_and_dec()
{ {
Item_result argtype= args[0]->result_type(); uint32 prec= args[0]->decimal_int_part();
/* use precision ony for the data type it is applicable for and valid */ set_if_smaller(prec, MY_INT64_NUM_DECIMAL_DIGITS);
uint32 char_length= args[0]->max_char_length() - fix_char_length(prec);
(argtype == DECIMAL_RESULT || argtype == INT_RESULT ?
args[0]->decimals : 0);
fix_char_length(char_length > MY_INT64_NUM_DECIMAL_DIGITS ?
MY_INT64_NUM_DECIMAL_DIGITS : char_length);
maybe_null=1; maybe_null=1;
unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag; unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag;
return false; return false;
@ -3169,6 +3165,8 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
func->maybe_null=1; func->maybe_null=1;
if (with_sum_func_cache) if (with_sum_func_cache)
with_sum_func_cache->join_with_sum_func(item); with_sum_func_cache->join_with_sum_func(item);
func->with_window_func= func->with_window_func ||
item->with_window_func;
func->with_field= func->with_field || item->with_field; func->with_field= func->with_field || item->with_field;
func->with_param= func->with_param || item->with_param; func->with_param= func->with_param || item->with_param;
func->With_subquery_cache::join(item); func->With_subquery_cache::join(item);

View File

@ -1516,12 +1516,12 @@ bool partition_info::check_partition_field_length()
for (i= 0; i < num_part_fields; i++) for (i= 0; i < num_part_fields; i++)
store_length+= get_partition_field_store_length(part_field_array[i]); store_length+= get_partition_field_store_length(part_field_array[i]);
if (store_length > MAX_KEY_LENGTH) if (store_length > MAX_DATA_LENGTH_FOR_KEY)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
store_length= 0; store_length= 0;
for (i= 0; i < num_subpart_fields; i++) for (i= 0; i < num_subpart_fields; i++)
store_length+= get_partition_field_store_length(subpart_field_array[i]); store_length+= get_partition_field_store_length(subpart_field_array[i]);
if (store_length > MAX_KEY_LENGTH) if (store_length > MAX_DATA_LENGTH_FOR_KEY)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }

View File

@ -6614,7 +6614,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list,
{ {
List_iterator <LEX_USER> str_list (user_list); List_iterator <LEX_USER> str_list (user_list);
LEX_USER *Str, *tmp_Str; LEX_USER *Str, *tmp_Str;
bool create_new_users= 0, result; bool create_new_users= 0;
int result;
const char *db_name, *table_name; const char *db_name, *table_name;
DBUG_ENTER("mysql_routine_grant"); DBUG_ENTER("mysql_routine_grant");
@ -7047,7 +7048,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
List_iterator <LEX_USER> str_list (list); List_iterator <LEX_USER> str_list (list);
LEX_USER *Str, *tmp_Str, *proxied_user= NULL; LEX_USER *Str, *tmp_Str, *proxied_user= NULL;
char tmp_db[SAFE_NAME_LEN+1]; char tmp_db[SAFE_NAME_LEN+1];
bool create_new_users=0, result; bool create_new_users=0;
int result;
DBUG_ENTER("mysql_grant"); DBUG_ENTER("mysql_grant");
if (lower_case_table_names && db) if (lower_case_table_names && db)

Some files were not shown because too many files have changed in this diff Show More