1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

Merge 11.4 into 11.8

This commit is contained in:
Marko Mäkelä
2026-03-23 11:57:44 +02:00
264 changed files with 4409 additions and 2443 deletions

View File

@@ -261,6 +261,16 @@ IF (WITH_MSAN)
ENDIF()
ENDIF()
# SANs, with their additional processing workload, should have a basic
# but debuggable optimization unless user specifies otherwise.
IF((WITH_ASAN OR WITH_UBSAN OR WITH_TSAN OR WITH_MSAN)
AND NOT CMAKE_C_FLAGS MATCHES "-O[0-9sgzf]"
AND NOT CMAKE_CXX_FLAGS MATCHES "-O[0-9sgzf]"
AND NOT CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} MATCHES "-O[0-9sgzf]"
AND NOT CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} MATCHES "-O[0-9sgzf]")
MY_CHECK_AND_SET_COMPILER_FLAG("-Og")
ENDIF()
OPTION(WITH_GPROF "Enable profiling with gprof" OFF)
IF (WITH_GPROF)
MY_CHECK_AND_SET_COMPILER_FLAG("-pg -g -no-pie -fPIC")
@@ -585,9 +595,6 @@ INSTALL_DOCUMENTATION(README.md CREDITS COPYING THIRDPARTY COMPONENT Readme)
IF(UNIX)
INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY COMPONENT Readme)
IF(WITH_WSREP)
INSTALL_DOCUMENTATION(Docs/README-wsrep COMPONENT Readme)
ENDIF()
ENDIF()
INCLUDE(build_depends)

View File

@@ -15,14 +15,16 @@ MariaDB Server has a vibrant community contributing in a wide range of areas. Th
- Contribute towards [documenting MariaDB Server](https://mariadb.com/docs/general-resources/about/readme/contributing-documentation) and its ecosystem by adding new content or improving existing content.
- [Translate](https://mariadb.com/docs/general-resources/about/readme/contributing-documentation) existing documentation.
### Help debug and develop MariaDB
### Help develop MariaDB
-----
- [Report bugs](https://jira.mariadb.org/)
- Test development versions
- Write code to fix bugs or develop new features (see [Getting Started for Developers](https://mariadb.org/getting-started-for-developers)).See also [list of beginner friendly tasks](https://jira.mariadb.org/browse/MDEV-15736?jql=resolution%20%3D%20Unresolved%20AND%20labels%20%3D%20beginner-friendly%20ORDER%20BY%20updated%20DESC)
- Help with code quality control
- Participate in packaging for different Linux distributions
- Coding standards for the main source code can be found in [CODING_STANDARDS.md](CODING_STANDARDS.md).
- Fix bugs or develop new features
- Review code contributions
- Test bug fixes and features
- Participate in packaging for different distributions
Check the [list of beginner friendly tasks](https://jira.mariadb.org/issues/?jql=status%3DConfirmed%20AND%20labels%3Dbeginner-friendly%20ORDER%20BY%20updated%20DESC). Or talk to the [MariaDB developers](#engage-online-with-other-community-members).
See also [Getting Started for Developers](https://mariadb.org/getting-started-for-developers). Coding standards for the main source code can be found in [CODING_STANDARDS.md](CODING_STANDARDS.md).
### Sponsor or donate
---
@@ -34,7 +36,7 @@ You’re very welcome to support MariaDB Server as an individual, or talk your c
- [Events and Conferences page](https://mariadb.org/events/)
- [mariadb.meetup.com](http://mariadb.meetup.com/)
### Live QA for beginner contributors
### Live Q&A for beginner contributors
----
MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip.
From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays, anyone can ask any questions they’d like,
@@ -43,5 +45,5 @@ New contributors can ask questions any time, but we will provide immediate feedb
### Additional resources
----
- [MariaDB Foundation ](https://mariadb.org/)
- [MariaDB Foundation](https://mariadb.org/)
- [MariaDB Documentation](https://mariadb.com/docs/)

View File

@@ -1,485 +0,0 @@
Codership Oy
http://www.codership.com
<info@codership.com>
DISCLAIMER
THIS SOFTWARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL CODERSHIP OY BE HELD LIABLE TO ANY PARTY FOR ANY DAMAGES
RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE.
Trademark Information.
MySQL is a trademark or registered trademark of Oracle and/or its affiliates.
Other trademarks are the property of their respective owners.
Licensing Information.
Please see file COPYING that came with this distribution
Source code can be found at
wsrep API: https://launchpad.net/wsrep
MySQL patch: https://launchpad.net/codership-mysql
ABOUT THIS DOCUMENT
This document covers installation and configuration issues specific to this
wsrep-patched MySQL distribution by Codership. It does not cover the use or
administration of MySQL server per se. The reader is assumed to know how to
install, configure, administer and use standard MySQL server version 5.1.xx.
MYSQL-5.5.x/wsrep-23.x
CONTENTS:
=========
1. WHAT IS WSREP PATCH FOR MYSQL
2. INSTALLATION
3. FIRST TIME SETUP
3.1 CONFIGURATION FILES
3.2 DATABASE PRIVILEGES
3.3 CHECK AND CORRECT FIREWALL SETTINGS
3.4 SELINUX
3.5 APPARMOR
3.6 CONNECT TO CLUSTER
4. UPGRADING FROM MySQL 5.1.x
5. CONFIGURATION OPTIONS
5.1 MANDATORY MYSQL OPTIONS
5.2 WSREP OPTIONS
6. ONLINE SCHEMA UPGRADE
6.1 TOTAL ORDER ISOLATION (TOI)
6.2 ROLLING SCHEMA UPGRADE (RSU)
7. LIMITATIONS
1. WHAT IS WSREP PATCH FOR MYSQL/INNODB
Wsrep API developed by Codership Oy is a modern generic (database-agnostic)
replication API for transactional databases with a goal to make database
replication/logging subsystem completely modular and pluggable. It is developed
with flexibility and completeness in mind to satisfy a broad range of modern
replication scenarios. It is equally suitable for synchronous and asynchronous,
master-slave and multi-master replication.
wsrep stands for Write Set REPlication.
Wsrep patch for MySQL/InnoDB allows MySQL server to load and use various wsrep
API implementations ("wsrep providers") with different qualities of service.
Without wsrep provider MySQL-wsrep server will function like a regular
standalone server.
2. INSTALLATION
In the examples below mysql authentication options are omitted for brevity.
2.1 Download and install mysql-wsrep package.
Download binary package for your Linux distribution from
https://launchpad.net/codership-mysql/
2.1.1 On Debian and Debian-derived distributions.
Upgrade from mysql-server-5.0 to mysql-wsrep is not supported yet, please
upgrade to mysql-server-5.1 first.
If you're installing over an existing mysql installation, mysql-server-wsrep
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
mysql-server-wsrep requires psmisc and mysql-client-5.1.47 (or later).
MySQL 5.1 packages can be found from backports repositories.
For further information about configuring and using Debian or Ubuntu
backports, see:
* http://backports.debian.org
* https://help.ubuntu.com/community/UbuntuBackports
For example, installation of required packages on Debian Lenny:
$ sudo apt-get install psmisc
$ sudo apt-get -t lenny-backports install mysql-client-5.1
Now you should be able to install the mysql-wsrep package:
$ sudo dpkg -i <mysql-server-wsrep DEB>
2.1.2 On CentOS and similar RPM-based distributions.
If you're migrating from existing MySQL installation, there are two variants:
a) If you're already using official MySQL-server-community 5.1.x RPM from
Oracle:
# rpm -e mysql-server
b) If you're upgrading from the stock mysql-5.0.77 on CentOS:
1) Make sure that the following packages are not installed:
# rpm --nodeps --allmatches -e mysql-server mysql-test mysql-bench
2) Install *official* MySQL-shared-compat-5.1.x from
http://dev.mysql.com/downloads/mysql/5.1.html
Actual installation:
# rpm -Uvh <MySQL-server-wsrep RPM>
If this fails due to unsatisfied dependencies, install missing packages
(e.g. yum install perl-DBI) and retry.
Additional packages to consider (if not yet installed):
* galera (multi-master replication provider, https://launchpad.net/galera)
* MySQL-client-community (for connecting to server and mysqldump-based SST)
* rsync (for rsync-based SST)
* mariabackup and nc (for mariabackup-based SST)
2.2 Upgrade system tables.
If you're upgrading a previous MySQL installation, it might be advisable to
upgrade system tables. To do that start mysqld and run mysql_upgrade command.
Consult MySQL documentation in case of errors. Normally they are not critical
and can be ignored unless specific functionality is needed.
3. FIRST TIME SETUP
Unless you're upgrading an already installed mysql-wsrep package, you will need
to set up a few things to prepare the server for operation.
3.1 CONFIGURATION FILES
* Make sure system-wide my.cnf does not bind mysqld to 127.0.0.1. That is, if
you have the following line in [mysqld] section, comment it out:
#bind-address = 127.0.0.1
* 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
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
one of the peers. This requires a privileged MySQL account with access from
the rest of the cluster. Edit /etc/mysql/conf.d/wsrep.cnf and set mysql
login/password pair for SST, for example:
wsrep_sst_auth=wsrep_sst:wspass
* See CONFIGURATION section below about other configuration parameters that you
might want to change at this point.
3.2 DATABASE PRIVILEGES
Restart MySQL server and connect to it as root to grant privileges to SST
account (empty users confuse MySQL authentication matching rules, we need to
delete them too):
$ mysql -e "SET wsrep_on=OFF; DELETE FROM mysql.user WHERE user='';"
$ mysql -e "SET wsrep_on=OFF; GRANT ALL ON *.* TO wsrep_sst@'%' IDENTIFIED BY 'wspass'";
3.3 CHECK AND CORRECT FIREWALL SETTINGS.
MySQL-wsrep server needs to be accessible from other cluster members through
its client listening socket and through wsrep provider socket. See your
distribution and wsrep provider documentation for details. For example on
CentOS you might need to do something along these lines:
# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source <my IP>/24 --destination <my IP>/32 --dport 3306 -j ACCEPT
# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source <my IP>/24 --destination <my IP>/32 --dport 4567 -j ACCEPT
If there is a NAT firewall between the nodes, it must be configured to allow
direct connections between the nodes (e.g. via port forwarding).
3.4 SELINUX
If you have SELinux enabled, it may block mysqld from doing required operations.
You'll need to either disable it or configure to allow mysqld to run external
programs and open listen sockets at unprivileged ports (i.e. things that
an unprivileged user can do). See SELinux documentation about it.
To quickly disable SELinux:
1) run 'setenforce 0' as root.
2) set 'SELINUX=permissive' in /etc/selinux/config
3.5 APPARMOR
AppArmor automatically comes with Ubuntu and may also prevent mysqld to from
opening additional ports or run scripts. See AppArmor documentation about its
configuration. To disable AppArmor for mysqld:
$ cd /etc/apparmor.d/disable/
$ sudo ln -s /etc/apparmor.d/usr.sbin.mysqld
$ sudo service apparmor restart
3.6 CONNECT TO CLUSTER
Now you're ready to connect to cluster by setting wsrep_cluster_address variable
and monitor status of wsrep provider:
mysql> SET GLOBAL wsrep_cluster_address='<cluster address string>';
mysql> SHOW STATUS LIKE 'wsrep%';
4 UPGRADING FROM MySQL 5.1.x
!!! THESE INSTRUCTIONS ARE PRELIMINARY AND INCOMPLETE !!!
1) BEFORE UPGRADE (while running 5.1.x):
- comment out 'wsrep_provider' setting from configuration files
(my.cnf and/or wsrep.cnf)
- If performing a rolling upgrade on a running cluster, set
wsrep_sst_method=mysqldump.
You might also need to configure wsrep_sst_receive_address and
wsrep_sst_auth appropriately. mysqldump is the only way to transfer data
from 5.1.x to 5.5.x reliably.
- remove innodb_plugin settings from configuration files.
2) Perform upgrade as usual:
http://dev.mysql.com/doc/refman/5.5/en/upgrading-from-previous-series.html
Don't forget to run 'mysql_upgrade' command.
3) AFTER UPGRADING individual node:
- uncomment 'wsrep_provider' line in configuration file.
- restart the server and join the cluster.
4) AFTER UPGRADING the whole cluster:
- revert to usual wsrep SST settings if not 'mysqldump'.
5. CONFIGURATION OPTIONS
5.1 MANDATORY MYSQL OPTIONS
binlog_format=ROW
This option is required to use row-level replication as opposed to
statement-level. For performance and consistency considerations don't change
that. As a side effect, binlog, if turned on, can be ROW only. In future this
option won't have special meaning.
innodb_autoinc_lock_mode=2
This is a required parameter. Without it INSERTs into tables with
AUTO_INCREMENT column may fail.
autoinc lock modes 0 and 1 can cause unresolved deadlock, and make
the system unresponsive.
5.2 WSREP OPTIONS
All options are optional except for wsrep_provider, wsrep_cluster_address, and
wsrep_sst_auth.
wsrep_provider=none
A full path to the library that implements WSREP interface. If none is
specified, the server behaves like a regular mysqld.
wsrep_provider_options=
Provider-specific option string. Check wsrep provider documentation or
http://www.codership.com/wiki
wsrep_cluster_address=
Provider-specific cluster address string. This is used to connect a node to
the desired cluster. This option can be given either on mysqld startup or set
during runtime. See wsrep provider documentation for possible values.
wsrep_cluster_name="my_wsrep_cluster"
Logical cluster name, must be the same for all nodes of the cluster.
wsrep_node_address=
An option to explicitly specify the network address of the node in the form
<address>[:port] if autoguessing for some reason does not produce desirable
results (multiple network interfaces, NAT, etc.)
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 passed to the wsrep provider to be used as a base address in its
communications.
wsrep_node_name=
Human readable node name (for easier log reading only). Defaults to hostname.
wsrep_slave_threads=1
The number of threads dedicated to the processing of writesets from other nodes.
For best performance should be few per CPU core.
wsrep_dbug_option
Options for the built-in DBUG library (independent from what MySQL uses).
Empty by default. Not currently in use.
wsrep_debug=0
Enable debug-level logging.
wsrep_convert_LOCK_to_trx=0
Implicitly convert locking sessions into transactions inside mysqld. By
itself it does not mean support for locking sessions, but it prevents the
database from going into logically inconsistent state. Note however, that
loading large database dump with LOCK statements might result in abnormally
large transactions and cause an out-of-memory condition
wsrep_retry_autocommit=1
Retry autocommit queries and single statement transactions should they fail
certification test. This is analogous to rescheduling an autocommit query
should it go into a deadlock with other transactions in the database lock
manager.
wsrep_auto_increment_control=1
Automatically adjust auto_increment_increment and auto_increment_offset
variables based on the number of nodes in the cluster. Significantly reduces
certification conflict rate for INSERTS.
wsrep_drupal_282555_workaround=1
MySQL seems to have an obscure bug when INSERT into table with
AUTO_INCREMENT column with NULL value for that column can fail with a
duplicate key error. When this option is on, it retries such INSERTs.
Required for stable Drupal operation. Documented at:
http://bugs.mysql.com/bug.php?id=41984
http://drupal.org/node/282555
wsrep_causal_reads=0
Enforce strict READ COMMITTED semantics on reads and transactions. May
result in additional latencies. It is a session variable.
wsrep_OSU_method=TOI
Online Schema Upgrade (OSU) can be performed with two alternative methods:
Total Order Isolation (TOI) runs DDL statement in all cluster nodes in
same total order sequence locking the affected table for the duration of the
operation. This may result in the whole cluster being blocked for the
duration of the operation.
Rolling Schema Upgrade (RSU) executes the DDL statement only locally, thus
blocking only one cluster node. During the DDL processing, the node
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
with the cluster to become fully operational again. The DDL statement or
its effects are not replicated, so it is the user's responsibility to manually
perform this operation on each of the nodes.
wsrep_forced_binlog_format=none
Force every transaction to use given binlog format. When this variable is
set to something else than NONE, all transactions will use the given forced
format, regardless of what the client session has specified in binlog_format.
Valid choices for wsrep_forced_binlog_format are: ROW, STATEMENT, MIXED and
special value NONE, meaning that there is no forced binlog format in effect.
This variable was introduced to support STATEMENT format replication during
rolling schema upgrade processing. However, in most cases ROW replication
is valid for asymmetric schema replication.
State snapshot transfer options.
When a new node joins the cluster it has to synchronize its initial state with
the other cluster members by transferring state snapshot from one of them.
The options below govern how this happens and should be set up before attempting
to join or start a cluster.
wsrep_sst_method=rsync
What method to use to copy database state to a newly joined node. Supported
methods:
- mysqldump: slow (except for small datasets) but allows for upgrade
between major MySQL versions or InnoDB features.
- rsync: much faster on large datasets (default).
- rsync_wan: same as rsync but with deltaxfer to minimize network traffic.
- mariabackup: very fast and practically non-blocking SST method based on
mariabackup tool (enhanced version of Percona's xtrabackup).
(for mariabackup to work the following settings must be present in my.cnf
on all nodes:
[mysqld]
wsrep_sst_auth=root:<root password>
datadir=<path to data dir>
[client]
socket=<path to socket>
)
wsrep_sst_receive_address=
Address (hostname:port) at which this node wants to receive state snapshot.
Defaults to mysqld bind address, and if that is not specified (0.0.0.0) -
to the first IP of eth0 + mysqld bind port.
NOTE: check that your firewall allows connections to this address from other
cluster nodes.
wsrep_sst_auth=
Authentication information needed for state transfer. Depends on the state
transfer method. For mysqldump-based SST it is
<mysql_root_user>:<mysql_root_password>
and should be the same on all nodes - it is used to authenticate with both
state snapshot receiver and state snapshot donor.
wsrep_sst_donor=
A name of the node which should serve as state snapshot donor. This allows
controlling which node will serve the state snapshot request. By default the
most suitable node is chosen by the wsrep provider. This is the same as given in
wsrep_node_name.
6. ONLINE SCHEMA UPGRADE
Schema upgrades mean any data definition statements (DDL statements) run
for the database. They change the database structure and are non-
transactional.
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
rolling schema upgrade method. The OSU method choice is done by global
parameter: 'wsrep_OSU_method'.
6.1 Total Order Isolation (TOI)
With earlier releases, DDL processing happened always by Total Order
Isolation (TOI) method. With TOI, the DDL was scheduled to be processed in
same transaction sequencing 'slot' in each cluster node.
The processing is secured by locking the affected table from any other use.
With TOI method, the whole cluster has part of the database locked for the
duration of the DDL processing.
6.2 Rolling Schema Upgrade (RSU)
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
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
the DDL processing is complete, the node applies delayed replication events
and synchronizes back with the cluster.
The DDL can then be executed cluster-wide by running the same DDL statement
for each node in turn. When this rolling schema upgrade proceeds, part of
the cluster will have old schema structure and part of the cluster will have
new schema structure.
7. LIMITATIONS
1) Currently replication works only with InnoDB storage engine. Any writes to
tables of other types, including system (mysql.*) tables are not replicated.
However, DDL statements are replicated in statement level, and changes
to mysql.* tables will get replicated that way.
So, you can safely issue: CREATE USER...,
but issuing: INSERT INTO mysql.user..., will not be replicated.
2) DELETE operation is unsupported on tables without primary key. Also rows in
tables without primary key may appear in different order on different nodes.
As a result SELECT...LIMIT... may return slightly different sets.
3) Unsupported queries:
* LOCK/UNLOCK TABLES cannot be supported in multi-master setups.
* lock functions (GET_LOCK(), RELEASE_LOCK()... )
4) Query log cannot be directed to a table. If you enable query logging,
you must forward the log to a file:
log_output = FILE
Use general_log and general_log_file to choose query logging and the
log file name
5) Maximum allowed transaction size is defined by wsrep_max_ws_rows and
wsrep_max_ws_size. Anything bigger (e.g. huge LOAD DATA) will be rejected.
6) Due to cluster level optimistic concurrency control, transaction issuing
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
of them can successfully commit. The failing one will be aborted.
For cluster level aborts, MySQL/galera cluster gives back deadlock error.
code (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)).
7) XA transactions can not be supported due to possible rollback on commit.

