Merge branch '10.1' of github.com:MariaDB/server into 10.1

Conflicts:
	sql/item_subselect.cc

Fixed also typo in comment
This commit is contained in:
Monty 2015-07-09 14:47:32 +03:00
commit 9bb8b74e99
113 changed files with 15585 additions and 1581 deletions

View File

@ -351,7 +351,6 @@ struct my_collation_handler_st
my_bool (*propagate)(CHARSET_INFO *cs, const uchar *str, size_t len);
};
extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;

View File

@ -0,0 +1,241 @@
# WL#5096
#
# Description
# ===========
#
# This test case checks replication between hosts with same index
# structure but may differ on engines.
#
# Usage
# =====
#
# Before including this file the following variables should be set:
# * $server_1_engine
# * $server_2_engine
# * $server_3_engine
#
# Example:
#
# -- let $server_1_engine= Falcon
# -- let $server_2_engine= MyISAM
# -- let $server_3_engine= InnoDB
#
# -- source extra/rpl_tests/rpl_row_img.test
#
-- connection server_1
-- let $diff_table=test.t
let $i= 12;
while($i)
{
let $step= "";
-- connection server_1
SET SQL_LOG_BIN=0;
-- connection server_2
SET SQL_LOG_BIN=0;
-- connection server_3
SET SQL_LOG_BIN=0;
if ($i == 1) {
let $step= No keys;
--echo ******* TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_3_engine;
}
if ($i == 2)
{
let $step= One key;
--echo ******* TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_3_engine;
}
if ($i == 3)
{
let $step= One Composite key;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_3_engine;
}
if ($i == 4)
{
let $step= One Unique key;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_3_engine;
}
if ($i == 5)
{
let $step= One Composite Unique key;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_3_engine;
}
if ($i == 6)
{
let $step= One Primary key;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_3_engine;
}
if ($i == 7)
{
let $step= One Composite Primary Key;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_3_engine;
}
if ($i == 8)
{
let $step= One Composite key with holes;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_3_engine;
}
if ($i == 9)
{
let $step= One Composite Unique key with holes;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
}
if ($i == 10)
{
let $step= One Composite Primary Key with holes;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_3_engine;
}
if ($i == 11)
{
let $step= One Composite NOT NULL Unique key with holes;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
}
if ($i == 12)
{
let $step= One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
}
-- connection server_1
SET SQL_LOG_BIN=1;
-- connection server_2
SET SQL_LOG_BIN=1;
-- connection server_3
SET SQL_LOG_BIN=1;
-- connection server_1
INSERT INTO t VALUES (1, '1', '1', '1' );
INSERT INTO t VALUES (4, '4', '4', '4' );
INSERT INTO t VALUES (7, '7', '7', '7' );
INSERT INTO t VALUES (9, '9', '9', NULL );
INSERT INTO t VALUES (2, '1', '2', '2' );
INSERT INTO t VALUES (3, '1', '3', '2' );
-- source include/rpl_sync.inc
-- connection server_1
UPDATE t SET c4 = '7';
UPDATE t SET c4 = '5' WHERE c1 = 1;
UPDATE t SET c2 = '5' WHERE c1 = 1;
UPDATE t SET c1 = '5' WHERE c1 = 1;
UPDATE t SET c4 = '8' WHERE c2 = '4';
UPDATE t SET c1 = '8' WHERE c2 = '4';
UPDATE t SET c2 = '8' WHERE c2 = '4';
UPDATE t SET c3 = '0' WHERE c4 = NULL;
UPDATE t SET c2 = '0' WHERE c4 = '0';
UPDATE t SET c2 = '2' WHERE c4 = '2';
-- source include/rpl_sync.inc
-- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
-- source include/diff_tables.inc
-- connection server_1
DELETE FROM t WHERE c1 = 7;
DELETE FROM t WHERE c1 = 8;
DELETE FROM t;
-- source include/rpl_sync.inc
-- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
-- source include/diff_tables.inc
-- connection server_1
DROP TABLE t;
-- source include/rpl_sync.inc
dec $i;
}

View File

@ -0,0 +1,179 @@
# WL#5096
#
# Description
# ===========
#
# This test case covers Requirements for replication using different
# combinations of indexes and blob fields.
#
# It acts as a complement for rpl_row_img_sanity tests as it checks
# that in a chained replication scenario, replication does not break.
#
# Usage
# =====
#
# Before including this file the following variables should be set:
# * $server_1_engine
# * $server_2_engine
# * $server_3_engine
#
# Example:
#
# -- let $server_1_engine= Falcon
# -- let $server_2_engine= MyISAM
# -- let $server_3_engine= InnoDB
#
# -- source extra/rpl_tests/rpl_row_img_blobs.test
#
-- connection server_1
-- let $diff_table=test.t
let $i= 7;
while($i)
{
-- connection server_1
SET SQL_LOG_BIN=0;
-- connection server_2
SET SQL_LOG_BIN=0;
-- connection server_3
SET SQL_LOG_BIN=0;
#
# The comments below (on create table) must be read with the SQL
# instructions issued later in mind. Declaring a table obviously is
# not enough to assert anything.
#
# Also, the tests in this file make more sense when performed with
# binlog_row_image configured as NOBLOB.
#
if ($i == 1) {
-- echo ### Asserts that declaring a blob as part of a primary key does not break replication
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_3_engine;
}
if ($i == 2)
{
-- echo ### Asserts that declaring a blob as part of a unique (not null) key does not break replication
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_3_engine;
}
if ($i == 3)
{
-- echo ### Asserts that declaring a blob in a key does not break replication
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_3_engine;
}
if ($i == 4) {
-- echo ### Asserts that updates without blobs in the BI (PK exists int the table)
-- echo ### will not break replication
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_3_engine;
}
if ($i == 5)
{
-- echo ### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
-- echo ### will not break replication
-- connection server_1
--eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_3_engine;
}
if ($i == 6)
{
-- echo ### Asserts that updates without blobs in the AI (they are not updated)
-- echo ### will not break replication (check even if there is a key in the table)
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_3_engine;
}
if ($i == 7)
{
-- echo ### Asserts that updates without blobs in the AI (they are not updated)
-- echo ### will not break replication (check when there is no key in the table)
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_3_engine;
}
-- connection server_1
SET SQL_LOG_BIN=1;
-- connection server_2
SET SQL_LOG_BIN=1;
-- connection server_3
SET SQL_LOG_BIN=1;
-- connection server_1
-- let $blob1= "a"
-- let $blob2= "b"
-- let $blob3= "c"
-- eval INSERT INTO t VALUES (1, $blob1, 10)
-- eval INSERT INTO t VALUES (2, $blob2, 20)
-- eval INSERT INTO t VALUES (3, $blob3, 30)
-- source include/rpl_sync.inc
-- connection server_1
-- eval UPDATE t SET c1=10 WHERE c2=$blob1
-- eval UPDATE t SET c1=20 WHERE c1=2
-- eval UPDATE t SET c1=30 WHERE c3=30
-- eval UPDATE t SET c3=40 WHERE c1=30
-- source include/rpl_sync.inc
-- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
-- source include/diff_tables.inc
-- connection server_1
-- eval DELETE FROM t WHERE c2=$blob1
-- eval DELETE FROM t WHERE c1=20
-- eval DELETE FROM t
-- source include/rpl_sync.inc
-- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
-- source include/diff_tables.inc
-- connection server_1
DROP TABLE t;
-- source include/rpl_sync.inc
dec $i;
}

View File

@ -1802,5 +1802,33 @@ DROP TABLE t1;
--echo #
--echo #
--echo # End of tests
--echo # ctype_utf8mb4.inc: Start of 10.1 tests
--echo #
--echo #
--echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
--echo #
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id)
);
INSERT INTO t1 (a) VALUES (0x61);
INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF);
INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF);
INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF);
SELECT id,HEX(a) FROM t1 ORDER BY a,id;
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
SELECT COUNT(DISTINCT a) FROM t1;
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
SELECT id,HEX(a) FROM t1 ORDER BY a;
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
SELECT COUNT(DISTINCT a) FROM t1;
DROP TABLE t1;
--echo #
--echo # ctype_utf8mb4.inc: End of 10.1 tests
--echo #
--echo #
--echo # End of ctype_utf8mb4.inc
--echo #

View File

@ -639,6 +639,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t2.pk <> t1.d1 AND t2.pk = 4;
# MDEV-8189 field<>const and const<>field are not symmetric
# Do the same EXPLAIN and SELECT
# with "t1.d1 <> t2.pk" instead of "t2.pk <> t1.d1"
EXPLAIN
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t1.d1 <> t2.pk AND t2.pk = 4;
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t1.d1 <> t2.pk AND t2.pk = 4;
DROP TABLE t1, t2;
--echo #

View File

@ -0,0 +1,42 @@
#
# This is a helper script for rpl_row_img.test. It creates
# all combinations MyISAM / InnoDB in a three server replication
# chain. Each engine combination is tested against the current
# seetings for binlog_row_image (on each server).
#
# The test script that is executed on every combination is the
# only argument to this wrapper script. See below.
#
# This script takes one parameter:
# - $row_img_test_script
# the name of the test script to include in every combination
#
# Sample usage:
# -- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
# -- source include/rpl_row_img_general_loop.test
-- let $engine_type_a= 2
-- let $server_1_engine= MyISAM
while($engine_type_a)
{
-- let $engine_type_b= 2
-- let $server_2_engine= MyISAM
while($engine_type_b)
{
-- let $engine_type_c= 2
-- let $server_3_engine= MyISAM
while($engine_type_c)
{
-- echo ### engines: $server_1_engine, $server_2_engine, $server_3_engine
-- source $row_img_test_script
-- let $server_3_engine= InnoDB
-- dec $engine_type_c
}
-- let $server_2_engine= InnoDB
-- dec $engine_type_b
}
-- let $server_1_engine= InnoDB
-- dec $engine_type_a
}

View File

@ -0,0 +1,55 @@
#
# This is an auxiliar script that sets the binlog-row-image
# on a set of connections. These connections are passed as
# a parameter to this script. Its format is the following:
#
# <conid,value,Y_or_N>:[<conid,value,Y_or_N>:...]
#
# In detail:
#
# conid -- connection id (eg, master)
# value -- binlog_row_image value to set (eg, FULL)
# Y_or_N -- Issue stop and start slave (eg, Y)
#
# Sample usage:
#
# -- let $row_img_set=master:FULL:N,slave:MINIMAL:Y
# -- source include/rpl_row_img_set.inc
#
# Notes:
#
# 1. This script saves and restores the original connection that was
# in use at the time it was included.
-- let $old_conn= $CURRENT_CONNECTION
while (`SELECT HEX('$row_img_set') != HEX('')`)
{
-- let $tuple= `SELECT SUBSTRING_INDEX('$row_img_set', ',', 1)`
-- let $conn= `SELECT SUBSTRING_INDEX('$tuple', ':', 1)`
-- let $rimg= `SELECT SUBSTRING_INDEX(LTRIM(SUBSTRING('$tuple', LENGTH('$conn') + 2)), ':', 1)`
-- let $is_slave_restart= `SELECT LTRIM(SUBSTRING('$tuple', LENGTH('$conn') + LENGTH('$rimg')+ 3))`
-- echo CON: '$conn', IMG: '$rimg', RESTART SLAVE: '$is_slave_restart'
-- connection $conn
-- eval SET SESSION binlog_row_image= '$rimg'
-- eval SET GLOBAL binlog_row_image= '$rimg'
if ($is_slave_restart == Y)
{
-- source include/stop_slave.inc
-- source include/start_slave.inc
}
FLUSH TABLES;
SHOW VARIABLES LIKE 'binlog_row_image';
-- let $row_img_set= `SELECT LTRIM(SUBSTRING('$row_img_set', LENGTH('$tuple') + 2 ))`
}
-- connection $old_conn

View File

@ -531,4 +531,49 @@ EXPLAIN
}
drop table t5,t6,t7;
drop table t3;
#
# Tabular ANALYZE must get its data from execution tracker (and not from
# the query plan)
#
CREATE TABLE t2(
col1 int,
col2 int,
UNIQUE INDEX idx (col1, col2)) engine=myisam;
INSERT INTO t2(col1, col2) VALUES
(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
flush status;
explain
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by
analyze
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t2 range NULL idx 5 NULL 7 20.00 100.00 100.00 Using index for group-by
analyze format=json
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "range",
"key": "idx",
"key_length": "5",
"used_key_parts": ["col1"],
"r_loops": 1,
"rows": 7,
"r_rows": 20,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"using_index_for_group_by": true
}
}
}
drop table t2;
drop table t0,t1;

View File