View File

@@ -1458,13 +1458,25 @@ int main(int argc,char *argv[])
if (verbose)
tee_fprintf(stdout, "Reading history-file %s\n",histfile);
read_history(histfile);
if (!(histfile_tmp= (char*) my_malloc(PSI_NOT_INSTRUMENTED,
strlen(histfile) + 5, MYF(MY_WME))))
{
fprintf(stderr, "Couldn't allocate memory for temp histfile!\n");
exit(1);
/* Extra space for the suffix appended to histfile:
"." - separator (sizeof = 2, includes NUL)
+ PID - up to 20 digits (ULONG_MAX = 18446744073709551615)
+ ".TMP"- extension (sizeof = 5, includes NUL, doubles
as the string NUL terminator)
sizeof(".") and sizeof(".TMP") each carry a NUL, so the sum
over-allocates by one byte, which is intentional. */
size_t hlen= strlen(histfile) + sizeof(".") + 20 + sizeof(".TMP");
if (!(histfile_tmp= (char*) my_malloc(PSI_NOT_INSTRUMENTED, hlen, MYF(MY_WME))))
{
fprintf(stderr, "Couldn't allocate memory for temp histfile!\n");
exit(1);
}
/* Include PID in name to avoid rename collision when concurrent sessions exit. */
/* pid_t is signed but getpid() always returns a non-negative value (POSIX). */
snprintf(histfile_tmp, hlen, "%s.%lu.TMP", histfile,
(unsigned long) getpid());
}
sprintf(histfile_tmp, "%s.TMP", histfile);
}
}

View File

@@ -1073,7 +1073,7 @@ static void __attribute__((noinline)) print_result()
continue;
}
if (status && changed)
printf("%-50s %s", row[0], row[3]);
printf("%-50s %s\n", row[0], row[3]);
else if (!status && changed)
{
/*
@@ -1086,16 +1086,16 @@ static void __attribute__((noinline)) print_result()
*/
if (!strcmp(row[2],"error") && strstr(row[3],"REPAIR "))
{
printf("%-50s %s", row[0], "Needs upgrade with REPAIR");
printf("%-50s %s\n", row[0], "Needs upgrade with REPAIR");
array4repair= strstr(row[3], "VIEW") ? &views4repair : &tables4repair;
}
else if (!strcmp(row[2],"error") && strstr(row[3],"ALTER TABLE"))
{
printf("%-50s %s", row[0], "Needs upgrade with ALTER TABLE FORCE");
printf("%-50s %s\n", row[0], "Needs upgrade with ALTER TABLE FORCE");
array4repair= &tables4rebuild;
}
else
printf("%s\n%-9s: %s", row[0], row[2], row[3]);
printf("%s\n%-9s: %s\n", row[0], row[2], row[3]);
if (strcmp(row[2],"note"))
{
found_error=1;
@@ -1104,9 +1104,8 @@ static void __attribute__((noinline)) print_result()
}
}
else
printf("%-9s: %s", row[2], row[3]);
printf("%-9s: %s\n", row[2], row[3]);
strmov(prev, row[0]);
putchar('\n');
}
/* add the last table to be repaired to the list */
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR)

View File

@@ -221,5 +221,3 @@ include(${_SCRIPT_DIR}/WindowsCache.cmake)
# this is out of place, not really a system check
set(FN_NO_CASE_SENSE 1)
set(USE_SYMDIR 1)
set(HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT 1)

View File

@@ -446,11 +446,6 @@
/* This should mean case insensitive file system */
#cmakedefine FN_NO_CASE_SENSE 1
/* Whether an anonymous private mapping is unaccessible after
madvise(MADV_DONTNEED) or madvise(MADV_FREE) or similar has been invoked;
this is the case with Microsoft Windows VirtualFree(MEM_DECOMMIT) */
#cmakedefine HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT 1
#cmakedefine HAVE_CHARSET_armscii8 1
#cmakedefine HAVE_CHARSET_ascii 1
#cmakedefine HAVE_CHARSET_big5 1

View File

@@ -59,8 +59,10 @@ bind-address = 127.0.0.1
# journald.
# Enable this if you want to have error logging into a separate file
#log_error = /var/log/mysql/error.log
# Enable the slow query log to see queries with especially long duration
#log_slow_query_file = /var/log/mysql/mariadb-slow.log
#slow_query_log = 1
#log_slow_query_time = 10
#log_slow_verbosity = query_plan,explain
#log-queries-not-using-indexes

1
debian/control vendored
View File

@@ -18,7 +18,6 @@ Build-Depends: bison,
libboost-dev,
libboost-filesystem-dev [amd64 arm64],
libboost-regex-dev [amd64 arm64],
libboost-system-dev [amd64 arm64],
libboost-thread-dev [amd64 arm64],
libbz2-dev,
libcrack2-dev (>= 2.9.0),

View File

@@ -3,8 +3,8 @@
set -e
# Install Mroonga
mariadb --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/install.sql || true
mariadb --defaults-file=/etc/mysql/debian.cnf < /usr/share/mariadb/mroonga/install.sql || true
# Always exit with success instead of leaving dpkg in a broken state
#DEBHELPER#
#DEBHELPER#

View File

@@ -136,6 +136,7 @@ local_open(ds_ctxt_t *ctxt, const char *path,
local_file = (ds_local_file_t *) (file + 1);
local_file->fd = fd;
posix_fadvise(local_file->fd, 0, 0, POSIX_FADV_DONTNEED);
local_file->init_ibd_done = 0;
local_file->is_ibd = (path_len > 5) && !strcmp(fullpath + path_len - 5, ".ibd");
local_file->compressed = 0;
@@ -166,9 +167,7 @@ static int write_compressed(File fd, uchar *data, size_t len, size_t pagesize)
size_t n_bytes = MY_MIN(pagesize, len - written);
size_t datasize= trim_binary_zeros(ptr,n_bytes);
if (datasize > 0) {
if (!my_write(fd, ptr, datasize, MYF(MY_WME | MY_NABP)))
posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
else
if (my_write(fd, ptr, datasize, MYF(MY_WME | MY_NABP)))
return 1;
}
if (datasize < n_bytes) {
@@ -242,11 +241,10 @@ local_write(ds_file_t *file, const uchar *buf, size_t len)
return write_compressed(fd, b, len, local_file->pagesize);
}
if (!my_write(fd, b , len, MYF(MY_WME | MY_NABP))) {
posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
return 0;
if (my_write(fd, b , len, MYF(MY_WME | MY_NABP))) {
return 1;
}
return 1;
return 0;
}
static

View File

@@ -84,6 +84,7 @@ stdout_open(ds_ctxt_t *ctxt __attribute__((unused)),
#endif
stdout_file->fd = my_fileno(stdout);
posix_fadvise(stdout_file->fd, 0, 0, POSIX_FADV_DONTNEED);
file->path = (char *) stdout_file + sizeof(ds_stdout_file_t);
memcpy(file->path, fullpath, pathlen);
@@ -99,12 +100,11 @@ stdout_write(ds_file_t *file, const uchar *buf, size_t len)
{
File fd = ((ds_stdout_file_t *) file->ptr)->fd;
if (!my_write(fd, buf, len, MYF(MY_WME | MY_NABP))) {
posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
return 0;
if (my_write(fd, buf, len, MYF(MY_WME | MY_NABP))) {
return 1;
}
return 1;
return 0;
}
static

View File

@@ -115,6 +115,7 @@ tmpfile_open(ds_ctxt_t *ctxt, const char *path,
tmp_file->orig_path = (char *) tmp_file + sizeof(ds_tmp_file_t);
tmp_file->fd = fd;
posix_fadvise(tmp_file->fd, 0, 0, POSIX_FADV_DONTNEED);
memcpy(tmp_file->orig_path, path, path_len);
/* Store the real temporary file name in file->path */
@@ -138,12 +139,11 @@ tmpfile_write(ds_file_t *file, const uchar *buf, size_t len)
{
File fd = ((ds_tmp_file_t *) file->ptr)->fd;
if (!my_write(fd, buf, len, MYF(MY_WME | MY_NABP))) {
posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
return 0;
if (my_write(fd, buf, len, MYF(MY_WME | MY_NABP))) {
return 1;
}
return 1;
return 0;
}
static int

View File

@@ -2647,7 +2647,7 @@ static void log_hdr_init()
log_sys.format == log_t::FORMAT_ENC_11
? log_t::FORMAT_ENC_11 : log_t::FORMAT_10_8);
mach_write_to_8(LOG_HEADER_START_LSN + log_hdr_buf,
log_sys.next_checkpoint_lsn);
log_sys.last_checkpoint_lsn);
snprintf(reinterpret_cast<char*>(LOG_HEADER_CREATOR + log_hdr_buf),
16, "Backup %u.%u.%u",
MYSQL_VERSION_ID / 10000, MYSQL_VERSION_ID / 100 % 100,
@@ -2655,7 +2655,7 @@ static void log_hdr_init()
if (log_sys.is_encrypted())
log_crypt_write_header(log_hdr_buf + LOG_HEADER_CREATOR_END);
mach_write_to_4(508 + log_hdr_buf, my_crc32c(0, log_hdr_buf, 508));
mach_write_to_8(log_hdr_buf + 0x1000, log_sys.next_checkpoint_lsn);
mach_write_to_8(log_hdr_buf + 0x1000, log_sys.last_checkpoint_lsn);
mach_write_to_8(log_hdr_buf + 0x1008, recv_sys.lsn);
mach_write_to_4(log_hdr_buf + 0x103c,
my_crc32c(0, log_hdr_buf + 0x1000, 60));
@@ -2687,9 +2687,14 @@ static bool innodb_init()
}
ut_ad(srv_force_recovery <= SRV_FORCE_IGNORE_CORRUPT);
mysql_mutex_lock(&recv_sys.mutex);
ut_ad(recv_no_log_write);
buf_flush_sync();
if (recv_sys.recovery_on)
recv_sys.apply(true);
mysql_mutex_unlock(&recv_sys.mutex);
recv_sys.debug_free();
buf_flush_sync_batch(0, false);
ut_ad(!os_aio_pending_reads());
ut_d(mysql_mutex_lock(&buf_pool.flush_list_mutex));
ut_ad(!buf_pool.get_oldest_modification(0));
@@ -2724,7 +2729,7 @@ static bool innodb_init()
return true;
}
recv_sys.lsn= log_sys.next_checkpoint_lsn=
recv_sys.lsn= log_sys.last_checkpoint_lsn=
log_get_lsn() - SIZE_OF_FILE_CHECKPOINT;
log_sys.set_latest_format(false); // not encrypted
log_hdr_init();
@@ -3631,7 +3636,7 @@ static bool backup_wait_timeout(lsn_t lsn, lsn_t last_lsn)
return true;
msg("Was only able to copy log from " LSN_PF " to " LSN_PF
", not " LSN_PF "; try increasing innodb_log_file_size",
log_sys.next_checkpoint_lsn, last_lsn, lsn);
log_sys.last_checkpoint_lsn.load(), last_lsn, lsn);
return false;
}
@@ -4819,11 +4824,14 @@ static ulong xb_set_max_open_files(rlim_t max_file_limit)
goto end;
}
rlimit.rlim_cur = rlimit.rlim_max = max_file_limit;
rlimit.rlim_cur = max_file_limit;
if (setrlimit(RLIMIT_NOFILE, &rlimit)) {
/* Use original value */
max_file_limit = static_cast<ulong>(old_cur);
msg( "setrlimit failed %d %s limit S: %" PRIu64 " H: %" PRIu64,
errno, strerror(errno), rlimit.rlim_cur, rlimit.rlim_max);
} else {
rlimit.rlim_cur = 0; /* Safety if next call fails */
@@ -4886,9 +4894,9 @@ static bool backup_wait_for_commit_lsn()
/* read the latest checkpoint lsn */
if (recv_sys.find_checkpoint() == DB_SUCCESS && log_sys.is_latest())
{
if (log_sys.next_checkpoint_lsn > lsn)
lsn= log_sys.next_checkpoint_lsn;
metadata_to_lsn= log_sys.next_checkpoint_lsn;
metadata_to_lsn= log_sys.last_checkpoint_lsn;
if (metadata_to_lsn > lsn)
lsn= metadata_to_lsn;
msg("mariabackup: The latest check point (for incremental): '"
LSN_PF "'", metadata_to_lsn);
}
@@ -5531,7 +5539,7 @@ fail:
/* get current checkpoint_lsn */
{
log_sys.latch.wr_lock(SRW_LOCK_CALL);
log_sys.latch.wr_lock();
mysql_mutex_lock(&recv_sys.mutex);
dberr_t err = recv_sys.find_checkpoint();
log_sys.latch.wr_unlock();
@@ -5592,7 +5600,7 @@ fail:
}
/* label it */
recv_sys.file_checkpoint = log_sys.next_checkpoint_lsn;
recv_sys.file_checkpoint = log_sys.last_checkpoint_lsn;
log_hdr_init();
/* Write log header*/
if (ds_write(dst_log_file, log_hdr_buf, 12288)) {
@@ -5623,7 +5631,7 @@ fail:
mysql_mutex_lock(&recv_sys.mutex);
backup_log_parse = recv_sys.get_backup_parser();
recv_sys.lsn = log_sys.next_checkpoint_lsn;
recv_sys.lsn = log_sys.last_checkpoint_lsn;
const bool log_copy_failed = xtrabackup_copy_logfile(true);
@@ -5682,7 +5690,7 @@ fail:
backup_datasinks.destroy();
msg("Redo log (from LSN " LSN_PF " to " LSN_PF ") was copied.",
log_sys.next_checkpoint_lsn, recv_sys.lsn);
log_sys.last_checkpoint_lsn.load(), recv_sys.lsn);
xb_filters_free();
xb_data_files_close();

View File

@@ -28,9 +28,6 @@ SET(HEADERS
mariadb_capi_rename.h
pack.h
my_byteorder.h
byte_order_generic.h
byte_order_generic_x86.h
byte_order_generic_x86_64.h
little_endian.h
big_endian.h
mysql_time.h

View File

@@ -1,96 +0,0 @@
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software 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; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/*
Endianness-independent definitions for architectures other
than the x86 architecture.
*/
#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) |\
((int16) ((int16) (A)[1]) << 8))
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
(((uint32) 255L << 24) | \
(((uint32) (uchar) (A)[2]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[0])) : \
(((uint32) (uchar) (A)[2]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (int32) (((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1]) << 8)) |\
(((uint32) ((uchar) (A)[2]) << 16)) |\
(((uint32) ((uchar) (A)[3]) << 24)))
#define sint8korr(A) (longlong) uint8korr(A)
#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) |\
((uint16) ((uchar) (A)[1]) << 8))
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16))
#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16) |\
(((uint32) ((uchar) (A)[3])) << 24))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16) |\
(((uint32) ((uchar) (A)[3])) << 24)) |\
(((ulonglong) ((uchar) (A)[4])) << 32))
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \
(((uint32) ((uchar) (A)[1])) << 8) | \
(((uint32) ((uchar) (A)[2])) << 16) | \
(((uint32) ((uchar) (A)[3])) << 24)) | \
(((ulonglong) ((uchar) (A)[4])) << 32) | \
(((ulonglong) ((uchar) (A)[5])) << 40))
#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16) |\
(((uint32) ((uchar) (A)[3])) << 24)) |\
(((ulonglong) (((uint32) ((uchar) (A)[4])) |\
(((uint32) ((uchar) (A)[5])) << 8) |\
(((uint32) ((uchar) (A)[6])) << 16) |\
(((uint32) ((uchar) (A)[7])) << 24))) <<\
32))
#define int2store(T,A) do { uint def_temp= (uint) (A) ;\
*((uchar*) (T))= (uchar)(def_temp); \
*((uchar*) (T)+1)=(uchar)((def_temp >> 8)); \
} while(0)
#define int3store(T,A) do { /*lint -save -e734 */\
*((uchar*)(T))=(uchar) ((A));\
*((uchar*) (T)+1)=(uchar) (((A) >> 8));\
*((uchar*)(T)+2)=(uchar) (((A) >> 16)); \
/*lint -restore */} while(0)
#define int4store(T,A) do { *((char *)(T))=(char) ((A));\
*(((char *)(T))+1)=(char) (((A) >> 8));\
*(((char *)(T))+2)=(char) (((A) >> 16));\
*(((char *)(T))+3)=(char) (((A) >> 24));\
} while(0)
#define int5store(T,A) do { *((char *)(T))= (char)((A)); \
*(((char *)(T))+1)= (char)(((A) >> 8)); \
*(((char *)(T))+2)= (char)(((A) >> 16)); \
*(((char *)(T))+3)= (char)(((A) >> 24)); \
*(((char *)(T))+4)= (char)(((A) >> 32)); \
} while(0)
#define int6store(T,A) do { *((char *)(T))= (char)((A)); \
*(((char *)(T))+1)= (char)(((A) >> 8)); \
*(((char *)(T))+2)= (char)(((A) >> 16)); \
*(((char *)(T))+3)= (char)(((A) >> 24)); \
*(((char *)(T))+4)= (char)(((A) >> 32)); \
*(((char *)(T))+5)= (char)(((A) >> 40)); \
} while(0)
#define int8store(T,A) do { uint def_temp= (uint) (A), \
def_temp2= (uint) ((A) >> 32); \
int4store((T),def_temp); \
int4store((T+4),def_temp2);\
} while(0)