@ -33841,3 +33841,45 @@ ERROR HY000: Invalid eucjpms character string: '8EA0'
#
# End of 10.0 tests
#
#
# Start of 10.1 tests
#
#
# MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms, KEY(a));
INSERT INTO t1 VALUES ('a'),(0x7F);
INSERT INTO t1 VALUES (0x8EA1),(0x8EDF);
INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE);
INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE);
SELECT HEX(a) FROM t1 ORDER BY a;
HEX(a)
61
7F
8EA1
8EDF
8FA1A1
8FFEFE
A1A1
DEDE
DFDF
E0E0
FEFE
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET eucjpms COLLATE eucjpms_bin;
SELECT HEX(a) FROM t1 ORDER BY a;
HEX(a)
61
7F
8EA1
8EDF
8FA1A1
8FFEFE
A1A1
DEDE
DFDF
E0E0
FEFE
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@ -26144,3 +26144,45 @@ ERROR HY000: Invalid ujis character string: '8EA0'
#
# End of 10.0 tests
#
#
# Start of 10.1 tests
#
#
# MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis, KEY(a));
INSERT INTO t1 VALUES ('a'),(0x7F);
INSERT INTO t1 VALUES (0x8EA1),(0x8EDF);
INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE);
INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE);
SELECT HEX(a) FROM t1 ORDER BY a;
HEX(a)
61
7F
8EA1
8EDF
8FA1A1
8FFEFE
A1A1
DEDE
DFDF
E0E0
FEFE
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ujis COLLATE ujis_bin;
SELECT HEX(a) FROM t1 ORDER BY a;
HEX(a)
61
7F
8EA1
8EDF
8FA1A1
8FFEFE
A1A1
DEDE
DFDF
E0E0
FEFE
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@ -2127,3 +2127,64 @@ DEALLOCATE PREPARE stmt;
#
# End of 10.0 tests
#
#
# Start of 10.1 tests
#
#
# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
#
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
a VARCHAR(10) CHARACTER SET utf16, KEY(a,id)
);
INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
SELECT id,HEX(a) FROM t1 ORDER BY a,id;
id HEX(a)
1 0061
2 0080
3 07FF
4 0800
6 D800DC00
7 DBFFDFFF
5 FFFF
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
id HEX(a)
5 FFFF
7 DBFFDFFF
6 D800DC00
4 0800
3 07FF
2 0080
1 0061
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
6
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_bin;
SELECT id,HEX(a) FROM t1 ORDER BY a;
id HEX(a)
1 0061
2 0080
3 07FF
4 0800
5 FFFF
6 D800DC00
7 DBFFDFFF
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
id HEX(a)
7 DBFFDFFF
6 D800DC00
5 FFFF
4 0800
3 07FF
2 0080
1 0061
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
7
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@ -2319,3 +2319,64 @@ DFFFFFDFFFFF9CFFFF9DFFFF9EFFFF
#
# End of 5.6 tests
#
#
# Start of 10.1 tests
#
#
# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
#
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
a VARCHAR(10) CHARACTER SET utf16le, KEY(a,id)
);
INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
SELECT id,HEX(a) FROM t1 ORDER BY a,id;
id HEX(a)
1 6100
2 8000
3 FF07
4 0008
6 00D800DC
7 FFDBFFDF
5 FFFF
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
id HEX(a)
5 FFFF
7 FFDBFFDF
6 00D800DC
4 0008
3 FF07
2 8000
1 6100
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
6
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16le COLLATE utf16le_bin;
SELECT id,HEX(a) FROM t1 ORDER BY a;
id HEX(a)
1 6100
2 8000
3 FF07
4 0008
5 FFFF
6 00D800DC
7 FFDBFFDF
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
id HEX(a)
7 FFDBFFDF
6 00D800DC
5 FFFF
4 0008
3 FF07
2 8000
1 6100
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
7
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@ -2206,3 +2206,21 @@ DEALLOCATE PREPARE stmt;
#
# End of 10.0 tests
#
#
# Start of 10.1 tests
#
#
# MDEV-8419 utf32: compare broken bytes as "greater than any non-broken character"
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32, KEY(a));
INSERT INTO t1 VALUES (0x10000),(0x10001),(0x10002);
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
1
DROP TABLE t1;
SELECT _utf32 0x10001=_utf32 0x10002;
_utf32 0x10001=_utf32 0x10002
1
#
# End of 10.1 tests
#

View File

@ -5594,11 +5594,11 @@ a?z
ab
az
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
PREPARE stmt FROM @query;
EXECUTE stmt;
ch
z
# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
@ -5802,11 +5802,11 @@ a?z
ab
az
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
PREPARE stmt FROM @query;
EXECUTE stmt;
ch
z
# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');
@ -6002,11 +6002,11 @@ a?z
ab
az
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch');
PREPARE stmt FROM @query;
EXECUTE stmt;
ch
z
# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence
SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch');

View File

@ -2495,5 +2495,66 @@ DROP TABLE t1;
# End of 5.5 tests
#
#
# End of tests
# ctype_utf8mb4.inc: Start of 10.1 tests
#
#
# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
#
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id)
);
INSERT INTO t1 (a) VALUES (0x61);
INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF);
INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF);
INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF);
SELECT id,HEX(a) FROM t1 ORDER BY a,id;
id HEX(a)
1 61
2 C280
3 DFBF
4 E0A080
6 F0908080
7 F48FBFBF
5 EFBFBF
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
id HEX(a)
5 EFBFBF
7 F48FBFBF
6 F0908080
4 E0A080
3 DFBF
2 C280
1 61
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
6
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
SELECT id,HEX(a) FROM t1 ORDER BY a;
id HEX(a)
1 61
2 C280
3 DFBF
4 E0A080
5 EFBFBF
6 F0908080
7 F48FBFBF
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
id HEX(a)
7 F48FBFBF
6 F0908080
5 EFBFBF
4 E0A080
3 DFBF
2 C280
1 61
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
7
DROP TABLE t1;
#
# ctype_utf8mb4.inc: End of 10.1 tests
#
#
# End of ctype_utf8mb4.inc
#

View File

@ -2642,5 +2642,66 @@ DROP TABLE t1;
# End of 5.5 tests
#
#
# End of tests
# ctype_utf8mb4.inc: Start of 10.1 tests
#
#
# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
#
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id)
);
INSERT INTO t1 (a) VALUES (0x61);
INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF);
INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF);
INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF);
SELECT id,HEX(a) FROM t1 ORDER BY a,id;
id HEX(a)
1 61
2 C280
3 DFBF
4 E0A080
6 F0908080
7 F48FBFBF
5 EFBFBF
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
id HEX(a)
5 EFBFBF
7 F48FBFBF
6 F0908080
4 E0A080
3 DFBF
2 C280
1 61
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
6
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
SELECT id,HEX(a) FROM t1 ORDER BY a;
id HEX(a)
1 61
2 C280
3 DFBF
4 E0A080
5 EFBFBF
6 F0908080
7 F48FBFBF
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
id HEX(a)
7 F48FBFBF
6 F0908080
5 EFBFBF
4 E0A080
3 DFBF
2 C280
1 61
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
7
DROP TABLE t1;
#
# ctype_utf8mb4.inc: End of 10.1 tests
#
#
# End of ctype_utf8mb4.inc
#

View File

@ -2642,5 +2642,66 @@ DROP TABLE t1;
# End of 5.5 tests
#
#
# End of tests
# ctype_utf8mb4.inc: Start of 10.1 tests
#
#
# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
#
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id)
);
INSERT INTO t1 (a) VALUES (0x61);
INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF);
INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF);
INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF);
SELECT id,HEX(a) FROM t1 ORDER BY a,id;
id HEX(a)
1 61
2 C280
3 DFBF
4 E0A080
6 F0908080
7 F48FBFBF
5 EFBFBF
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
id HEX(a)
5 EFBFBF
7 F48FBFBF
6 F0908080
4 E0A080
3 DFBF
2 C280
1 61
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
6
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
SELECT id,HEX(a) FROM t1 ORDER BY a;
id HEX(a)
1 61
2 C280
3 DFBF
4 E0A080
5 EFBFBF
6 F0908080
7 F48FBFBF
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
id HEX(a)
7 F48FBFBF
6 F0908080
5 EFBFBF
4 E0A080
3 DFBF
2 C280
1 61
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
7
DROP TABLE t1;
#
# ctype_utf8mb4.inc: End of 10.1 tests
#
#
# End of ctype_utf8mb4.inc
#

View File

@ -293,14 +293,17 @@ EXPLAIN
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"filtered": 100,
"attached_condition": "(t1.b = t0.a)"
"expression_cache": {
"state": "uninitialized",
"query_block": {
"select_id": 2,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"filtered": 100,
"attached_condition": "(t1.b = t0.a)"
}
}
}
}
@ -323,14 +326,17 @@ EXPLAIN
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"filtered": 100,
"attached_condition": "(t1.b = t0.a)"
"expression_cache": {
"state": "uninitialized",
"query_block": {
"select_id": 2,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"filtered": 100,
"attached_condition": "(t1.b = t0.a)"
}
}
}
}

View File

@ -1633,9 +1633,7 @@ drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists
Warnings:
Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row 1
drop table if exists t1;drop table if exists t1;
select * from information_schema.global_variables where variable_name like 'init%' order by variable_name;
VARIABLE_NAME VARIABLE_VALUE
INIT_CONNECT drop table if exists t1;drop table if exists t1;
@ -1658,11 +1656,9 @@ drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists t1;
drop table if exists t1;drop table if exists
drop table if exists t1;drop table if exists t1;
INIT_FILE
INIT_SLAVE
Warnings:
Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row #
set global init_connect="";
create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT';
SELECT 1;

View File

@ -600,6 +600,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t2.pk <> t1.d1 AND t2.pk = 4;
d1 pk i1
1 4 1
EXPLAIN
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t1.d1 <> t2.pk AND t2.pk = 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL k1 9 NULL 3 Using index
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t1.d1 <> t2.pk AND t2.pk = 4;
d1 pk i1
1 4 1
DROP TABLE t1, t2;
#
# BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89

View File

@ -4321,6 +4321,23 @@ h
n
v
p
EXPLAIN
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where
1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
v
b
h
n
v
p
SET SESSION join_cache_level=6;
EXPLAIN
SELECT t2.v FROM t1, t2, t3
@ -4339,6 +4356,23 @@ h
n
v
p
EXPLAIN
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
v
b
h
n
v
p
SET SESSION join_cache_level=4;
EXPLAIN
SELECT t2.v FROM t1, t2, t3
@ -4357,6 +4391,23 @@ h
n
v
p
EXPLAIN
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort
1 SIMPLE t3 hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join)
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
v
b
h
n
v
p
DROP TABLE t1,t2,t3;
SET SESSION join_cache_level=DEFAULT;
#

View File

@ -604,6 +604,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t2.pk <> t1.d1 AND t2.pk = 4;
d1 pk i1
1 4 1
EXPLAIN
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t1.d1 <> t2.pk AND t2.pk = 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL k1 9 NULL 3 Using index
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t1.d1 <> t2.pk AND t2.pk = 4;
d1 pk i1
1 4 1
DROP TABLE t1, t2;
#
# BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89

View File

@ -87,6 +87,17 @@ The following options may be given as the first argument:
The maximum size of a row-based binary log event in
bytes. Rows will be grouped into events smaller than this
size if possible. The value has to be a multiple of 256.
--binlog-row-image=name
Controls whether rows should be logged in 'FULL',
'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all
columns in the before and after image are logged.
'NOBLOB', means that mysqld avoids logging blob columns
whenever possible (eg, blob column was not changed or is
not part of primary key). 'MINIMAL', means that a PK
equivalent (PK columns or full row if there is no PK in
the table) is logged in the before image, and only
changed columns are logged in the after image. (Default:
FULL).
--binlog-stmt-cache-size=#
The size of the statement cache for updates to
non-transactional engines for the binary log. If you
@ -1127,6 +1138,7 @@ binlog-direct-non-transactional-updates FALSE
binlog-format STATEMENT
binlog-optimize-thread-scheduling TRUE
binlog-row-event-max-size 1024
binlog-row-image FULL
binlog-stmt-cache-size 32768
bulk-insert-buffer-size 8388608
changed-page-bitmaps ON

View File

@ -2241,3 +2241,27 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0
drop table t1,t2;
#
# Start of 10.1 tests
#
#
# MDEV-8189 field<>const and const<>field are not symmetric
#
CREATE TABLE t1 (a INT, b INT, KEY(a));
INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70);
EXPLAIN SELECT * FROM t1 WHERE a<>10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 3 Using index condition
EXPLAIN SELECT * FROM t1 WHERE 10<>a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 3 Using index condition
SELECT * FROM t1 WHERE a<>10;
a b
70 NULL
SELECT * FROM t1 WHERE 10<>a;
a b
70 NULL
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@ -2243,4 +2243,28 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0
drop table t1,t2;
#
# Start of 10.1 tests
#
#
# MDEV-8189 field<>const and const<>field are not symmetric
#
CREATE TABLE t1 (a INT, b INT, KEY(a));
INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70);
EXPLAIN SELECT * FROM t1 WHERE a<>10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 3 Using index condition; Rowid-ordered scan
EXPLAIN SELECT * FROM t1 WHERE 10<>a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 3 Using index condition; Rowid-ordered scan
SELECT * FROM t1 WHERE a<>10;
a b
70 NULL
SELECT * FROM t1 WHERE 10<>a;
a b
70 NULL
DROP TABLE t1;
#
# End of 10.1 tests
#
set optimizer_switch=@mrr_icp_extra_tmp;

View File

@ -101,19 +101,19 @@ drop table t1;
show variables like "wait_timeout%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 5 N 1 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8
Variable_name Value
wait_timeout 28800
show variables like "WAIT_timeout%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 5 N 1 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8
Variable_name Value
wait_timeout 28800
show variables like "this_doesn't_exists%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 0 N 1 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 0 N 1 0 8
Variable_name Value
show table status from test like "this_doesn't_exists%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr

View File

@ -39,6 +39,231 @@ Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 31
analyze format=json
select a, (select d from t2 where b=c) from t1;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
},
"subqueries": [
{
"expression_cache": {
"r_loops": 10,
"r_hit_ratio": 60,
"query_block": {
"select_id": 2,
"r_loops": 4,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 4,
"rows": 4,
"r_rows": 4,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 18.75,
"attached_condition": "(t1.b = t2.c)"
}
}
}
}
]
}
}
analyze format=json
select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
},
"subqueries": [
{
"expression_cache": {
"r_loops": 10,
"r_hit_ratio": 60,
"query_block": {
"union_result": {
"table_name": "<union3,4>",
"access_type": "ALL",
"r_loops": 4,
"r_rows": 1,
"query_specifications": [
{
"query_block": {
"select_id": 3,
"r_loops": 4,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 4,
"rows": 4,
"r_rows": 4,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 18.75,
"attached_condition": "(t1.b = t2.c)"
}
}
},
{
"query_block": {
"select_id": 4,
"table": {
"message": "No tables used"
}
}
}
]
}
}
}
},
{
"expression_cache": {
"r_loops": 10,
"r_hit_ratio": 60,
"query_block": {
"select_id": 2,
"r_loops": 4,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 4,
"rows": 4,
"r_rows": 4,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 18.75,
"attached_condition": "(t1.b = t2.c)"
}
}
}
}
]
}
}
explain format=json
select a, (select d from t2 where b=c) from t1;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"filtered": 100
},
"subqueries": [
{
"expression_cache": {
"state": "uninitialized",
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "(t1.b = t2.c)"
}
}
}
}
]
}
}
explain format=json
select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"filtered": 100
},
"subqueries": [
{
"expression_cache": {
"state": "uninitialized",
"query_block": {
"union_result": {
"table_name": "<union3,4>",
"access_type": "ALL",
"query_specifications": [
{
"query_block": {
"select_id": 3,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "(t1.b = t2.c)"
}
}
},
{
"query_block": {
"select_id": 4,
"table": {
"message": "No tables used"
}
}
}
]
}
}
}
},
{
"expression_cache": {
"state": "uninitialized",
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "(t1.b = t2.c)"
}
}
}
}
]
}
}
set optimizer_switch='subquery_cache=off';
flush status;
select a, (select d from t2 where b=c) from t1;