View File

@@ -1,89 +0,0 @@
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software 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; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/*
Optimized function-like macros for the x86 architecture (_WIN32 included).
*/
#define sint2korr(A) (*((const int16 *) (A)))
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
(((uint32) 255L << 24) | \
(((uint32) (uchar) (A)[2]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[0])) : \
(((uint32) (uchar) (A)[2]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (*((const long *) (A)))
#define uint2korr(A) (*((const uint16 *) (A)))
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16))
#define uint4korr(A) (*((const uint32 *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16) |\
(((uint32) ((uchar) (A)[3])) << 24)) |\
(((ulonglong) ((uchar) (A)[4])) << 32))
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \
(((uint32) ((uchar) (A)[1])) << 8) | \
(((uint32) ((uchar) (A)[2])) << 16) | \
(((uint32) ((uchar) (A)[3])) << 24)) | \
(((ulonglong) ((uchar) (A)[4])) << 32) | \
(((ulonglong) ((uchar) (A)[5])) << 40))
#define uint8korr(A) (*((const ulonglong *) (A)))
#define sint8korr(A) (*((const longlong *) (A)))
#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
#define int3store(T,A) do { *(T)= (uchar) ((A));\
*(T+1)=(uchar) (((uint) (A) >> 8));\
*(T+2)=(uchar) (((A) >> 16));\
} while (0)
#define int4store(T,A) *((long *) (T))= (long) (A)
#define int5store(T,A) do { *(T)= (uchar)((A));\
*((T)+1)=(uchar) (((A) >> 8));\
*((T)+2)=(uchar) (((A) >> 16));\
*((T)+3)=(uchar) (((A) >> 24));\
*((T)+4)=(uchar) (((A) >> 32));\
} while(0)
#define int6store(T,A) do { *(T)= (uchar)((A)); \
*((T)+1)=(uchar) (((A) >> 8)); \
*((T)+2)=(uchar) (((A) >> 16)); \
*((T)+3)=(uchar) (((A) >> 24)); \
*((T)+4)=(uchar) (((A) >> 32)); \
*((T)+5)=(uchar) (((A) >> 40)); \
} while(0)
#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
typedef union {
double v;
long m[2];
} doubleget_union;
#define doubleget(V,M) \
do { doubleget_union _tmp; \
_tmp.m[0] = *((const long*)(M)); \
_tmp.m[1] = *(((const long*) (M))+1); \
(V) = _tmp.v; } while(0)
#define doublestore(T,V) \
do { *((long *) T) = ((const doubleget_union *)&V)->m[0]; \
*(((long *) T)+1) = ((const doubleget_union *)&V)->m[1]; \
} while (0)
#define float4get(V,M) \
do { *((float *) &(V)) = *((const float*) (M)); } while(0)
#define float8get(V,M) doubleget((V),(M))
#define float4store(V,M) memcpy((uchar*)(V), (uchar*)(&M), sizeof(float))
#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V), sizeof(float))
#define floatget(V,M) memcpy((uchar*)(&V),(uchar*) (M), sizeof(float))
#define float8store(V,M) doublestore((V),(M))

View File

@@ -1,125 +0,0 @@
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software 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; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/*
Optimized function-like macros for the x86 architecture (_WIN32 included).
*/
#define sint2korr(A) (int16) (*((int16 *) (A)))
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
(((uint32) 255L << 24) | \
(((uint32) (uchar) (A)[2]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[0])) : \
(((uint32) (uchar) (A)[2]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (int32) (*((int32 *) (A)))
#define uint2korr(A) (uint16) (*((uint16 *) (A)))
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16))
#define uint4korr(A) (uint32) (*((uint32 *) (A)))
static inline ulonglong uint5korr(const void *p)
{
ulonglong a= *(uint32 *) p;
ulonglong b= *(4 + (uchar *) p);
return a | (b << 32);
}
static inline ulonglong uint6korr(const void *p)
{
ulonglong a= *(uint32 *) p;
ulonglong b= *(uint16 *) (4 + (char *) p);
return a | (b << 32);
}
#define uint8korr(A) (ulonglong) (*((ulonglong *) (A)))
#define sint8korr(A) (longlong) (*((longlong *) (A)))
#define int2store(T,A) do { uchar *pT= (uchar*)(T);\
*((uint16*)(pT))= (uint16) (A);\
} while (0)
#define int3store(T,A) do { *(T)= (uchar) ((A));\
*(T+1)=(uchar) (((uint) (A) >> 8));\
*(T+2)=(uchar) (((A) >> 16));\
} while (0)
#define int4store(T,A) do { uchar *pT= (uchar*)(T);\
*((uint32 *) (pT))= (uint32) (A); \
} while (0)
#define int5store(T,A) do { uchar *pT= (uchar*)(T);\
*((uint32 *) (pT))= (uint32) (A); \
*((pT)+4)=(uchar) (((A) >> 32));\
} while (0)
#define int6store(T,A) do { uchar *pT= (uchar*)(T);\
*((uint32 *) (pT))= (uint32) (A); \
*((uint16*)(pT+4))= (uint16) (A >> 32);\
} while (0)
#define int8store(T,A) do { uchar *pT= (uchar*)(T);\
*((ulonglong *) (pT))= (ulonglong) (A);\
} while(0)
#if defined(__GNUC__)
#define HAVE_mi_uint5korr
#define HAVE_mi_uint6korr
#define HAVE_mi_uint7korr
#define HAVE_mi_uint8korr
/* Read numbers stored in high-bytes-first order */
static inline ulonglong mi_uint5korr(const void *p)
{
ulonglong a= *(uint32 *) p;
ulonglong b= *(4 + (uchar *) p);
ulonglong v= (a | (b << 32)) << 24;
asm ("bswapq %0" : "=r" (v) : "0" (v));
return v;
}
static inline ulonglong mi_uint6korr(const void *p)
{
ulonglong a= *(uint32 *) p;
ulonglong b= *(uint16 *) (4 + (char *) p);
ulonglong v= (a | (b << 32)) << 16;
asm ("bswapq %0" : "=r" (v) : "0" (v));
return v;
}
static inline ulonglong mi_uint7korr(const void *p)
{
ulonglong a= *(uint32 *) p;
ulonglong b= *(uint16 *) (4 + (char *) p);
ulonglong c= *(6 + (uchar *) p);
ulonglong v= (a | (b << 32) | (c << 48)) << 8;
asm ("bswapq %0" : "=r" (v) : "0" (v));
return v;
}
static inline ulonglong mi_uint8korr(const void *p)
{
ulonglong v= *(ulonglong *) p;
asm ("bswapq %0" : "=r" (v) : "0" (v));
return v;
}
#endif

View File

@@ -227,13 +227,14 @@ enum ha_extra_function {
that we are starting an ordered index scan. Needed by Spider
*/
HA_EXTRA_STARTING_ORDERED_INDEX_SCAN,
/** Start writing rows during ALTER TABLE...ALGORITHM=COPY. */
HA_EXTRA_BEGIN_ALTER_COPY,
/** Finish writing rows during ALTER TABLE...ALGORITHM=COPY. */
HA_EXTRA_END_ALTER_COPY,
/** Abort of writing rows during ALTER TABLE..ALGORITHM=COPY or
CREATE..SELCT */
HA_EXTRA_ABORT_ALTER_COPY
/** Start copying in ALTER TABLE...ALGORITHM=COPY or CREATE TABLE..SELECT */
HA_EXTRA_BEGIN_COPY,
/** Start writing rows during ALTER IGNORE TABLE..ALGORITHM=COPY */
HA_EXTRA_BEGIN_ALTER_IGNORE_COPY,
/** Finish HA_EXTRA_BEGIN_COPY or HA_EXTRA_BEGIN_ALTER_IGNORE_COPY */
HA_EXTRA_END_COPY,
/** Abort HA_EXTRA_BEGIN_COPY or HA_EXTRA_BEGIN_ALTER_IGNORE_COPY */
HA_EXTRA_ABORT_COPY
};
/* Compatible option, to be deleted in 6.0 */

View File

@@ -19,32 +19,269 @@
#include <string.h>
/*
Macro for reading 32-bit integer from network byte order (big-endian)
from an unaligned memory location.
Byte-swap helpers.
*/
#define int4net(A) (int32) (((uint32) ((uchar) (A)[3])) | \
(((uint32) ((uchar) (A)[2])) << 8) | \
(((uint32) ((uchar) (A)[1])) << 16) | \
(((uint32) ((uchar) (A)[0])) << 24))
/*
Function-like macros for reading and storing in machine independent
format (low byte first). There are 'korr' (assume 'corrector') variants
for integer types, but 'get' (assume 'getter') for floating point types.
*/
#if (defined(__i386__) || defined(_M_IX86)) && !defined(WITH_UBSAN)
#define MY_BYTE_ORDER_ARCH_OPTIMIZED
#include "byte_order_generic_x86.h"
#elif (defined(__x86_64__) || defined (_M_X64)) && !defined(WITH_UBSAN)
#include "byte_order_generic_x86_64.h"
#ifdef _MSC_VER
# include <stdlib.h> /* _byteswap_* */
# define MY_BSWAP16(x) _byteswap_ushort(x)
# define MY_BSWAP32(x) _byteswap_ulong(x)
# define MY_BSWAP64(x) _byteswap_uint64(x)
#elif defined __GNUC__
# define MY_BSWAP16(x) __builtin_bswap16(x)
# define MY_BSWAP32(x) __builtin_bswap32(x)
# define MY_BSWAP64(x) __builtin_bswap64(x)
#else
#include "byte_order_generic.h"
# error provide byteswap intrinsics
#endif
/*
Function-like macros for reading and storing in machine format from/to
short/long to/from some place in memory V should be a variable (not on
a register) and M a pointer to byte.
Some inline functions to convert between little-endian and host byte order
in the spirit of htons/htonl et al.
*/
static inline uint16 my_letoh16(uint16 x)
{
#ifdef WORDS_BIGENDIAN
return MY_BSWAP16(x);
#else
return x;
#endif
}
static inline uint16 my_betoh16(uint16 x)
{
#ifdef WORDS_BIGENDIAN
return x;
#else
return MY_BSWAP16(x);
#endif
}
static inline uint32 my_letoh32(uint32 x)
{
#ifdef WORDS_BIGENDIAN
return MY_BSWAP32(x);
#else
return x;
#endif
}
static inline uint32 my_betoh32(uint32 x)
{
#ifdef WORDS_BIGENDIAN
return x;
#else
return MY_BSWAP32(x);
#endif
}
static inline uint64 my_letoh64(uint64 x)
{
#ifdef WORDS_BIGENDIAN
return MY_BSWAP64(x);
#else
return x;
#endif
}
static inline uint64 my_betoh64(uint64 x)
{
#ifdef WORDS_BIGENDIAN
return x;
#else
return MY_BSWAP64(x);
#endif
}
#define my_htole16(x) my_letoh16(x)
#define my_htobe16(x) my_betoh16(x)
#define my_htole32(x) my_letoh32(x)
#define my_htobe32(x) my_betoh32(x)
#define my_htole64(x) my_letoh64(x)
#define my_htobe64(x) my_betoh64(x)
/*
Inline functions for reading/storing little endian integers from/to
potentially unaligned memory.
memcpy() is used to avoid unaligned access. On most platforms the compiler
will optimize memcpy to a single instruction.
*/
static inline uint16 uint2korr(const void *p)
{
uint16 ret;
memcpy(&ret, p, 2);
return my_letoh16(ret);
}
static inline uint32 uint4korr(const void *p)
{
uint32 ret;
memcpy(&ret, p, 4);
return my_letoh32(ret);
}
static inline uint64 uint8korr(const void *p)
{
uint64 ret;
memcpy(&ret, p, 8);
return my_letoh64(ret);
}
static inline int16 sint2korr(const void *p)
{
return (int16) uint2korr(p);
}
static inline int32 sint4korr(const void *p)
{
return (int32) uint4korr(p);
}
static inline longlong sint8korr(const void *p)
{
return (longlong) uint8korr(p);
}
static inline void int2store(void *t, ulonglong a)
{
uint16 v= my_htole16((uint16) a);
memcpy(t, &v, 2);
}
static inline void int4store(void *t, ulonglong a)
{
uint32 v= my_htole32((uint32) a);
memcpy(t, &v, 4);
}
static inline void int8store(void *t, ulonglong a)
{
uint64 v= my_htole64((uint64) a);
memcpy(t, &v, 8);
}
/*
Odd-width and sign-extending functions. These use only individual
byte accesses or delegate to the even-width functions above, so they
are correct on any host endianness without further #ifdefs.
*/
static inline uint32 uint3korr(const void *p)
{
return (uint32) uint2korr(p) | ((uint32) ((const uchar *) p)[2] << 16);
}
static inline int32 sint3korr(const void *p)
{
uint32 v = uint3korr(p);
/*
Shift left to move sign bit into MSB position, then arithmetic
right shift to sign-extend back.
*/
return ((int32)(v << 8)) >> 8;
}
static inline ulonglong uint5korr(const void *p)
{
return (ulonglong) uint4korr(p) | ((ulonglong) ((const uchar *) p)[4] << 32);
}
static inline ulonglong uint6korr(const void *p)
{
return (ulonglong) uint4korr(p) |
((ulonglong) uint2korr((const uchar *) p + 4) << 32);
}
static inline void int3store(void *t, ulonglong a)
{
uchar *p= (uchar *) t;
int2store(t, a);
p[2]= (uchar) (a >> 16);
}
static inline void int5store(void *t, ulonglong a)
{
uchar *p= (uchar *) t;
int4store(t, a);
p[4]= (uchar) (a >> 32);
}
static inline void int6store(void *t, ulonglong a)
{
uchar *p= (uchar *) t;
int4store(t, a);
int2store(p + 4, a >> 32);
}
/*
mi_uint*korr: read an N-byte unsigned integer stored in big-endian
order, as used by MyISAM.
Below are optimizations for little-endian architectures.
*/
#ifndef WORDS_BIGENDIAN
#define HAVE_mi_uint5korr
#define HAVE_mi_uint6korr
#define HAVE_mi_uint7korr
#define HAVE_mi_uint8korr
static inline ulonglong mi_uint5korr(const void *p)
{
uint32 lo;
memcpy(&lo, (const uchar *) p + 1, 4);
lo= MY_BSWAP32(lo);
return ((ulonglong) ((const uchar *)p)[0]) << 32 | lo;
}
static inline ulonglong mi_uint6korr(const void *p)
{
uint32 a;
uint16 b;
ulonglong v;
memcpy(&a, p, 4);
memcpy(&b, (const uchar *) p + 4, 2);
v= ((ulonglong) a | ((ulonglong) b << 32)) << 16;
return MY_BSWAP64(v);
}
static inline ulonglong mi_uint7korr(const void *p)
{
uint32 a;
uint16 b;
ulonglong v;
ulonglong c= ((const uchar *)p)[6];
memcpy(&a, p, 4);
memcpy(&b, (const uchar *) p + 4, 2);
v= ((ulonglong)a | ((ulonglong)b << 32) | (c << 48)) << 8;
return MY_BSWAP64(v);
}
static inline ulonglong mi_uint8korr(const void *p)
{
ulonglong ret;
memcpy(&ret, p, 8);
return MY_BSWAP64(ret);
}
#endif /* !WORDS_BIGENDIAN */
/*
Read a 32-bit integer from network byte order (big-endian)
from an unaligned memory location.
*/
static inline int32 int4net(const void *p)
{
int32 ret;
memcpy(&ret, p, 4);
return (int32)my_betoh32(ret);
}
/*
Some macros for reading doubles and floats (clean, do not assume alignment)
These are defined in big_endian.h and little_endian.h
*/
#ifdef WORDS_BIGENDIAN
#include "big_endian.h"

View File

@@ -59,8 +59,8 @@
#define HMT_high()
#endif
#if defined __i386__ || defined __x86_64__ || defined _WIN32
# define HAVE_PAUSE_INSTRUCTION /* added in Intel Pentium 4 */
#if defined __i386__ || defined __x86_64__ || defined _M_IX86 || defined _M_X64
# define HAVE_PAUSE_INSTRUCTION /* no-op repurposed in Intel Pentium 4 */
#endif
#ifdef _WIN32

View File