View File

@ -1092,6 +1092,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
);
COUNT(*)
3724
EXPLAIN
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
WHERE alias5.b = alias4.b
AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where
1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index
1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3)
1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join)
1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join)
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
WHERE alias5.b = alias4.b
AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
);
COUNT(*)
3724
set optimizer_prune_level=@tmp_951283;
DROP TABLE t1,t2;
#

View File

@ -1107,6 +1107,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
);
COUNT(*)
3724
EXPLAIN
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
WHERE alias5.b = alias4.b
AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where
1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index
1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3)
1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join)
1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (incremental, BNL join)
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
WHERE alias5.b = alias4.b
AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
);
COUNT(*)
3724
set optimizer_prune_level=@tmp_951283;
DROP TABLE t1,t2;
#

View File

@ -1094,6 +1094,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
);
COUNT(*)
3724
EXPLAIN
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
WHERE alias5.b = alias4.b
AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where
1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index
1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3)
1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join)
1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join)
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
WHERE alias5.b = alias4.b
AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
);
COUNT(*)
3724
set optimizer_prune_level=@tmp_951283;
DROP TABLE t1,t2;
#

View File

@ -893,5 +893,57 @@ DROP TABLE t1;
# End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field
#
#
# MDEV-8336 The meaning of NO_ZERO_DATE is not clear for DATETIME
#
SET sql_mode='NO_ZERO_DATE';
SELECT TIMESTAMP'0000-00-01 10:20:30';
TIMESTAMP'0000-00-01 10:20:30'
0000-00-01 10:20:30
SELECT TIMESTAMP'0000-00-00 10:20:30';
TIMESTAMP'0000-00-00 10:20:30'
0000-00-00 10:20:30
SELECT TIMESTAMP'0000-00-00 00:00:00.000001';
TIMESTAMP'0000-00-00 00:00:00.000001'
0000-00-00 00:00:00.000001
CREATE TABLE t1 (a DATETIME);
INSERT INTO t1 VALUES ('0000-00-00 10:20:30');
SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1;
a LEAST(a,'2001-01-01 10:20:30')
0000-00-00 10:20:30 0000-00-00 10:20:30.000000
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME(6));
INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000001');
SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1;
a LEAST(a,'2001-01-01 10:20:30')
0000-00-00 00:00:00.000001 0000-00-00 00:00:00.000001
DROP TABLE t1;
SELECT STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s');
STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s')
0000-00-00 10:20:30
SELECT STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f');
STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f')
0000-00-00 00:00:00.000001
SET old_mode=zero_date_time_cast;
SELECT CAST(TIME'10:20:30' AS DATETIME);
CAST(TIME'10:20:30' AS DATETIME)
0000-00-00 10:20:30
SELECT CAST(TIME'00:00:00.000001' AS DATETIME(6));
CAST(TIME'00:00:00.000001' AS DATETIME(6))
0000-00-00 00:00:00.000001
SELECT CAST(CAST('10:20:30' AS TIME) AS DATETIME);
CAST(CAST('10:20:30' AS TIME) AS DATETIME)
0000-00-00 10:20:30
SELECT CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6));
CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6))
0000-00-00 00:00:00.000001
SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME);
CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME)
0000-00-00 10:20:30
SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6));
CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6))
0000-00-00 00:00:00.000001
SET old_mode=DEFAULT;
SET sql_mode=DEFAULT;
#
# End of 10.1 tests
#

View File

@ -1,12 +1,27 @@
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
Level Code Message
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
show warnings;
Level Code Message
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
show warnings;
Level Code Message
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
ERROR HY000: Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: ENCRYPTION_KEY_ID 3 not available
Error 1005 Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
show warnings;
Level Code Message
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
show warnings;
Level Code Message
set innodb_default_encryption_key_id = 5;
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encrypted=yes;
show create table innodb_defkey;

View File

@ -2,7 +2,11 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
show warnings;
Level Code Message
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1 page_compressed=1;
show warnings;
Level Code Message
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=2 page_compressed=1;
show warnings;
Level Code Message

View File

@ -4,10 +4,20 @@ call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key versi
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
Level Code Message
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
show warnings;
Level Code Message
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
show warnings;
Level Code Message
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
show warnings;
Level Code Message
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
show warnings;
Level Code Message
show create table innodb_compact;
Table Create Table
innodb_compact CREATE TABLE `innodb_compact` (

View File

@ -262,5 +262,3 @@ drop table innodb_page_compressed6;
drop table innodb_page_compressed7;
drop table innodb_page_compressed8;
drop table innodb_page_compressed9;
SET GLOBAL innodb_encryption_threads = 4;
SET GLOBAL innodb_encrypt_tables = on;

View File

@ -2,10 +2,20 @@
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
Level Code Message
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=2;
show warnings;
Level Code Message
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=3;
show warnings;
Level Code Message
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=4;
show warnings;
Level Code Message
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=5;
show warnings;
Level Code Message
insert into innodb_normal values (1,'test1'),(2,'foo'),(3,'bar'),(4,'mariadb');
insert into innodb_compact select * from innodb_normal;
insert into innodb_compressed select * from innodb_normal;

View File

@ -10,12 +10,18 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
show warnings;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
show warnings;
--error ER_CANT_CREATE_TABLE
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
show warnings;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
show warnings;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
show warnings;
set innodb_default_encryption_key_id = 5;
create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encrypted=yes;

View File

@ -15,7 +15,9 @@ SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1 page_compressed=1;
show warnings;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=2 page_compressed=1;
show warnings;

View File

@ -15,10 +15,15 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
show warnings;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2;
show warnings;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
show warnings;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4;
show warnings;
show create table innodb_compact;
show create table innodb_compressed;

View File

@ -8,6 +8,8 @@
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
let $innodb_encrypt_tables_orig = `SELECT @@innodb_encrypt_tables`;
let $innodb_encryption_threads_orig = `SELECT @@innodb_encryption_threads`;
--enable_query_log
SET GLOBAL innodb_file_format = `Barracuda`;
@ -161,7 +163,7 @@ drop table innodb_page_compressed9;
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
EVAL SET GLOBAL innodb_encrypt_tables = $innodb_encrypt_tables_orig;
EVAL SET GLOBAL innodb_encryption_threads = $innodb_encryption_threads_orig;
--enable_query_log
SET GLOBAL innodb_encryption_threads = 4;
SET GLOBAL innodb_encrypt_tables = on;

View File

@ -16,10 +16,15 @@ SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
show warnings;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=2;
show warnings;
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=3;
show warnings;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=4;
show warnings;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=5;
show warnings;
insert into innodb_normal values (1,'test1'),(2,'foo'),(3,'bar'),(4,'mariadb');
insert into innodb_compact select * from innodb_normal;

View File

@ -167,9 +167,9 @@ def information_schema GEOMETRY_COLUMNS MAX_PPR 12 0 NO tinyint NULL NULL 3 0 NU
def information_schema GEOMETRY_COLUMNS SRID 13 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select
def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select
def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema INDEX_STATISTICS INDEX_NAME 3 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) select
def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select
def information_schema INDEX_STATISTICS TABLE_NAME 2 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) select
@ -321,9 +321,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NUL
def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select
def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select
@ -345,15 +345,15 @@ def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL
def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT 14 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select
def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select
def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select
def information_schema SYSTEM_VARIABLES READ_ONLY 13 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select
def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
@ -694,9 +694,9 @@ NULL information_schema GEOMETRY_COLUMNS COORD_DIMENSION tinyint NULL NULL NULL
NULL information_schema GEOMETRY_COLUMNS MAX_PPR tinyint NULL NULL NULL NULL tinyint(2)
NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema INDEX_STATISTICS TABLE_SCHEMA varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS TABLE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS INDEX_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
@ -848,9 +848,9 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet
3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema SESSION_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512)
NULL information_schema SPATIAL_REF_SYS AUTH_SRID smallint NULL NULL NULL NULL smallint(5)
@ -872,10 +872,10 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3)
3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16)
3.0000 information_schema STATISTICS INDEX_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_SCOPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048)

View File

@ -167,9 +167,9 @@ def information_schema GEOMETRY_COLUMNS MAX_PPR 12 0 NO tinyint NULL NULL 3 0 NU
def information_schema GEOMETRY_COLUMNS SRID 13 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5)
def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2)
def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema INDEX_STATISTICS INDEX_NAME 3 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192)
def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21)
def information_schema INDEX_STATISTICS TABLE_NAME 2 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192)
@ -321,9 +321,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NUL
def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512)
def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512)
def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5)
def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5)
@ -345,15 +345,15 @@ def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL
def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT 14 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21)
def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21)
def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21)
def information_schema SYSTEM_VARIABLES READ_ONLY 13 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3)
def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024)
def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048)
def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
@ -694,9 +694,9 @@ NULL information_schema GEOMETRY_COLUMNS COORD_DIMENSION tinyint NULL NULL NULL
NULL information_schema GEOMETRY_COLUMNS MAX_PPR tinyint NULL NULL NULL NULL tinyint(2)
NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema INDEX_STATISTICS TABLE_SCHEMA varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS TABLE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS INDEX_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
@ -848,9 +848,9 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet
3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema SESSION_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512)
NULL information_schema SPATIAL_REF_SYS AUTH_SRID smallint NULL NULL NULL NULL smallint(5)
@ -872,10 +872,10 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3)
3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16)
3.0000 information_schema STATISTICS INDEX_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_SCOPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SYSTEM_VARIABLES VARIABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048)

View File

@ -606,6 +606,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t2.pk <> t1.d1 AND t2.pk = 4;
d1 pk i1
1 4 1
EXPLAIN
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t1.d1 <> t2.pk AND t2.pk = 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL k1 9 NULL 3 Using index
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where
SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1
WHERE t1.d1 <> t2.pk AND t2.pk = 4;
d1 pk i1
1 4 1
DROP TABLE t1, t2;
#
# BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
!include include/default_mysqld.cnf
[mysqld.1]
log-slave-updates
innodb
innodb_flush_log_at_trx_commit= 0
[mysqld.2]
log-slave-updates
innodb
innodb_flush_log_at_trx_commit= 0
[mysqld.3]
log-slave-updates
innodb
innodb_flush_log_at_trx_commit= 0
[ENV]
SERVER_MYPORT_1= @mysqld.1.port
SERVER_MYPORT_2= @mysqld.2.port
SERVER_MYPORT_3= @mysqld.3.port

View File

@ -0,0 +1 @@
!include suite/rpl/t/rpl_row_img.cnf

View File

@ -0,0 +1,59 @@
#Want to skip this test from daily Valgrind execution
--source include/no_valgrind_without_big.inc
#
# This file contains tests for WL#5096.
#
--let $rpl_topology= 1->2->3
--source include/rpl_init.inc
-- source include/have_binlog_format_row.inc
-- connection server_1
-- source include/have_innodb.inc
-- connection server_2
-- source include/have_innodb.inc
-- connection server_3
-- source include/have_innodb.inc
-- connection server_1
#
# WL#5096 Tests.
#
#
# Tests combinations of binlog-row-image against mixes of MyISAM and InnoDB
# storage engines on all three servers.
#
# All the combinarions need not to be separated into their own files as
# the tests for indexes and engines mixes are, because noblobs test script
# does not take too long time, thence we do not risk triggering PB2 timeout
# on valgrind runs.
#
## NOBLOB
-- let $row_img_set=server_1:NOBLOB:N,server_2:NOBLOB:Y,server_3:NOBLOB:Y
-- source include/rpl_row_img_set.inc
-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
-- source include/rpl_row_img_general_loop.inc
## MINIMAL
-- let $row_img_set=server_1:MINIMAL:N,server_2:MINIMAL:Y,server_3:MINIMAL:Y
-- source include/rpl_row_img_set.inc
-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
-- source include/rpl_row_img_general_loop.inc
## FULL
-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
-- source include/rpl_row_img_set.inc
-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
-- source include/rpl_row_img_general_loop.inc
--source include/rpl_end.inc

View File

@ -0,0 +1 @@
!include suite/rpl/t/rpl_row_img.cnf

View File

@ -0,0 +1,39 @@
#Want to skip this test from daily Valgrind execution
--source include/no_valgrind_without_big.inc
#
# This file contains tests for WL#5096 and bug fixes.
#
--let $rpl_topology= 1->2->3
--source include/rpl_init.inc
-- source include/have_binlog_format_row.inc
-- connection server_1
-- source include/have_innodb.inc
-- connection server_2
-- source include/have_innodb.inc
-- connection server_3
-- source include/have_innodb.inc
-- connection server_1
#
# WL#5096
#
#
# Tests for different storage engines on each server,
# but same index structure on tables. The tests are conducted
# using MINIMAL binlog-row-image on all servers.
#
-- let $row_img_set=server_1:MINIMAL:N,server_2:MINIMAL:Y,server_3:MINIMAL:Y
-- source include/rpl_row_img_set.inc
-- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
-- source include/rpl_row_img_general_loop.inc
-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
-- source include/rpl_row_img_set.inc
--source include/rpl_end.inc

View File

@ -0,0 +1 @@
!include suite/rpl/t/rpl_row_img.cnf

View File

@ -0,0 +1,39 @@
#Want to skip this test from daily Valgrind execution
--source include/no_valgrind_without_big.inc
#
# This file contains tests for WL#5096 and bug fixes.
#
--let $rpl_topology= 1->2->3
--source include/rpl_init.inc
-- source include/have_binlog_format_row.inc
-- connection server_1
-- source include/have_innodb.inc
-- connection server_2
-- source include/have_innodb.inc
-- connection server_3
-- source include/have_innodb.inc
-- connection server_1
#
# WL#5096
#
#
# Tests for different storage engines on each server,
# but same index structure on tables. The tests are conducted
# using NOBLOB binlog-row-image on all servers.
#
-- let $row_img_set=server_1:NOBLOB:N,server_2:NOBLOB:Y,server_3:NOBLOB:Y
-- source include/rpl_row_img_set.inc
-- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
-- source include/rpl_row_img_general_loop.inc
-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
-- source include/rpl_row_img_set.inc
--source include/rpl_end.inc

View File