@@ -24,9 +24,9 @@
extern "C" {
#endif
# ifdef _WIN32
#ifdef _WIN32
char *my_virtual_mem_reserve(size_t *size);
# endif
#endif
char *my_virtual_mem_commit(char *ptr, size_t size);
void my_virtual_mem_decommit(char *ptr, size_t size);
void my_virtual_mem_release(char *ptr, size_t size);

View File

@@ -4503,13 +4503,11 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
max_length
*/
MYSQL_BIND *my_bind, *end;
MYSQL_FIELD *field;
bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count);
for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
field= stmt->fields;
for (my_bind= stmt->bind, end= my_bind + stmt->field_count;
my_bind < end ;
my_bind++, field++)
my_bind++)
{
my_bind->buffer_type= MYSQL_TYPE_NULL;
my_bind->buffer_length=1;

View File

@@ -46,6 +46,8 @@ json_query('{"key1":123, "key1": [1,2,3]}', '$.key1')
select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000))) as exp;
exp
NULL
Warnings:
Warning 4043 Limit of 32 on JSON path depth is reached in argument 2 to function 'json_query' at position 65
select json_array();
json_array()
[]
@@ -680,6 +682,8 @@ JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path)
SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]')
NULL
Warnings:
Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_value'
CREATE TABLE t1 (f INT NOT NULL);
INSERT INTO t1 VALUES (0);
SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
@@ -1474,6 +1478,8 @@ SET COLLATION_CONNECTION= ucs2_unicode_ci;
SELECT JSON_VALUE('["foo"]', '$**[0]') AS f;
f
NULL
Warnings:
Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_value'
SET @@COLLATION_CONNECTION= @old_collation_connection;
#
# MDEV-32587 JSON_VALID fail to validate integer zero in scientific notation
@@ -1786,6 +1792,26 @@ null<=>json_extract('1',json_object(null,'{ }',null,null),'{}')
Warnings:
Warning 4042 Syntax error in JSON path in argument 2 to function 'json_extract' at position 1
# End of 10.6 tests
SELECT json_extract(t.j, '$')
FROM (SELECT json_extract('["a",1]', '$') AS j) AS t;
json_extract(t.j, '$')
["a", 1]
SELECT json_extract(t.j, '$')
FROM (SELECT json_extract('{"key":"value"}', '$') AS j) AS t;
json_extract(t.j, '$')
{"key": "value"}
SELECT json_extract(t.j, '$[0]', '$[1]')
FROM (SELECT json_extract('[{"a":1},{"b":2},{"c":3}]', '$') AS j) AS t;
json_extract(t.j, '$[0]', '$[1]')
[{"a": 1}, {"b": 2}]
SELECT json_extract(t.j, '$')
FROM (SELECT json_extract('{"name":"Ä Ö Ü ß","city":"München"}', '$') AS j) AS t;
json_extract(t.j, '$')
{"name": "Ä Ö Ü ß", "city": "München"}
SELECT json_extract(t.j, '$.name')
FROM (SELECT json_extract('{"name":"日本語テスト","val":[1,2]}', '$') AS j) AS t;
json_extract(t.j, '$.name')
"日本語テスト"
#
# MDEV-35614 JSON_UNQUOTE doesn't work with emojis
#
@@ -2402,6 +2428,8 @@ SET @json= '[
SELECT JSON_VALUE(@json, '$[0][1 to 2].key1');
JSON_VALUE(@json, '$[0][1 to 2].key1')
NULL
Warnings:
Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_value'
SET @json='{
"A": [0,
[1, 2, 3],
@@ -2418,7 +2446,7 @@ SET @json='{
}';
SELECT JSON_QUERY(@json, '$.A[-2][-3 to -1]');
JSON_QUERY(@json, '$.A[-2][-3 to -1]')
NULL
[13, 14]
SET @json= '[
[1, {"key1": "value1"}, 3],
[false, 5, 6],
@@ -2567,6 +2595,8 @@ SET @json1= '[
SELECT JSON_VALUE(@json1, '$[2][1 to 2].key1');
JSON_VALUE(@json1, '$[2][1 to 2].key1')
NULL
Warnings:
Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_value'
SET @json= '[
[1.1, {"key1": "value1"}, 3],
[false, 5, 6],
@@ -2577,9 +2607,13 @@ SET @json= '[
SELECT JSON_VALUE(@json, '$[*][0]');
JSON_VALUE(@json, '$[*][0]')
NULL
Warnings:
Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_value'
SELECT JSON_VALUE(@json, '$[2 to 3][0]');
JSON_VALUE(@json, '$[2 to 3][0]')
NULL
Warnings:
Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_value'
#
# MDEV-28072: JSON_EXTRACT has inconsistent behavior with '0' value in
# json path (when range is used)
@@ -2788,6 +2822,19 @@ S1A1
SELECT JSON_VALUE('{"a":[1,2]}', '$.a[*]');
JSON_VALUE('{"a":[1,2]}', '$.a[*]')
NULL
Warnings:
Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_value'
#
# MDEV-37640: Crash at String::append with json_normalize
#
SELECT ( WITH x AS ( WITH x AS ( SELECT 1.000000 ) SELECT ( REPEAT ( ( json_normalize ( ' -1' ) ) , 357 ) ) x ) SELECT x FROM x WHERE x IN ( x , x ) );
( WITH x AS ( WITH x AS ( SELECT 1.000000 ) SELECT ( REPEAT ( ( json_normalize ( ' -1' ) ) , 357 ) ) x ) SELECT x FROM x WHERE x IN ( x , x ) )
-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0-1.0E0
#
# MDEV-37640: Crash in JSON_KEYS
#
SELECT JSON_SET('{"c":4}', '$.a', 5) AS x HAVING (x IN (JSON_KEYS(x), ','));
x
# End of 10.11 Test
#
# MDEV-32007: JSON_VALUE and JSON_EXTRACT doesn't handle dash (-)
@@ -4997,6 +5044,8 @@ NULL
SELECT JSON_KEY_VALUE('[1,2,3]', '');
JSON_KEY_VALUE('[1,2,3]', '')
NULL
Warnings:
Warning 4041 Unexpected end of JSON path in argument 2 to function 'json_key_value'
SELECT JSON_KEY_VALUE('[1,2,3]', NULL);
JSON_KEY_VALUE('[1,2,3]', NULL)
NULL
@@ -5046,6 +5095,8 @@ k v id
SELECT JSON_KEY_VALUE('[]', '[0]');
JSON_KEY_VALUE('[]', '[0]')
NULL
Warnings:
Warning 4042 Syntax error in JSON path in argument 2 to function 'json_key_value' at position 1
SELECT JSON_KEY_VALUE('[1, 2, 3]', '$[0]');
JSON_KEY_VALUE('[1, 2, 3]', '$[0]')
NULL

View File

@@ -1228,6 +1228,23 @@ select null<=>json_extract('1',json_object(null,'{ }',null,null),'{}');
--echo # End of 10.6 tests
SELECT json_extract(t.j, '$')
FROM (SELECT json_extract('["a",1]', '$') AS j) AS t;
SELECT json_extract(t.j, '$')
FROM (SELECT json_extract('{"key":"value"}', '$') AS j) AS t;
# Multi-path extraction through derived table
SELECT json_extract(t.j, '$[0]', '$[1]')
FROM (SELECT json_extract('[{"a":1},{"b":2},{"c":3}]', '$') AS j) AS t;
# UTF-8 content through derived table
SELECT json_extract(t.j, '$')
FROM (SELECT json_extract('{"name":"Ä Ö Ü ß","city":"München"}', '$') AS j) AS t;
SELECT json_extract(t.j, '$.name')
FROM (SELECT json_extract('{"name":"日本語テスト","val":[1,2]}', '$') AS j) AS t;
--echo #
--echo # MDEV-35614 JSON_UNQUOTE doesn't work with emojis
--echo #
@@ -2016,6 +2033,18 @@ COLUMNS(NAME VARCHAR(30) PATH '$.NAME')) AS t_sz;
SELECT JSON_VALUE('{"a":[1,2]}', '$.a[*]');
--echo #
--echo # MDEV-37640: Crash at String::append with json_normalize
--echo #
SELECT ( WITH x AS ( WITH x AS ( SELECT 1.000000 ) SELECT ( REPEAT ( ( json_normalize ( ' -1' ) ) , 357 ) ) x ) SELECT x FROM x WHERE x IN ( x , x ) );
--echo #
--echo # MDEV-37640: Crash in JSON_KEYS
--echo #
SELECT JSON_SET('{"c":4}', '$.a', 5) AS x HAVING (x IN (JSON_KEYS(x), ','));
--echo # End of 10.11 Test
--echo #

View File

@@ -389,7 +389,7 @@ result
MULTIPOINT(7 5,7 5.142857142857142,5.899999999999998 5.300000000000001,5.799999999999997 5.600000000000001,3 7)
SELECT ST_CROSSES( GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 4, 2 5, 3 5) ) ') , POLYGONFROMTEXT(' POLYGON((2 4,3 4,3 5,2 5,2 4)) ')) as result;
result
0
NULL
SELECT ST_WITHIN( POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 2 0 , 1 0, 2 4 , 0 4, 0 5) ) ') , POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 1 4 , 1 3 , 3 3 , 3 0 , 0 0 , 0 5), ( 1 1 , 2 1 , 2 2 , 1 2 , 1 1 ) ) ') ) as result;
result
0
@@ -868,3 +868,15 @@ ST_INTERSECTION(
ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 4,3 5,2 5,2 7,5 4,3 4),(5 4,7.4 7,8 7,8 4,5 4))) ') )) as V;
V
3
#
# MDEV-36058 ST_CROSSES returns 0 instead of NULL.
#
SELECT ST_CROSSES( ST_GEOMFROMTEXT('point(1 1)'), st_geomfromtext('point(1 1)') ) a;
a
NULL
SELECT ST_CROSSES( ST_GEOMFROMTEXT('POLYGON ((59 18,67 18,67 13,59 13,59 18)) '), st_geomfromtext('polygon((2 2,2 4, 4 2,2 2))') ) a;
a
NULL
SELECT ST_CROSSES( ST_GEOMFROMTEXT('POLYGON ((59 18,67 18,67 13,59 13,59 18)) '), st_geomfromtext('point(1 1)') ) a;
a
NULL

View File

@@ -477,7 +477,6 @@ set @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)');
SELECT TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10);
SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10);
--echo #
--echo # MDEV-31499 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult.
--echo #
@@ -486,3 +485,12 @@ SELECT ST_NUMGEOMETRIES(
ST_INTERSECTION(
ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 4,3 5,2 5,2 7,5 4,3 4),(5 4,7.4 7,8 7,8 4,5 4))) ') )) as V;
--echo #
--echo # MDEV-36058 ST_CROSSES returns 0 instead of NULL.
--echo #
SELECT ST_CROSSES( ST_GEOMFROMTEXT('point(1 1)'), st_geomfromtext('point(1 1)') ) a;
SELECT ST_CROSSES( ST_GEOMFROMTEXT('POLYGON ((59 18,67 18,67 13,59 13,59 18)) '), st_geomfromtext('polygon((2 2,2 4, 4 2,2 2))') ) a;
SELECT ST_CROSSES( ST_GEOMFROMTEXT('POLYGON ((59 18,67 18,67 13,59 13,59 18)) '), st_geomfromtext('point(1 1)') ) a;

View File