@ -0,0 +1,100 @@
SELECT @@GLOBAL.binlog_row_image;
@@GLOBAL.binlog_row_image
FULL
SELECT @@SESSION.binlog_row_image;
@@SESSION.binlog_row_image
FULL
FULL Expected
'#---------------------BS_STVARS_002_01----------------------#'
SET @start_value= @@global.binlog_row_image;
SELECT COUNT(@@GLOBAL.binlog_row_image);
COUNT(@@GLOBAL.binlog_row_image)
1
1 Expected
SELECT COUNT(@@SESSION.binlog_row_image);
COUNT(@@SESSION.binlog_row_image)
1
1 Expected
'#---------------------BS_STVARS_002_02----------------------#'
SET @@GLOBAL.binlog_row_image=0;
SELECT @@GLOBAL.binlog_row_image;
@@GLOBAL.binlog_row_image
MINIMAL
MINIMAL Expected
SET @@SESSION.binlog_row_image=0;
SELECT @@SESSION.binlog_row_image;
@@SESSION.binlog_row_image
MINIMAL
MINIMAL Expected
SET @@GLOBAL.binlog_row_image=1;
SELECT @@GLOBAL.binlog_row_image;
@@GLOBAL.binlog_row_image
NOBLOB
NOBLOB Expected
SET @@SESSION.binlog_row_image=1;
SELECT @@SESSION.binlog_row_image;
@@SESSION.binlog_row_image
NOBLOB
NOBLOB Expected
SET @@GLOBAL.binlog_row_image=2;
SELECT @@GLOBAL.binlog_row_image;
@@GLOBAL.binlog_row_image
FULL
FULL Expected
SET @@SESSION.binlog_row_image=2;
SELECT @@SESSION.binlog_row_image;
@@SESSION.binlog_row_image
FULL
FULL Expected
'#---------------------BS_STVARS_002_03----------------------#'
SELECT @@GLOBAL.binlog_row_image = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='binlog_row_image';
@@GLOBAL.binlog_row_image = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.binlog_row_image);
COUNT(@@GLOBAL.binlog_row_image)
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='binlog_row_image';
COUNT(VARIABLE_VALUE)
1
1 Expected
'#---------------------BS_STVARS_002_04----------------------#'
SELECT @@SESSION.binlog_row_image = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='binlog_row_image';
@@SESSION.binlog_row_image = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@SESSION.binlog_row_image);
COUNT(@@SESSION.binlog_row_image)
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='binlog_row_image';
COUNT(VARIABLE_VALUE)
1
1 Expected
'#---------------------BS_STVARS_002_05----------------------#'
SELECT COUNT(@@binlog_row_image);
COUNT(@@binlog_row_image)
1
1 Expected
SELECT COUNT(@@local.binlog_row_image);
COUNT(@@local.binlog_row_image)
1
1 Expected
SELECT COUNT(@@SESSION.binlog_row_image);
COUNT(@@SESSION.binlog_row_image)
1
1 Expected
SELECT COUNT(@@GLOBAL.binlog_row_image);
COUNT(@@GLOBAL.binlog_row_image)
1
1 Expected
SET @@global.binlog_row_image= @start_value;

View File

@ -233,6 +233,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_ROW_IMAGE
SESSION_VALUE FULL
GLOBAL_VALUE FULL
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE FULL
VARIABLE_SCOPE SESSION
VARIABLE_TYPE ENUM
VARIABLE_COMMENT Controls whether rows should be logged in 'FULL', 'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all columns in the before and after image are logged. 'NOBLOB', means that mysqld avoids logging blob columns whenever possible (eg, blob column was not changed or is not part of primary key). 'MINIMAL', means that a PK equivalent (PK columns or full row if there is no PK in the table) is logged in the before image, and only changed columns are logged in the after image. (Default: FULL).
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST MINIMAL,NOBLOB,FULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_STMT_CACHE_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 32768

View File

@ -233,6 +233,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_ROW_IMAGE
SESSION_VALUE FULL
GLOBAL_VALUE FULL
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE FULL
VARIABLE_SCOPE SESSION
VARIABLE_TYPE ENUM
VARIABLE_COMMENT Controls whether rows should be logged in 'FULL', 'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all columns in the before and after image are logged. 'NOBLOB', means that mysqld avoids logging blob columns whenever possible (eg, blob column was not changed or is not part of primary key). 'MINIMAL', means that a PK equivalent (PK columns or full row if there is no PK in the table) is logged in the before image, and only changed columns are logged in the after image. (Default: FULL).
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST MINIMAL,NOBLOB,FULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_STMT_CACHE_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 32768

View File

@ -0,0 +1,129 @@
################## mysql-test\t\binlog_row_image_basic.test ###################
# #
# Variable Name: binlog_row_image #
# Scope: Global & Session #
# Access Type: Static #
# Data Type: enumeration #
# #
# #
# Creation Date: 2010-05-20 #
# Author : Luis Soares #
# #
# #
# Description:Test Cases of Dynamic System Variable binlog_row_image #
# that checks the behavior of this variable in the following ways #
# * Value Check #
# * Scope Check #
# #
# Reference: #
# http://dev.mysql.com/doc/refman/5.X/en/server-system-variables.html #
# #
###############################################################################
SELECT @@GLOBAL.binlog_row_image;
SELECT @@SESSION.binlog_row_image;
--echo FULL Expected
--echo '#---------------------BS_STVARS_002_01----------------------#'
####################################################################
# Displaying default value #
####################################################################
SET @start_value= @@global.binlog_row_image;
SELECT COUNT(@@GLOBAL.binlog_row_image);
--echo 1 Expected
SELECT COUNT(@@SESSION.binlog_row_image);
--echo 1 Expected
--echo '#---------------------BS_STVARS_002_02----------------------#'
####################################################################
# Check if Value can set #
####################################################################
SET @@GLOBAL.binlog_row_image=0;
SELECT @@GLOBAL.binlog_row_image;
--echo MINIMAL Expected
SET @@SESSION.binlog_row_image=0;
SELECT @@SESSION.binlog_row_image;
--echo MINIMAL Expected
SET @@GLOBAL.binlog_row_image=1;
SELECT @@GLOBAL.binlog_row_image;
--echo NOBLOB Expected
SET @@SESSION.binlog_row_image=1;
SELECT @@SESSION.binlog_row_image;
--echo NOBLOB Expected
SET @@GLOBAL.binlog_row_image=2;
SELECT @@GLOBAL.binlog_row_image;
--echo FULL Expected
SET @@SESSION.binlog_row_image=2;
SELECT @@SESSION.binlog_row_image;
--echo FULL Expected
--echo '#---------------------BS_STVARS_002_03----------------------#'
#################################################################
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
--disable_warnings
SELECT @@GLOBAL.binlog_row_image = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='binlog_row_image';
--enable_warnings
--echo 1 Expected
SELECT COUNT(@@GLOBAL.binlog_row_image);
--echo 1 Expected
--disable_warnings
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='binlog_row_image';
--enable_warnings
--echo 1 Expected
--echo '#---------------------BS_STVARS_002_04----------------------#'
#################################################################
# Check if the value in SESSION Table matches value in variable #
#################################################################
--disable_warnings
SELECT @@SESSION.binlog_row_image = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='binlog_row_image';
--enable_warnings
--echo 1 Expected
SELECT COUNT(@@SESSION.binlog_row_image);
--echo 1 Expected
--disable_warnings
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='binlog_row_image';
--enable_warnings
--echo 1 Expected
--echo '#---------------------BS_STVARS_002_05----------------------#'
################################################################################
# Check if binlog_row_image can be accessed with and without @@ sign #
################################################################################
SELECT COUNT(@@binlog_row_image);
--echo 1 Expected
SELECT COUNT(@@local.binlog_row_image);
--echo 1 Expected
SELECT COUNT(@@SESSION.binlog_row_image);
--echo 1 Expected
SELECT COUNT(@@GLOBAL.binlog_row_image);
--echo 1 Expected
SET @@global.binlog_row_image= @start_value;

View File

@ -147,6 +147,31 @@ select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= 5
group by t5.a order by sum limit 1;
drop table t5,t6,t7;
drop table t3;
--echo #
--echo # Tabular ANALYZE must get its data from execution tracker (and not from
--echo # the query plan)
--echo #
CREATE TABLE t2(
col1 int,
col2 int,
UNIQUE INDEX idx (col1, col2)) engine=myisam;
INSERT INTO t2(col1, col2) VALUES
(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
flush status;
explain
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
analyze
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ /"r_buffer_size": "[^"]+"/"r_buffer_size": "REPLACED"/
analyze format=json
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
drop table t2;
drop table t0,t1;

View File

@ -541,3 +541,28 @@ SELECT _eucjpms 0x8EA0;
--echo #
--echo # End of 10.0 tests
--echo #
--echo #
--echo # Start of 10.1 tests
--echo #
--echo #
--echo # MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
--echo #
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms, KEY(a));
# [x00-x7F] # ASCII/JIS-Roman
# [x8E][xA1-xDF] # half-width katakana
# [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990
# [xA1-xFE][xA1-xFE] # JIS X 0208:1997
INSERT INTO t1 VALUES ('a'),(0x7F);
INSERT INTO t1 VALUES (0x8EA1),(0x8EDF);
INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE);
INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE);
SELECT HEX(a) FROM t1 ORDER BY a;
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET eucjpms COLLATE eucjpms_bin;
SELECT HEX(a) FROM t1 ORDER BY a;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -1369,3 +1369,28 @@ SELECT _ujis 0x8EA0;
--echo #
--echo # End of 10.0 tests
--echo #
--echo #
--echo # Start of 10.1 tests
--echo #
--echo #
--echo # MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
--echo #
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis, KEY(a));
# [x00-x7F] # ASCII/JIS-Roman
# [x8E][xA1-xDF] # half-width katakana
# [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990
# [xA1-xFE][xA1-xFE] # JIS X 0208:1997
INSERT INTO t1 VALUES ('a'),(0x7F);
INSERT INTO t1 VALUES (0x8EA1),(0x8EDF);
INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE);
INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE);
SELECT HEX(a) FROM t1 ORDER BY a;
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ujis COLLATE ujis_bin;
SELECT HEX(a) FROM t1 ORDER BY a;DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -860,3 +860,31 @@ DEALLOCATE PREPARE stmt;
--echo #
--echo # End of 10.0 tests
--echo #
--echo #
--echo # Start of 10.1 tests
--echo #
--echo #
--echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
--echo #
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
a VARCHAR(10) CHARACTER SET utf16, KEY(a,id)
);
INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
SELECT id,HEX(a) FROM t1 ORDER BY a,id;
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
SELECT COUNT(DISTINCT a) FROM t1;
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_bin;
SELECT id,HEX(a) FROM t1 ORDER BY a;
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
SELECT COUNT(DISTINCT a) FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -744,3 +744,31 @@ SET NAMES utf8, collation_connection=utf16le_bin;
--echo #
--echo # End of 5.6 tests
--echo #
--echo #
--echo # Start of 10.1 tests
--echo #
--echo #
--echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
--echo #
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
a VARCHAR(10) CHARACTER SET utf16le, KEY(a,id)
);
INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
SELECT id,HEX(a) FROM t1 ORDER BY a,id;
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
SELECT COUNT(DISTINCT a) FROM t1;
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16le COLLATE utf16le_bin;
SELECT id,HEX(a) FROM t1 ORDER BY a;
SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
SELECT COUNT(DISTINCT a) FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -956,3 +956,20 @@ DEALLOCATE PREPARE stmt;
--echo # End of 10.0 tests
--echo #
--echo #
--echo # Start of 10.1 tests
--echo #
--echo #
--echo # MDEV-8419 utf32: compare broken bytes as "greater than any non-broken character"
--echo #
# Make sure that all non-BMP characters are compared as equal
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32, KEY(a));
INSERT INTO t1 VALUES (0x10000),(0x10001),(0x10002);
SELECT COUNT(DISTINCT a) FROM t1;
DROP TABLE t1;
SELECT _utf32 0x10001=_utf32 0x10002;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -2505,6 +2505,18 @@ SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
# MDEV-8189 field<>const and const<>field are not symmetric
# Do the same EXPLAIN and SELECT
# for "t2.v <> t3.v" instead of "t3.v <> t2.v"
EXPLAIN
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
SET SESSION join_cache_level=6;
EXPLAIN
SELECT t2.v FROM t1, t2, t3
@ -2514,6 +2526,17 @@ SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
# MDEV-8189 field<>const and const<>field are not symmetric
# Do the same EXPLAIN and SELECT
# for "t2.v <> t3.v" instead of "t3.v <> t2.v"
EXPLAIN
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
SET SESSION join_cache_level=4;
EXPLAIN
SELECT t2.v FROM t1, t2, t3
@ -2523,6 +2546,17 @@ SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
# MDEV-8189 field<>const and const<>field are not symmetric
# Do the same EXPLAIN and SELECT
# for "t2.v <> t3.v" instead of "t3.v <> t2.v"
EXPLAIN
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
SELECT t2.v FROM t1, t2, t3
WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
DROP TABLE t1,t2,t3;
SET SESSION join_cache_level=DEFAULT;

View File

@ -1777,3 +1777,24 @@ explain extended select * from t2 where (b > 25 and b < 15) or c < 44;
explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44);
drop table t1,t2;
--echo #
--echo # Start of 10.1 tests
--echo #
--echo #
--echo # MDEV-8189 field<>const and const<>field are not symmetric
--echo #
CREATE TABLE t1 (a INT, b INT, KEY(a));
INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70);
EXPLAIN SELECT * FROM t1 WHERE a<>10;
EXPLAIN SELECT * FROM t1 WHERE 10<>a;
SELECT * FROM t1 WHERE a<>10;
SELECT * FROM t1 WHERE 10<>a;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -24,6 +24,16 @@ select a, (select d from t2 where b=c) from t1;
show status like "subquery_cache%";
show status like '%Handler_read%';
--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/
analyze format=json
select a, (select d from t2 where b=c) from t1;
--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/
analyze format=json
select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
explain format=json
select a, (select d from t2 where b=c) from t1;
explain format=json
select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
set optimizer_switch='subquery_cache=off';
flush status;

View File