@@ -1816,7 +1816,7 @@ exp
#
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))) as exp;
exp
NULL
POINT
#
# MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations
#
@@ -5499,6 +5499,13 @@ SELECT ST_DISTANCE_SPHERE(st_geomfromtext('linestring( 2 2, 2 8) '), ST_GeomFrom
ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments.
# End of 10.5 tests
#
# MDEV-35766 ST_PointOnSurface returns NULL with Polygon in some case.
#
SELECT ST_ASTEXT(ST_POINTONSURFACE(ST_GeomFromText('POLYGON((-1 0, 1 2, 1 0, -1 0))'))) as T;
T
POINT(0.5 1)
# End of 10.6 tests
#
# Start of 11.5 tests
#
#

View File

@@ -3505,6 +3505,13 @@ SELECT ST_DISTANCE_SPHERE(st_geomfromtext('linestring( 2 2, 2 8) '), ST_GeomFrom
--echo # End of 10.5 tests
--echo #
--echo # MDEV-35766 ST_PointOnSurface returns NULL with Polygon in some case.
--echo #
SELECT ST_ASTEXT(ST_POINTONSURFACE(ST_GeomFromText('POLYGON((-1 0, 1 2, 1 0, -1 0))'))) as T;
--echo # End of 10.6 tests
--echo #
--echo # Start of 11.5 tests
--echo #

View File

@@ -1020,3 +1020,27 @@ SET optimizer_trace= @save_optimizer_trace;
#
# End of 10.11 tests
#
#
# MDEV-38070 wrong resultset with having and or condition
#
CREATE TABLE t1 ( a int, PRIMARY KEY (a)) ;
INSERT INTO t1 values (3),(4),(5),(6),(7);
CREATE TABLE t2 (b int , c TIMESTAMP );
INSERT INTO t2 VALUES (1,'2025-11-06 09:24:27'),(1,'2025-11-06 09:24:27'),
(2,'2025-11-06 09:24:27'),(2,'2025-11-06 09:24:27'),(3,'2025-11-06 09:24:27'),
(3,'2025-11-06 09:24:27'),(4,'2025-11-06 09:24:27'),(4,'2025-11-06 09:24:27'),
(5,'2025-11-06 09:24:27'),(5,'2025-11-06 09:24:27'),(6,'2025-11-06 09:24:27'),
(6,'2025-11-06 09:24:27'),(7,'2025-11-06 11:24:27'),(7,'2025-11-06 11:24:27');
SELECT t1.a, tbl.b
FROM t1
JOIN ( SELECT t2.b as id2, max(t2.c) AS b FROM t2 GROUP BY t2.b ) tbl
ON tbl.id2 = t1.a
GROUP BY t1.a
HAVING (tbl.b < '2025-11-06 10:40:00');
a b
3 2025-11-06 09:24:27
4 2025-11-06 09:24:27
5 2025-11-06 09:24:27
6 2025-11-06 09:24:27
DROP TABLE t1, t2;
# End of 11.4 tests

View File

@@ -1078,3 +1078,28 @@ SET optimizer_trace= @save_optimizer_trace;
--echo #
--echo # End of 10.11 tests
--echo #
--echo #
--echo # MDEV-38070 wrong resultset with having and or condition
--echo #
CREATE TABLE t1 ( a int, PRIMARY KEY (a)) ;
INSERT INTO t1 values (3),(4),(5),(6),(7);
CREATE TABLE t2 (b int , c TIMESTAMP );
INSERT INTO t2 VALUES (1,'2025-11-06 09:24:27'),(1,'2025-11-06 09:24:27'),
(2,'2025-11-06 09:24:27'),(2,'2025-11-06 09:24:27'),(3,'2025-11-06 09:24:27'),
(3,'2025-11-06 09:24:27'),(4,'2025-11-06 09:24:27'),(4,'2025-11-06 09:24:27'),
(5,'2025-11-06 09:24:27'),(5,'2025-11-06 09:24:27'),(6,'2025-11-06 09:24:27'),
(6,'2025-11-06 09:24:27'),(7,'2025-11-06 11:24:27'),(7,'2025-11-06 11:24:27');
SELECT t1.a, tbl.b
FROM t1
JOIN ( SELECT t2.b as id2, max(t2.c) AS b FROM t2 GROUP BY t2.b ) tbl
ON tbl.id2 = t1.a
GROUP BY t1.a
HAVING (tbl.b < '2025-11-06 10:40:00');
DROP TABLE t1, t2;
--echo # End of 11.4 tests

View File

@@ -943,3 +943,17 @@ LIMIT ROWS EXAMINED 1;
1
DROP TABLE t1;
# End of 10.11 tests
#
# MDEV-38683 SIGSEGV (dbg), SIGABRT or ER_EMPTY_QUERY when using
# ROWS EXAMINED with log_output=TABLE
#
SET GLOBAL general_log=ON, GLOBAL log_output='TABLE';
CREATE TABLE t1 (c INT);
EXPLAIN SELECT * FROM t1 LIMIT ROWS EXAMINED 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found
select 1;
1
1
drop table t1;
SET GLOBAL log_output= default;

View File

@@ -673,3 +673,15 @@ LIMIT ROWS EXAMINED 1;
DROP TABLE t1;
--echo # End of 10.11 tests
--echo #
--echo # MDEV-38683 SIGSEGV (dbg), SIGABRT or ER_EMPTY_QUERY when using
--echo # ROWS EXAMINED with log_output=TABLE
--echo #
SET GLOBAL general_log=ON, GLOBAL log_output='TABLE';
CREATE TABLE t1 (c INT);
EXPLAIN SELECT * FROM t1 LIMIT ROWS EXAMINED 1;
select 1;
drop table t1;
SET GLOBAL log_output= default;

View File

@@ -0,0 +1,7 @@
!include include/default_my.cnf
[mysqld.1]
extra-port= @ENV.MASTER_EXTRA_PORT
[ENV]
MASTER_EXTRA_PORT= @OPT.port

View File

@@ -0,0 +1 @@
--thread-handling=pool-of-threads --loose-thread-pool-mode=generic --thread-pool-size=1 --thread-pool-max-threads=3 --thread-pool-oversubscribe=1 --thread-pool-stall-limit=10000 --thread-pool-dedicated-listener

View File

@@ -0,0 +1,35 @@
# MDEV-33070 Thread pool starvation at oversubscribe threshold
CREATE TABLE t1 (a INT);
connect c1, localhost, root,,;
connect c2, localhost, root,,;
connect c3, localhost, root,,;
connect extra_con, 127.0.0.1, root,,test,$MASTER_EXTRA_PORT,;
connection c1;
SELECT SLEEP(1000);
connection extra_con;
connection c2;
SELECT SLEEP(1000);
connection extra_con;
connection c3;
INSERT INTO t1 VALUES (1);
connection extra_con;
KILL QUERY c1_id;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
connection c1;
disconnect c1;
connection extra_con;
KILL QUERY c2_id;
connection c2;
disconnect c2;
connection c3;
disconnect c3;
connection extra_con;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
disconnect extra_con;
connection default;
DROP TABLE t1;
# End of MDEV-33070 tests

View File

@@ -0,0 +1,83 @@
--source include/not_embedded.inc
--source include/have_pool_of_threads.inc
--echo # MDEV-33070 Thread pool starvation at oversubscribe threshold
# The server is started with a single thread group, a dedicated listener,
# one worker thread, and thread_pool_oversubscribe=1.
#
# c1 and c2 run long queries and occupy the one worker plus the one allowed
# oversubscribe slot. c3 submits a trivial INSERT which the listener can only
# enqueue, because it is sent only after both c1 and c2 are confirmed running.
#
# Before the fix, after c1 was killed the worker stayed at the oversubscribe
# threshold and went to sleep instead of dequeuing c3. Because
# thread_pool_dedicated_listener=ON, only the worker can drain the queue, so if
# c3 is still pending while c1 and c2 run and completes only after c1 is
# killed, then the worker resumed dequeuing.
CREATE TABLE t1 (a INT);
--connect (c1, localhost, root,,)
--connect (c2, localhost, root,,)
--connect (c3, localhost, root,,)
--connect (extra_con, 127.0.0.1, root,,test,$MASTER_EXTRA_PORT,)
--connection c1
--let $c1_id= `SELECT CONNECTION_ID()`
--send SELECT SLEEP(1000)
--connection extra_con
let $wait_condition=
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE='User sleep' AND ID=$c1_id;
--source include/wait_condition.inc
--connection c2
--let $c2_id= `SELECT CONNECTION_ID()`
--send SELECT SLEEP(1000)
--connection extra_con
let $wait_condition=
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE='User sleep' AND ID=$c2_id;
--source include/wait_condition.inc
--connection c3
--send INSERT INTO t1 VALUES (1)
--connection extra_con
--replace_result $c1_id c1_id
eval KILL QUERY $c1_id;
let $wait_timeout= 10;
let $wait_condition=
SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) = 1 FROM t1;
--connection c1
--error 0,ER_QUERY_INTERRUPTED,ER_STATEMENT_TIMEOUT
--reap
--disconnect c1
--connection extra_con
--replace_result $c2_id c2_id
eval KILL QUERY $c2_id;
--connection c2
--error 0,ER_QUERY_INTERRUPTED
--reap
--disconnect c2
--connection c3
--reap
--disconnect c3
--connection extra_con
SELECT COUNT(*) = 1 FROM t1;
--disconnect extra_con
--connection default
DROP TABLE t1;
--echo # End of MDEV-33070 tests

View File

@@ -0,0 +1,29 @@
#
# MDEV-38998: Assertion failure in diagnostics area upon INSERT/UPDATE IGNORE and check with ER_DATA_OUT_OF_RANGE
#
CREATE TABLE t1 (f INT, CHECK(COT(f)));
# Test INSERT IGNORE
INSERT IGNORE INTO t1 VALUES (0);
Warnings:
Error 1690 DOUBLE value is out of range in 'cot(`test`.`t1`.`f`)'
Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
# Test several values with INSERT IGNORE
TRUNCATE TABLE t1;
INSERT IGNORE INTO t1 VALUES (0), (1);
Warnings:
Error 1690 DOUBLE value is out of range in 'cot(`test`.`t1`.`f`)'
Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
SELECT * FROM t1;
f
1
# Test UPDATE IGNORE
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (1);
UPDATE IGNORE t1 SET f=0;
Warnings:
Error 1690 DOUBLE value is out of range in 'cot(`test`.`t1`.`f`)'
Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
SELECT * FROM t1;
f
1
DROP TABLE t1;

View File

@@ -0,0 +1,26 @@
--source include/have_debug.inc
--echo #
--echo # MDEV-38998: Assertion failure in diagnostics area upon INSERT/UPDATE IGNORE and check with ER_DATA_OUT_OF_RANGE
--echo #
CREATE TABLE t1 (f INT, CHECK(COT(f)));
--echo # Test INSERT IGNORE
INSERT IGNORE INTO t1 VALUES (0);
--echo # Test several values with INSERT IGNORE
TRUNCATE TABLE t1;
INSERT IGNORE INTO t1 VALUES (0), (1);
SELECT * FROM t1;
--echo # Test UPDATE IGNORE
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (1);
UPDATE IGNORE t1 SET f=0;
SELECT * FROM t1;
DROP TABLE t1;

View File

@@ -2453,3 +2453,18 @@ GRANT USAGE ON *.* TO `foo`@`bar`
GRANT ALL PRIVILEGES ON `mysql`.* TO `foo`@`bar`
drop user foo@bar;
# End of 11.3 tests
#
# MDEV-38698 mysql_upgrade does not fix charset and collation for mysql.user
#
FLUSH TABLES mysql.user;
FLUSH PRIVILEGES;
SELECT CHARACTER_SET_CLIENT, COLLATION_CONNECTION FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_SCHEMA='mysql' AND TABLE_NAME='user';
CHARACTER_SET_CLIENT COLLATION_CONNECTION
utf8mb3 utf8mb3_general_ci
FLUSH TABLES mysql.user;
FLUSH PRIVILEGES;
SELECT CHARACTER_SET_CLIENT, COLLATION_CONNECTION FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_SCHEMA='mysql' AND TABLE_NAME='user';
CHARACTER_SET_CLIENT COLLATION_CONNECTION
latin1 latin1_swedish_ci

View File

@@ -573,3 +573,25 @@ show grants for foo@bar;
drop user foo@bar;
--echo # End of 11.3 tests
--echo #
--echo # MDEV-38698 mysql_upgrade does not fix charset and collation for mysql.user
--echo #
--remove_file $MYSQLD_DATADIR/mysql/user.frm
--copy_file std_data/upgrade/user-100625-utf8mb3.frm $MYSQLD_DATADIR/mysql/user.frm
FLUSH TABLES mysql.user;
FLUSH PRIVILEGES;
SELECT CHARACTER_SET_CLIENT, COLLATION_CONNECTION FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_SCHEMA='mysql' AND TABLE_NAME='user';
--replace_result $MYSQLTEST_VARDIR var
--exec $MYSQL_UPGRADE --force --silent 2>&1
--remove_file $MYSQLD_DATADIR/mariadb_upgrade_info
FLUSH TABLES mysql.user;
FLUSH PRIVILEGES;
SELECT CHARACTER_SET_CLIENT, COLLATION_CONNECTION FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_SCHEMA='mysql' AND TABLE_NAME='user';

View File

@@ -494,3 +494,11 @@ select db_name,table_name,column_name,min_value,max_value,nulls_ratio,avg_length
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency
test t1 a 1 3 0.0000 4.0000 1.0000
drop table t1;
#
# MDEV-38778 mariadbcheck --silent
#
create table t1 (a int) engine=innodb;
test.t1
note : Table does not support optimize, doing recreate + analyze instead
drop table t1;
# End of 10.11 tests

View File

@@ -422,3 +422,12 @@ select db_name,table_name,column_name,min_value,max_value,nulls_ratio,avg_length
--exec $MYSQL_CHECK --analyze test t1 --persistent
select db_name,table_name,column_name,min_value,max_value,nulls_ratio,avg_length,avg_frequency from mysql.column_stats where db_name = 'test' and table_name = 't1' order by db_name,table_name;
drop table t1;
--echo #
--echo # MDEV-38778 mariadbcheck --silent
--echo #
create table t1 (a int) engine=innodb;
--exec $MYSQL_CHECK -s --optimize test t1
drop table t1;
--echo # End of 10.11 tests

View File

@@ -999,3 +999,8 @@ SELECT 1 /* doesn't throw error */;
1
1
End of tests
#
# MDEV-38696: infinite loop in my_copy() function
#
# caught error and exited my_copy()
# End of 10.11 tests

View File

@@ -2962,6 +2962,23 @@ SELECT 1 /* doesn't throw error */;
--echo End of tests
--echo #
--echo # MDEV-38696: infinite loop in my_copy() function
--echo #
--let $srcdir= $MYSQLTEST_VARDIR/tmp/mdev_38696_srcdir
--let $dstfile= $MYSQLTEST_VARDIR/tmp/mdev_38696_dstfile
--mkdir $srcdir
--error 1
--copy_file $srcdir $dstfile
--echo # caught error and exited my_copy()
--rmdir $srcdir
--echo # End of 10.11 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@@ -2,6 +2,32 @@
# Test for MDEV-36108: Variable substitutions in mysqltest
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Test absolute value function
# ----------------------------------------------------------------------------
# Basic abs() function tests
abs(10) -> 10;
abs(-10) -> 10;
abs(0) -> 0;
abs(123456789) -> 123456789;
abs(-987654321) -> 987654321;
abs(NULL) -> ;
abs(5 - 10) -> 5;
abs(10 - 5) -> 5;
abs(-(-25)) -> 25;
abs(-2147483648) -> 2147483648;
abs(2147483647) -> 2147483647;
abs(1 == 1) -> 1;
abs(1 == 0) -> 0;
abs(-((5 * -3) + (2 - 8))) -> 21;
abs(((10 - 25) * (3 + 2))) -> 75;
abs(((2 - 6) * (-4 + 1))) -> 12;
abs((((-5 * 6) + 10) - (8 * -2))) -> 4;
abs(((((3 - 9) * 2) + 4) - 1)) -> 9;
abs(((-100 + 50) * (2 - 5))) -> 150;
abs(((-3 * (2 + 4)) + (18 / 3))) -> 12;
abs(((((10 - 5) * -3) + 4) * -2)) -> 22;
abs((((-2 * -2) - (5 * 3)) + 20)) -> 9;
# ----------------------------------------------------------------------------
# Test conversion functions (conv, bin, oct, hex)
# ----------------------------------------------------------------------------
# Basic conv() function tests

View File

@@ -4,6 +4,79 @@
--source include/not_embedded.inc
--echo # ----------------------------------------------------------------------------
--echo # Test absolute value function
--echo # ----------------------------------------------------------------------------
--echo # Basic abs() function tests
let $a1 = $(abs(10));
-- echo abs(10) -> $a1;
let $a2 = $(abs(-10));
-- echo abs(-10) -> $a2;
let $a3 = $(abs(0));
-- echo abs(0) -> $a3;
let $a4 = $(abs(123456789));
-- echo abs(123456789) -> $a4;
let $a5 = $(abs(-987654321));
-- echo abs(-987654321) -> $a5;
let $a6 = $(abs(NULL));
-- echo abs(NULL) -> $a6;
let $a7 = $(abs(5 - 10));
-- echo abs(5 - 10) -> $a7;
let $a8 = $(abs(10 - 5));
-- echo abs(10 - 5) -> $a8;
let $a9 = $(abs(-(-25)));
-- echo abs(-(-25)) -> $a9;
let $a10 = $(abs(-2147483648));
-- echo abs(-2147483648) -> $a10;
let $a11 = $(abs(2147483647));
-- echo abs(2147483647) -> $a11;
let $a12 = $(abs(1 == 1));
-- echo abs(1 == 1) -> $a12;
let $a13 = $(abs(1 == 0));
-- echo abs(1 == 0) -> $a13;
let $a14 = $(abs(-((5 * -3) + (2 - 8))));
-- echo abs(-((5 * -3) + (2 - 8))) -> $a14;
let $a15 = $(abs(((10 - 25) * (3 + 2))));
-- echo abs(((10 - 25) * (3 + 2))) -> $a15;
let $a16 = $(abs(((2 - 6) * (-4 + 1))));
-- echo abs(((2 - 6) * (-4 + 1))) -> $a16;
let $a17 = $(abs((((-5 * 6) + 10) - (8 * -2))));
-- echo abs((((-5 * 6) + 10) - (8 * -2))) -> $a17;
let $a18 = $(abs(((((3 - 9) * 2) + 4) - 1)));
-- echo abs(((((3 - 9) * 2) + 4) - 1)) -> $a18;
let $a19 = $(abs(((-100 + 50) * (2 - 5))));
-- echo abs(((-100 + 50) * (2 - 5))) -> $a19;
let $a20 = $(abs(((-3 * (2 + 4)) + (18 / 3))));
-- echo abs(((-3 * (2 + 4)) + (18 / 3))) -> $a20;
let $a21 = $(abs(((((10 - 5) * -3) + 4) * -2)));
-- echo abs(((((10 - 5) * -3) + 4) * -2)) -> $a21;
let $a22 = $(abs((((-2 * -2) - (5 * 3)) + 20)));
-- echo abs((((-2 * -2) - (5 * 3)) + 20)) -> $a22;
--echo # ----------------------------------------------------------------------------
--echo # Test conversion functions (conv, bin, oct, hex)
--echo # ----------------------------------------------------------------------------

View File

@@ -147,3 +147,72 @@ set SQL_MODE=oracle;
select * from t13 union select * from t234 intersect all select * from t12;
ERROR 42S02: Table 'test.t13' doesn't exist
set SQL_MODE=default;
#
# MDEV-38799 Some views are broken in Oracle mode after upgrade to Q1 2026
#
set sql_mode='';
create view v as select 'foo' as a union select 'bar' as a;
create view v2 as select 'foo' as a, 'baz' as b union select 'bar' as a, 'qux' as b;
create view v3 as select * from (select 'foo' as a, 'baz' as b) s union select * from (select 'bar' as a, 'qux' as b) s2;
create view v4 as select * from (select 'foo' as a) s union select * from (select 'bar' as a) s2;
select a from v;
a
foo
bar
select a, b from v2;
a b
foo baz
bar qux
select a, b from v3;
a b
foo baz
bar qux
select a from v4;
a
foo
bar
set sql_mode=oracle;
show create view v;
View Create View character_set_client collation_connection
v CREATE VIEW "v" AS select "__4"."a" AS "a" from (select 'foo' AS "a" union select 'bar' AS "a") "__4" latin1 latin1_swedish_ci
show create view v2;
View Create View character_set_client collation_connection
v2 CREATE VIEW "v2" AS select "__4"."a" AS "a","__4"."b" AS "b" from (select 'foo' AS "a",'baz' AS "b" union select 'bar' AS "a",'qux' AS "b") "__4" latin1 latin1_swedish_ci
select a from v;
a
foo
bar
select a, b from v2;
a b
foo baz
bar qux
select a, b from v3;
a b
foo baz
bar qux
select a from v4;
a
foo
bar
drop view v;
drop view v2;
drop view v3;
drop view v4;
set sql_mode=default;
# End of 10.11 tests
#
# MDEV-38987 ASAN heap-use-after-free upon using a view through a trigger in ORACLE mode
#
set sql_mode = oracle;
create table t1 (f int);
create table t2 (a int);
create view v as select 'x' union select 'x' union select 'x';
create trigger tr before insert on t1 for each row delete from v;
insert into t1 values (1);
ERROR HY000: The target table v of the DELETE is not updatable
drop view v;
create view v as select * from t2;
INSERT into t1 values (2);
drop view v;
drop table t1, t2;
# End of 11.4 tests

View File

@@ -74,3 +74,50 @@ set SQL_MODE=oracle;
--error ER_NO_SUCH_TABLE
select * from t13 union select * from t234 intersect all select * from t12;
set SQL_MODE=default;
--echo #
--echo # MDEV-38799 Some views are broken in Oracle mode after upgrade to Q1 2026
--echo #
set sql_mode='';
create view v as select 'foo' as a union select 'bar' as a;
create view v2 as select 'foo' as a, 'baz' as b union select 'bar' as a, 'qux' as b;
create view v3 as select * from (select 'foo' as a, 'baz' as b) s union select * from (select 'bar' as a, 'qux' as b) s2;
create view v4 as select * from (select 'foo' as a) s union select * from (select 'bar' as a) s2;
select a from v;
select a, b from v2;
select a, b from v3;
select a from v4;
set sql_mode=oracle;
show create view v;
show create view v2;
select a from v;
select a, b from v2;
select a, b from v3;
select a from v4;
drop view v;
drop view v2;
drop view v3;
drop view v4;
set sql_mode=default;
--echo # End of 10.11 tests
--echo #
--echo # MDEV-38987 ASAN heap-use-after-free upon using a view through a trigger in ORACLE mode
--echo #
set sql_mode = oracle;
create table t1 (f int);
create table t2 (a int);
create view v as select 'x' union select 'x' union select 'x';
create trigger tr before insert on t1 for each row delete from v;
--error ER_NON_UPDATABLE_TABLE
insert into t1 values (1);
drop view v;
create view v as select * from t2;
INSERT into t1 values (2);
drop view v;
drop table t1, t2;
--echo # End of 11.4 tests

View File

@@ -148,6 +148,47 @@ EXPECT_0
# restart: --skip-grant-tables
# End of 10.10 tests
#
# MDEV-38811 crash in information_schema.table_constraints when --skip-grant-tables
#
select * from information_schema.table_constraints;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
def mysql Host mysql roles_mapping UNIQUE
def mysql Options mysql servers CHECK
def mysql PRIMARY mysql column_stats PRIMARY KEY
def mysql PRIMARY mysql columns_priv PRIMARY KEY
def mysql PRIMARY mysql db PRIMARY KEY
def mysql PRIMARY mysql event PRIMARY KEY
def mysql PRIMARY mysql func PRIMARY KEY
def mysql PRIMARY mysql global_priv PRIMARY KEY
def mysql PRIMARY mysql gtid_slave_pos PRIMARY KEY
def mysql PRIMARY mysql help_category PRIMARY KEY
def mysql PRIMARY mysql help_keyword PRIMARY KEY
def mysql PRIMARY mysql help_relation PRIMARY KEY
def mysql PRIMARY mysql help_topic PRIMARY KEY
def mysql PRIMARY mysql index_stats PRIMARY KEY
def mysql PRIMARY mysql plugin PRIMARY KEY
def mysql PRIMARY mysql proc PRIMARY KEY
def mysql PRIMARY mysql procs_priv PRIMARY KEY
def mysql PRIMARY mysql proxies_priv PRIMARY KEY
def mysql PRIMARY mysql servers PRIMARY KEY
def mysql PRIMARY mysql table_stats PRIMARY KEY
def mysql PRIMARY mysql tables_priv PRIMARY KEY
def mysql PRIMARY mysql time_zone PRIMARY KEY
def mysql PRIMARY mysql time_zone_leap_second PRIMARY KEY
def mysql PRIMARY mysql time_zone_name PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY
def mysql Priv mysql global_priv CHECK
def mysql name mysql help_category UNIQUE
def mysql name mysql help_keyword UNIQUE
def mysql name mysql help_topic UNIQUE
def sys PRIMARY sys sys_config PRIMARY KEY
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
# End of 10.11 tests
#
# MDEV-36351 MariaDB crashes when trying to access information_schema.users under --skip-grant-tables
#
select * from information_schema.users;

View File

@@ -186,6 +186,14 @@ SELECT @@skip_grant_tables AS EXPECT_0;
--echo # End of 10.10 tests
--echo #
--echo # MDEV-38811 crash in information_schema.table_constraints when --skip-grant-tables
--echo #
--sorted_result
select * from information_schema.table_constraints;
--echo # End of 10.11 tests
--echo #
--echo # MDEV-36351 MariaDB crashes when trying to access information_schema.users under --skip-grant-tables
--echo #

View File

@@ -1571,7 +1571,12 @@ declare continue handler for 0 set @x=0;
end$$
ERROR HY000: Incorrect CONDITION value: '0'
set @old_recursion_depth = @@max_sp_recursion_depth;
set @@max_sp_recursion_depth = 255;
set @l = 255;
SELECT IF(global_value like 'MSAN%', 20,
IF(global_value LIKE 'ASAN%', 200, 255)) INTO @l
FROM information_schema.system_variables
WHERE variable_name='have_sanitizer' AND version() LIKE '%debug%';
set @@max_sp_recursion_depth = @l;
create procedure p1(a int)
begin
declare continue handler for 1436 -- ER_STACK_OVERRUN_NEED_MORE

View File

@@ -2230,10 +2230,17 @@ delimiter ;$$
#
# Bug#15192: "fatal errors" are caught by handlers in stored procedures
#
# MDEV-39109 - lower limits for debug sanitizers.
set @old_recursion_depth = @@max_sp_recursion_depth;
set @@max_sp_recursion_depth = 255;
set @l = 255;
--disable_warnings
SELECT IF(global_value like 'MSAN%', 20,
IF(global_value LIKE 'ASAN%', 200, 255)) INTO @l
FROM information_schema.system_variables
WHERE variable_name='have_sanitizer' AND version() LIKE '%debug%';
--enable_warnings
set @@max_sp_recursion_depth = @l;
delimiter |;
create procedure p1(a int)
begin

View File

@@ -700,3 +700,24 @@ DROP TABLE t1;
#
# End of 10.6 tests
#
#
# Failed CREATE TEMPORARY ... SELECT must not roll back transaction
#
CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t VALUES (0);
INSERT INTO t VALUES (1);
CREATE TEMPORARY TABLE tmp2 (a INT) ENGINE=InnoDB SELECT 'x' AS a;
ERROR 22007: Incorrect integer value: 'x' for column `test`.`tmp2`.`a` at row 1
SELECT * FROM t ORDER BY pk;
pk
0
1
INSERT INTO t VALUES (1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
COMMIT;
SELECT * FROM t ORDER BY pk;
pk
0
1
DROP TABLE t;

View File

@@ -768,3 +768,20 @@ DROP TABLE t1;
--echo #
--echo # End of 10.6 tests
--echo #
--echo #
--echo # Failed CREATE TEMPORARY ... SELECT must not roll back transaction
--echo #
CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t VALUES (0);
INSERT INTO t VALUES (1);
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
CREATE TEMPORARY TABLE tmp2 (a INT) ENGINE=InnoDB SELECT 'x' AS a;
SELECT * FROM t ORDER BY pk;
--error ER_DUP_ENTRY
INSERT INTO t VALUES (1);
COMMIT;
SELECT * FROM t ORDER BY pk;
DROP TABLE t;

View File

@@ -0,0 +1,16 @@
TYPE=VIEW
query=select `mysql`.`global_priv`.`Host` AS `Host`,`mysql`.`global_priv`.`User` AS `User`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.plugin\') in (\'mysql_native_password\',\'mysql_old_password\'),ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.authentication_string\'),\'\'),\'\') AS `Password`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 1,\'Y\',\'N\') AS `Select_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 2,\'Y\',\'N\') AS `Insert_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 4,\'Y\',\'N\') AS `Update_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 8,\'Y\',\'N\') AS `Delete_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 16,\'Y\',\'N\') AS `Create_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 32,\'Y\',\'N\') AS `Drop_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 64,\'Y\',\'N\') AS `Reload_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 128,\'Y\',\'N\') AS `Shutdown_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 256,\'Y\',\'N\') AS `Process_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 512,\'Y\',\'N\') AS `File_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 1024,\'Y\',\'N\') AS `Grant_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 2048,\'Y\',\'N\') AS `References_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 4096,\'Y\',\'N\') AS `Index_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 8192,\'Y\',\'N\') AS `Alter_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 16384,\'Y\',\'N\') AS `Show_db_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 32768,\'Y\',\'N\') AS `Super_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 65536,\'Y\',\'N\') AS `Create_tmp_table_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 131072,\'Y\',\'N\') AS `Lock_tables_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 262144,\'Y\',\'N\') AS `Execute_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 524288,\'Y\',\'N\') AS `Repl_slave_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 1048576,\'Y\',\'N\') AS `Repl_client_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 2097152,\'Y\',\'N\') AS `Create_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 4194304,\'Y\',\'N\') AS `Show_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 8388608,\'Y\',\'N\') AS `Create_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 16777216,\'Y\',\'N\') AS `Alter_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 33554432,\'Y\',\'N\') AS `Create_user_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 67108864,\'Y\',\'N\') AS `Event_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 134217728,\'Y\',\'N\') AS `Trigger_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 268435456,\'Y\',\'N\') AS `Create_tablespace_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 536870912,\'Y\',\'N\') AS `Delete_history_priv`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.ssl_type\'),0) + 1,\'\',\'ANY\',\'X509\',\'SPECIFIED\') AS `ssl_type`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.ssl_cipher\'),\'\') AS `ssl_cipher`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.x509_issuer\'),\'\') AS `x509_issuer`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.x509_subject\'),\'\') AS `x509_subject`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.max_questions\'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.max_updates\'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.max_connections\'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.max_user_connections\'),0) as signed) AS `max_user_connections`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.plugin\'),\'\') AS `plugin`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.authentication_string\'),\'\') AS `authentication_string`,if(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.password_last_changed\'),1) = 0,\'Y\',\'N\') AS `password_expired`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.is_role\'),0) + 1,\'N\',\'Y\') AS `is_role`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.default_role\'),\'\') AS `default_role`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.max_statement_time\'),0.0) as decimal(12,6)) AS `max_statement_time` from `mysql`.`global_priv`
md5=9e8063501afc8396f55d7c723632d5d8
updatable=1
algorithm=0
definer_user=mariadb.sys
definer_host=localhost
suid=1
with_check_option=0
timestamp=0001769683779044792
create-version=2
source=SELECT\n Host,\n User,\n IF(JSON_VALUE(Priv, \'$.plugin\') IN (\'mysql_native_password\', \'mysql_old_password\'), IFNULL(JSON_VALUE(Priv, \'$.authentication_string\'), \'\'), \'\') AS Password,\n IF(JSON_VALUE(Priv, \'$.access\') & 1, \'Y\', \'N\') AS Select_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 2, \'Y\', \'N\') AS Insert_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 4, \'Y\', \'N\') AS Update_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 8, \'Y\', \'N\') AS Delete_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 16, \'Y\', \'N\') AS Create_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 32, \'Y\', \'N\') AS Drop_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 64, \'Y\', \'N\') AS Reload_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 128, \'Y\', \'N\') AS Shutdown_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 256, \'Y\', \'N\') AS Process_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 512, \'Y\', \'N\') AS File_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 1024, \'Y\', \'N\') AS Grant_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 2048, \'Y\', \'N\') AS References_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 4096, \'Y\', \'N\') AS Index_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 8192, \'Y\', \'N\') AS Alter_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 16384, \'Y\', \'N\') AS Show_db_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 32768, \'Y\', \'N\') AS Super_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 65536, \'Y\', \'N\') AS Create_tmp_table_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 131072, \'Y\', \'N\') AS Lock_tables_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 262144, \'Y\', \'N\') AS Execute_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 524288, \'Y\', \'N\') AS Repl_slave_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 1048576, \'Y\', \'N\') AS Repl_client_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 2097152, \'Y\', \'N\') AS Create_view_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 4194304, \'Y\', \'N\') AS Show_view_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 8388608, \'Y\', \'N\') AS Create_routine_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 16777216, \'Y\', \'N\') AS Alter_routine_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 33554432, \'Y\', \'N\') AS Create_user_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 67108864, \'Y\', \'N\') AS Event_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 134217728, \'Y\', \'N\') AS Trigger_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 268435456, \'Y\', \'N\') AS Create_tablespace_priv,\n IF(JSON_VALUE(Priv, \'$.access\') & 536870912, \'Y\', \'N\') AS Delete_history_priv,\n ELT(IFNULL(JSON_VALUE(Priv, \'$.ssl_type\'), 0) + 1, \'\', \'ANY\',\'X509\', \'SPECIFIED\') AS ssl_type,\n IFNULL(JSON_VALUE(Priv, \'$.ssl_cipher\'), \'\') AS ssl_cipher,\n IFNULL(JSON_VALUE(Priv, \'$.x509_issuer\'), \'\') AS x509_issuer,\n IFNULL(JSON_VALUE(Priv, \'$.x509_subject\'), \'\') AS x509_subject,\n CAST(IFNULL(JSON_VALUE(Priv, \'$.max_questions\'), 0) AS UNSIGNED) AS max_questions,\n CAST(IFNULL(JSON_VALUE(Priv, \'$.max_updates\'), 0) AS UNSIGNED) AS max_updates,\n CAST(IFNULL(JSON_VALUE(Priv, \'$.max_connections\'), 0) AS UNSIGNED) AS max_connections,\n CAST(IFNULL(JSON_VALUE(Priv, \'$.max_user_connections\'), 0) AS SIGNED) AS max_user_connections,\n IFNULL(JSON_VALUE(Priv, \'$.plugin\'), \'\') AS plugin,\n IFNULL(JSON_VALUE(Priv, \'$.authentication_string\'), \'\') AS authentication_string,\n IF(IFNULL(JSON_VALUE(Priv, \'$.password_last_changed\'), 1) = 0, \'Y\', \'N\') AS password_expired,\n ELT(IFNULL(JSON_VALUE(Priv, \'$.is_role\'), 0) + 1, \'N\', \'Y\') AS is_role,\n IFNULL(JSON_VALUE(Priv, \'$.default_role\'), \'\') AS default_role,\n CAST(IFNULL(JSON_VALUE(Priv, \'$.max_statement_time\'), 0.0) AS DECIMAL(12,6)) AS max_statement_time\n FROM global_priv;
client_cs_name=utf8mb3
connection_cl_name=utf8mb3_general_ci
view_body_utf8=select `mysql`.`global_priv`.`Host` AS `Host`,`mysql`.`global_priv`.`User` AS `User`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.plugin\') in (\'mysql_native_password\',\'mysql_old_password\'),ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.authentication_string\'),\'\'),\'\') AS `Password`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 1,\'Y\',\'N\') AS `Select_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 2,\'Y\',\'N\') AS `Insert_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 4,\'Y\',\'N\') AS `Update_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 8,\'Y\',\'N\') AS `Delete_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 16,\'Y\',\'N\') AS `Create_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 32,\'Y\',\'N\') AS `Drop_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 64,\'Y\',\'N\') AS `Reload_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 128,\'Y\',\'N\') AS `Shutdown_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 256,\'Y\',\'N\') AS `Process_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 512,\'Y\',\'N\') AS `File_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 1024,\'Y\',\'N\') AS `Grant_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 2048,\'Y\',\'N\') AS `References_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 4096,\'Y\',\'N\') AS `Index_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 8192,\'Y\',\'N\') AS `Alter_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 16384,\'Y\',\'N\') AS `Show_db_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 32768,\'Y\',\'N\') AS `Super_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 65536,\'Y\',\'N\') AS `Create_tmp_table_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 131072,\'Y\',\'N\') AS `Lock_tables_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 262144,\'Y\',\'N\') AS `Execute_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 524288,\'Y\',\'N\') AS `Repl_slave_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 1048576,\'Y\',\'N\') AS `Repl_client_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 2097152,\'Y\',\'N\') AS `Create_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 4194304,\'Y\',\'N\') AS `Show_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 8388608,\'Y\',\'N\') AS `Create_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 16777216,\'Y\',\'N\') AS `Alter_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 33554432,\'Y\',\'N\') AS `Create_user_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 67108864,\'Y\',\'N\') AS `Event_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 134217728,\'Y\',\'N\') AS `Trigger_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 268435456,\'Y\',\'N\') AS `Create_tablespace_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,\'$.access\') & 536870912,\'Y\',\'N\') AS `Delete_history_priv`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.ssl_type\'),0) + 1,\'\',\'ANY\',\'X509\',\'SPECIFIED\') AS `ssl_type`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.ssl_cipher\'),\'\') AS `ssl_cipher`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.x509_issuer\'),\'\') AS `x509_issuer`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.x509_subject\'),\'\') AS `x509_subject`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.max_questions\'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.max_updates\'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.max_connections\'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.max_user_connections\'),0) as signed) AS `max_user_connections`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.plugin\'),\'\') AS `plugin`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.authentication_string\'),\'\') AS `authentication_string`,if(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.password_last_changed\'),1) = 0,\'Y\',\'N\') AS `password_expired`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.is_role\'),0) + 1,\'N\',\'Y\') AS `is_role`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.default_role\'),\'\') AS `default_role`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,\'$.max_statement_time\'),0.0) as decimal(12,6)) AS `max_statement_time` from `mysql`.`global_priv`
mariadb-version=100625

View File

@@ -363,6 +363,8 @@ INSERT INTO t1 values (3,3);
CREATE TEMPORARY TABLE t2 (primary key (a)) engine=innodb select * from t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
DROP TABLE IF EXISTS t2;
Warnings:
Note 1051 Unknown table 'test.t2'

View File

@@ -329,6 +329,8 @@ INSERT INTO t1 values (3,3);
CREATE TEMPORARY TABLE t2 (primary key (a)) engine=innodb select * from t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
DROP TABLE IF EXISTS t2;
Warnings:
Note 1051 Unknown table 'test.t2'

View File

@@ -1,5 +0,0 @@
--innodb-encrypt-tables=ON
--innodb-encrypt-log=ON
--innodb-encryption-rotate-key-age=15
--innodb-encryption-threads=4
--innodb-tablespaces-encryption

View File

@@ -9,7 +9,7 @@ connection node_1;
SET DEBUG_SYNC = 'now WAIT_FOR may_run';
TRUNCATE TABLE t1;
connection con1;
Got one of the listed errors
ERROR 70100: Query execution was interrupted
SET DEBUG_SYNC = 'RESET';
--- CTAS with non-empty result set ---
INSERT INTO t1 VALUES (10), (20), (30);
@@ -19,7 +19,7 @@ connection node_1;
SET DEBUG_SYNC = 'now WAIT_FOR may_run';
TRUNCATE TABLE t1;
connection con1;
Got one of the listed errors
ERROR 70100: Query execution was interrupted
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
disconnect con1;

View File

@@ -2,7 +2,9 @@ connection node_2;
connection node_1;
connection node_1;
connection node_2;
SET SESSION wsrep_sync_wait=0;
connection node_2;
SET SESSION wsrep_sync_wait=0;
select @@wsrep_slave_threads;
@@wsrep_slave_threads
1

View File

@@ -0,0 +1,11 @@
connection node_2;
connection node_1;
CREATE TABLE t(a INT) ENGINE=INNODB;
PREPARE s FROM 'CREATE TRIGGER tr AFTER DELETE ON t FOR EACH ROW SET @a=1';
EXECUTE s;
EXECUTE s;
ERROR HY000: Trigger 'test.tr' already exists
DROP TRIGGER tr;
DROP TABLE t;
disconnect node_2;
disconnect node_1;

View File

@@ -0,0 +1,21 @@
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3;
RESET MASTER;
connection node_2;
SET GLOBAL DEBUG_DBUG = "+d,delay_sql_thread_after_release_run_lock";
START SLAVE;
SET DEBUG_SYNC = "now WAIT_FOR sql_thread_run_lock_released";
SET GLOBAL DEBUG_DBUG = "+d,wsrep_async_slave_node_dropped_error";
SET DEBUG_SYNC = "now SIGNAL sql_thread_continue";
SET DEBUG_SYNC = "now WAIT_FOR sql_thread_run_lock_released";
SET GLOBAL DEBUG_DBUG = "-d,wsrep_async_slave_node_dropped_error";
SET DEBUG_SYNC = "now SIGNAL sql_thread_continue";
SET DEBUG_SYNC = "RESET";
SET GLOBAL DEBUG_DBUG = "";
STOP SLAVE;
RESET SLAVE;
connection node_3;
RESET MASTER;
disconnect node_3;

View File

@@ -1,5 +1,12 @@
connection node_2;
connection node_1;
connection node_1;
set global auto_increment_offset=1;
set global auto_increment_increment=2;
connection node_2;
set global auto_increment_offset=2;
set global auto_increment_increment=2;
connection node_1;
CREATE TABLE author (
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL
@@ -45,3 +52,6 @@ id name
SELECT * FROM book;
id title author_id
DROP TABLE book, author;
set global auto_increment_increment=2;
connection node_2;
set global auto_increment_offset=2;

View File

@@ -1,17 +1,4 @@
!include ../galera_4nodes.cnf
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port'
wsrep_ignore_apply_errors=0
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port'
wsrep_ignore_apply_errors=0
[mysqld.3]
wsrep_provider_options='base_port=@mysqld.3.#galera_port'
wsrep_ignore_apply_errors=0
[mysqld.4]
wsrep_provider_options='base_port=@mysqld.4.#galera_port'
[mysqld]
wsrep_ignore_apply_errors=0

View File

@@ -31,7 +31,7 @@ TRUNCATE TABLE t1;
--connection con1
# CTAS gets BF aborted.
--error ER_QUERY_INTERRUPTED, ER_LOCK_DEADLOCK
--error ER_QUERY_INTERRUPTED
--reap
# Cleanup
@@ -56,7 +56,7 @@ TRUNCATE TABLE t1;
--connection con1
# CTAS gets BF aborted.
--error ER_QUERY_INTERRUPTED, ER_LOCK_DEADLOCK
--error ER_QUERY_INTERRUPTED
--reap
# Cleanup

View File

@@ -5,7 +5,9 @@
--let $node_2=node_2
--source ../galera/include/auto_increment_offset_save.inc
SET SESSION wsrep_sync_wait=0;
--connection node_2
SET SESSION wsrep_sync_wait=0;
select @@wsrep_slave_threads;
SET @cluster_address_orig = @@wsrep_cluster_address;
SET GLOBAL wsrep_cluster_address=AUTO;
@@ -23,6 +25,13 @@ SHOW WARNINGS;
--disable_query_log
SET GLOBAL wsrep_cluster_address = @cluster_address_orig;
--enable_query_log
# wait (without using SELECT) for the cluster becoming ready for all SQL statements
let $show_statement= SHOW STATUS LIKE 'wsrep_ready';
let $field= Value;
let $condition= = 'ON';
--source include/wait_show_condition.inc
select @@wsrep_slave_threads;
show status like 'wsrep_cluster_size';
show status like 'wsrep_cluster_status';

View File

@@ -0,0 +1,17 @@
#
# MDEV-30612: Executing CREATE TRIGGER prepared statement twice led to a crash.
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t(a INT) ENGINE=INNODB;
PREPARE s FROM 'CREATE TRIGGER tr AFTER DELETE ON t FOR EACH ROW SET @a=1';
EXECUTE s;
--error ER_TRG_ALREADY_EXISTS
EXECUTE s;
DROP TRIGGER tr;
DROP TABLE t;
--source include/galera_end.inc

View File

@@ -0,0 +1,7 @@
!include ../galera_2nodes_as_slave.cnf
[mysqld.1]
wsrep_restart_slave=1
[mysqld.2]
wsrep_restart_slave=1

View File

@@ -0,0 +1,48 @@
#
# MDEV-39011: The node running async slave replication hangs in shutdown.
# The problem was in a leaked THD_count on the error path when
# wsrep_restart_slave is set.
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
# node 3 is a native MariaDB server operating as async replication master
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
RESET MASTER;
# nodes 1 and 2 form a Galera cluster, node 2 operates as a slave for the
# native MariaDB master in node 3
--connection node_2
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
SET GLOBAL DEBUG_DBUG = "+d,delay_sql_thread_after_release_run_lock";
START SLAVE;
# Wait for the async slave thread to get started
SET DEBUG_SYNC = "now WAIT_FOR sql_thread_run_lock_released";
# Simulate a node dropped error for Wsrep to go to the restart point
SET GLOBAL DEBUG_DBUG = "+d,wsrep_async_slave_node_dropped_error";
SET DEBUG_SYNC = "now SIGNAL sql_thread_continue";
# Now wait again as the execution should follow the error path and repeat
SET DEBUG_SYNC = "now WAIT_FOR sql_thread_run_lock_released";
# Don't follow the error path anymore
SET GLOBAL DEBUG_DBUG = "-d,wsrep_async_slave_node_dropped_error";
SET DEBUG_SYNC = "now SIGNAL sql_thread_continue";
# Cleanup before restart
SET DEBUG_SYNC = "RESET";
SET GLOBAL DEBUG_DBUG = "";
STOP SLAVE;
RESET SLAVE;
# Now try to restart the node: it should not hang in a shutdown
--source include/restart_mysqld.inc
--connection node_3
RESET MASTER;
--disconnect node_3

View File

@@ -4,9 +4,7 @@
binlog-format=row
[mysqld.1]
wsrep_restart_slave=1
wsrep-debug=1
[mysqld.2]
wsrep_restart_slave=1
wsrep-debug=1

View File

@@ -1,9 +0,0 @@
!include ../galera_2nodes.cnf
[mysqld.1]
auto_increment_offset=1
auto_increment_increment=2
[mysqld.2]
auto_increment_offset=2
auto_increment_increment=2

View File

@@ -1,6 +1,17 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
#
# Make sure earlier test has no effect to this one
#
--connection node_1
set global auto_increment_offset=1;
set global auto_increment_increment=2;
--connection node_2
set global auto_increment_offset=2;
set global auto_increment_increment=2;
--connection node_1
CREATE TABLE author (
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL
@@ -38,3 +49,8 @@ SELECT * FROM author;
SELECT * FROM book;
DROP TABLE book, author;
set global auto_increment_increment=2;
--connection node_2
set global auto_increment_offset=2;

View File

@@ -21,7 +21,7 @@ SET SESSION wsrep_on = ON;
Restarting server 3 with one applier thread having FK and UK checks disabled
SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_after_write_row';
connection node_1;
INSERT INTO child VALUES (1, 1);
INSERT INTO child VALUES (1, 2);
connection node_3;
SET DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_after_write_row_reached';
SET GLOBAL DEBUG_DBUG = '';
@@ -29,7 +29,6 @@ SET wsrep_sync_wait = 0;
SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL signal.wsrep_after_write_row';
INSERT INTO child VALUES (2, 2);
SET DEBUG_SYNC = 'RESET';
include/assert_grep.inc [no FK constraint failure]
Server 3
SELECT COUNT(*) AS EXPECT_1 FROM parent;
EXPECT_1

View File

@@ -61,7 +61,7 @@ SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_after_write_row';
# Insert a child row that will be applied on node #3, but should not
# grab table-level X-lock.
--connection node_1
INSERT INTO child VALUES (1, 1);
INSERT INTO child VALUES (1, 2);
--connection node_3
SET DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_after_write_row_reached';
@@ -75,14 +75,6 @@ SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL signal.wsrep_after_write_row';
# grabs table-level X-lock, they'll both deadlock forever.
INSERT INTO child VALUES (2, 2);
SET DEBUG_SYNC = 'RESET';
--let $assert_select = foreign key constraint fails
--let $assert_count = 0
--let $assert_text = no FK constraint failure
--let $assert_only_after = CURRENT_TEST
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.3.err
--source include/assert_grep.inc
# Child row insert is applied even though there's no parent row.
--echo Server 3
SELECT COUNT(*) AS EXPECT_1 FROM parent;

View File

@@ -8,6 +8,12 @@ f4 INT as (f2) STORED,
f5 INT as (f3) STORED,
PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB;
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
CREATE TABLE t2(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
INDEX idx(f2))ENGINE=INNODB;
INSERT INTO t2(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
# All the following cases needs table rebuild
# Add and Drop primary key
ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1), ALGORITHM=COPY;
@@ -44,18 +50,23 @@ info: Records: 1 Duplicates: 0 Warnings: 0
ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t2 page_compressed=1, ALGORITHM=COPY;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
DROP TABLE t2;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
INDEX idx(f2))ENGINE=INNODB;
INDEX idx(f2)) PAGE_COMPRESSED=1, ENGINE=INNODB;
CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
INDEX(f1),
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1, ALGORITHM=COPY;
ALTER TABLE t1 ADD INDEX idx1(f4), page_compression_level=7, ALGORITHM=COPY;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
ALTER TABLE t1 DROP INDEX idx, page_compression_level=5, ALGORITHM=COPY;
@@ -132,6 +143,12 @@ f4 INT as (f2) STORED,
f5 INT as (f3) STORED,
PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB;
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
CREATE TABLE t2(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
INDEX idx(f2))ENGINE=INNODB;
INSERT INTO t2(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
# All the following cases needs table rebuild
# Add and Drop primary key
ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1), ALGORITHM=INPLACE;
@@ -168,18 +185,23 @@ info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t2 page_compressed=1, ALGORITHM=INPLACE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
DROP TABLE t2;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
INDEX idx(f2))ENGINE=INNODB;
INDEX idx(f2)) PAGE_COMPRESSED=1, ENGINE=INNODB;
CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
INDEX(f1),
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1, ALGORITHM=INPLACE;
ALTER TABLE t1 ADD INDEX idx1(f4), page_compression_level=7, ALGORITHM=INPLACE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 DROP INDEX idx, page_compression_level=5, ALGORITHM=INPLACE;
@@ -255,6 +277,12 @@ f4 INT as (f2) STORED,
f5 INT as (f3) STORED,
PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB;
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
CREATE TABLE t2(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
INDEX idx(f2))ENGINE=INNODB;
INSERT INTO t2(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
# All the following cases needs table rebuild
# Add and Drop primary key
ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1), ALGORITHM=NOCOPY;
@@ -283,18 +311,22 @@ Got one of the listed errors
ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t2 page_compressed=1, ALGORITHM=NOCOPY;
Got one of the listed errors
DROP TABLE t1;
affected rows: 0
DROP TABLE t2;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
INDEX idx(f2))ENGINE=INNODB;
INDEX idx(f2)) PAGE_COMPRESSED=1, ENGINE=INNODB;
CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
INDEX(f1),
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1, ALGORITHM=NOCOPY;
ALTER TABLE t1 ADD INDEX idx1(f4), page_compression_level=7, ALGORITHM=NOCOPY;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 DROP INDEX idx, page_compression_level=5, ALGORITHM=NOCOPY;
@@ -370,6 +402,12 @@ f4 INT as (f2) STORED,
f5 INT as (f3) STORED,
PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB;
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
CREATE TABLE t2(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
INDEX idx(f2))ENGINE=INNODB;
INSERT INTO t2(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
# All the following cases needs table rebuild
# Add and Drop primary key
ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1), ALGORITHM=INSTANT;
@@ -398,18 +436,22 @@ Got one of the listed errors
ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t2 page_compressed=1, ALGORITHM=INSTANT;
Got one of the listed errors
DROP TABLE t1;
affected rows: 0
DROP TABLE t2;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
INDEX idx(f2))ENGINE=INNODB;
INDEX idx(f2)) PAGE_COMPRESSED=1, ENGINE=INNODB;
CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
INDEX(f1),
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1, ALGORITHM=INSTANT;
ALTER TABLE t1 ADD INDEX idx1(f4), page_compression_level=7, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY
ALTER TABLE t1 DROP INDEX idx, page_compression_level=5, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY

View File

@@ -139,8 +139,7 @@ DROP TABLE t;
#
CREATE TABLE t (a INT) ENGINE=InnoDB;
START TRANSACTION;
SELECT * FROM t;
a
INSERT t VALUES (0),(1);
SAVEPOINT A;
select @@in_transaction;
@@in_transaction
@@ -149,8 +148,12 @@ CREATE TEMPORARY TABLE tmp (a TINYINT) ENGINE=InnoDB AS SELECT 256 AS a;
ERROR 22003: Out of range value for column 'a' at row 1
select @@in_transaction;
@@in_transaction
0
1
ROLLBACK TO SAVEPOINT A;
ERROR 42000: SAVEPOINT A does not exist
COMMIT;
SELECT * FROM t;
a
0
1
DROP TABLE t;
# End of 10.11 tests

View File

@@ -113,3 +113,14 @@ Warnings:
Warning 1088 Error updating stats for table after table rebuild: Lock wait timeout
SET innodb_lock_wait_timeout = @lock_wait_timeout;
DROP TABLE t;
#
# MDEV-38882 Assertion in diagnostics area on DDL stats
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=InnoDB;
connect con1,localhost,root,,;
ALTER TABLE t1 NOWAIT FORCE, ALGORITHM=COPY;;
connection default;
ALTER TABLE t2 FORCE, ALGORITHM=COPY;
connection con1;
DROP TABLE t1, t2;