@ -1222,6 +1222,25 @@ WHERE alias3.d IN (
AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
);
# MDEV-8189 field<>const and const<>field are not symmetric
# Do the same EXPLAIN SELECT and SELECT
# with "alias3.c != alias5.c" instead of "alias5.c != alias3.c"
EXPLAIN
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
WHERE alias5.b = alias4.b
AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
);
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
WHERE alias5.b = alias4.b
AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
);
set optimizer_prune_level=@tmp_951283;
DROP TABLE t1,t2;

View File

@ -622,6 +622,33 @@ let type=DATETIME;
let defval='0000-00-00 00:00:00';
--source include/type_temporal_zero_default.inc
--echo #
--echo # MDEV-8336 The meaning of NO_ZERO_DATE is not clear for DATETIME
--echo #
SET sql_mode='NO_ZERO_DATE';
SELECT TIMESTAMP'0000-00-01 10:20:30';
SELECT TIMESTAMP'0000-00-00 10:20:30';
SELECT TIMESTAMP'0000-00-00 00:00:00.000001';
CREATE TABLE t1 (a DATETIME);
INSERT INTO t1 VALUES ('0000-00-00 10:20:30');
SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME(6));
INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000001');
SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1;
DROP TABLE t1;
SELECT STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s');
SELECT STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f');
SET old_mode=zero_date_time_cast;
SELECT CAST(TIME'10:20:30' AS DATETIME);
SELECT CAST(TIME'00:00:00.000001' AS DATETIME(6));
SELECT CAST(CAST('10:20:30' AS TIME) AS DATETIME);
SELECT CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6));
SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME);
SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6));
SET old_mode=DEFAULT;
SET sql_mode=DEFAULT;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -10093,10 +10093,9 @@ Create_field::Create_field(Field *old_field,Field *orig_field)
orig_field->move_field_offset(diff); // Points now at default_values
if (!orig_field->is_real_null())
{
char buff[MAX_FIELD_WIDTH], *pos;
String tmp(buff, sizeof(buff), charset), *res;
res= orig_field->val_str(&tmp);
pos= (char*) sql_strmake(res->ptr(), res->length());
StringBuffer<MAX_FIELD_WIDTH> tmp(charset);
String *res= orig_field->val_str(&tmp);
char *pos= (char*) sql_strmake(res->ptr(), res->length());
def= new Item_string(pos, res->length(), charset);
}
orig_field->move_field_offset(-diff); // Back to record[0]

View File

@ -5662,8 +5662,7 @@ static int write_locked_table_maps(THD *thd)
}
typedef bool Log_func(THD*, TABLE*, bool, MY_BITMAP*,
uint, const uchar*, const uchar*);
typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*);
static int binlog_log_row(TABLE* table,
const uchar *before_record,
@ -5680,40 +5679,24 @@ static int binlog_log_row(TABLE* table,
if (check_table_binlog_row_based(thd, table))
{
MY_BITMAP cols;
/* Potential buffer on the stack for the bitmap */
uint32 bitbuf[BITMAP_STACKBUF_SIZE/sizeof(uint32)];
uint n_fields= table->s->fields;
my_bool use_bitbuf= n_fields <= sizeof(bitbuf)*8;
/*
If there are no table maps written to the binary log, this is
the first row handled in this statement. In that case, we need
to write table maps for all locked tables to the binary log.
*/
if (likely(!(error= my_bitmap_init(&cols,
use_bitbuf ? bitbuf : NULL,
(n_fields + 7) & ~7UL,
FALSE))))
if (likely(!(error= write_locked_table_maps(thd))))
{
bitmap_set_all(&cols);
if (likely(!(error= write_locked_table_maps(thd))))
{
/*
We need to have a transactional behavior for SQLCOM_CREATE_TABLE
(i.e. CREATE TABLE... SELECT * FROM TABLE) in order to keep a
compatible behavior with the STMT based replication even when
the table is not transactional. In other words, if the operation
fails while executing the insert phase nothing is written to the
binlog.
*/
bool const has_trans= thd->lex->sql_command == SQLCOM_CREATE_TABLE ||
table->file->has_transactions();
error= (*log_func)(thd, table, has_trans, &cols, table->s->fields,
before_record, after_record);
}
if (!use_bitbuf)
my_bitmap_free(&cols);
/*
We need to have a transactional behavior for SQLCOM_CREATE_TABLE
(i.e. CREATE TABLE... SELECT * FROM TABLE) in order to keep a
compatible behavior with the STMT based replication even when
the table is not transactional. In other words, if the operation
fails while executing the insert phase nothing is written to the
binlog.
*/
bool const has_trans= thd->lex->sql_command == SQLCOM_CREATE_TABLE ||
table->file->has_transactions();
error= (*log_func)(thd, table, has_trans, before_record, after_record);
}
}
return error ? HA_ERR_RBR_LOGGING_FAILED : 0;

View File

@ -1715,7 +1715,7 @@ public:
SPLIT_FUNC_SKIP_REGISTERED:
Function be must skipped for registered SUM
SUM items
SPLIT_FUNC_SELECT
SPLIT_SUM_SELECT
We are called on the select level and have to
register items operated on sum function
@ -7593,6 +7593,19 @@ bool Item_cache_wrapper::set_cache(THD *thd)
DBUG_RETURN(expr_cache == NULL);
}
Expression_cache_tracker* Item_cache_wrapper::init_tracker(MEM_ROOT *mem_root)
{
if (expr_cache)
{
Expression_cache_tracker* tracker=
new(mem_root) Expression_cache_tracker(expr_cache);
if (tracker)
((Expression_cache_tmptable *)expr_cache)->set_tracker(tracker);
return tracker;
}
return NULL;
}
/**
Check if the current values of the parameters are in the expression cache

View File

@ -3808,6 +3808,7 @@ public:
class Item_cache;
class Expression_cache;
class Expression_cache_tracker;
/**
The objects of this class can store its values in an expression cache.
@ -3842,6 +3843,7 @@ public:
enum Type real_type() const { return orig_item->type(); }
bool set_cache(THD *thd);
Expression_cache_tracker* init_tracker(MEM_ROOT *mem_root);
bool fix_fields(THD *thd, Item **it);
void cleanup();

View File

@ -591,6 +591,7 @@ public:
Item_func_ne(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {}
longlong val_int();
enum Functype functype() const { return NE_FUNC; }
enum Functype rev_functype() const { return NE_FUNC; }
cond_result eq_cmp_result() const { return COND_FALSE; }
const char *func_name() const { return "<>"; }
Item *negated_item();

View File

@ -1204,7 +1204,10 @@ Item* Item_singlerow_subselect::expr_cache_insert_transformer(uchar *thd_arg)
if (expr_cache_is_needed(tmp_thd) &&
(expr_cache= set_expr_cache(tmp_thd)))
{
init_expr_cache_tracker(tmp_thd);
DBUG_RETURN(expr_cache);
}
DBUG_RETURN(this);
}
@ -1501,7 +1504,10 @@ Item* Item_exists_subselect::expr_cache_insert_transformer(uchar *thd_arg)
if (substype() == EXISTS_SUBS && expr_cache_is_needed(tmp_thd) &&
(expr_cache= set_expr_cache(tmp_thd)))
{
init_expr_cache_tracker(tmp_thd);
DBUG_RETURN(expr_cache);
}
DBUG_RETURN(this);
}
@ -6561,3 +6567,23 @@ void subselect_table_scan_engine::cleanup()
{
}
/*
Create an execution tracker for the expression cache we're using for this
subselect; add the tracker to the query plan.
*/
void Item_subselect::init_expr_cache_tracker(THD *thd)
{
if(!expr_cache)
return;
Explain_query *qw= thd->lex->explain;
DBUG_ASSERT(qw);
Explain_node *node= qw->get_node(unit->first_select()->select_number);
if (!node)
return;
DBUG_ASSERT(expr_cache->type() == Item::EXPR_CACHE_ITEM);
node->cache_tracker= ((Item_cache_wrapper *)expr_cache)->init_tracker(qw->mem_root);
}

View File

@ -244,7 +244,10 @@ public:
bool limit_index_condition_pushdown_processor(uchar *opt_arg)
{
return TRUE;
}
}
void init_expr_cache_tracker(THD *thd);
friend class select_result_interceptor;
friend class Item_in_optimizer;

View File

@ -9499,6 +9499,18 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
DBUG_ENTER("Rows_log_event::do_add_row_data");
DBUG_PRINT("enter", ("row_data: 0x%lx length: %lu", (ulong) row_data,
(ulong) length));
/*
If length is zero, there is nothing to write, so we just
return. Note that this is not an optimization, since calling
realloc() with size 0 means free().
*/
if (length == 0)
{
m_row_count++;
DBUG_RETURN(0);
}
/*
Don't print debug messages when running valgrind since they can
trigger false warnings.
@ -9855,12 +9867,19 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
longer if slave has extra columns.
*/
DBUG_PRINT_BITSET("debug", "Setting table's write_set from: %s", &m_cols);
DBUG_PRINT_BITSET("debug", "Setting table's read_set from: %s", &m_cols);
bitmap_set_all(table->read_set);
if (get_general_type_code() == DELETE_ROWS_EVENT ||
get_general_type_code() == UPDATE_ROWS_EVENT)
bitmap_intersect(table->read_set,&m_cols);
bitmap_set_all(table->write_set);
if (!get_flags(COMPLETE_ROWS_F))
bitmap_intersect(table->write_set,&m_cols);
/* WRITE ROWS EVENTS store the bitmap in m_cols instead of m_cols_ai */
MY_BITMAP *after_image= ((get_general_type_code() == UPDATE_ROWS_EVENT) ?
&m_cols_ai : &m_cols);
bitmap_intersect(table->write_set, after_image);
this->slave_exec_mode= slave_exec_mode_options; // fix the mode
@ -9888,7 +9907,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
rgi->set_row_stmt_start_timestamp();
THD_STAGE_INFO(thd, stage_executing);
while (error == 0 && m_curr_row < m_rows_end)
do
{
/* in_use can have been set to NULL in close_tables_for_reopen */
THD* old_thd= table->in_use;
@ -9936,18 +9955,14 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
if (!m_curr_row_end && !error)
error= unpack_current_row(rgi);
// at this moment m_curr_row_end should be set
DBUG_ASSERT(error || m_curr_row_end != NULL);
DBUG_ASSERT(error || m_curr_row < m_curr_row_end);
DBUG_ASSERT(error || m_curr_row_end <= m_rows_end);
m_curr_row= m_curr_row_end;
if (error == 0 && !transactional_table)
thd->transaction.all.modified_non_trans_table=
thd->transaction.stmt.modified_non_trans_table= TRUE;
} // row processing loop
while (error == 0 && (m_curr_row != m_rows_end));
/*
Restore the sql_mode after the rows event is processed.
@ -11118,9 +11133,9 @@ void Table_map_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info)
#if !defined(MYSQL_CLIENT)
Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
ulong tid_arg,
MY_BITMAP const *cols,
bool is_transactional)
: Rows_log_event(thd_arg, tbl_arg, tid_arg, cols, is_transactional, WRITE_ROWS_EVENT_V1)
: Rows_log_event(thd_arg, tbl_arg, tid_arg, tbl_arg->write_set,
is_transactional, WRITE_ROWS_EVENT_V1)
{
}
#endif
@ -11377,7 +11392,16 @@ Rows_log_event::write_row(rpl_group_info *rgi,
the size of the first row and use that value to initialize
storage engine for bulk insertion.
*/
ulong estimated_rows= (m_rows_end - m_curr_row) / (m_curr_row_end - m_curr_row);
/* this is the first row to be inserted, we estimate the rows with
the size of the first row and use that value to initialize
storage engine for bulk insertion */
DBUG_ASSERT(!(m_curr_row > m_curr_row_end));
ulong estimated_rows= 0;
if (m_curr_row < m_curr_row_end)
estimated_rows= (m_rows_end - m_curr_row) / (m_curr_row_end - m_curr_row);
else if (m_curr_row == m_curr_row_end)
estimated_rows= 1;
table->file->ha_start_bulk_insert(estimated_rows);
}
@ -12132,9 +12156,9 @@ end:
#ifndef MYSQL_CLIENT
Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
ulong tid, MY_BITMAP const *cols,
bool is_transactional)
: Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional, DELETE_ROWS_EVENT_V1)
ulong tid, bool is_transactional)
: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional,
DELETE_ROWS_EVENT_V1)
{
}
#endif /* #if !defined(MYSQL_CLIENT) */
@ -12262,21 +12286,11 @@ uint8 Delete_rows_log_event::get_trg_event_map()
#if !defined(MYSQL_CLIENT)
Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
ulong tid,
MY_BITMAP const *cols_bi,
MY_BITMAP const *cols_ai,
bool is_transactional)
: Rows_log_event(thd_arg, tbl_arg, tid, cols_bi, is_transactional, UPDATE_ROWS_EVENT_V1)
: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional,
UPDATE_ROWS_EVENT_V1)
{
init(cols_ai);
}
Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
ulong tid,
MY_BITMAP const *cols,
bool is_transactional)
: Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional, UPDATE_ROWS_EVENT_V1)
{
init(cols);
init(tbl_arg->write_set);
}
void Update_rows_log_event::init(MY_BITMAP const *cols)
@ -12378,7 +12392,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
able to skip to the next pair of updates
*/
m_curr_row= m_curr_row_end;
unpack_current_row(rgi);
unpack_current_row(rgi, &m_cols_ai);
thd_proc_info(thd, tmp);
return error;
}
@ -12407,7 +12421,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
/* this also updates m_curr_row_end */
thd_proc_info(thd, message);
if ((error= unpack_current_row(rgi)))
if ((error= unpack_current_row(rgi, &m_cols_ai)))
goto err;
/*
@ -12440,9 +12454,15 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
goto err;
}
// Temporary fix to find out why it fails [/Matz]
memcpy(m_table->read_set->bitmap, m_cols.bitmap, (m_table->read_set->n_bits + 7) / 8);
memcpy(m_table->write_set->bitmap, m_cols_ai.bitmap, (m_table->write_set->n_bits + 7) / 8);
m_table->mark_columns_per_binlog_row_image();
error= m_table->file->ha_update_row(m_table->record[1], m_table->record[0]);
if (error == HA_ERR_RECORD_IS_THE_SAME)
error= 0;
m_table->default_column_bitmaps();
if (invoke_triggers && !error &&
process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE))

View File

@ -4264,9 +4264,58 @@ public:
virtual int get_data_size();
MY_BITMAP const *get_cols() const { return &m_cols; }
MY_BITMAP const *get_cols_ai() const { return &m_cols_ai; }
size_t get_width() const { return m_width; }
ulong get_table_id() const { return m_table_id; }
#if defined(MYSQL_SERVER)
/*
This member function compares the table's read/write_set
with this event's m_cols and m_cols_ai. Comparison takes
into account what type of rows event is this: Delete, Write or
Update, therefore it uses the correct m_cols[_ai] according
to the event type code.
Note that this member function should only be called for the
following events:
- Delete_rows_log_event
- Write_rows_log_event
- Update_rows_log_event
@param[IN] table The table to compare this events bitmaps
against.
@return TRUE if sets match, FALSE otherwise. (following
bitmap_cmp return logic).
*/
virtual bool read_write_bitmaps_cmp(TABLE *table)
{
bool res= FALSE;
switch (get_general_type_code())
{
case DELETE_ROWS_EVENT:
res= bitmap_cmp(get_cols(), table->read_set);
break;
case UPDATE_ROWS_EVENT:
res= (bitmap_cmp(get_cols(), table->read_set) &&
bitmap_cmp(get_cols_ai(), table->write_set));
break;
case WRITE_ROWS_EVENT:
res= bitmap_cmp(get_cols(), table->write_set);
break;
default:
/*
We should just compare bitmaps for Delete, Write
or Update rows events.
*/
DBUG_ASSERT(0);
}
return res;
}
#endif
#ifdef MYSQL_SERVER
virtual bool write_data_header(IO_CACHE *file);
virtual bool write_data_body(IO_CACHE *file);
@ -4360,12 +4409,23 @@ protected:
int find_row(rpl_group_info *);
int write_row(rpl_group_info *, const bool);
// Unpack the current row into m_table->record[0], but with
// a different columns bitmap.
int unpack_current_row(rpl_group_info *rgi, MY_BITMAP const *cols)
{
DBUG_ASSERT(m_table);
ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT);
return ::unpack_row(rgi, m_table, m_width, m_curr_row, cols,
&m_curr_row_end, &m_master_reclength, m_rows_end);
}
// Unpack the current row into m_table->record[0]
int unpack_current_row(rpl_group_info *rgi)
{
DBUG_ASSERT(m_table);
ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT);
ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT);
return ::unpack_row(rgi, m_table, m_width, m_curr_row, &m_cols,
&m_curr_row_end, &m_master_reclength, m_rows_end);
}
@ -4469,8 +4529,8 @@ public:
};
#if defined(MYSQL_SERVER)
Write_rows_log_event(THD*, TABLE*, ulong table_id,
MY_BITMAP const *cols, bool is_transactional);
Write_rows_log_event(THD*, TABLE*, ulong table_id,
bool is_transactional);
#endif
#ifdef HAVE_REPLICATION
Write_rows_log_event(const char *buf, uint event_len,
@ -4479,14 +4539,11 @@ public:
#if defined(MYSQL_SERVER)
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
MY_BITMAP *cols,
uint fields,
const uchar *before_record
__attribute__((unused)),
const uchar *after_record)
{
return thd->binlog_write_row(table, is_transactional,
cols, fields, after_record);
return thd->binlog_write_row(table, is_transactional, after_record);
}
#endif
@ -4532,12 +4589,6 @@ public:
#ifdef MYSQL_SERVER
Update_rows_log_event(THD*, TABLE*, ulong table_id,
MY_BITMAP const *cols_bi,
MY_BITMAP const *cols_ai,
bool is_transactional);
Update_rows_log_event(THD*, TABLE*, ulong table_id,
MY_BITMAP const *cols,
bool is_transactional);
void init(MY_BITMAP const *cols);
@ -4553,13 +4604,11 @@ public:
#ifdef MYSQL_SERVER
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
MY_BITMAP *cols,
uint fields,
const uchar *before_record,
const uchar *after_record)
{
return thd->binlog_update_row(table, is_transactional,
cols, fields, before_record, after_record);
before_record, after_record);
}
#endif
@ -4616,8 +4665,7 @@ public:
};
#ifdef MYSQL_SERVER
Delete_rows_log_event(THD*, TABLE*, ulong,
MY_BITMAP const *cols, bool is_transactional);
Delete_rows_log_event(THD*, TABLE*, ulong, bool is_transactional);
#endif
#ifdef HAVE_REPLICATION
Delete_rows_log_event(const char *buf, uint event_len,
@ -4626,14 +4674,12 @@ public:
#ifdef MYSQL_SERVER
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
MY_BITMAP *cols,
uint fields,
const uchar *before_record,
const uchar *after_record
__attribute__((unused)))
{
return thd->binlog_delete_row(table, is_transactional,
cols, fields, before_record);
before_record);
}
#endif

View File

@ -369,14 +369,11 @@ public:
#if !defined(MYSQL_CLIENT)
static bool binlog_row_logging_function(THD *thd, TABLE *table,
bool is_transactional,
MY_BITMAP *cols,
uint fields,
const uchar *before_record
__attribute__((unused)),
const uchar *after_record)
{
return thd->binlog_write_row(table, is_transactional,
cols, fields, after_record);
return thd->binlog_write_row(table, is_transactional, after_record);
}
#endif
@ -452,7 +449,7 @@ public:
const uchar *after_record)
{
return thd->binlog_update_row(table, is_transactional,
cols, fields, before_record, after_record);
before_record, after_record);
}
#endif
@ -526,8 +523,7 @@ public:
const uchar *after_record
__attribute__((unused)))
{
return thd->binlog_delete_row(table, is_transactional,
cols, fields, before_record);
return thd->binlog_delete_row(table, is_transactional, before_record);
}
#endif

View File

@ -1902,7 +1902,10 @@ static void __cdecl kill_server(int sig_ptr)
#endif
/* Stop wsrep threads in case they are running. */
wsrep_stop_replication(NULL);
if (wsrep_running_threads > 0)
{
wsrep_stop_replication(NULL);
}
close_connections();
@ -5808,10 +5811,6 @@ int mysqld_main(int argc, char **argv)
wsrep_create_appliers(wsrep_slave_threads - 1);
}
}
else
{
wsrep_init_startup (false);
}
if (opt_bootstrap)
{
@ -7523,7 +7522,6 @@ struct my_option my_long_options[]=
MYSQL_COMPATIBILITY_OPTION("log-bin-use-v1-row-events"),
MYSQL_TO_BE_IMPLEMENTED_OPTION("default-authentication-plugin"),
MYSQL_COMPATIBILITY_OPTION("binlog-max-flush-queue-time"),
MYSQL_TO_BE_IMPLEMENTED_OPTION("binlog-row-image"),
MYSQL_TO_BE_IMPLEMENTED_OPTION("explicit-defaults-for-timestamp"),
MYSQL_COMPATIBILITY_OPTION("master-info-repository"),
MYSQL_COMPATIBILITY_OPTION("relay-log-info-repository"),

View File

@ -118,62 +118,6 @@ int injector::transaction::use_table(server_id_type sid, table tbl)
}
int injector::transaction::write_row (server_id_type sid, table tbl,
MY_BITMAP const* cols, size_t colcnt,
record_type record)
{
DBUG_ENTER("injector::transaction::write_row(...)");
int error= check_state(ROW_STATE);
if (error)
DBUG_RETURN(error);
server_id_type save_id= m_thd->variables.server_id;
m_thd->set_server_id(sid);
error= m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, record);
m_thd->set_server_id(save_id);
DBUG_RETURN(error);
}
int injector::transaction::delete_row(server_id_type sid, table tbl,
MY_BITMAP const* cols, size_t colcnt,
record_type record)
{
DBUG_ENTER("injector::transaction::delete_row(...)");
int error= check_state(ROW_STATE);
if (error)
DBUG_RETURN(error);
server_id_type save_id= m_thd->variables.server_id;
m_thd->set_server_id(sid);
error= m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, record);
m_thd->set_server_id(save_id);
DBUG_RETURN(error);
}
int injector::transaction::update_row(server_id_type sid, table tbl,
MY_BITMAP const* cols, size_t colcnt,
record_type before, record_type after)
{
DBUG_ENTER("injector::transaction::update_row(...)");
int error= check_state(ROW_STATE);
if (error)
DBUG_RETURN(error);
server_id_type save_id= m_thd->variables.server_id;
m_thd->set_server_id(sid);
error= m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, before, after);
m_thd->set_server_id(save_id);
DBUG_RETURN(error);
}
injector::transaction::binlog_pos injector::transaction::start_pos() const
{

View File

@ -180,27 +180,6 @@ public:
*/
int use_table(server_id_type sid, table tbl);
/*
Add a 'write row' entry to the transaction.
*/
int write_row (server_id_type sid, table tbl,
MY_BITMAP const *cols, size_t colcnt,
record_type record);
/*
Add a 'delete row' entry to the transaction.
*/
int delete_row(server_id_type sid, table tbl,
MY_BITMAP const *cols, size_t colcnt,
record_type record);
/*
Add an 'update row' entry to the transaction.
*/
int update_row(server_id_type sid, table tbl,
MY_BITMAP const *cols, size_t colcnt,
record_type before, record_type after);
/*
Commit a transaction.

View File

@ -209,6 +209,16 @@ unpack_row(rpl_group_info *rgi,
Field **field_ptr;
Field **const end_ptr= begin_ptr + colcnt;
if (bitmap_is_clear_all(cols))
{
/**
There was no data sent from the master, so there is
nothing to unpack.
*/
*current_row_end= pack_ptr;
*master_reclength= 0;
DBUG_RETURN(error);
}
DBUG_ASSERT(null_ptr < row_data + master_null_byte_count);
// Mask to mask out the correct bit among the null bits

View File