View File

@@ -243,3 +243,35 @@ a b
1 1
2 1
DROP TABLE t1;
#
# MDEV-38079 Crash recovery fails after ALTER TABLE…PAGE_COMPRESSED=1
#
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE t1 PAGE_COMPRESSED=1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACE
DROP TABLE t1;
#
# MDEV-38928 Assertion undo_no <= 1 in reset_and_truncate_undo
# during ALTER IGNORE on temporary table
#
CREATE TEMPORARY TABLE t1 (f1 INT) ENGINE=INNODB;
INSERT INTO t1 (f1) VALUES (0),(0);
ALTER IGNORE TABLE t1 FORCE;
DROP TABLE t1;
#
# MDEV-38951 Assertion `0' upon ALTER IGNORE handling duplicate keys
#
CREATE TABLE t1(f1 INT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1), (1);
ALTER IGNORE TABLE t1 ADD UNIQUE(f1);
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
#
# MDEV-38993 Assertion `trx->undo_no == 1' fails upon ALTER IGNORE
#
CREATE TABLE t (a INT) ENGINE=InnoDB;
INSERT INTO t VALUES (1),(2),(1),(2);
ALTER IGNORE TABLE t ADD UNIQUE(a);
DROP TABLE t;

View File

@@ -258,6 +258,7 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY fk1 (b) REFERENCES t1 (a))
ENGINE=InnoDB;
ALTER TABLE t2 DROP FOREIGN KEY fk1, DROP FOREIGN KEY fk1;
ERROR 42000: Can't DROP FOREIGN KEY `fk1`; check that it exists
DROP TABLE t2, t1;
CREATE TABLE t1 (f VARCHAR(256)) ENGINE=InnoDB;
SET SESSION FOREIGN_KEY_CHECKS = OFF;
@@ -1204,6 +1205,36 @@ set GLOBAL innodb_fast_shutdown=0;
# restart
ALTER TABLE t2 FORCE;
DROP TABLE t2, t1, t3;
#
# MDEV-19194 ASAN use-after-poison in
# fk_prepare_copy_alter_table upon dropping FK
#
CREATE TABLE t1(f1 INT NOT NULL, KEY(f1))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL,
FOREIGN KEY `f1`(f1) REFERENCES t1(f1))ENGINE=InnoDB;
ALTER TABLE t2 DROP FOREIGN KEY f1, DROP FOREIGN KEY f1, ALGORITHM=COPY;
ERROR 42000: Can't DROP FOREIGN KEY `f1`; check that it exists
ALTER IGNORE TABLE t2 DROP FOREIGN KEY f0, DROP FOREIGN KEY f0, ALGORITHM=COPY;
ERROR 42000: Can't DROP FOREIGN KEY `f0`; check that it exists
ALTER IGNORE TABLE t2 DROP FOREIGN KEY f0, ALGORITHM=COPY;
ERROR 42000: Can't DROP FOREIGN KEY `f0`; check that it exists
ALTER IGNORE TABLE t2 DROP FOREIGN KEY f1, DROP FOREIGN KEY f1, ALGORITHM=COPY;
ERROR 42000: Can't DROP FOREIGN KEY `f1`; check that it exists
ALTER IGNORE TABLE t2 DROP FOREIGN KEY f1, DROP FOREIGN KEY IF EXISTS f1, ALGORITHM=COPY;
Warnings:
Note 1091 Can't DROP FOREIGN KEY `f1`; check that it exists
ALTER TABLE t2 DROP FOREIGN KEY f1, ALGORITHM=COPY;
ERROR 42000: Can't DROP FOREIGN KEY `f1`; check that it exists
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS f1, ALGORITHM=COPY;
Warnings:
Note 1091 Can't DROP FOREIGN KEY `f1`; check that it exists
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS f1, DROP FOREIGN KEY f1, ALGORITHM=COPY;
ERROR 42000: Can't DROP FOREIGN KEY `f1`; check that it exists
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS f1, DROP FOREIGN KEY IF EXISTS f1, ALGORITHM=COPY;
Warnings:
Note 1091 Can't DROP FOREIGN KEY `f1`; check that it exists
Note 1091 Can't DROP FOREIGN KEY `f1`; check that it exists
DROP TABLE t2, t1;
# End of 10.6 tests
CREATE TABLE t1
(

View File

@@ -474,8 +474,8 @@ SET NAMES utf8;
SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci));
hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci))
0E33
SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci));
hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci))
SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci)) AS hex_ws;
hex_ws
FFFD
SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a));
hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci) hex(lower(@a))
@@ -951,9 +951,9 @@ HEX(WEIGHT_STRING(a)) HEX(CONVERT(a USING ucs2)) HEX(a)
15D3 09B809CD E0A6B8E0A78D
15D4 09B909CD E0A6B9E0A78D
SELECT HEX(WEIGHT_STRING(a)) as wa,
GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a)
GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a) AS gc
FROM t1 GROUP BY a ORDER BY a;
wa GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a)
wa gc
15A2 0985
15A3 0986
15A4 0987

View File

@@ -5,7 +5,7 @@ call mtr.add_suppression("InnoDB: OPT_PAGE_CHECKSUM mismatch on \\[page id: spac
call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1");
call mtr.add_suppression("InnoDB: Cannot apply log to \\[page id: space=127, page number=0\\] of corrupted file '.*test/t\\.ibd");
call mtr.add_suppression("(InnoDB: Plugin|Plugin 'InnoDB')");
call mtr.add_suppression("InnoDB: Page .* Current system log sequence number 12(3(38|54|70|86)|4(02|18|34|50|66|82|98))");
call mtr.add_suppression("InnoDB: Page .* Current system log sequence number 123(38|54)");
SET GLOBAL innodb_fast_shutdown=0;
# restart
SELECT * FROM INFORMATION_SCHEMA.ENGINES

View File

@@ -0,0 +1,37 @@
--- log_file_size.result
+++ log_file_size,release.result
@@ -21,8 +21,6 @@
42
INSERT INTO t1 VALUES (0),(123);
BEGIN;
-SET GLOBAL innodb_limit_optimistic_insert_debug=2;
-INSERT INTO t1 VALUES (124),(125),(126),(127),(128),(129);
DELETE FROM t1 WHERE a>0;
# Persist the state of the above incomplete transaction by
# causing a redo log write for another transaction.
@@ -36,19 +34,6 @@
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /syntax error in innodb_log_group_home_dir/ in mysqld.1.err
-# restart: --debug-dbug=d,innodb_log_abort_1
-SELECT * FROM t1;
-ERROR 42000: Unknown storage engine 'InnoDB'
-FOUND 1 /InnoDB: Starting crash recovery from checkpoint LSN=.*/ in mysqld.1.err
-# restart: --innodb-log-file-size=5M
-SELECT * FROM t1;
-a
-42
-123
-# restart: --debug-dbug=d,innodb_log_abort_5
-SELECT * FROM t1;
-ERROR 42000: Unknown storage engine 'InnoDB'
-FOUND 1 /redo log from 5\.000MiB to [0-9.]*[KMGT]iB/ in mysqld.1.err
# restart
SELECT * FROM t1;
a
@@ -70,4 +55,4 @@
42
123
DROP TABLE t1;
-FOUND 2 /InnoDB: Resizing redo log from 5\.000MiB to [0-9.]*[KMGT]iB; LSN=\d+\b/ in mysqld.1.err
+FOUND 1 /InnoDB: Resizing redo log from 5\.000MiB to [0-9.]*[KMGT]iB; LSN=\d+\b/ in mysqld.1.err

View File

@@ -1,3 +1,6 @@
SET GLOBAL innodb_file_per_table=0;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
# restart: --innodb-log-file-size=4m
CHECK TABLE t1;
@@ -18,6 +21,8 @@ a
42
INSERT INTO t1 VALUES (0),(123);
BEGIN;
SET GLOBAL innodb_limit_optimistic_insert_debug=2;
INSERT INTO t1 VALUES (124),(125),(126),(127),(128),(129);
DELETE FROM t1 WHERE a>0;
# Persist the state of the above incomplete transaction by
# causing a redo log write for another transaction.
@@ -35,18 +40,20 @@ FOUND 1 /syntax error in innodb_log_group_home_dir/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /InnoDB: Starting crash recovery from checkpoint LSN=.*/ in mysqld.1.err
# restart: --innodb-read-only
# restart: --innodb-log-file-size=5M
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err
a
42
123
# restart: --debug-dbug=d,innodb_log_abort_5
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /redo log from 5\.000MiB to [0-9.]*[KMGT]iB/ in mysqld.1.err
# restart: --innodb-read-only
# restart
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 2 /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err
a
42
123
# restart
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'

View File

@@ -111,3 +111,16 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
# End of 10.11 tests
#
# MDEV-38832 Assertion `!commit_lsn' failed in void trx_t::free()
#
CREATE DATABASE test_1;
CREATE TABLE test_1.t1(f1 INT NOT NULL)Engine=InnoDB;
SET @old_stats=@@global.innodb_stats_persistent;
SET @flush_log_at_commit=@@global.innodb_flush_log_at_trx_commit;
SET GLOBAL innodb_stats_persistent=OFF;
SET GLOBAL innodb_flush_log_at_trx_commit=0;
DROP TABLE test_1.t1;
DROP DATABASE test_1;
SET GLOBAL innodb_stats_persistent=@old_stats;
SET GLOBAL innodb_flush_log_at_trx_commit=@flush_log_at_commit;

View File

@@ -187,13 +187,16 @@ INSERT INTO t1 VALUES(2);
# restart
DROP TABLE t1;
#
# MDEV-34222 Alter operation on redundant table aborts the server
# MDEV-38079 Crash recovery fails after ALTER TABLE…PAGE_COMPRESSED=1
#
SET @df_row = @@global.INNODB_DEFAULT_ROW_FORMAT;
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT=REDUNDANT;
CREATE TABLE t1 (c CHAR(1)) ENGINE=InnoDB;
ALTER TABLE t1 PAGE_COMPRESSED=1, ALGORITHM=INPLACE;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED'
ALTER TABLE t1 PAGE_COMPRESSED=1, ALGORITHM=COPY;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT=compact;
ALTER TABLE t1 PAGE_COMPRESSED=1;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED=1 ROW_FORMAT=REDUNDANT'
ALTER TABLE t1 PAGE_COMPRESSED=1, ALGORITHM=COPY;
DROP TABLE t1;
SET @@global.INNODB_DEFAULT_ROW_FORMAT = @df_row;

View File

@@ -27,16 +27,12 @@ undo002
undo001
undo002
undo003
# case 4: Abort after re-creating new undo tablespaces
# restart: --innodb_undo_tablespaces=4 --debug_dbug=+d,after_reinit_undo_abort
# restart: --innodb_undo_tablespaces=4
# Should list 4 undo log tablespaces
undo001
undo002
undo003
undo004
# case 5: Abort after re-creating new undo tablespaces successfully
# restart: --innodb_undo_tablespaces=2 --debug_dbug=+d,after_reinit_undo_success
# restart: --innodb_undo_tablespaces=2
# Should list 2 undo log tablespaces
undo001

View File

@@ -16,6 +16,7 @@ connection default;
disconnect con1;
disconnect con2;
connect con1,localhost,root;
SET STATEMENT innodb_lock_wait_timeout=1 FOR # work around MDEV-38741
SELECT * FROM t1 LOCK IN SHARE MODE;
connection default;
SET innodb_lock_wait_timeout=1;

View File

@@ -21,6 +21,13 @@ CREATE TABLE t1(f1 INT NOT NULL,
PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB;
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
CREATE TABLE t2(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
INDEX idx(f2))ENGINE=INNODB;
INSERT INTO t2(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
--enable_info
--echo # All the following cases needs table rebuild
@@ -58,7 +65,11 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
--error $error_code
eval ALTER TABLE t2 page_compressed=1, ALGORITHM=$alter_algorithm;
DROP TABLE t1;
DROP TABLE t2;
--disable_info
if ($algorithm == "NOCOPY") {
@@ -73,7 +84,7 @@ CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
INDEX idx(f2))ENGINE=INNODB;
INDEX idx(f2)) PAGE_COMPRESSED=1, ENGINE=INNODB;
CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
INDEX(f1),
@@ -83,7 +94,7 @@ INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
--enable_info
--error $error_code
--eval ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1, ALGORITHM=$alter_algorithm
--eval ALTER TABLE t1 ADD INDEX idx1(f4), page_compression_level=7, ALGORITHM=$alter_algorithm
--error $error_code
--eval ALTER TABLE t1 DROP INDEX idx, page_compression_level=5, ALGORITHM=$alter_algorithm

View File

@@ -148,14 +148,15 @@ DROP TABLE t;
--echo #
CREATE TABLE t (a INT) ENGINE=InnoDB;
START TRANSACTION;
SELECT * FROM t;
INSERT t VALUES (0),(1);
SAVEPOINT A;
select @@in_transaction;
--error ER_WARN_DATA_OUT_OF_RANGE
CREATE TEMPORARY TABLE tmp (a TINYINT) ENGINE=InnoDB AS SELECT 256 AS a;
select @@in_transaction;
--error ER_SP_DOES_NOT_EXIST
ROLLBACK TO SAVEPOINT A;
COMMIT;
SELECT * FROM t;
DROP TABLE t;
--echo # End of 10.11 tests

View File

@@ -97,3 +97,19 @@ SET innodb_lock_wait_timeout = 1;
CREATE TABLE t ENGINE=InnoDB AS SELECT * FROM mysql.innodb_table_stats;
SET innodb_lock_wait_timeout = @lock_wait_timeout;
DROP TABLE t;
--echo #
--echo # MDEV-38882 Assertion in diagnostics area on DDL stats
--echo #
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=InnoDB;
--connect (con1,localhost,root,,)
--send ALTER TABLE t1 NOWAIT FORCE, ALGORITHM=COPY;
--connection default
ALTER TABLE t2 FORCE, ALGORITHM=COPY;
--disable_warnings
--connection con1
--error 0,ER_LOCK_WAIT_TIMEOUT
--reap
--enable_warnings
DROP TABLE t1, t2;

View File

@@ -241,3 +241,37 @@ CHECK TABLE t1;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-38079 Crash recovery fails after ALTER TABLE…PAGE_COMPRESSED=1
--echo #
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 PAGE_COMPRESSED=1, ALGORITHM=INSTANT;
DROP TABLE t1;
--echo #
--echo # MDEV-38928 Assertion undo_no <= 1 in reset_and_truncate_undo
--echo # during ALTER IGNORE on temporary table
--echo #
CREATE TEMPORARY TABLE t1 (f1 INT) ENGINE=INNODB;
INSERT INTO t1 (f1) VALUES (0),(0);
ALTER IGNORE TABLE t1 FORCE;
DROP TABLE t1;
--echo #
--echo # MDEV-38951 Assertion `0' upon ALTER IGNORE handling duplicate keys
--echo #
CREATE TABLE t1(f1 INT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1), (1);
ALTER IGNORE TABLE t1 ADD UNIQUE(f1);
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
--echo #
--echo # MDEV-38993 Assertion `trx->undo_no == 1' fails upon ALTER IGNORE
--echo #
CREATE TABLE t (a INT) ENGINE=InnoDB;
INSERT INTO t VALUES (1),(2),(1),(2);
ALTER IGNORE TABLE t ADD UNIQUE(a);
DROP TABLE t;

View File

@@ -256,6 +256,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY fk1 (b) REFERENCES t1 (a))
ENGINE=InnoDB;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP FOREIGN KEY fk1, DROP FOREIGN KEY fk1;
DROP TABLE t2, t1;
@@ -1271,6 +1272,30 @@ set GLOBAL innodb_fast_shutdown=0;
ALTER TABLE t2 FORCE;
DROP TABLE t2, t1, t3;
--echo #
--echo # MDEV-19194 ASAN use-after-poison in
--echo # fk_prepare_copy_alter_table upon dropping FK
--echo #
CREATE TABLE t1(f1 INT NOT NULL, KEY(f1))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL,
FOREIGN KEY `f1`(f1) REFERENCES t1(f1))ENGINE=InnoDB;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP FOREIGN KEY f1, DROP FOREIGN KEY f1, ALGORITHM=COPY;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER IGNORE TABLE t2 DROP FOREIGN KEY f0, DROP FOREIGN KEY f0, ALGORITHM=COPY;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER IGNORE TABLE t2 DROP FOREIGN KEY f0, ALGORITHM=COPY;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER IGNORE TABLE t2 DROP FOREIGN KEY f1, DROP FOREIGN KEY f1, ALGORITHM=COPY;
ALTER IGNORE TABLE t2 DROP FOREIGN KEY f1, DROP FOREIGN KEY IF EXISTS f1, ALGORITHM=COPY;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP FOREIGN KEY f1, ALGORITHM=COPY;
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS f1, ALGORITHM=COPY;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS f1, DROP FOREIGN KEY f1, ALGORITHM=COPY;
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS f1, DROP FOREIGN KEY IF EXISTS f1, ALGORITHM=COPY;
DROP TABLE t2, t1;
--echo # End of 10.6 tests
CREATE TABLE t1

View File

@@ -181,10 +181,12 @@ create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
show create table t1;
insert into t1 values (0x0061);
--disable_view_protocol
--enable_metadata
set @@character_set_results=NULL;
select * from t1;
--disable_metadata
--enable_view_protocol
drop table t1;
#
@@ -205,7 +207,7 @@ SET NAMES utf8;
# make sure utf8mb4_test_400_ci is Unicode-4.0.0 based
SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci));
SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci));
SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci)) AS hex_ws;
SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a));
SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a));
SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a));
@@ -342,7 +344,7 @@ INSERT INTO t1 VALUES
SELECT HEX(WEIGHT_STRING(a)), HEX(CONVERT(a USING ucs2)), HEX(a)
FROM t1 ORDER BY a, BINARY(a);
SELECT HEX(WEIGHT_STRING(a)) as wa,
GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a)
GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a) AS gc
FROM t1 GROUP BY a ORDER BY a;
DROP TABLE t1;

View File

@@ -15,7 +15,7 @@ call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1");
call mtr.add_suppression("InnoDB: Cannot apply log to \\[page id: space=127, page number=0\\] of corrupted file '.*test/t\\.ibd");
call mtr.add_suppression("(InnoDB: Plugin|Plugin 'InnoDB')");
# Allow innodb_force_recovery=1 to write up to 10 FILE_CHECKPOINT records
call mtr.add_suppression("InnoDB: Page .* Current system log sequence number 12(3(38|54|70|86)|4(02|18|34|50|66|82|98))");
call mtr.add_suppression("InnoDB: Page .* Current system log sequence number 123(38|54)");
SET GLOBAL innodb_fast_shutdown=0;
--source include/shutdown_mysqld.inc
--move_file $DATADIR/ib_logfile0 $DATADIR/ib_logfile0.old

View File

@@ -2,8 +2,7 @@
--source include/innodb_page_size_small.inc
# Embedded server tests do not support restarting
--source include/not_embedded.inc
# DBUG_EXECUTE_IF is needed
--source include/have_debug.inc
--source include/maybe_debug.inc
# This test is slow on buildbot.
--source include/big_test.inc
@@ -20,6 +19,7 @@ call mtr.add_suppression("InnoDB: Expecting only ib_logfile0");
FLUSH TABLES;
--enable_query_log
let MYSQLD_DATADIR= `select @@datadir`;
SET GLOBAL innodb_file_per_table=0;
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
--source include/shutdown_mysqld.inc
@@ -89,6 +89,10 @@ INSERT INTO t1 VALUES (0),(123);
let SEARCH_ABORT = NOT FOUND;
BEGIN;
if ($have_debug) {
SET GLOBAL innodb_limit_optimistic_insert_debug=2;
INSERT INTO t1 VALUES (124),(125),(126),(127),(128),(129);
}
DELETE FROM t1 WHERE a>0;
--echo # Persist the state of the above incomplete transaction by
@@ -107,22 +111,23 @@ DELETE FROM t1 WHERE a=0;
SELECT * FROM t1;
let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir;
--source include/search_pattern_in_file.inc
--let $restart_parameters=
if ($have_debug) {
--let $restart_parameters= --debug-dbug=d,innodb_log_abort_1
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting crash recovery from checkpoint LSN=.*;
--source include/search_pattern_in_file.inc
let $restart_parameters = --innodb-log-file-size=5M;
}
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--source include/search_pattern_in_file.inc
if ($have_debug) {
--let $restart_parameters= --debug-dbug=d,innodb_log_abort_5
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
@@ -130,12 +135,10 @@ SELECT * FROM t1;
let SEARCH_PATTERN= redo log from 5\\.000MiB to [0-9.]*[KMGT]iB;
--source include/search_pattern_in_file.inc
--let $restart_parameters= --innodb-read-only
--let $restart_parameters=
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--source include/search_pattern_in_file.inc
}
# Trigger an error in recovery.

View File

@@ -119,3 +119,17 @@ SET STATEMENT transaction_read_only=1 FOR ANALYZE TABLE t1;
DROP TABLE t1;
--echo # End of 10.11 tests
--echo #
--echo # MDEV-38832 Assertion `!commit_lsn' failed in void trx_t::free()
--echo #
CREATE DATABASE test_1;
CREATE TABLE test_1.t1(f1 INT NOT NULL)Engine=InnoDB;
SET @old_stats=@@global.innodb_stats_persistent;
SET @flush_log_at_commit=@@global.innodb_flush_log_at_trx_commit;
SET GLOBAL innodb_stats_persistent=OFF;
SET GLOBAL innodb_flush_log_at_trx_commit=0;
DROP TABLE test_1.t1;
DROP DATABASE test_1;
SET GLOBAL innodb_stats_persistent=@old_stats;
SET GLOBAL innodb_flush_log_at_trx_commit=@flush_log_at_commit;

View File

@@ -257,13 +257,16 @@ let $shutdown_timeout = 0;
DROP TABLE t1;
--echo #
--echo # MDEV-34222 Alter operation on redundant table aborts the server
--echo # MDEV-38079 Crash recovery fails after ALTER TABLE…PAGE_COMPRESSED=1
--echo #
SET @df_row = @@global.INNODB_DEFAULT_ROW_FORMAT;
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT=REDUNDANT;
CREATE TABLE t1 (c CHAR(1)) ENGINE=InnoDB;
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT=compact;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 PAGE_COMPRESSED=1;
ALTER TABLE t1 PAGE_COMPRESSED=1, ALGORITHM=INPLACE;
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 PAGE_COMPRESSED=1, ALGORITHM=COPY;
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT=compact;
ALTER TABLE t1 PAGE_COMPRESSED=1, ALGORITHM=COPY;
DROP TABLE t1;
SET @@global.INNODB_DEFAULT_ROW_FORMAT = @df_row;

View File

@@ -47,22 +47,12 @@ let $restart_parameters=--innodb_undo_tablespaces=3;
--echo # Should list 3 undo log tablespaces
list_files $MYSQLD_DATADIR undo*;
--echo # case 4: Abort after re-creating new undo tablespaces
let $restart_parameters=--innodb_undo_tablespaces=4 --debug_dbug="+d,after_reinit_undo_abort";
--source include/restart_mysqld.inc
let $restart_parameters=--innodb_undo_tablespaces=4;
--source include/restart_mysqld.inc
--echo # Should list 4 undo log tablespaces
list_files $MYSQLD_DATADIR undo*;
--echo # case 5: Abort after re-creating new undo tablespaces successfully
let $restart_parameters=--innodb_undo_tablespaces=2 --debug_dbug="+d,after_reinit_undo_success";
--source include/restart_mysqld.inc
let $restart_parameters=--innodb_undo_tablespaces=2;
--source include/restart_mysqld.inc

View File

@@ -31,13 +31,15 @@ connection default;
disconnect con1;
disconnect con2;
connect (con1,localhost,root);
--send SELECT * FROM t1 LOCK IN SHARE MODE
send
SET STATEMENT innodb_lock_wait_timeout=1 FOR # work around MDEV-38741
SELECT * FROM t1 LOCK IN SHARE MODE;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'Sending data' and
info = 'SELECT * FROM t1 LOCK IN SHARE MODE';
info LIKE 'SET STATEMENT innodb_lock_wait_timeout%';
--source include/wait_condition.inc
SET innodb_lock_wait_timeout=1;

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