@ -5922,13 +5922,11 @@ int THD::decide_logging_format(TABLE_LIST *tables)
If error, NULL.
*/
template <class RowsEventT> Rows_log_event*
template <class RowsEventT> Rows_log_event*
THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
MY_BITMAP const* cols,
size_t colcnt,
size_t needed,
bool is_transactional,
RowsEventT *hint __attribute__((unused)))
RowsEventT *hint __attribute__((unused)))
{
DBUG_ENTER("binlog_prepare_pending_rows_event");
/* Pre-conditions */
@ -5964,16 +5962,15 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
event.
*/
if (!pending ||
pending->server_id != serv_id ||
pending->server_id != serv_id ||
pending->get_table_id() != table->s->table_map_id ||
pending->get_general_type_code() != general_type_code ||
pending->get_data_size() + needed > opt_binlog_rows_event_max_size ||
pending->get_width() != colcnt ||
!bitmap_cmp(pending->get_cols(), cols))
pending->get_general_type_code() != general_type_code ||
pending->get_data_size() + needed > opt_binlog_rows_event_max_size ||
pending->read_write_bitmaps_cmp(table) == FALSE)
{
/* Create a new RowsEventT... */
Rows_log_event* const
ev= new RowsEventT(this, table, table->s->table_map_id, cols,
ev= new RowsEventT(this, table, table->s->table_map_id,
is_transactional);
if (unlikely(!ev))
DBUG_RETURN(NULL);
@ -6118,9 +6115,8 @@ CPP_UNNAMED_NS_START
CPP_UNNAMED_NS_END
int THD::binlog_write_row(TABLE* table, bool is_trans,
MY_BITMAP const* cols, size_t colcnt,
uchar const *record)
int THD::binlog_write_row(TABLE* table, bool is_trans,
uchar const *record)
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() &&
@ -6135,14 +6131,14 @@ int THD::binlog_write_row(TABLE* table, bool is_trans,
uchar *row_data= memory.slot(0);
size_t const len= pack_row(table, cols, row_data, record);
size_t const len= pack_row(table, table->write_set, row_data, record);
/* Ensure that all events in a GTID group are in the same cache */
if (variables.option_bits & OPTION_GTID_BEGIN)
is_trans= 1;
Rows_log_event* const ev=
binlog_prepare_pending_rows_event(table, variables.server_id, cols, colcnt,
binlog_prepare_pending_rows_event(table, variables.server_id,
len, is_trans,
static_cast<Write_rows_log_event*>(0));
@ -6153,13 +6149,19 @@ int THD::binlog_write_row(TABLE* table, bool is_trans,
}
int THD::binlog_update_row(TABLE* table, bool is_trans,
MY_BITMAP const* cols, size_t colcnt,
const uchar *before_record,
const uchar *after_record)
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() &&
((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()));
/**
Save a reference to the original read and write set bitmaps.
We will need this to restore the bitmaps at the end.
*/
MY_BITMAP *old_read_set= table->read_set;
MY_BITMAP *old_write_set= table->write_set;
size_t const before_maxlen = max_row_length(table, before_record);
size_t const after_maxlen = max_row_length(table, after_record);
@ -6170,9 +6172,9 @@ int THD::binlog_update_row(TABLE* table, bool is_trans,
uchar *before_row= row_data.slot(0);
uchar *after_row= row_data.slot(1);
size_t const before_size= pack_row(table, cols, before_row,
size_t const before_size= pack_row(table, table->read_set, before_row,
before_record);
size_t const after_size= pack_row(table, cols, after_row,
size_t const after_size= pack_row(table, table->write_set, after_row,
after_record);
/* Ensure that all events in a GTID group are in the same cache */
@ -6191,26 +6193,44 @@ int THD::binlog_update_row(TABLE* table, bool is_trans,
#endif
Rows_log_event* const ev=
binlog_prepare_pending_rows_event(table, variables.server_id, cols, colcnt,
before_size + after_size, is_trans,
static_cast<Update_rows_log_event*>(0));
binlog_prepare_pending_rows_event(table, variables.server_id,
before_size + after_size, is_trans,
static_cast<Update_rows_log_event*>(0));
if (unlikely(ev == 0))
return HA_ERR_OUT_OF_MEM;
return
ev->add_row_data(before_row, before_size) ||
ev->add_row_data(after_row, after_size);
int error= ev->add_row_data(before_row, before_size) ||
ev->add_row_data(after_row, after_size);
/* restore read/write set for the rest of execution */
table->column_bitmaps_set_no_signal(old_read_set,
old_write_set);
return error;
}
int THD::binlog_delete_row(TABLE* table, bool is_trans,
MY_BITMAP const* cols, size_t colcnt,
uchar const *record)
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() &&
((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()));
/**
Save a reference to the original read and write set bitmaps.
We will need this to restore the bitmaps at the end.
*/
MY_BITMAP *old_read_set= table->read_set;
MY_BITMAP *old_write_set= table->write_set;
/*
/**
This will remove spurious fields required during execution but
not needed for binlogging. This is done according to the:
binlog-row-image option.
*/
binlog_prepare_row_images(table);
/*
Pack records into format for transfer. We are allocating more
memory than needed, but that doesn't matter.
*/
@ -6220,24 +6240,96 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans,
uchar *row_data= memory.slot(0);
size_t const len= pack_row(table, cols, row_data, record);
DBUG_DUMP("table->read_set", (uchar*) table->read_set->bitmap, (table->s->fields + 7) / 8);
size_t const len= pack_row(table, table->read_set, row_data, record);
/* Ensure that all events in a GTID group are in the same cache */
if (variables.option_bits & OPTION_GTID_BEGIN)
is_trans= 1;
Rows_log_event* const ev=
binlog_prepare_pending_rows_event(table, variables.server_id, cols, colcnt,
len, is_trans,
static_cast<Delete_rows_log_event*>(0));
binlog_prepare_pending_rows_event(table, variables.server_id,
len, is_trans,
static_cast<Delete_rows_log_event*>(0));
if (unlikely(ev == 0))
return HA_ERR_OUT_OF_MEM;
return ev->add_row_data(row_data, len);
int error= ev->add_row_data(row_data, len);
/* restore read/write set for the rest of execution */
table->column_bitmaps_set_no_signal(old_read_set,
old_write_set);
return error;
}
void THD::binlog_prepare_row_images(TABLE *table)
{
DBUG_ENTER("THD::binlog_prepare_row_images");
/**
Remove from read_set spurious columns. The write_set has been
handled before in table->mark_columns_needed_for_update.
*/
DBUG_PRINT_BITSET("debug", "table->read_set (before preparing): %s", table->read_set);
THD *thd= table->in_use;
/**
if there is a primary key in the table (ie, user declared PK or a
non-null unique index) and we dont want to ship the entire image,
and the handler involved supports this.
*/
if (table->s->primary_key < MAX_KEY &&
(thd->variables.binlog_row_image < BINLOG_ROW_IMAGE_FULL) &&
!ha_check_storage_engine_flag(table->s->db_type(), HTON_NO_BINLOG_ROW_OPT))
{
/**
Just to be sure that tmp_set is currently not in use as
the read_set already.
*/
DBUG_ASSERT(table->read_set != &table->tmp_set);
bitmap_clear_all(&table->tmp_set);
switch(thd->variables.binlog_row_image)
{
case BINLOG_ROW_IMAGE_MINIMAL:
/* MINIMAL: Mark only PK */
table->mark_columns_used_by_index_no_reset(table->s->primary_key,
&table->tmp_set);
break;
case BINLOG_ROW_IMAGE_NOBLOB:
/**
NOBLOB: Remove unnecessary BLOB fields from read_set
(the ones that are not part of PK).
*/
bitmap_union(&table->tmp_set, table->read_set);
for (Field **ptr=table->field ; *ptr ; ptr++)
{
Field *field= (*ptr);
if ((field->type() == MYSQL_TYPE_BLOB) &&
!(field->flags & PRI_KEY_FLAG))
bitmap_clear_bit(&table->tmp_set, field->field_index);
}
break;
default:
DBUG_ASSERT(0); // impossible.
}
/* set the temporary read_set */
table->column_bitmaps_set_no_signal(&table->tmp_set,
table->write_set);
}
DBUG_PRINT_BITSET("debug", "table->read_set (after preparing): %s", table->read_set);
DBUG_VOID_RETURN;
}
int THD::binlog_remove_pending_rows_event(bool clear_maps,
bool is_transactional)
{

View File

@ -96,6 +96,16 @@ enum enum_mark_columns
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
enum enum_binlog_row_image {
/** PKE in the before image and changed columns in the after image */
BINLOG_ROW_IMAGE_MINIMAL= 0,
/** Whenever possible, before and after image contain all columns except blobs. */
BINLOG_ROW_IMAGE_NOBLOB= 1,
/** All columns in both before and after image. */
BINLOG_ROW_IMAGE_FULL= 2
};
/* Bits for different SQL modes modes (including ANSI mode) */
#define MODE_REAL_AS_FLOAT (1ULL << 0)
#define MODE_PIPES_AS_CONCAT (1ULL << 1)
@ -588,6 +598,7 @@ typedef struct system_variables
/* Flags for slow log filtering */
ulong log_slow_rate_limit;
ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format)
ulong binlog_row_image;
ulong progress_report_time;
ulong completion_type;
ulong query_cache_type;
@ -2118,14 +2129,12 @@ public:
int binlog_write_table_map(TABLE *table, bool is_transactional,
my_bool *with_annotate= 0);
int binlog_write_row(TABLE* table, bool is_transactional,
MY_BITMAP const* cols, size_t colcnt,
const uchar *buf);
int binlog_delete_row(TABLE* table, bool is_transactional,
MY_BITMAP const* cols, size_t colcnt,
const uchar *buf);
int binlog_update_row(TABLE* table, bool is_transactional,
MY_BITMAP const* cols, size_t colcnt,
const uchar *old_data, const uchar *new_data);
static void binlog_prepare_row_images(TABLE* table);
void set_server_id(uint32 sid) { variables.server_id = sid; }
@ -2134,11 +2143,9 @@ public:
*/
template <class RowsEventT> Rows_log_event*
binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
MY_BITMAP const* cols,
size_t colcnt,
size_t needed,
bool is_transactional,
RowsEventT* hint);
RowsEventT* hint);
Rows_log_event* binlog_get_pending_rows_event(bool is_transactional) const;
void binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional);
inline int binlog_flush_pending_rows_event(bool stmt_end)

View File

@ -23,6 +23,7 @@
#include "sql_select.h"
#include "my_json_writer.h"
#include "opt_range.h"
#include "sql_expression_cache.h"
const char * STR_DELETING_ALL_ROWS= "Deleting all rows";
const char * STR_IMPOSSIBLE_WHERE= "Impossible WHERE";
@ -520,6 +521,8 @@ void Explain_union::print_explain_json(Explain_query *query,
Json_writer_nesting_guard guard(writer);
char table_name_buffer[SAFE_NAME_LEN];
bool started_object= print_explain_json_cache(writer, is_analyze);
writer->add_member("query_block").start_object();
writer->add_member("union_result").start_object();
// using_temporary_table
@ -560,6 +563,9 @@ void Explain_union::print_explain_json(Explain_query *query,
writer->end_object(); // union_result
writer->end_object(); // query_block
if (started_object)
writer->end_object();
}
@ -640,6 +646,35 @@ void Explain_node::print_explain_json_for_children(Explain_query *query,
}
bool Explain_node::print_explain_json_cache(Json_writer *writer,
bool is_analyze)
{
if (cache_tracker)
{
cache_tracker->fetch_current_stats();
writer->add_member("expression_cache").start_object();
if (cache_tracker->state != Expression_cache_tracker::OK)
{
writer->add_member("state").
add_str(Expression_cache_tracker::state_str[cache_tracker->state]);
}
if (is_analyze)
{
longlong cache_reads= cache_tracker->hit + cache_tracker->miss;
writer->add_member("r_loops").add_ll(cache_reads);
if (cache_reads != 0)
{
double hit_ratio= double(cache_tracker->hit) / cache_reads * 100.0;
writer->add_member("r_hit_ratio").add_double(hit_ratio);
}
}
return true;
}
return false;
}
void Explain_select::replace_table(uint idx, Explain_table_access *new_tab)
{
delete join_tabs[idx];
@ -691,8 +726,36 @@ int Explain_select::print_explain(Explain_query *query,
}
else
{
bool using_tmp= using_temporary;
bool using_fs= using_filesort;
bool using_tmp;
bool using_fs;
if (is_analyze)
{
/*
Get the data about "Using temporary; Using filesort" from execution
tracking system.
*/
using_tmp= false;
using_fs= false;
Sort_and_group_tracker::Iterator iter(&ops_tracker);
enum_qep_action action;
Filesort_tracker *dummy;
while ((action= iter.get_next(&dummy)) != EXPL_ACTION_EOF)
{
if (action == EXPL_ACTION_FILESORT)
using_fs= true;
else if (action == EXPL_ACTION_TEMPTABLE)
using_tmp= true;
}
}
else
{
/* Use imprecise "estimates" we got with the query plan */
using_tmp= using_temporary;
using_fs= using_filesort;
}
for (uint i=0; i< n_join_tabs; i++)
{
join_tabs[i]->print_explain(output, explain_flags, is_analyze, select_id,
@ -740,6 +803,8 @@ void Explain_select::print_explain_json(Explain_query *query,
Json_writer *writer, bool is_analyze)
{
Json_writer_nesting_guard guard(writer);
bool started_cache= print_explain_json_cache(writer, is_analyze);
if (message)
{
@ -757,12 +822,13 @@ void Explain_select::print_explain_json(Explain_query *query,
{
writer->add_member("query_block").start_object();
writer->add_member("select_id").add_ll(select_id);
if (is_analyze && time_tracker.get_loops())
{
writer->add_member("r_loops").add_ll(time_tracker.get_loops());
writer->add_member("r_total_time_ms").add_double(time_tracker.get_time_ms());
}
if (exec_const_cond)
{
writer->add_member("const_condition");
@ -859,6 +925,8 @@ void Explain_select::print_explain_json(Explain_query *query,
writer->end_object();
}
if (started_cache)
writer->end_object();
}

View File

@ -84,9 +84,10 @@ class Explain_query;
class Explain_node : public Sql_alloc
{
public:
Explain_node(MEM_ROOT *root) :
connection_type(EXPLAIN_NODE_OTHER),
children(root)
Explain_node(MEM_ROOT *root) :
cache_tracker(NULL),
connection_type(EXPLAIN_NODE_OTHER),
children(root)
{}
/* A type specifying what kind of node this is */
enum explain_node_type
@ -106,10 +107,14 @@ public:
EXPLAIN_NODE_NON_MERGED_SJ /* aka JTBM semi-join */
};
virtual enum explain_node_type get_type()= 0;
virtual int get_select_id()= 0;
/**
expression cache statistics
*/
Expression_cache_tracker* cache_tracker;
/*
How this node is connected to its parent.
(NOTE: EXPLAIN_NODE_NON_MERGED_SJ is set very late currently)
@ -135,6 +140,7 @@ public:
uint8 explain_flags, bool is_analyze);
void print_explain_json_for_children(Explain_query *query,
Json_writer *writer, bool is_analyze);
bool print_explain_json_cache(Json_writer *writer, bool is_analyze);
virtual ~Explain_node(){}
};
@ -221,7 +227,7 @@ public:
members have no info
*/
const char *message;
/* Expensive constant condition */
Item *exec_const_cond;

View File

@ -43,7 +43,7 @@ ulong subquery_cache_miss, subquery_cache_hit;
Expression_cache_tmptable::Expression_cache_tmptable(THD *thd,
List<Item> &dependants,
Item *value)
:cache_table(NULL), table_thd(thd), items(dependants), val(value),
:cache_table(NULL), table_thd(thd), tracker(NULL), items(dependants), val(value),
hit(0), miss(0), inited (0)
{
DBUG_ENTER("Expression_cache_tmptable::Expression_cache_tmptable");
@ -61,6 +61,9 @@ void Expression_cache_tmptable::disable_cache()
cache_table->file->ha_index_end();
free_tmp_table(table_thd, cache_table);
cache_table= NULL;
update_tracker();
if (tracker)
tracker->cache= NULL;
}
@ -164,6 +167,7 @@ void Expression_cache_tmptable::init()
goto error;
}
update_tracker();
DBUG_VOID_RETURN;
error:
@ -180,6 +184,11 @@ Expression_cache_tmptable::~Expression_cache_tmptable()
if (cache_table)
disable_cache();
else
{
update_tracker();
tracker= NULL;
}
}
@ -323,3 +332,7 @@ void Expression_cache_tmptable::print(String *str, enum_query_type query_type)
}
str->append('>');
}
const char *Expression_cache_tracker::state_str[3]=
{"uninitialized", "disabled", "enabled"};

View File

@ -19,6 +19,7 @@
#include "sql_select.h"
/**
Interface for expression cache
@ -62,6 +63,11 @@ public:
Initialize this cache
*/
virtual void init()= 0;
/**
Save this object's statistics into Expression_cache_tracker object
*/
virtual void update_tracker()= 0;
};
struct st_table_ref;
@ -69,6 +75,30 @@ struct st_join_table;
class Item_field;
class Expression_cache_tracker :public Sql_alloc
{
public:
enum expr_cache_state {UNINITED, STOPPED, OK};
Expression_cache_tracker(Expression_cache *c) :
cache(c), hit(0), miss(0), state(UNINITED)
{}
Expression_cache *cache;
ulong hit, miss;
enum expr_cache_state state;
static const char* state_str[3];
void set(ulong h, ulong m, enum expr_cache_state s)
{hit= h; miss= m; state= s;}
void fetch_current_stats()
{
if (cache)
cache->update_tracker();
}
};
/**
Implementation of expression cache over a temporary table
*/
@ -85,6 +115,22 @@ public:
bool is_inited() { return inited; };
void init();
void set_tracker(Expression_cache_tracker *st)
{
tracker= st;
update_tracker();
}
virtual void update_tracker()
{
if (tracker)
{
tracker->set(hit, miss, (inited ? (cache_table ?
Expression_cache_tracker::OK :
Expression_cache_tracker::STOPPED) :
Expression_cache_tracker::UNINITED));
}
}
private:
void disable_cache();
@ -94,6 +140,8 @@ private:
TABLE *cache_table;
/* Thread handle for the temporary table */
THD *table_thd;
/* EXPALIN/ANALYZE statistics */
Expression_cache_tracker *tracker;
/* TABLE_REF for index lookup */
struct st_table_ref ref;
/* Cached result */
@ -103,7 +151,7 @@ private:
/* Value Item example */
Item *val;
/* hit/miss counters */
uint hit, miss;
ulong hit, miss;
/* Set on if the object has been succesfully initialized with init() */
bool inited;
};

View File

@ -3505,6 +3505,8 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
bool empty_union_result= true;
bool is_correlated_unit= false;
bool first= true;
bool union_plan_saved= false;
/*
If the subquery is a UNION, optimize all the subqueries in the UNION. If
there is no UNION, then the loop will execute once for the subquery.
@ -3512,6 +3514,17 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
for (SELECT_LEX *sl= un->first_select(); sl; sl= sl->next_select())
{
JOIN *inner_join= sl->join;
if (first)
first= false;
else
{
if (!union_plan_saved)
{
union_plan_saved= true;
if (un->save_union_explain(un->thd->lex->explain))
return true; /* Failure */
}
}
if (!inner_join)
continue;
SELECT_LEX *save_select= un->thd->lex->current_select;
@ -4365,10 +4378,15 @@ void LEX::restore_set_statement_var()
int st_select_lex_unit::save_union_explain(Explain_query *output)
{
SELECT_LEX *first= first_select();
if (output->get_union(first->select_number))
return 0; /* Already added */
Explain_union *eu=
new (output->mem_root) Explain_union(output->mem_root,
thd->lex->analyze_stmt);
if (derived)
eu->connection_type= Explain_node::EXPLAIN_NODE_DERIVED;
/*

View File

@ -4764,12 +4764,25 @@ Item_func_ne::add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables,
SARGABLE_PARAM **sargables)
{
if (is_local_field(args[0]) && !(used_tables() & OUTER_REF_TABLE_BIT))
if (!(used_tables() & OUTER_REF_TABLE_BIT))
{
Item **values= is_local_field(args[1]) ? args : args + 1;
add_key_equal_fields(join, key_fields, *and_level, this,
(Item_field*) (args[0]->real_item()), false,
values, 1, usable_tables, sargables);
/*
QQ: perhaps test for !is_local_field(args[1]) is not really needed here.
Other comparison functions, e.g. Item_func_le, Item_func_gt, etc,
do not have this test. See Item_bool_func2::add_key_field_optimize_op().
Check with the optimizer team.
*/
if (is_local_field(args[0]) && !is_local_field(args[1]))
add_key_equal_fields(join, key_fields, *and_level, this,
(Item_field*) (args[0]->real_item()), false,
&args[1], 1, usable_tables, sargables);
/*
QQ: perhaps test for !is_local_field(args[0]) is not really needed here.
*/
if (is_local_field(args[1]) && !is_local_field(args[0]))
add_key_equal_fields(join, key_fields, *and_level, this,
(Item_field*) (args[1]->real_item()), false,
&args[0], 1, usable_tables, sargables);
}
}

View File

@ -8619,7 +8619,7 @@ ST_FIELD_INFO variables_fields_info[]=
{
{"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name",
SKIP_OPEN_TABLE},
{"VARIABLE_VALUE", 1024, MYSQL_TYPE_STRING, 0, 0, "Value", SKIP_OPEN_TABLE},
{"VARIABLE_VALUE", 2048, MYSQL_TYPE_STRING, 0, 0, "Value", SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
@ -8627,10 +8627,10 @@ ST_FIELD_INFO variables_fields_info[]=
ST_FIELD_INFO sysvars_fields_info[]=
{
{"VARIABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
{"SESSION_VALUE", 1024, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
{"GLOBAL_VALUE", 1024, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
{"SESSION_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
{"GLOBAL_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
{"GLOBAL_VALUE_ORIGIN", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
{"DEFAULT_VALUE", 1024, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
{"DEFAULT_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0},
{"VARIABLE_SCOPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
{"VARIABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
{"VARIABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},

View File

@ -143,11 +143,22 @@ extern DATE_TIME_FORMAT global_time_format;
extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
extern LEX_STRING interval_type_to_name[];
static inline bool
non_zero_hhmmssuu(const MYSQL_TIME *ltime)
{
return ltime->hour || ltime->minute || ltime->second || ltime->second_part;
}
static inline bool
non_zero_YYMMDD(const MYSQL_TIME *ltime)
{
return ltime->year || ltime->month || ltime->day;
}
static inline bool
non_zero_date(const MYSQL_TIME *ltime)
{
return ltime->year || ltime->month || ltime->day;
return non_zero_YYMMDD(ltime) ||
(ltime->time_type == MYSQL_TIMESTAMP_DATETIME &&
non_zero_hhmmssuu(ltime));
}
static inline bool
check_date(const MYSQL_TIME *ltime, ulonglong flags, int *was_cut)

View File

@ -5213,6 +5213,22 @@ static Sys_var_mybool Sys_encrypt_tmp_files(
READ_ONLY GLOBAL_VAR(encrypt_tmp_files),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
static const char *binlog_row_image_names[]= {"MINIMAL", "NOBLOB", "FULL", NullS};
static Sys_var_enum Sys_binlog_row_image(
"binlog_row_image",
"Controls whether rows should be logged in 'FULL', 'NOBLOB' or "
"'MINIMAL' formats. 'FULL', means that all columns in the before "
"and after image are logged. 'NOBLOB', means that mysqld avoids logging "
"blob columns whenever possible (eg, blob column was not changed or "
"is not part of primary key). 'MINIMAL', means that a PK equivalent (PK "
"columns or full row if there is no PK in the table) is logged in the "
"before image, and only changed columns are logged in the after image. "
"(Default: FULL).",
SESSION_VAR(binlog_row_image), CMD_LINE(REQUIRED_ARG),
binlog_row_image_names, DEFAULT(BINLOG_ROW_IMAGE_FULL),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
ON_UPDATE(NULL));
static bool check_pseudo_slave_mode(sys_var *self, THD *thd, set_var *var)
{
longlong previous_val= thd->variables.pseudo_slave_mode;

View File

@ -5829,6 +5829,8 @@ void TABLE::mark_auto_increment_column()
void TABLE::mark_columns_needed_for_delete()
{
mark_columns_per_binlog_row_image();
if (triggers)
triggers->mark_fields_used(TRG_EVENT_DELETE);
if (file->ha_table_flags() & HA_REQUIRES_KEY_COLUMNS_FOR_DELETE)
@ -5880,6 +5882,9 @@ void TABLE::mark_columns_needed_for_delete()
void TABLE::mark_columns_needed_for_update()
{
DBUG_ENTER("mark_columns_needed_for_update");
mark_columns_per_binlog_row_image();
if (triggers)
triggers->mark_fields_used(TRG_EVENT_UPDATE);
if (file->ha_table_flags() & HA_REQUIRES_KEY_COLUMNS_FOR_DELETE)
@ -5924,6 +5929,8 @@ void TABLE::mark_columns_needed_for_update()
void TABLE::mark_columns_needed_for_insert()
{
mark_columns_per_binlog_row_image();
if (triggers)
{
/*
@ -5941,6 +5948,101 @@ void TABLE::mark_columns_needed_for_insert()
mark_virtual_columns_for_write(TRUE);
}
/*
Mark columns according the binlog row image option.
When logging in RBR, the user can select whether to
log partial or full rows, depending on the table
definition, and the value of binlog_row_image.
Semantics of the binlog_row_image are the following
(PKE - primary key equivalent, ie, PK fields if PK
exists, all fields otherwise):
binlog_row_image= MINIMAL
- This marks the PKE fields in the read_set
- This marks all fields where a value was specified
in the write_set
binlog_row_image= NOBLOB
- This marks PKE + all non-blob fields in the read_set
- This marks all fields where a value was specified
and all non-blob fields in the write_set
binlog_row_image= FULL
- all columns in the read_set
- all columns in the write_set
This marking is done without resetting the original
bitmaps. This means that we will strip extra fields in
the read_set at binlogging time (for those cases that
we only want to log a PK and we needed other fields for
execution).
*/
void TABLE::mark_columns_per_binlog_row_image()
{
DBUG_ENTER("mark_columns_per_binlog_row_image");
DBUG_ASSERT(read_set->bitmap);
DBUG_ASSERT(write_set->bitmap);
/**
If in RBR we may need to mark some extra columns,
depending on the binlog-row-image command line argument.
*/
if ((mysql_bin_log.is_open() && in_use &&
in_use->is_current_stmt_binlog_format_row() &&
!ha_check_storage_engine_flag(s->db_type(), HTON_NO_BINLOG_ROW_OPT)))
{
THD *thd= current_thd;
/* if there is no PK, then mark all columns for the BI. */
if (s->primary_key >= MAX_KEY)
bitmap_set_all(read_set);
switch (thd->variables.binlog_row_image)
{
case BINLOG_ROW_IMAGE_FULL:
if (s->primary_key < MAX_KEY)
bitmap_set_all(read_set);
bitmap_set_all(write_set);
break;
case BINLOG_ROW_IMAGE_NOBLOB:
/* for every field that is not set, mark it unless it is a blob */
for (Field **ptr=field ; *ptr ; ptr++)
{
Field *my_field= *ptr;
/*
bypass blob fields. These can be set or not set, we don't care.
Later, at binlogging time, if we don't need them in the before
image, we will discard them.
If set in the AI, then the blob is really needed, there is
nothing we can do about it.
*/
if ((s->primary_key < MAX_KEY) &&
((my_field->flags & PRI_KEY_FLAG) ||
(my_field->type() != MYSQL_TYPE_BLOB)))
bitmap_set_bit(read_set, my_field->field_index);
if (my_field->type() != MYSQL_TYPE_BLOB)
bitmap_set_bit(write_set, my_field->field_index);
}
break;
case BINLOG_ROW_IMAGE_MINIMAL:
/* mark the primary key if available in the read_set */
if (s->primary_key < MAX_KEY)
mark_columns_used_by_index_no_reset(s->primary_key, read_set);
break;
default:
DBUG_ASSERT(FALSE);
}
file->column_bitmaps_signal();
}
DBUG_VOID_RETURN;
}
/*
@brief Mark a column as virtual used by the query

View File

@ -1275,6 +1275,7 @@ public:
void mark_columns_needed_for_update(void);
void mark_columns_needed_for_delete(void);
void mark_columns_needed_for_insert(void);
void mark_columns_per_binlog_row_image(void);
bool mark_virtual_col(Field *field);
void mark_virtual_columns_for_write(bool insert_fl);
void mark_default_fields_for_write();

View File

@ -552,33 +552,34 @@ int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff,
*v++= wsrep_status_vars[i];
DBUG_ASSERT(i < maxi);
DBUG_ASSERT(wsrep != NULL);
wsrep_stats_var* stats= wsrep->stats_get(wsrep);
for (wsrep_stats_var *sv= stats; i < maxi && sv && sv->name; i++, sv++, v++)
{
v->name = thd->strdup(sv->name);
switch (sv->type) {
case WSREP_VAR_INT64:
v->value = (char*)thd->memdup(&sv->value._int64, sizeof(longlong));
v->type = SHOW_LONGLONG;
break;
case WSREP_VAR_STRING:
v->value = thd->strdup(sv->value._string);
v->type = SHOW_CHAR;
break;
case WSREP_VAR_DOUBLE:
v->value = (char*)thd->memdup(&sv->value._double, sizeof(double));
v->type = SHOW_DOUBLE;
break;
if (wsrep != NULL) {
wsrep_stats_var* stats= wsrep->stats_get(wsrep);
for (wsrep_stats_var *sv= stats; i < maxi && sv && sv->name; i++, sv++, v++)
{
v->name = thd->strdup(sv->name);
switch (sv->type) {
case WSREP_VAR_INT64:
v->value = (char*)thd->memdup(&sv->value._int64, sizeof(longlong));
v->type = SHOW_LONGLONG;
break;
case WSREP_VAR_STRING:
v->value = thd->strdup(sv->value._string);
v->type = SHOW_CHAR;
break;
case WSREP_VAR_DOUBLE:
v->value = (char*)thd->memdup(&sv->value._double, sizeof(double));
v->type = SHOW_DOUBLE;
break;
}
DBUG_ASSERT(i < maxi);
}
DBUG_ASSERT(i < maxi);
wsrep->stats_free(wsrep, stats);
}
wsrep->stats_free(wsrep, stats);
my_qsort(buff, i, sizeof(*v), show_var_cmp);
v->name= 0; // terminator
v->name= 0; // terminator
return 0;
}

View File

@ -2049,7 +2049,7 @@ fil_crypt_complete_rotate_space(
fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space);
/* Space might already be dropped */
if (crypt_data || !crypt_data->inited) {
if (crypt_data != NULL && crypt_data->inited) {
mutex_enter(&crypt_data->mutex);
/**

View File

@ -355,12 +355,16 @@ fil_compress_page(
write_size+=header_len;
if (block_size <= 0) {
block_size = 512;
}
ut_ad(write_size > 0 && block_size > 0);
/* Actual write needs to be alligned on block size */
if (write_size % block_size) {
size_t tmp = write_size;
#ifdef UNIV_DEBUG
ut_a(block_size > 0);
#endif
write_size = (size_t)ut_uint64_align_up((ib_uint64_t)write_size, block_size);
#ifdef UNIV_DEBUG
ut_a(write_size > 0 && ((write_size % block_size) == 0));

View File

@ -11398,12 +11398,12 @@ ha_innobase::check_table_options(
if (encrypt == FIL_SPACE_ENCRYPTION_ON ||
(encrypt == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
if (!encryption_key_id_exists(options->encryption_key_id)) {
if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
"InnoDB: ENCRYPTION_KEY_ID %lu not available",
options->encryption_key_id
"InnoDB: ENCRYPTION_KEY_ID %u not available",
(uint)options->encryption_key_id
);
return "ENCRYPTION_KEY_ID";
}
@ -11469,7 +11469,7 @@ ha_innobase::create(
/* Cache table options */
ha_table_option_struct *options= form->s->option_struct;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
ulint key_id = options->encryption_key_id;
uint key_id = (uint)options->encryption_key_id;
DBUG_ENTER("ha_innobase::create");
@ -17897,7 +17897,7 @@ innodb_encrypt_tables_update(
const void* save) /*!< in: immediate result
from check function */
{
fil_crypt_set_encrypt_tables(*static_cast<const uint*>(save));
fil_crypt_set_encrypt_tables(*static_cast<const ulong*>(save));
}
static SHOW_VAR innodb_status_variables_export[]= {
@ -20140,7 +20140,7 @@ innodb_encrypt_tables_validate(
if (check_sysvar_enum(thd, var, save, value))
return 1;
long encrypt_tables = *(long*)save;
ulong encrypt_tables = *(ulong*)save;
if (encrypt_tables
&& !encryption_key_id_exists(FIL_DEFAULT_ENCRYPTION_KEY)) {

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