Merge 10.0 into 10.1

Also, implement MDEV-11027 a little differently from 5.5 and 10.0:

recv_apply_hashed_log_recs(): Change the return type back to void
(DB_SUCCESS was always returned).

Report progress also via systemd using sd_notifyf().
This commit is contained in:
Marko Mäkelä 2017-03-08 19:44:22 +02:00
commit ad0c218a44
338 changed files with 11292 additions and 5851 deletions

View File

@ -328,6 +328,9 @@ SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
# Common defines and includes
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
IF(_FILE_OFFSET_BITS)
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
ENDIF()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
# Add bundled or system zlib.

View File

@ -700,8 +700,9 @@ static void write_header(FILE *sql_file, char *db_name)
"-- MySQL dump %s Distrib %s, for %s (%s)\n--\n",
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
MACHINE_TYPE);
print_comment(sql_file, 0, "-- Host: %s Database: %s\n",
fix_for_comment(current_host ? current_host : "localhost"),
print_comment(sql_file, 0, "-- Host: %s ",
fix_for_comment(current_host ? current_host : "localhost"));
print_comment(sql_file, 0, "Database: %s\n",
fix_for_comment(db_name ? db_name : ""));
print_comment(sql_file, 0,
"-- ------------------------------------------------------\n"

View File

@ -492,7 +492,6 @@
#cmakedefine _LARGE_FILES 1
#cmakedefine _LARGEFILE_SOURCE 1
#cmakedefine _LARGEFILE64_SOURCE 1
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
#cmakedefine TIME_WITH_SYS_TIME 1

View File

@ -66,9 +66,10 @@ typedef struct my_aio_result {
#define MY_FAE 8 /* Fatal if any error */
#define MY_WME 16 /* Write message on error */
#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
#define MY_IGNORE_BADFD 32 /* my_sync(): ignore 'bad descriptor' errors */
#define MY_ENCRYPT 64 /* Encrypt IO_CACHE temporary files */
#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
#define MY_NOSYMLINKS 512 /* my_open(): don't follow symlinks */
#define MY_FULL_IO 512 /* my_read(): loop intil I/O is complete */
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
#define MY_COPYTIME 64 /* my_redel() copys time */
@ -261,7 +262,7 @@ extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
extern ulong my_file_total_opened;
extern ulong my_sync_count;
extern uint mysys_usage_id;
extern my_bool my_init_done;
extern my_bool my_init_done, my_thr_key_mysys_exists;
extern my_bool my_assert_on_error;
extern myf my_global_flags; /* Set to MY_WME for more error messages */
/* Point to current my_message() */
@ -615,6 +616,7 @@ int my_b_pread(IO_CACHE *info, uchar *Buffer, size_t Count, my_off_t pos);
typedef uint32 ha_checksum;
extern int (*mysys_test_invalid_symlink)(const char *filename);
#include <my_alloc.h>
/* Prototypes for mysys and my_func functions */
@ -642,9 +644,11 @@ extern int my_realpath(char *to, const char *filename, myf MyFlags);
extern File my_create_with_symlink(const char *linkname, const char *filename,
int createflags, int access_flags,
myf MyFlags);
extern int my_delete_with_symlink(const char *name, myf MyFlags);
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
extern int my_handler_delete_with_symlink(PSI_file_key key, const char *name,
const char *ext, myf sync_dir);
extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
myf MyFlags);

View File

@ -441,20 +441,6 @@
inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5)
#endif
/**
@def mysql_file_delete_with_symlink(K, P1, P2)
Instrumented delete with symbolic link.
@c mysql_file_delete_with_symlink is a replacement
for @c my_delete_with_symlink.
*/
#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_delete_with_symlink(K, P1, P2) \
inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2)
#else
#define mysql_file_delete_with_symlink(K, P1, P2) \
inline_mysql_file_delete_with_symlink(P1, P2)
#endif
/**
@def mysql_file_rename_with_symlink(K, P1, P2, P3)
Instrumented rename with symbolic link.
@ -1337,31 +1323,6 @@ inline_mysql_file_create_with_symlink(
return file;
}
static inline int
inline_mysql_file_delete_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *name, myf flags)
{
int result;
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_DELETE, name, &locker);
if (likely(locker != NULL))
{
PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
result= my_delete_with_symlink(name, flags);
PSI_FILE_CALL(end_file_close_wait)(locker, result);
return result;
}
#endif
result= my_delete_with_symlink(name, flags);
return result;
}
static inline int
inline_mysql_file_rename_with_symlink(

View File

@ -417,7 +417,7 @@ enum PSI_file_operation
PSI_FILE_FSTAT= 12,
/** File chsize, as in @c my_chsize(). */
PSI_FILE_CHSIZE= 13,
/** File delete, such as @c my_delete() or @c my_delete_with_symlink(). */
/** File delete, such as @c my_delete() or @c my_handler_delete_with_symlink(). */
PSI_FILE_DELETE= 14,
/** File rename, such as @c my_rename() or @c my_rename_with_symlink(). */
PSI_FILE_RENAME= 15,

View File

@ -0,0 +1,27 @@
--source include/have_partition.inc
--source include/gap_lock_error_init.inc
let $select_lock=for update;
let $autocommit = 0;
--source include/gap_lock_error_select.inc
let $autocommit = 1;
--source include/gap_lock_error_select.inc
let $select_lock=lock in share mode;
let $autocommit = 0;
--source include/gap_lock_error_select.inc
let $autocommit = 1;
--source include/gap_lock_error_select.inc
let $select_lock=;
let $autocommit = 0;
--source include/gap_lock_error_select.inc
let $autocommit = 1;
--source include/gap_lock_error_select.inc
let $autocommit = 0;
--source include/gap_lock_error_update.inc
let $autocommit = 1;
--source include/gap_lock_error_update.inc
--source include/gap_lock_error_cleanup.inc

View File

@ -0,0 +1 @@
drop table gap1, gap2, gap3, gap4;

View File

@ -0,0 +1,24 @@
eval CREATE TABLE gap1 (id1 INT, id2 INT, id3 INT, c1 INT, value INT,
PRIMARY KEY (id1, id2, id3),
INDEX i (c1)) ENGINE=$engine;
CREATE TABLE gap2 like gap1;
eval CREATE TABLE gap3 (id INT, value INT,
PRIMARY KEY (id),
UNIQUE KEY ui(value)) ENGINE=$engine;
eval CREATE TABLE gap4 (id INT, value INT,
PRIMARY KEY (id)) ENGINE=$engine
PARTITION BY HASH(id) PARTITIONS 2;
--disable_query_log
let $max = 1000;
let $i = 1;
while ($i <= $max) {
eval INSERT INTO gap1 (id1, id2, id3, c1, value)
VALUES ($i div 2, $i div 10, $i, $i, $i);
eval INSERT INTO gap2 (id1, id2, id3, c1, value)
VALUES ($i div 2, $i div 10, $i, $i, $i);
inc $i;
}
--enable_query_log
insert into gap3 values (1,1), (2,2),(3,3),(4,4),(5,5);
insert into gap4 values (1,1), (2,2),(3,3),(4,4),(5,5);

View File

@ -0,0 +1,89 @@
eval set session autocommit=$autocommit;
let $is_gaplock_target = `SELECT @@autocommit = 0 && '$select_lock' != '' && '$expect_gap_lock_errors' = 1`;
if ($is_gaplock_target)
{
# rnd_init
--error ER_UNKNOWN_ERROR
eval select * from gap1 limit 1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 where value != 100 limit 1 $select_lock;
# index_read_map
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 and id2= 1 $select_lock;
# read_range_first
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 and id2= 1 and id3 != 1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 and id2= 1 and id3
between 1 and 3 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 and id2= 1 order by id3 asc
limit 1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 and id2= 1 order by id3 desc
limit 1 $select_lock;
# index_first
--error ER_UNKNOWN_ERROR
eval select * from gap1 order by id1 asc limit 1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 $select_lock;
# index_last
--error ER_UNKNOWN_ERROR
eval select * from gap1 order by id1 desc limit 1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 order by id1 desc, id2 desc, id3 desc
limit 1 $select_lock;
# secondary index lookup
--error ER_UNKNOWN_ERROR
eval select * from gap1 force index(i) where c1=1 $select_lock;
# unique index lookup, ensure no gap lock errors as this is effectively a
# single point select that does not lock ranges or gaps of keys
eval select * from gap3 force index(ui) where value=1 $select_lock;
# primary key lookup, ensure no gap lock errors as these are effectively
# single point selects that do not lock ranges or gaps of keys
eval select * from gap1 where id1=1 and id2=1 and id3=1 $select_lock;
eval select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) $select_lock;
eval select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
order by c1 $select_lock;
eval select * from gap3 where id=1 $select_lock;
eval select * from gap4 where id=1 $select_lock;
eval select * from gap4 where id in (1, 2, 3) $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap4 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap4 where id between 3 and 7 $select_lock;
}
if (!$is_gaplock_target)
{
eval select * from gap1 limit 1 $select_lock;
eval select * from gap1 where value != 100 limit 1 $select_lock;
eval select * from gap1 where id1=1 $select_lock;
eval select * from gap1 where id1=1 and id2= 1 $select_lock;
eval select * from gap1 where id1=1 and id2= 1 and id3 != 1 $select_lock;
eval select * from gap1 where id1=1 and id2= 1 and id3
between 1 and 3 $select_lock;
eval select * from gap1 where id1=1 and id2= 1 order by id3 asc
limit 1 $select_lock;
eval select * from gap1 where id1=1 and id2= 1 order by id3 desc
limit 1 $select_lock;
eval select * from gap1 order by id1 asc limit 1 $select_lock;
eval select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 $select_lock;
eval select * from gap1 order by id1 desc limit 1 $select_lock;
eval select * from gap1 order by id1 desc, id2 desc, id3 desc
limit 1 $select_lock;
eval select * from gap1 force index(i) where c1=1 $select_lock;
eval select * from gap3 force index(ui) where value=1 $select_lock;
eval select * from gap1 where id1=1 and id2=1 and id3=1 $select_lock;
eval select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) $select_lock;
eval select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
order by c1 $select_lock;
eval select * from gap3 where id=1 $select_lock;
eval select * from gap4 where id=1 $select_lock;
eval select * from gap4 where id in (1, 2, 3) $select_lock;
eval select * from gap4 $select_lock;
eval select * from gap4 where id between 3 and 7 $select_lock;
}

View File

@ -0,0 +1,91 @@
eval set session autocommit=$autocommit;
let $is_gaplock_target = `SELECT @@autocommit = 0 && '$expect_gap_lock_errors' = 1`;
if ($is_gaplock_target)
{
## single-table insert,update,delete
insert into gap1 (id1, id2, id3) values (-1,-1,-1);
insert into gap1 (id1, id2, id3) values (-1,-1,-1)
on duplicate key update value=100;
--error ER_UNKNOWN_ERROR
update gap1 set value=100 where id1=1;
update gap1 set value=100 where id1=1 and id2=1 and id3=1;
--error ER_UNKNOWN_ERROR
delete from gap1 where id1=2;
delete from gap1 where id1=-1 and id2=-1 and id3=-1;
commit;
## multi-table statements (preventing all gap locks with autocommit)
# insert into select
--error ER_UNKNOWN_ERROR
insert into gap2 select * from gap1;
--error ER_UNKNOWN_ERROR
insert into gap2 select * from gap1 where id1=1;
insert into gap2 select * from gap1 where id1=1 and id2=1 and id3=1;
# create table select
create table t4 select * from gap1 where id1=1 and id2=1 and id3=1;
drop table t4;
--error ER_UNKNOWN_ERROR
create table t4 select * from gap1;
--error ER_UNKNOWN_ERROR
create table t4 select * from gap1 where id1=1;
# update join
update gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 set gap1.value=100 where gap2.id1=3
and gap2.id2=3 and gap2.id3=3;
--error ER_UNKNOWN_ERROR
update gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 set gap1.value=100 where gap2.id1=3;
--error ER_UNKNOWN_ERROR
update gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 join gap3 on gap1.id1=gap3.id
set gap1.value=100 where gap2.id1=3;
--error ER_UNKNOWN_ERROR
update gap1 set gap1.value= (select count(*) from gap2);
# delete join
delete gap1 from gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 where gap2.id1=3
and gap2.id2=3 and gap2.id3=3;
--error ER_UNKNOWN_ERROR
delete gap1 from gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 where gap2.id1=3;
# select join / self join
--error ER_UNKNOWN_ERROR
select * from gap1, gap2 limit 1 for update;
--error ER_UNKNOWN_ERROR
select * from gap1 a, gap1 b limit 1 for update;
# unique secondary key
create table u1(
c1 int,
c2 int,
c3 int,
c4 int,
primary key (c1, c2, c3),
unique key (c3, c1)
);
begin;
insert into u1 values (1,1,1,1);
commit;
begin;
insert into u1 values (1,2,1,1) on duplicate key update c4=10;
commit;
begin;
select * from u1 where c3=1 and c1 = 1 for update;
--error ER_UNKNOWN_ERROR
select * from u1 where c3=1 for update;
commit;
drop table u1;
}
if (!$is_gaplock_target)
{
# autocommit doesn't prevent single table operations
insert into gap1 (id1, id2, id3) values (-1,-1,-1);
insert into gap1 (id1, id2, id3) values (-1,-1,-1)
on duplicate key update value=100;
update gap1 set value=100 where id1=1;
update gap1 set value=100 where id1=1 and id2=1 and id3=1;
delete from gap1 where id1=2;
delete from gap1 where id1=-1 and id2=-1 and id3=-1;
commit;
}

View File

@ -1013,6 +1013,29 @@ David Yes 210
Edward Yes 150
DROP TABLE example1463;
set sql_mode= @save_sql_mode;
#
# MDEV-9028: SELECT DISTINCT constant column of derived table
# used as the second operand of LEFT JOIN
#
create table t1 (id int, data varchar(255));
insert into t1 values (1,'yes'),(2,'yes');
select distinct t1.id, tt.id, tt.data
from t1
left join
(select t1.id, 'yes' as data from t1) as tt
on t1.id = tt.id;
id id data
1 1 yes
2 2 yes
select distinct t1.id, tt.id, tt.data
from t1
left join
(select t1.id, 'yes' as data from t1 where id > 1) as tt
on t1.id = tt.id;
id id data
2 2 yes
1 NULL NULL
drop table t1;
# end of 5.5
#
# Start of 10.1 tests

View File

@ -2534,6 +2534,54 @@ DROP USER mysqltest_u1@localhost;
# End of Bug#38347.
#
# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
# DIFFERENTLY'.
#
drop database if exists mysqltest_db1;
create database mysqltest_db1;
create user mysqltest_u1;
# Both GRANT statements below should fail with the same error.
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
# Let us show that GRANT behaviour for routines is consistent
# with GRANT behaviour for tables. Attempt to grant privilege
# on non-existent table also results in an error.
grant select on mysqltest_db1.t1 to mysqltest_u1;
ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
show grants for mysqltest_u1;
Grants for mysqltest_u1@%
GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
drop database mysqltest_db1;
drop user mysqltest_u1;
#
# Bug#12766319 - 61865: RENAME USER DOES NOT WORK CORRECTLY -
# REQUIRES FLUSH PRIVILEGES
#
CREATE USER foo@'127.0.0.1';
GRANT ALL ON *.* TO foo@'127.0.0.1';
# First attempt, should connect successfully
SELECT user(), current_user();
user() current_user()
foo@localhost foo@127.0.0.1
# Rename the user
RENAME USER foo@'127.0.0.1' to foo@'127.0.0.0/255.0.0.0';
# Second attempt, should connect successfully as its valid mask
# This was failing without fix
SELECT user(), current_user();
user() current_user()
foo@localhost foo@127.0.0.0/255.0.0.0
# Rename the user back to original
RENAME USER foo@'127.0.0.0/255.0.0.0' to foo@'127.0.0.1';
# Third attempt, should connect successfully
SELECT user(), current_user();
user() current_user()
foo@localhost foo@127.0.0.1
# Clean-up
DROP USER foo@'127.0.0.1';
# End of Bug#12766319
#
# Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
# DATABASE SECURITY
@ -2560,26 +2608,4 @@ ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'secret'
# Connection default
DROP USER untrusted@localhost;
DROP DATABASE secret;
#
# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
# DIFFERENTLY'.
#
drop database if exists mysqltest_db1;
create database mysqltest_db1;
create user mysqltest_u1;
# Both GRANT statements below should fail with the same error.
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
# Let us show that GRANT behaviour for routines is consistent
# with GRANT behaviour for tables. Attempt to grant privilege
# on non-existent table also results in an error.
grant select on mysqltest_db1.t1 to mysqltest_u1;
ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
show grants for mysqltest_u1;
Grants for mysqltest_u1@%
GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
drop database mysqltest_db1;
drop user mysqltest_u1;
set GLOBAL sql_mode=default;

View File

@ -1870,4 +1870,99 @@ f4
NULL
NULL
DROP TABLE t1,t2,t3,t4,t5;
#
# MDEV-7992: Nested left joins + 'not exists' optimization
#
CREATE TABLE t1(
K1 INT PRIMARY KEY,
Name VARCHAR(15)
);
INSERT INTO t1 VALUES
(1,'T1Row1'), (2,'T1Row2');
CREATE TABLE t2(
K2 INT PRIMARY KEY,
K1r INT,
rowTimestamp DATETIME,
Event VARCHAR(15)
);
INSERT INTO t2 VALUES
(1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
(2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
(3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
SELECT t1a.*, t2a.*,
t2i.K2 AS K2B, t2i.K1r AS K1rB,
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
FROM
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
LEFT JOIN
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
ON (t1i.K1 = 1) AND
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
OR (t2i.K2 IS NULL))
WHERE
t2a.K1r = 1 AND t2i.K2 IS NULL;
K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
EXPLAIN EXTENDED SELECT t1a.*, t2a.*,
t2i.K2 AS K2B, t2i.K1r AS K1rB,
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
FROM
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
LEFT JOIN
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
ON (t1i.K1 = 1) AND
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
OR (t2i.K2 IS NULL))
WHERE
t2a.K1r = 1 AND t2i.K2 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `test`.`t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`test`.`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
CREATE VIEW v1 AS
SELECT t2i.*
FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
WHERE t1i.K1 = 1 ;
SELECT
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
FROM
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
LEFT JOIN
v1 as t2b
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
OR (t2b.K2 IS NULL)
WHERE
t1a.K1 = 1 AND
t2b.K2 IS NULL;
K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
EXPLAIN EXTENDED SELECT
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
FROM
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
LEFT JOIN
v1 as t2b
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
OR (t2b.K2 IS NULL)
WHERE
t1a.K1 = 1 AND
t2b.K2 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
DROP VIEW v1;
DROP TABLE t1,t2;
set optimizer_search_depth= @tmp_mdev621;

View File

@ -1881,6 +1881,101 @@ f4
NULL
NULL
DROP TABLE t1,t2,t3,t4,t5;
#
# MDEV-7992: Nested left joins + 'not exists' optimization
#
CREATE TABLE t1(
K1 INT PRIMARY KEY,
Name VARCHAR(15)
);
INSERT INTO t1 VALUES
(1,'T1Row1'), (2,'T1Row2');
CREATE TABLE t2(
K2 INT PRIMARY KEY,
K1r INT,
rowTimestamp DATETIME,
Event VARCHAR(15)
);
INSERT INTO t2 VALUES
(1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
(2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
(3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
SELECT t1a.*, t2a.*,
t2i.K2 AS K2B, t2i.K1r AS K1rB,
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
FROM
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
LEFT JOIN
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
ON (t1i.K1 = 1) AND
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
OR (t2i.K2 IS NULL))
WHERE
t2a.K1r = 1 AND t2i.K2 IS NULL;
K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
EXPLAIN EXTENDED SELECT t1a.*, t2a.*,
t2i.K2 AS K2B, t2i.K1r AS K1rB,
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
FROM
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
LEFT JOIN
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
ON (t1i.K1 = 1) AND
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
OR (t2i.K2 IS NULL))
WHERE
t2a.K1r = 1 AND t2i.K2 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `test`.`t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`test`.`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
CREATE VIEW v1 AS
SELECT t2i.*
FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
WHERE t1i.K1 = 1 ;
SELECT
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
FROM
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
LEFT JOIN
v1 as t2b
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
OR (t2b.K2 IS NULL)
WHERE
t1a.K1 = 1 AND
t2b.K2 IS NULL;
K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
EXPLAIN EXTENDED SELECT
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
FROM
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
LEFT JOIN
v1 as t2b
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
OR (t2b.K2 IS NULL)
WHERE
t1a.K1 = 1 AND
t2b.K2 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
DROP VIEW v1;
DROP TABLE t1,t2;
set optimizer_search_depth= @tmp_mdev621;
CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));

View File

@ -5515,3 +5515,4 @@ USE `db1`;
DROP DATABASE db1;
DROP DATABASE db2;
FOUND /Database: mysql/ in bug11505.sql

View File

@ -734,6 +734,97 @@ SELECT * FROM t1 WHERE d = '1991-01-01';
d
1991-01-01
DROP TABLE t1;
set global default_storage_engine=default;
#
# MDEV-9455: [ERROR] mysqld got signal 11
#
CREATE TABLE `t1` (
`DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`NAME` varchar(75) DEFAULT NULL,
`DATETIME` varchar(10) NOT NULL DEFAULT '',
`DAILY_CALL_CNT` int(11) DEFAULT NULL,
`DAILY_SMS_CNT` int(11) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`),
KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`)
) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(`DATETIME`)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
CREATE TABLE `t2` (
`DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`CALL_TYPE` varchar(1) DEFAULT NULL,
`DATA_TYPE` varchar(1) DEFAULT NULL,
`FEATURES` varchar(1) DEFAULT NULL,
`NAME` varchar(75) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DATETIME` datetime NOT NULL,
`REG_DATE` datetime NOT NULL,
`TITLE` varchar(50) DEFAULT NULL,
`BODY` varchar(4200) DEFAULT NULL,
`MIME_TYPE` varchar(32) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
`DEVICE_ID` varchar(64) DEFAULT NULL,
`DEVICE_NAME` varchar(32) DEFAULT NULL,
PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`),
KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`),
KEY `IDX_TB_DIARY_02` (`REG_DATE`)
) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(REG_DATE)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
SELECT
A.IMORY_ID,
A.NUMBER,
A.NAME,
DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE,
SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT,
SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT,
SUM(CAST(A.DURATION AS INT)) AS DURATION,
( SELECT COUNT(*)
FROM t1
WHERE IMORY_ID=A.IMORY_ID
AND NUMBER=A.NUMBER
AND NAME=A.NAME
AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
) STATS_COUNT
FROM t2 A
WHERE A.IMORY_ID = 55094102
AND A.DATETIME LIKE (
SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%')
FROM t2
WHERE IMORY_ID=55094102
AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 )
group by DATE_FORMAT(DATETIME, '%Y-%m-%d')
)
GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
;
IMORY_ID NUMBER NAME TARGET_DATE CALL_CNT SMS_CNT DURATION STATS_COUNT
drop table t2, t1;
set global default_storage_engine='innodb';
#
# MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503,
# Failing assertion: 0 with "key ptr now exceeds key end by 762 bytes"

View File

@ -230,6 +230,22 @@ PARTITION pMax VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Partition p1, first row");
DROP TABLE t1;
#
# MDEV-10418 Assertion `m_extra_cache' failed
# in ha_partition::late_extra_cache(uint)
#
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT) ENGINE=MyISAM PARTITION BY RANGE(f2) (PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t2 VALUES (8);
CREATE ALGORITHM = MERGE VIEW v AS SELECT f2 FROM t2, t1;
UPDATE v SET f2 = 1;
SELECT * FROM t2;
f2
1
DROP VIEW v;
DROP TABLE t2;
DROP TABLE t1;
#
# bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
# TABLE CORRUPTS MYISAM
DROP TABLE if exists `t1`;

View File

@ -4108,4 +4108,76 @@ NULL
NULL
deallocate prepare stmt;
drop table t1,t2,t3,t4;
#
# MDEV-11859: the plans for the first and the second executions
# of PS are not the same
#
create table t1 (id int, c varchar(3), key idx(c))engine=myisam;
insert into t1 values (3,'bar'), (1,'xxx'), (2,'foo'), (5,'yyy');
prepare stmt1 from
"explain extended
select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
execute stmt1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`c` = 'foo')
execute stmt1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`c` = 'foo')
deallocate prepare stmt1;
prepare stmt1 from
"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
flush status;
execute stmt1;
id c
2 foo
show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
flush status;
execute stmt1;
id c
2 foo
show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
deallocate prepare stmt1;
prepare stmt2 from
"explain extended
select * from t1 where (1, 2) in ( select 3, 4 )";
execute stmt2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0
execute stmt2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0
deallocate prepare stmt2;
drop table t1;
# End of 5.5 tests

View File

@ -60,11 +60,11 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
Country IN ('CAN', 'ARG') AND ID < 3800 OR
Country < 'U' AND Name LIKE 'Zhu%' OR
ID BETWEEN 3800 AND 3810;
Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
Country <= 'ALB' AND Name LIKE 'L%' OR
ID BETWEEN 3807 AND 3810;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 132 Using sort_union(Name,Country,PRIMARY); Using where
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,PRIMARY,Country 35,4,3 NULL 31 Using sort_union(Name,PRIMARY,Country); Using where
EXPLAIN
SELECT * FROM City
WHERE (Population > 101000 AND Population < 115000);
@ -1769,4 +1769,42 @@ a b
167 9999
168 10000
DROP TABLE t1;
#
# MDEV-8603: Wrong result OR/AND condition over index fields
#
CREATE TABLE t1 (
id INT NOT NULL,
state VARCHAR(64),
capital VARCHAR(64),
UNIQUE KEY (id),
KEY state (state,id),
KEY capital (capital, id)
);
INSERT INTO t1 VALUES
(1,'Arizona','Phoenix'),
(2,'Hawaii','Honolulu'),
(3,'Georgia','Atlanta'),
(4,'Florida','Tallahassee'),
(5,'Alaska','Juneau'),
(6,'Michigan','Lansing'),
(7,'Pennsylvania','Harrisburg'),
(8,'Virginia','Richmond')
;
EXPLAIN
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range state,capital state 71 NULL 12 Using index condition; Using where
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
id state capital
4 Florida Tallahassee
3 Georgia Atlanta
2 Hawaii Honolulu
6 Michigan Lansing
7 Pennsylvania Harrisburg
8 Virginia Richmond
DROP TABLE t1;
set session optimizer_switch='index_merge_sort_intersection=default';

View File

@ -61,11 +61,11 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
Country IN ('CAN', 'ARG') AND ID < 3800 OR
Country < 'U' AND Name LIKE 'Zhu%' OR
ID BETWEEN 3800 AND 3810;
Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
Country <= 'ALB' AND Name LIKE 'L%' OR
ID BETWEEN 3807 AND 3810;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,7,4 NULL 123 Using sort_union(Name,Country,PRIMARY); Using where
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 33 Using sort_union(Name,Country,PRIMARY); Using where
EXPLAIN
SELECT * FROM City
WHERE (Population > 101000 AND Population < 115000);
@ -369,7 +369,7 @@ WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
OR ((ID BETWEEN 100 AND 200) AND
(Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 Using where
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Population,PRIMARY 39,4,4 NULL 305 Using sort_union(Name,Population,PRIMARY); Using where
SELECT * FROM City USE INDEX ()
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
OR ((ID BETWEEN 100 AND 110) AND
@ -1770,5 +1770,43 @@ a b
167 9999
168 10000
DROP TABLE t1;
#
# MDEV-8603: Wrong result OR/AND condition over index fields
#
CREATE TABLE t1 (
id INT NOT NULL,
state VARCHAR(64),
capital VARCHAR(64),
UNIQUE KEY (id),
KEY state (state,id),
KEY capital (capital, id)
);
INSERT INTO t1 VALUES
(1,'Arizona','Phoenix'),
(2,'Hawaii','Honolulu'),
(3,'Georgia','Atlanta'),
(4,'Florida','Tallahassee'),
(5,'Alaska','Juneau'),
(6,'Michigan','Lansing'),
(7,'Pennsylvania','Harrisburg'),
(8,'Virginia','Richmond')
;
EXPLAIN
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range state,capital state 71 NULL 10 Using index condition; Using where
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
id state capital
4 Florida Tallahassee
3 Georgia Atlanta
2 Hawaii Honolulu
6 Michigan Lansing
7 Pennsylvania Harrisburg
8 Virginia Richmond
DROP TABLE t1;
set session optimizer_switch='index_merge_sort_intersection=default';
SET SESSION STORAGE_ENGINE=DEFAULT;

View File

@ -2,12 +2,15 @@ create table t1 (a int) engine=myisam data directory='MYSQL_TMP_DIR';
insert t1 values (1);
repair table t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t1 repair error 40 for record at pos 0
test.t1 repair Error File 'MYSQL_TMP_DIR/t1.MYD' not found (Errcode: 40 "Too many levels of symbolic links")
test.t1 repair status Operation failed
drop table t1;
create table t2 (a int) engine=aria data directory='MYSQL_TMP_DIR';
insert t2 values (1);
repair table t2;
Table Op Msg_type Msg_text
test.t2 repair status OK
test.t2 repair error 40 for record at pos 256
test.t2 repair Error File 'MYSQL_TMP_DIR/t2.MAD' not found (Errcode: 40 "Too many levels of symbolic links")
test.t2 repair status Operation failed
drop table t2;
foobar5543

View File

@ -2440,6 +2440,40 @@ EXECUTE stmt;
i
6
drop table t1, t2, t3;
#
# MDEV-11078: NULL NOT IN (non-empty subquery) should never return results
#
create table t1(a int,b int);
create table t2(a int,b int);
insert into t1 value (1,2);
select (NULL) in (select 1 from t1);
(NULL) in (select 1 from t1)
NULL
select (null) in (select 1 from t2);
(null) in (select 1 from t2)
0
select 1 in (select 1 from t1);
1 in (select 1 from t1)
1
select 1 in (select 1 from t2);
1 in (select 1 from t2)
0
select 1 from dual where null in (select 1 from t1);
1
select 1 from dual where null in (select 1 from t2);
1
select (null,null) in (select * from t1);
(null,null) in (select * from t1)
NULL
select (null,null) in (select * from t2);
(null,null) in (select * from t2)
0
select 1 from dual where null not in (select 1 from t1);
1
select 1 from dual where null not in (select 1 from t2);
1
1
drop table t1,t2;
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
#

View File

@ -494,6 +494,21 @@ HAVING SQ2_alias1 . col_int_key >= 7
drop table t1;
set optimizer_switch=@subselect_innodb_tmp;
#
# MDEV-9635:Server crashes in part_of_refkey or assertion
# `!created && key_to_save < (int)s->keys' failed in
# TABLE::use_index(int) or with join_cache_level>2
#
SET join_cache_level=3;
CREATE TABLE t1 (f1 VARCHAR(1024)) ENGINE=InnoDB;
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (f2 VARCHAR(4)) ENGINE=InnoDB;
INSERT INTO t2 VALUES ('foo'),('bar');
SELECT * FROM v1, t2 WHERE ( f1, f2 ) IN ( SELECT f1, f1 FROM t1 );
f1 f2
set join_cache_level = default;
drop view v1;
drop table t1,t2;
#
# MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding
#
create table t1(a int) engine=innodb;

View File

@ -0,0 +1,39 @@
set default_storage_engine=Aria;
call mtr.add_suppression("File.*t1.* not found");
create table mysql.t1 (a int, b char(16), index(a));
insert mysql.t1 values (100, 'test'),(101,'test');
create table t1 (a int, b char(16), index(a))
data directory="MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
select * from t1;
a b
200 some
201 some
flush tables;
set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
select * from t1;
set debug_sync='now WAIT_FOR ok';
set debug_sync='now SIGNAL go';
ERROR HY000: File 'MYSQLTEST_VARDIR/tmp/foo/t1.MAD' not found (Errcode: 20 "Not a directory")
flush tables;
drop table if exists t1;
create table t1 (a int, b char(16), index (a))
index directory="MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
explain select a from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 2 Using index
select a from t1;
a
200
201
flush tables;
set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
select a from t1;
set debug_sync='now WAIT_FOR waiting';
set debug_sync='now SIGNAL run';
ERROR HY000: Can't find file: './test/t1.MAI' (errno: 20 "Not a directory")
flush tables;
drop table if exists t1;
drop table mysql.t1;
set debug_sync='RESET';

View File

@ -0,0 +1,38 @@
call mtr.add_suppression("File.*t1.* not found");
create table mysql.t1 (a int, b char(16), index(a));
insert mysql.t1 values (100, 'test'),(101,'test');
create table t1 (a int, b char(16), index(a))
data directory="MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
select * from t1;
a b
200 some
201 some
flush tables;
set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
select * from t1;
set debug_sync='now WAIT_FOR ok';
set debug_sync='now SIGNAL go';
ERROR HY000: File 'MYSQLTEST_VARDIR/tmp/foo/t1.MYD' not found (Errcode: 20 "Not a directory")
flush tables;
drop table if exists t1;
create table t1 (a int, b char(16), index (a))
index directory="MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
explain select a from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 2 Using index
select a from t1;
a
200
201
flush tables;
set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
select a from t1;
set debug_sync='now WAIT_FOR waiting';
set debug_sync='now SIGNAL run';
ERROR HY000: Can't find file: './test/t1.MYI' (errno: 20 "Not a directory")
flush tables;
drop table if exists t1;
drop table mysql.t1;
set debug_sync='RESET';

View File

@ -597,7 +597,8 @@ CREATE TABLE t1 (a int(11), b varchar(1)) ;
INSERT IGNORE INTO t1 VALUES (0,'g');
CREATE TABLE t3 ( a varchar(1)) ;
INSERT IGNORE INTO t3 VALUES ('g');
CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a)) ;
CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a));
INSERT INTO t2 VALUES (9), (10);
create view v1 as SELECT t1.* FROM t1 LEFT JOIN t2 ON ( t1.a = t2.a ) WHERE t2.a <> 0;
SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
a b
@ -606,7 +607,7 @@ EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 system NULL NULL NULL NULL 1
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
drop view v1;
DROP TABLE t1,t2,t3;
#

View File

@ -5568,6 +5568,89 @@ Warnings:
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1;
drop table t1,t2;
#
# MDEV-12099: usage of mergeable view with LEFT JOIN
# that can be converted to INNER JOIN
#
create table t1 (a int, b int, key(a)) engine=myisam;
insert into t1 values
(3,20), (7,10), (2,10), (4,30), (8,70),
(7,70), (9,100), (9,60), (8,80), (7,60);
create table t2 (c int, d int, key (c)) engine=myisam;
insert into t2 values
(50,100), (20, 200), (10,300),
(150,100), (120, 200), (110,300),
(250,100), (220, 200), (210,300);
create table t3(e int, f int not null, key(e), unique (f)) engine=myisam;
insert into t3 values
(100, 3), (300, 5), (400, 4), (300,7),
(300,2), (600, 13), (800, 15), (700, 14),
(600, 23), (800, 25), (700, 24);
create view v1 as
select * from t2 left join t3 on t3.e=t2.d where t3.f is not null;
select *
from t1 left join v1 on v1.c=t1.b
where t1.a < 5;
a b c d e f
2 10 10 300 300 5
2 10 10 300 300 7
2 10 10 300 300 2
3 20 NULL NULL NULL NULL
4 30 NULL NULL NULL NULL
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f is not null
where t1.a < 5;
a b c d e f
2 10 10 300 300 5
2 10 10 300 300 7
2 10 10 300 300 2
3 20 NULL NULL NULL NULL
4 30 NULL NULL NULL NULL
explain extended
select *
from t1 left join v1 on v1.c=t1.b
where t1.a < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
1 SIMPLE t3 ref f,e e 5 test.t2.d 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`e` = `test`.`t2`.`d`) and (`test`.`t3`.`f` is not null) and (`test`.`t1`.`b` is not null) and (`test`.`t2`.`d` is not null))) where (`test`.`t1`.`a` < 5)
explain extended
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f is not null
where t1.a < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
1 SIMPLE t3 ref f,e e 5 test.t2.d 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`e` = `test`.`t2`.`d`) and (`test`.`t3`.`f` is not null) and (`test`.`t1`.`b` is not null) and (`test`.`t2`.`d` is not null))) where (`test`.`t1`.`a` < 5)
explain extended
select *
from t1 left join v1 on v1.c=t1.b and v1.f=t1.a
where t1.a < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
1 SIMPLE t3 eq_ref f,e f 4 test.t1.a 1 100.00 Using where
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`f` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t3`.`e`) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`b` is not null))) where (`test`.`t1`.`a` < 5)
explain extended
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f=t1.a and t3.f is not null
where t1.a < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
1 SIMPLE t3 eq_ref f,e f 4 test.t1.a 1 100.00 Using where
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`f` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t3`.`e`) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`b` is not null))) where (`test`.`t1`.`a` < 5)
drop view v1;
drop table t1,t2,t3;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------

View File

@ -61,6 +61,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
--echo # Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
--echo #
--replace_result 20 2
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';

View File

@ -20,28 +20,24 @@ ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /syntax error in innodb_log_group_home_dir/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
FOUND /InnoDB: Starting crash recovery from checkpoint LSN=/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
FOUND /InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
FOUND /redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
FOUND /InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
FOUND /redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
FOUND /InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
FOUND /redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;

View File

@ -76,15 +76,13 @@ let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir;
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
let SEARCH_PATTERN= InnoDB: Starting crash recovery from checkpoint LSN=;
--source include/search_pattern_in_file.inc
--let $restart_parameters= --debug=d,innodb_log_abort_3
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
@ -98,18 +96,14 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--let $restart_parameters= --debug=d,innodb_log_abort_5
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--let $restart_parameters= --innodb-read-only
@ -124,9 +118,7 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--let $restart_parameters= --debug=d,innodb_log_abort_7

View File

@ -0,0 +1,121 @@
create table t1 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=-2;
a
delete from t1 where a=-2;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=18446744073709551615;
a
18446744073709551615
delete from t1 where a=18446744073709551615;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
2
65535
drop table t1;
create table t2 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
select * from t2 where a=18446744073709551615;
a
18446744073709551615
delete from t2 where a=18446744073709551615;
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a bigint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` bigint(20) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775806
9223372036854775807
select * from t3 where a=9223372036854775806;
a
9223372036854775806
delete from t3 where a=9223372036854775806;
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775807
drop table t3;

View File

@ -0,0 +1,121 @@
create table t1 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=-2;
a
delete from t1 where a=-2;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=18446744073709551615;
a
18446744073709551615
delete from t1 where a=18446744073709551615;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
2
65535
drop table t1;
create table t2 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
select * from t2 where a=18446744073709551615;
a
18446744073709551615
delete from t2 where a=18446744073709551615;
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a bigint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` bigint(20) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775806
9223372036854775807
select * from t3 where a=9223372036854775806;
a
9223372036854775806
delete from t3 where a=9223372036854775806;
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775807
drop table t3;

View File

@ -0,0 +1,82 @@
create table t1 (a double not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t1 where a=1.5;
a
1.5
delete from t1 where a=1.5;
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1234.567
2.2250738585072016e208
drop table t1;
create table t2 (a double not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 10;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 10 */
insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t2 where a=1234.567;
a
1234.567
delete from t2 where a=1234.567;
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
2.2250738585072016e208
delete from t2;
1024*3 inserts;
select count(*) from t2;
count(*)
3072
drop table t2;

View File

@ -0,0 +1,82 @@
create table t1 (a double not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t1 where a=1.5;
a
1.5
delete from t1 where a=1.5;
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1234.567
2.2250738585072016e208
drop table t1;
create table t2 (a double not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 10;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 10 */
insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t2 where a=1234.567;
a
1234.567
delete from t2 where a=1234.567;
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
2.2250738585072016e208
delete from t2;
16384*3 inserts;
select count(*) from t2;
count(*)
49152
drop table t2;

View File

@ -88,85 +88,3 @@ select count(*) from t2;
count(*)
3072
drop table t2;
create table t1 (a double not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t1 where a=1.5;
a
1.5
delete from t1 where a=1.5;
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1234.567
2.2250738585072016e208
drop table t1;
create table t2 (a double not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 10;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 10 */
insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t2 where a=1234.567;
a
1234.567
delete from t2 where a=1234.567;
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
2.2250738585072016e208
delete from t2;
1024*3 inserts;
select count(*) from t2;
count(*)
3072
drop table t2;

View File

@ -88,85 +88,3 @@ select count(*) from t2;
count(*)
49152
drop table t2;
create table t1 (a double not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t1 where a=1.5;
a
1.5
delete from t1 where a=1.5;
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1234.567
2.2250738585072016e208
drop table t1;
create table t2 (a double not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 10;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 10 */
insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t2 where a=1234.567;
a
1234.567
delete from t2 where a=1234.567;
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
2.2250738585072016e208
delete from t2;
16384*3 inserts;
select count(*) from t2;
count(*)
49152
drop table t2;

View File

@ -1,221 +1,3 @@
create table t1 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (255), (254), (253), (252), (1), (2), (128);
select * from t1;
a
1
128
2
252
253
254
255
select * from t1 where a=253;
a
253
delete from t1 where a=253;
select * from t1;
a
1
128
2
252
254
255
drop table t1;
create table t2 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (255), (254), (253), (252);
select * from t2;
a
252
253
254
255
select * from t2 where a=253;
a
253
delete from t2 where a=253;
select * from t2;
a
252
254
255
delete from t2;
255 inserts;
select count(*) from t2;
count(*)
255
drop table t2;
create table t3 (a tinyint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` tinyint(4) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
select * from t3;
a
-1
-127
-128
0
1
124
125
126
127
select * from t3 where a=125;
a
125
delete from t3 where a=125;
select * from t3;
a
-1
-127
-128
0
1
124
126
127
drop table t3;
create table t1 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
select * from t1;
a
1
2
256
65532
65533
65534
65535
select * from t1 where a=65533;
a
65533
delete from t1 where a=65533;
select * from t1;
a
1
2
256
65532
65534
65535
drop table t1;
create table t2 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (65535), (65534), (65533), (65532);
select * from t2;
a
65532
65533
65534
65535
select * from t2 where a=65533;
a
65533
delete from t2 where a=65533;
select * from t2;
a
65532
65534
65535
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a smallint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
select * from t3;
a
-1
-32767
-32768
0
1
32764
32765
32766
32767
select * from t3 where a=32765;
a
32765
delete from t3 where a=32765;
select * from t3;
a
-1
-32767
-32768
0
1
32764
32766
32767
drop table t3;
create table t1 (a int unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
@ -325,233 +107,3 @@ a
2147483646
2147483647
drop table t3;
create table t1 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
select * from t1;
a
1
16777212
16777213
16777214
16777215
2
65535
select * from t1 where a=16777213;
a
16777213
delete from t1 where a=16777213;
select * from t1;
a
1
16777212
16777214
16777215
2
65535
drop table t1;
create table t2 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (16777215), (16777214), (16777213), (16777212);
select * from t2;
a
16777212
16777213
16777214
16777215
select * from t2 where a=16777213;
a
16777213
delete from t2 where a=16777213;
select * from t2;
a
16777212
16777214
16777215
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a mediumint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` mediumint(9) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388605
8388606
8388607
select * from t3 where a=8388605;
a
8388605
delete from t3 where a=8388605;
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388606
8388607
drop table t3;
create table t1 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=-2;
a
delete from t1 where a=-2;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=18446744073709551615;
a
18446744073709551615
delete from t1 where a=18446744073709551615;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
2
65535
drop table t1;
create table t2 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
select * from t2 where a=18446744073709551615;
a
18446744073709551615
delete from t2 where a=18446744073709551615;
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a bigint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` bigint(20) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775806
9223372036854775807
select * from t3 where a=9223372036854775806;
a
9223372036854775806
delete from t3 where a=9223372036854775806;
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775807
drop table t3;

View File

@ -1,221 +1,3 @@
create table t1 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (255), (254), (253), (252), (1), (2), (128);
select * from t1;
a
1
128
2
252
253
254
255
select * from t1 where a=253;
a
253
delete from t1 where a=253;
select * from t1;
a
1
128
2
252
254
255
drop table t1;
create table t2 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (255), (254), (253), (252);
select * from t2;
a
252
253
254
255
select * from t2 where a=253;
a
253
delete from t2 where a=253;
select * from t2;
a
252
254
255
delete from t2;
255 inserts;
select count(*) from t2;
count(*)
255
drop table t2;
create table t3 (a tinyint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` tinyint(4) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
select * from t3;
a
-1
-127
-128
0
1
124
125
126
127
select * from t3 where a=125;
a
125
delete from t3 where a=125;
select * from t3;
a
-1
-127
-128
0
1
124
126
127
drop table t3;
create table t1 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
select * from t1;
a
1
2
256
65532
65533
65534
65535
select * from t1 where a=65533;
a
65533
delete from t1 where a=65533;
select * from t1;
a
1
2
256
65532
65534
65535
drop table t1;
create table t2 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (65535), (65534), (65533), (65532);
select * from t2;
a
65532
65533
65534
65535
select * from t2 where a=65533;
a
65533
delete from t2 where a=65533;
select * from t2;
a
65532
65534
65535
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a smallint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
select * from t3;
a
-1
-32767
-32768
0
1
32764
32765
32766
32767
select * from t3 where a=32765;
a
32765
delete from t3 where a=32765;
select * from t3;
a
-1
-32767
-32768
0
1
32764
32766
32767
drop table t3;
create table t1 (a int unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
@ -325,233 +107,3 @@ a
2147483646
2147483647
drop table t3;
create table t1 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
select * from t1;
a
1
16777212
16777213
16777214
16777215
2
65535
select * from t1 where a=16777213;
a
16777213
delete from t1 where a=16777213;
select * from t1;
a
1
16777212
16777214
16777215
2
65535
drop table t1;
create table t2 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (16777215), (16777214), (16777213), (16777212);
select * from t2;
a
16777212
16777213
16777214
16777215
select * from t2 where a=16777213;
a
16777213
delete from t2 where a=16777213;
select * from t2;
a
16777212
16777214
16777215
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a mediumint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` mediumint(9) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388605
8388606
8388607
select * from t3 where a=8388605;
a
8388605
delete from t3 where a=8388605;
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388606
8388607
drop table t3;
create table t1 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=-2;
a
delete from t1 where a=-2;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=18446744073709551615;
a
18446744073709551615
delete from t1 where a=18446744073709551615;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
2
65535
drop table t1;
create table t2 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
select * from t2 where a=18446744073709551615;
a
18446744073709551615
delete from t2 where a=18446744073709551615;
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a bigint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` bigint(20) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775806
9223372036854775807
select * from t3 where a=9223372036854775806;
a
9223372036854775806
delete from t3 where a=9223372036854775806;
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775807
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
select * from t1;
a
1
16777212
16777213
16777214
16777215
2
65535
select * from t1 where a=16777213;
a
16777213
delete from t1 where a=16777213;
select * from t1;
a
1
16777212
16777214
16777215
2
65535
drop table t1;
create table t2 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (16777215), (16777214), (16777213), (16777212);
select * from t2;
a
16777212
16777213
16777214
16777215
select * from t2 where a=16777213;
a
16777213
delete from t2 where a=16777213;
select * from t2;
a
16777212
16777214
16777215
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a mediumint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` mediumint(9) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388605
8388606
8388607
select * from t3 where a=8388605;
a
8388605
delete from t3 where a=8388605;
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388606
8388607
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
select * from t1;
a
1
16777212
16777213
16777214
16777215
2
65535
select * from t1 where a=16777213;
a
16777213
delete from t1 where a=16777213;
select * from t1;
a
1
16777212
16777214
16777215
2
65535
drop table t1;
create table t2 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (16777215), (16777214), (16777213), (16777212);
select * from t2;
a
16777212
16777213
16777214
16777215
select * from t2 where a=16777213;
a
16777213
delete from t2 where a=16777213;
select * from t2;
a
16777212
16777214
16777215
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a mediumint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` mediumint(9) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388605
8388606
8388607
select * from t3 where a=8388605;
a
8388605
delete from t3 where a=8388605;
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388606
8388607
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
select * from t1;
a
1
2
256
65532
65533
65534
65535
select * from t1 where a=65533;
a
65533
delete from t1 where a=65533;
select * from t1;
a
1
2
256
65532
65534
65535
drop table t1;
create table t2 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (65535), (65534), (65533), (65532);
select * from t2;
a
65532
65533
65534
65535
select * from t2 where a=65533;
a
65533
delete from t2 where a=65533;
select * from t2;
a
65532
65534
65535
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a smallint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
select * from t3;
a
-1
-32767
-32768
0
1
32764
32765
32766
32767
select * from t3 where a=32765;
a
32765
delete from t3 where a=32765;
select * from t3;
a
-1
-32767
-32768
0
1
32764
32766
32767
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
select * from t1;
a
1
2
256
65532
65533
65534
65535
select * from t1 where a=65533;
a
65533
delete from t1 where a=65533;
select * from t1;
a
1
2
256
65532
65534
65535
drop table t1;
create table t2 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (65535), (65534), (65533), (65532);
select * from t2;
a
65532
65533
65534
65535
select * from t2 where a=65533;
a
65533
delete from t2 where a=65533;
select * from t2;
a
65532
65534
65535
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a smallint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
select * from t3;
a
-1
-32767
-32768
0
1
32764
32765
32766
32767
select * from t3 where a=32765;
a
32765
delete from t3 where a=32765;
select * from t3;
a
-1
-32767
-32768
0
1
32764
32766
32767
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (255), (254), (253), (252), (1), (2), (128);
select * from t1;
a
1
128
2
252
253
254
255
select * from t1 where a=253;
a
253
delete from t1 where a=253;
select * from t1;
a
1
128
2
252
254
255
drop table t1;
create table t2 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (255), (254), (253), (252);
select * from t2;
a
252
253
254
255
select * from t2 where a=253;
a
253
delete from t2 where a=253;
select * from t2;
a
252
254
255
delete from t2;
255 inserts;
select count(*) from t2;
count(*)
255
drop table t2;
create table t3 (a tinyint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` tinyint(4) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
select * from t3;
a
-1
-127
-128
0
1
124
125
126
127
select * from t3 where a=125;
a
125
delete from t3 where a=125;
select * from t3;
a
-1
-127
-128
0
1
124
126
127
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (255), (254), (253), (252), (1), (2), (128);
select * from t1;
a
1
128
2
252
253
254
255
select * from t1 where a=253;
a
253
delete from t1 where a=253;
select * from t1;
a
1
128
2
252
254
255
drop table t1;
create table t2 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (255), (254), (253), (252);
select * from t2;
a
252
253
254
255
select * from t2 where a=253;
a
253
delete from t2 where a=253;
select * from t2;
a
252
254
255
delete from t2;
255 inserts;
select count(*) from t2;
count(*)
255
drop table t2;
create table t3 (a tinyint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` tinyint(4) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
select * from t3;
a
-1
-127
-128
0
1
124
125
126
127
select * from t3 where a=125;
a
125
delete from t3 where a=125;
select * from t3;
a
-1
-127
-128
0
1
124
126
127
drop table t3;

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_bigint_innodb.test #
# #
# Purpose: #
# Tests around integer type #
# INNODB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_innodb #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
##### max rows to be inserted
let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_bigint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_bigint_myisam.test #
# #
# Purpose: #
# Tests around integer type #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_myisam #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
--source include/long_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MYISAM';
##### number of rows to be inserted
let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_bigint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_double_innodb.test #
# #
# Purpose: #
# Tests around float type #
# INNODB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_float_innodb #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
##### Number of row to be inserted.
let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_double.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_double_myisam.test #
# #
# Purpose: #
# Tests around float type #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_float_myisam #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
--source include/long_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MYISAM';
##### Number of row to be inserted.
let $maxrows=16384;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_double.inc

View File

@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: #
# Change Date: #
# Change: #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test for double type has been spawned into a separate test file #
################################################################################
#
@ -44,4 +44,3 @@ let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_float.inc
--source suite/parts/inc/partition_double.inc

View File

@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: #
# Change Date: #
# Change: #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test for double type has been spawned into a separate test file #
################################################################################
#
@ -44,4 +44,3 @@ let $maxrows=16384;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_float.inc
--source suite/parts/inc/partition_double.inc

View File

@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: #
# Change Date: #
# Change: #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: Int subtypes (tinyint etc.) have been spawned into separate tests #
################################################################################
#
@ -43,8 +43,4 @@ let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_tinyint.inc
--source suite/parts/inc/partition_smallint.inc
--source suite/parts/inc/partition_int.inc
--source suite/parts/inc/partition_mediumint.inc
--source suite/parts/inc/partition_bigint.inc

View File

@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: #
# Change Date: #
# Change: #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: Int subtypes (tinyint etc.) have been spawned into separate tests #
################################################################################
#
@ -43,8 +43,4 @@ let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_tinyint.inc
--source suite/parts/inc/partition_smallint.inc
--source suite/parts/inc/partition_int.inc
--source suite/parts/inc/partition_mediumint.inc
--source suite/parts/inc/partition_bigint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_mediumint_innodb.test #
# #
# Purpose: #
# Tests around integer type #
# INNODB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_innodb #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
##### max rows to be inserted
let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_mediumint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_mediumint_myisam.test #
# #
# Purpose: #
# Tests around integer type #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_myisam #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
--source include/long_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MYISAM';
##### number of rows to be inserted
let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_mediumint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_smallint_innodb.test #
# #
# Purpose: #
# Tests around integer type #
# INNODB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_innodb #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
##### max rows to be inserted
let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_smallint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_smallint_myisam.test #
# #
# Purpose: #
# Tests around integer type #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_myisam #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
--source include/long_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MYISAM';
##### number of rows to be inserted
let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_smallint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_tinyint_innodb.test #
# #
# Purpose: #
# Tests around integer type #
# INNODB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_innodb #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
##### max rows to be inserted
let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_tinyint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_tinyint_myisam.test #
# #
# Purpose: #
# Tests around integer type #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_myisam #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
--source include/long_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MYISAM';
##### number of rows to be inserted
let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_tinyint.inc

View File

@ -7,7 +7,6 @@ RESET SLAVE;
SET @restore_slave_net_timeout=@@global.slave_net_timeout;
RESET MASTER;
SET @restore_slave_net_timeout=@@global.slave_net_timeout;
SET @restore_event_scheduler=@@global.event_scheduler;
*** Default value ***
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
@ -221,7 +220,7 @@ RESET SLAVE;
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5;
include/start_slave.inc
SET @@global.event_scheduler=1;
Number of received heartbeat events: 0
Received heartbeats meet expectations: TRUE
DELETE FROM t1;
DROP EVENT e1;

View File

@ -34,7 +34,6 @@ eval SET @restore_slave_heartbeat_timeout=$slave_heartbeat_timeout;
--connection master
RESET MASTER;
SET @restore_slave_net_timeout=@@global.slave_net_timeout;
SET @restore_event_scheduler=@@global.event_scheduler;
--echo
#
@ -352,21 +351,54 @@ eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTE
--connection master
# Enable scheduler
SET @@global.event_scheduler=1;
--sync_slave_with_master
let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
# Wait some updates for table t1 from master
let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5;
--source include/wait_condition.inc
--connection master
# Whether or not to send a heartbeat is decided on the master, based on
# whether the binlog was updated during the period or not.
# Even with the 1-second event, we cannot make the master to write binary
# logs (or execute SQL) in a timely manner. We can only check that they
# were executed in a timely manner, and if they were not, neutralize the
# heartbeat check on the slave.
# We will wait for 5 events, and keep checking 'Binlog_commits' on master.
# Time interval between consequent events will be measured.
# We can only expect that no heartbeats have been sent if the interval
# between events never exceeded MASTER_HEARTBEAT_PERIOD.
# If it has exceeded the value at least once, the slave can legitimately
# receive a heartbeat (but we cannot require it, because the delay
# could have occurred somewhere else, e.g. upon checking the status).
# So, if the delay is detected, we will signal slave to ignore possible
# heartbeats.
let $possible_heartbeats= 0;
let $commits_to_wait= 5;
while ($commits_to_wait)
{
let $tm= `SELECT UNIX_TIMESTAMP(NOW(3))`;
let $binlog_commits= query_get_value(SHOW STATUS LIKE 'Binlog_commits', Value, 1);
let $wait_condition= SELECT VARIABLE_VALUE > $binlog_commits FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME= 'BINLOG_COMMITS';
--source include/wait_condition.inc
dec $commits_to_wait;
if (`SELECT UNIX_TIMESTAMP(NOW(3)) > $tm + 5`)
{
let $possible_heartbeats= 1;
let $commits_to_wait= 0;
}
}
--connection slave
let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
--echo Number of received heartbeat events: $result
let $result= `SELECT CASE WHEN $possible_heartbeats THEN 'TRUE' WHEN $rcvd_heartbeats_after - $rcvd_heartbeats_before > 0 THEN 'FALSE' ELSE 'TRUE' END`;
--echo Received heartbeats meet expectations: $result
--connection master
DELETE FROM t1;
DROP EVENT e1;
--sync_slave_with_master
--echo
# Check received heartbeat events while logs flushed on slave
--echo *** Flush logs on slave ***
STOP SLAVE;

View File

@ -0,0 +1,25 @@
SELECT @@innodb_stats_include_delete_marked;
@@innodb_stats_include_delete_marked
0
SET GLOBAL innodb_stats_include_delete_marked=1;
SELECT @@innodb_stats_include_delete_marked;
@@innodb_stats_include_delete_marked
1
SET SESSION innodb_stats_include_delete_marked=1;
ERROR HY000: Variable 'innodb_stats_include_delete_marked' is a GLOBAL variable and should be set with SET GLOBAL
SET GLOBAL innodb_stats_include_delete_marked=100;
ERROR 42000: Variable 'innodb_stats_include_delete_marked' can't be set to the value of '100'
SET GLOBAL innodb_stats_include_delete_marked=foo;
ERROR 42000: Variable 'innodb_stats_include_delete_marked' can't be set to the value of 'foo'
SET GLOBAL innodb_stats_include_delete_marked=OFF ;
SELECT @@innodb_stats_include_delete_marked;
@@innodb_stats_include_delete_marked
0
SET GLOBAL innodb_stats_include_delete_marked=ON ;
SELECT @@innodb_stats_include_delete_marked;
@@innodb_stats_include_delete_marked
1
SET GLOBAL innodb_stats_include_delete_marked=Default ;
SELECT @@innodb_stats_include_delete_marked;
@@innodb_stats_include_delete_marked
0

View File

@ -1,7 +1,7 @@
--- suite/sys_vars/r/sysvars_innodb.result 2016-05-06 14:03:16.000000000 +0300
+++ suite/sys_vars/r/sysvars_innodb,32bit.reject 2016-05-08 13:28:44.312418574 +0300
@@ -47,13 +47,27 @@
ENUM_VALUE_LIST NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_ADAPTIVE_HASH_INDEX_PARTITIONS
@ -97,7 +97,7 @@
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
@@ -355,6 +369,20 @@
ENUM_VALUE_LIST NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_BUFFER_POOL_POPULATE
@ -418,15 +418,6 @@
VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 6
@@ -1047,7 +1215,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Kills the server during crash recovery.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10
@@ -1055,6 +1223,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
@ -1227,8 +1218,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.33
+GLOBAL_VALUE 5.6.34-79.1
-GLOBAL_VALUE 5.6.35
+GLOBAL_VALUE 5.6.35-80.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL

View File

@ -197,15 +197,6 @@
VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 6
@@ -1047,7 +1047,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Kills the server during crash recovery.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10
@@ -1075,7 +1075,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8000000

View File

@ -0,0 +1,53 @@
###############################################################################
# #
# Variable Name: innodb_stats_include_delete_marked #
# Scope: Global #
# Access Type: Dynamic #
# Data Type: numeric #
# #
# #
# Creation Date: 2016-08-29 #
# Author : Aditya #
# #
# #
# Description: #
# * Value check #
# * Scope check #
# #
###############################################################################
--source include/have_innodb.inc
####################################################################
# Display default value #
####################################################################
SELECT @@innodb_stats_include_delete_marked;
SET GLOBAL innodb_stats_include_delete_marked=1;
SELECT @@innodb_stats_include_delete_marked;
# check error
--error ER_GLOBAL_VARIABLE
SET SESSION innodb_stats_include_delete_marked=1;
# check error
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL innodb_stats_include_delete_marked=100;
# check error
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL innodb_stats_include_delete_marked=foo;
SET GLOBAL innodb_stats_include_delete_marked=OFF ;
SELECT @@innodb_stats_include_delete_marked;
SET GLOBAL innodb_stats_include_delete_marked=ON ;
SELECT @@innodb_stats_include_delete_marked;
# Check with default setting
SET GLOBAL innodb_stats_include_delete_marked=Default ;
SELECT @@innodb_stats_include_delete_marked;

View File

@ -21,6 +21,9 @@ SHOW VARIABLES LIKE 'secure_file_priv';
--perl
use File::Basename;
my $protected_file= dirname($ENV{MYSQLTEST_VARDIR}).'/bug50373.txt';
# Ensure bug50373.txt does not exist (e.g. leftover from previous
# test runs).
unlink $protected_file;
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/bug50373.inc") or die;
print FILE "SELECT * FROM t1 INTO OUTFILE '".$protected_file."';\n";
print FILE "DELETE FROM t1;\n";

View File

@ -295,3 +295,112 @@ Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1`
SELECT * FROM t1 NATURAL JOIN t2;
b a
DROP TABLE t1,t2;
create table t1 (
pk integer auto_increment,
bi integer not null,
vi integer generated always as (bi) persistent,
bc varchar(1) not null,
vc varchar(2) generated always as (concat(bc, bc)) persistent,
primary key (pk),
key (vi, vc));
insert t1 (bi, bc) values (0, 'x'), (0, 'n'), (1, 'w'), (7, 's'), (0, 'a'), (4, 'd'), (1, 'w'), (1, 'j'), (1, 'm'), (4, 'k'), (7, 't'), (4, 'k'), (2, 'e'), (0, 'i'), (1, 't'), (6, 'z'), (3, 'c'), (6, 'i'), (8, 'v');
create table t2 (
pk integer auto_increment,
bi integer not null,
vi integer generated always as (bi) persistent,
bc varchar(257) not null,
vc varchar(2) generated always as (concat(bc, bc)) persistent,
primary key (pk),
key (vi, vc));
insert t2 (bi, bc) values (1, 'c'), (8, 'm'), (9, 'd'), (6, 'y'), (1, 't'), (6, 'd'), (2, 's'), (4, 'r'), (8, 'm'), (4, 'b'), (4, 'x'), (7, 'g'), (4, 'p'), (1, 'q'), (9, 'w'), (4, 'd'), (8, 'e'), (4, 'b'), (8, 'y');
explain # should be using join buffer
select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL vi 10 NULL 19 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 index NULL PRIMARY 4 NULL 19 Using where; Using index; Using join buffer (incremental, BNL join)
select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
vi
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
6
6
6
6
7
7
8
8
8
8
9
9
drop table t2,t1;

View File

@ -68,3 +68,35 @@ SELECT * FROM t1 NATURAL JOIN t2;
SELECT * FROM t1 NATURAL JOIN t2;
DROP TABLE t1,t2;
#
# MDEV-11525 Assertion `cp + len <= buff + buff_size' failed in JOIN_CACHE::write_record_data
#
create table t1 (
pk integer auto_increment,
bi integer not null,
vi integer generated always as (bi) persistent,
bc varchar(1) not null,
vc varchar(2) generated always as (concat(bc, bc)) persistent,
primary key (pk),
key (vi, vc));
insert t1 (bi, bc) values (0, 'x'), (0, 'n'), (1, 'w'), (7, 's'), (0, 'a'), (4, 'd'), (1, 'w'), (1, 'j'), (1, 'm'), (4, 'k'), (7, 't'), (4, 'k'), (2, 'e'), (0, 'i'), (1, 't'), (6, 'z'), (3, 'c'), (6, 'i'), (8, 'v');
create table t2 (
pk integer auto_increment,
bi integer not null,
vi integer generated always as (bi) persistent,
bc varchar(257) not null,
vc varchar(2) generated always as (concat(bc, bc)) persistent,
primary key (pk),
key (vi, vc));
insert t2 (bi, bc) values (1, 'c'), (8, 'm'), (9, 'd'), (6, 'y'), (1, 't'), (6, 'd'), (2, 's'), (4, 'r'), (8, 'm'), (4, 'b'), (4, 'x'), (7, 'g'), (4, 'p'), (1, 'q'), (9, 'w'), (4, 'd'), (8, 'e'), (4, 'b'), (8, 'y');
explain # should be using join buffer
select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
--sorted_result
select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
drop table t2,t1;
#
# End of 5.5 tests
#

View File

@ -875,6 +875,29 @@ SELECT Customer, Success, SUM(OrderSize)
DROP TABLE example1463;
set sql_mode= @save_sql_mode;
--echo #
--echo # MDEV-9028: SELECT DISTINCT constant column of derived table
--echo # used as the second operand of LEFT JOIN
--echo #
create table t1 (id int, data varchar(255));
insert into t1 values (1,'yes'),(2,'yes');
select distinct t1.id, tt.id, tt.data
from t1
left join
(select t1.id, 'yes' as data from t1) as tt
on t1.id = tt.id;
select distinct t1.id, tt.id, tt.data
from t1
left join
(select t1.id, 'yes' as data from t1 where id > 1) as tt
on t1.id = tt.id;
drop table t1;
--echo # end of 5.5
--echo #

View File

@ -2178,6 +2178,68 @@ DROP USER mysqltest_u1@localhost;
--echo # End of Bug#38347.
--echo
--echo #
--echo # BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
--echo # DIFFERENTLY'.
--echo #
--disable_warnings
drop database if exists mysqltest_db1;
--enable_warnings
create database mysqltest_db1;
create user mysqltest_u1;
--echo # Both GRANT statements below should fail with the same error.
--error ER_SP_DOES_NOT_EXIST
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
--error ER_SP_DOES_NOT_EXIST
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
--echo # Let us show that GRANT behaviour for routines is consistent
--echo # with GRANT behaviour for tables. Attempt to grant privilege
--echo # on non-existent table also results in an error.
--error ER_NO_SUCH_TABLE
grant select on mysqltest_db1.t1 to mysqltest_u1;
show grants for mysqltest_u1;
drop database mysqltest_db1;
drop user mysqltest_u1;
--echo #
--echo # Bug#12766319 - 61865: RENAME USER DOES NOT WORK CORRECTLY -
--echo # REQUIRES FLUSH PRIVILEGES
--echo #
CREATE USER foo@'127.0.0.1';
GRANT ALL ON *.* TO foo@'127.0.0.1';
--echo # First attempt, should connect successfully
connect (conn1, '127.0.0.1', foo,,test);
SELECT user(), current_user();
--echo # Rename the user
RENAME USER foo@'127.0.0.1' to foo@'127.0.0.0/255.0.0.0';
--echo # Second attempt, should connect successfully as its valid mask
--echo # This was failing without fix
connect (conn2, '127.0.0.1', foo,,test);
SELECT user(), current_user();
--echo # Rename the user back to original
RENAME USER foo@'127.0.0.0/255.0.0.0' to foo@'127.0.0.1';
--echo # Third attempt, should connect successfully
connect (conn3, '127.0.0.1', foo,,test);
SELECT user(), current_user();
--echo # Clean-up
connection default;
disconnect conn1;
disconnect conn2;
disconnect conn3;
DROP USER foo@'127.0.0.1';
--echo # End of Bug#12766319
--echo #
--echo # Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
--echo # DATABASE SECURITY
@ -2210,29 +2272,6 @@ disconnect con1;
DROP USER untrusted@localhost;
DROP DATABASE secret;
--echo #
--echo # BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
--echo # DIFFERENTLY'.
--echo #
--disable_warnings
drop database if exists mysqltest_db1;
--enable_warnings
create database mysqltest_db1;
create user mysqltest_u1;
--echo # Both GRANT statements below should fail with the same error.
--error ER_SP_DOES_NOT_EXIST
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
--error ER_SP_DOES_NOT_EXIST
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
--echo # Let us show that GRANT behaviour for routines is consistent
--echo # with GRANT behaviour for tables. Attempt to grant privilege
--echo # on non-existent table also results in an error.
--error ER_NO_SUCH_TABLE
grant select on mysqltest_db1.t1 to mysqltest_u1;
show grants for mysqltest_u1;
drop database mysqltest_db1;
drop user mysqltest_u1;
set GLOBAL sql_mode=default;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -1309,5 +1309,74 @@ LEFT JOIN t4 AS alias5
JOIN t5 ON alias5.f5
ON alias2.f3 ON alias1.f2;
DROP TABLE t1,t2,t3,t4,t5;
set optimizer_search_depth= @tmp_mdev621;
--echo #
--echo # MDEV-7992: Nested left joins + 'not exists' optimization
--echo #
CREATE TABLE t1(
K1 INT PRIMARY KEY,
Name VARCHAR(15)
);
INSERT INTO t1 VALUES
(1,'T1Row1'), (2,'T1Row2');
CREATE TABLE t2(
K2 INT PRIMARY KEY,
K1r INT,
rowTimestamp DATETIME,
Event VARCHAR(15)
);
INSERT INTO t2 VALUES
(1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
(2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
(3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
let $q1=
SELECT t1a.*, t2a.*,
t2i.K2 AS K2B, t2i.K1r AS K1rB,
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
FROM
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
LEFT JOIN
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
ON (t1i.K1 = 1) AND
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
OR (t2i.K2 IS NULL))
WHERE
t2a.K1r = 1 AND t2i.K2 IS NULL;
eval $q1;
eval EXPLAIN EXTENDED $q1;
CREATE VIEW v1 AS
SELECT t2i.*
FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
WHERE t1i.K1 = 1 ;
let $q2=
SELECT
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
FROM
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
LEFT JOIN
v1 as t2b
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
OR (t2b.K2 IS NULL)
WHERE
t1a.K1 = 1 AND
t2b.K2 IS NULL;
eval $q2;
eval EXPLAIN EXTENDED $q2;
DROP VIEW v1;
DROP TABLE t1,t2;
set optimizer_search_depth= @tmp_mdev621;

View File

@ -2513,6 +2513,7 @@ if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Wind
}
--exec $MYSQL_DUMP --routines --compact $shell_ready_db_name
DROP DATABASE `a\"'``b`;
#"
use test;
@ -2568,3 +2569,11 @@ CREATE VIEW nonunique_table_view_name AS SELECT 1;
DROP DATABASE db1;
DROP DATABASE db2;
#"
# MDEV-11505 wrong databasename in mysqldump comment
#
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/bug11505.sql;
let SEARCH_PATTERN=Database: mysql;
exec $MYSQL_DUMP mysql func > $SEARCH_FILE;
source include/search_pattern_in_file.inc;

View File

@ -822,6 +822,104 @@ INSERT INTO t1 (d) VALUES ('1991-01-01');
SELECT * FROM t1 WHERE d = '1991-01-01';
DROP TABLE t1;
set global default_storage_engine=default;
--echo #
--echo # MDEV-9455: [ERROR] mysqld got signal 11
--echo #
CREATE TABLE `t1` (
`DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`NAME` varchar(75) DEFAULT NULL,
`DATETIME` varchar(10) NOT NULL DEFAULT '',
`DAILY_CALL_CNT` int(11) DEFAULT NULL,
`DAILY_SMS_CNT` int(11) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`),
KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`)
) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(`DATETIME`)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
CREATE TABLE `t2` (
`DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`CALL_TYPE` varchar(1) DEFAULT NULL,
`DATA_TYPE` varchar(1) DEFAULT NULL,
`FEATURES` varchar(1) DEFAULT NULL,
`NAME` varchar(75) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DATETIME` datetime NOT NULL,
`REG_DATE` datetime NOT NULL,
`TITLE` varchar(50) DEFAULT NULL,
`BODY` varchar(4200) DEFAULT NULL,
`MIME_TYPE` varchar(32) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
`DEVICE_ID` varchar(64) DEFAULT NULL,
`DEVICE_NAME` varchar(32) DEFAULT NULL,
PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`),
KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`),
KEY `IDX_TB_DIARY_02` (`REG_DATE`)
) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(REG_DATE)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
SELECT
A.IMORY_ID,
A.NUMBER,
A.NAME,
DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE,
SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT,
SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT,
SUM(CAST(A.DURATION AS INT)) AS DURATION,
( SELECT COUNT(*)
FROM t1
WHERE IMORY_ID=A.IMORY_ID
AND NUMBER=A.NUMBER
AND NAME=A.NAME
AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
) STATS_COUNT
FROM t2 A
WHERE A.IMORY_ID = 55094102
AND A.DATETIME LIKE (
SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%')
FROM t2
WHERE IMORY_ID=55094102
AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 )
group by DATE_FORMAT(DATETIME, '%Y-%m-%d')
)
GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
;
drop table t2, t1;
set global default_storage_engine='innodb';
--echo #
--echo # MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503,
--echo # Failing assertion: 0 with "key ptr now exceeds key end by 762 bytes"

View File

@ -216,6 +216,28 @@ PARTITION BY RANGE (a)
PARTITION pMax VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Partition p1, first row");
DROP TABLE t1;
--echo #
--echo # MDEV-10418 Assertion `m_extra_cache' failed
--echo # in ha_partition::late_extra_cache(uint)
--echo #
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT) ENGINE=MyISAM PARTITION BY RANGE(f2) (PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t2 VALUES (8);
CREATE ALGORITHM = MERGE VIEW v AS SELECT f2 FROM t2, t1;
UPDATE v SET f2 = 1;
SELECT * FROM t2;
DROP VIEW v;
DROP TABLE t2;
DROP TABLE t1;
--echo #
--echo # bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
--echo # TABLE CORRUPTS MYISAM

View File

@ -3697,5 +3697,38 @@ EXECUTE stmt;
deallocate prepare stmt;
drop table t1,t2,t3,t4;
--echo #
--echo # MDEV-11859: the plans for the first and the second executions
--echo # of PS are not the same
--echo #
create table t1 (id int, c varchar(3), key idx(c))engine=myisam;
insert into t1 values (3,'bar'), (1,'xxx'), (2,'foo'), (5,'yyy');
prepare stmt1 from
"explain extended
select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
execute stmt1;
execute stmt1;
deallocate prepare stmt1;
prepare stmt1 from
"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
flush status;
execute stmt1;
show status like '%Handler_read%';
flush status;
execute stmt1;
show status like '%Handler_read%';
deallocate prepare stmt1;
prepare stmt2 from
"explain extended
select * from t1 where (1, 2) in ( select 3, 4 )";
execute stmt2;
execute stmt2;
deallocate prepare stmt2;
drop table t1;
--echo # End of 5.5 tests

View File

@ -57,9 +57,9 @@ SELECT * FROM City
EXPLAIN
SELECT * FROM City
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
Country IN ('CAN', 'ARG') AND ID < 3800 OR
Country < 'U' AND Name LIKE 'Zhu%' OR
ID BETWEEN 3800 AND 3810;
Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
Country <= 'ALB' AND Name LIKE 'L%' OR
ID BETWEEN 3807 AND 3810;
# The output of the next 3 commands tells us about selectivities
# of the conditions utilized in 2 queries following after them
@ -1206,6 +1206,41 @@ SELECT * FROM t1
DROP TABLE t1;
--echo #
--echo # MDEV-8603: Wrong result OR/AND condition over index fields
--echo #
CREATE TABLE t1 (
id INT NOT NULL,
state VARCHAR(64),
capital VARCHAR(64),
UNIQUE KEY (id),
KEY state (state,id),
KEY capital (capital, id)
);
INSERT INTO t1 VALUES
(1,'Arizona','Phoenix'),
(2,'Hawaii','Honolulu'),
(3,'Georgia','Atlanta'),
(4,'Florida','Tallahassee'),
(5,'Alaska','Juneau'),
(6,'Michigan','Lansing'),
(7,'Pennsylvania','Harrisburg'),
(8,'Virginia','Richmond')
;
EXPLAIN
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
DROP TABLE t1;
#the following command must be the last one in the file
set session optimizer_switch='index_merge_sort_intersection=default';

View File

@ -9,7 +9,7 @@
eval create table t1 (a int) engine=myisam data directory='$MYSQL_TMP_DIR';
insert t1 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/
repair table t1;
drop table t1;
@ -17,7 +17,7 @@ drop table t1;
eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR';
insert t2 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/
repair table t2;
drop table t2;

View File

@ -1997,6 +1997,25 @@ EXECUTE stmt;
drop table t1, t2, t3;
--echo #
--echo # MDEV-11078: NULL NOT IN (non-empty subquery) should never return results
--echo #
create table t1(a int,b int);
create table t2(a int,b int);
insert into t1 value (1,2);
select (NULL) in (select 1 from t1);
select (null) in (select 1 from t2);
select 1 in (select 1 from t1);
select 1 in (select 1 from t2);
select 1 from dual where null in (select 1 from t1);
select 1 from dual where null in (select 1 from t2);
select (null,null) in (select * from t1);
select (null,null) in (select * from t2);
select 1 from dual where null not in (select 1 from t1);
select 1 from dual where null not in (select 1 from t2);
drop table t1,t2;
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;

View File

@ -482,6 +482,26 @@ drop table t1;
set optimizer_switch=@subselect_innodb_tmp;
--echo #
--echo # MDEV-9635:Server crashes in part_of_refkey or assertion
--echo # `!created && key_to_save < (int)s->keys' failed in
--echo # TABLE::use_index(int) or with join_cache_level>2
--echo #
SET join_cache_level=3;
CREATE TABLE t1 (f1 VARCHAR(1024)) ENGINE=InnoDB;
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (f2 VARCHAR(4)) ENGINE=InnoDB;
INSERT INTO t2 VALUES ('foo'),('bar');
SELECT * FROM v1, t2 WHERE ( f1, f2 ) IN ( SELECT f1, f1 FROM t1 );
set join_cache_level = default;
drop view v1;
drop table t1,t2;
--echo #
--echo # MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding
--echo #
@ -535,4 +555,3 @@ from
t1;
drop table t1,t2;

View File

@ -0,0 +1,6 @@
#
# MDEV-11902 mi_open race condition
#
source include/have_maria.inc;
set default_storage_engine=Aria;
source symlink-myisam-11902.test;

View File

@ -0,0 +1,60 @@
#
# MDEV-11902 mi_open race condition
#
source include/have_debug_sync.inc;
source include/have_symlink.inc;
source include/not_windows.inc;
call mtr.add_suppression("File.*t1.* not found");
create table mysql.t1 (a int, b char(16), index(a));
insert mysql.t1 values (100, 'test'),(101,'test');
let $datadir=`select @@datadir`;
exec mkdir $MYSQLTEST_VARDIR/tmp/foo;
replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR;
eval create table t1 (a int, b char(16), index(a))
data directory="$MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
select * from t1;
flush tables;
set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
send select * from t1;
connect con1, localhost, root;
set debug_sync='now WAIT_FOR ok';
exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
set debug_sync='now SIGNAL go';
connection default;
replace_regex / '.*\/tmp\// 'MYSQLTEST_VARDIR\/tmp\// /31/20/;
error 29;
reap;
flush tables;
drop table if exists t1;
exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
# same with INDEX DIRECTORY
exec mkdir $MYSQLTEST_VARDIR/tmp/foo;
replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR;
eval create table t1 (a int, b char(16), index (a))
index directory="$MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
explain select a from t1;
select a from t1;
flush tables;
set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
send select a from t1;
connection con1;
set debug_sync='now WAIT_FOR waiting';
exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
set debug_sync='now SIGNAL run';
connection default;
replace_regex / '.*\/test\// '.\/test\// /31/20/;
error ER_FILE_NOT_FOUND;
reap;
flush tables;
drop table if exists t1;
exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
drop table mysql.t1;
set debug_sync='RESET';

View File

@ -534,12 +534,12 @@ INSERT IGNORE INTO t1 VALUES (0,'g');
CREATE TABLE t3 ( a varchar(1)) ;
INSERT IGNORE INTO t3 VALUES ('g');
CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a)) ;
CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a));
INSERT INTO t2 VALUES (9), (10);
create view v1 as SELECT t1.* FROM t1 LEFT JOIN t2 ON ( t1.a = t2.a ) WHERE t2.a <> 0;
SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
drop view v1;
DROP TABLE t1,t2,t3;

View File

@ -5517,6 +5517,66 @@ SHOW CREATE VIEW v1;
drop view v1;
drop table t1,t2;
--echo #
--echo # MDEV-12099: usage of mergeable view with LEFT JOIN
--echo # that can be converted to INNER JOIN
--echo #
create table t1 (a int, b int, key(a)) engine=myisam;
insert into t1 values
(3,20), (7,10), (2,10), (4,30), (8,70),
(7,70), (9,100), (9,60), (8,80), (7,60);
create table t2 (c int, d int, key (c)) engine=myisam;
insert into t2 values
(50,100), (20, 200), (10,300),
(150,100), (120, 200), (110,300),
(250,100), (220, 200), (210,300);
create table t3(e int, f int not null, key(e), unique (f)) engine=myisam;
insert into t3 values
(100, 3), (300, 5), (400, 4), (300,7),
(300,2), (600, 13), (800, 15), (700, 14),
(600, 23), (800, 25), (700, 24);
create view v1 as
select * from t2 left join t3 on t3.e=t2.d where t3.f is not null;
select *
from t1 left join v1 on v1.c=t1.b
where t1.a < 5;
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f is not null
where t1.a < 5;
explain extended
select *
from t1 left join v1 on v1.c=t1.b
where t1.a < 5;
explain extended
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f is not null
where t1.a < 5;
explain extended
select *
from t1 left join v1 on v1.c=t1.b and v1.f=t1.a
where t1.a < 5;
explain extended
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f=t1.a and t3.f is not null
where t1.a < 5;
drop view v1;
drop table t1,t2,t3;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------

View File

@ -27,6 +27,7 @@ main.alter_table : Modified in 10.1.21
main.alter_table_trans : MDEV-11805 - timeout
main.analyze_stmt_slow_query_log : Modified in 10.1.21
main.cast : Modified in 10.1.21
main.count_distinct2 : MDEV-11768 - timeout
main.create : Modified in 10.1.21
main.create_delayed : MDEV-10605 - failed with timeout
main.create_drop_binlog : Uses binlog_start_pos.inc modified in 10.1.20
@ -40,12 +41,15 @@ main.ctype_utf32 : Modified in 10.1.21
main.ctype_utf8 : Modified in 10.1.20
main.ctype_utf8mb4 : Modified in 10.1.20
main.default : Modified in 10.1.20
main.debug_sync : MDEV-10607 - internal error
main.derived : Modified in 10.1.20
main.derived_opt : MDEV-11768 - timeout
main.derived_view : Modified in 10.1.20
main.events_restart : MDEV-11221: assertion failure
main.events_restart : MDEV-11221 - assertion failure
main.events_slowlog : Added in 10.1.21
main.fulltext_charsets : Added in 10.1.20
main.func_time : Modified in 10.1.21
main.grant : Modified in 10.1.22
main.group_by : Modified in 10.1.20
main.group_by_innodb : Modified in 10.1.20
main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown
@ -54,6 +58,7 @@ main.index_merge_innodb : MDEV-7142 - Wrong execution plan, also modi
main.information_schema_part : Modified in 10.1.21
main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure
main.join_cache : Modified in 10.1.21
main.join_nested : Modified in 10.1.22
main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist
main.loaddata : Modified in 10.1.21
main.log_slow : Modified in 10.1.21
@ -62,19 +67,26 @@ main.mdev-504 : MDEV-10607 - sporadic "can't connect"
main.mdev375 : MDEV-10607 - sporadic "can't connect"
main.merge : MDEV-10607 - sporadic "can't connect"
main.mysqlbinlog : Uses binlog_start_pos.inc modified in 10.1.20
main.mysqldump : Modified in 10.1.22
main.mysqldump-max : Uses binlog_start_pos.inc modified in 10.1.20
main.mysqlslap : MDEV-11801 - timeout
main.mysqlhotcopy_myisam : MDEV-10995 - test hangs on debug build
main.mysqltest : MDEV-9269 - fails on Alpha
main.named_pipe : Uses search_pattern_in_file.inc modified in 10.1.20
main.order_by : Modified in 10.1.21
main.order_by_optimizer_innodb : MDEV-10683 - wrong execution plan
main.parser : Modified in 10.1.20
main.partition_innodb : Modified in 10.1.22
main.partition_myisam : Modified in 10.1.22
main.pool_of_threads : Modified in 10.1.21
main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count
main.range_vs_index_merge : Modified in 10.1.22
main.repair_symlink-5543 : Modified in 10.1.22
main.selectivity : Modified in 10.1.20
main.show_explain : MDEV-10674 - sporadic failure
main.signal_demo3 : MDEV-11720 - Thread stack overrun on labrador
main.show_explain : MDEV-10674 - wrong result
main.signal_demo3 : MDEV-11720 - Thread stack overrun on Solaris
main.sp : Modified in 10.1.21
main.sp_notembedded : MDEV-10607 - internal error
main.sp-prelocking : Modified in 10.1.21
main.sp-security : MDEV-10607 - sporadic "can't connect"
main.stat_tables_par_innodb : MDEV-10515 - sporadic wrong results
@ -89,17 +101,24 @@ main.subselect_no_mat : Uses subselect.test modified in 10.1.21
main.subselect_no_opts : Uses subselect.test modified in 10.1.21
main.subselect_no_scache : Uses subselect.test modified in 10.1.21
main.subselect_no_semijoin : Uses subselect.test modified in 10.1.21
main.symlink-aria-11902 : Added in 10.0.30
main.symlink-myisam-11902 : Added in 10.0.30
main.table_elim : Modified in 10.1.22
main.trigger_null-8605 : Modified in 10.1.21
main.type_datetime_hires : MDEV-10687 - timeout
main.type_decimal : Modified in 10.1.20
main.union : Modified in 10.1.21
main.view : Modified in 10.1.21
main.wait_timeout_not_windows : Uses search_pattern_in_file.inc modified in 10.1.20
main.xa : MDEV-11769 - lock wait timeout
#----------------------------------------------------------------
archive.archive-big : MDEV-10615 - table is marked as crashed
archive.discover : MDEV-10510 - table is marked as crashed; modified in 10.1.21
archive.archive-big : MDEV-10615 - table is marked as crashed
archive.archive_bitfield : MDEV-11771 - table is marked as crashed
archive.archive_symlink : MDEV-12170 - unexpected error on rmdir
archive.discover : MDEV-10510 - table is marked as crashed
archive.mysqlhotcopy_archive : MDEV-10995 - test hangs on debug build
#----------------------------------------------------------------
@ -107,6 +126,7 @@ binlog.binlog_commit_wait : MDEV-10150 - Error: too much time el
binlog.binlog_incident : Uses binlog_start_pos.inc modified in 10.1.20
binlog.binlog_killed : Uses binlog_start_pos.inc modified in 10.1.20
binlog.binlog_killed_simulate : Uses binlog_start_pos.inc modified in 10.1.20
binlog.binlog_max_binlog_stmt_cache_size : Added in 10.0.30
binlog.binlog_mysqlbinlog2 : Uses binlog_start_pos.inc modified in 10.1.20
binlog.mix_innodb_myisam_binlog : Uses binlog_start_pos.inc modified in 10.1.20
binlog.binlog_row_annotate : Uses binlog_start_pos.inc modified in 10.1.20
@ -118,9 +138,10 @@ binlog_encryption.* : Added in 10.1.20
#----------------------------------------------------------------
connect.jdbc : Modified in 10.1.21
connect.jdbc_new : Modified in 10.1.21
connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results
connect.xml : Uses xsample2.xml modified in 10.0.30
connect.xml_zip : Added in 10.0.30
connect.zip : Added in 10.0.30
#----------------------------------------------------------------
@ -159,6 +180,7 @@ engines/funcs.* : Not maintained in timely manner
#----------------------------------------------------------------
federated_bug_35333 : Modified in 10.0.30
federated.federatedx : MDEV-10617 - Wrong checksum, timeouts
federated.federated_innodb : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips
federated.federated_partition : MDEV-10417 - Fails on Mips
@ -166,7 +188,11 @@ federated.federated_transactions : MDEV-10617, MDEV-10417 - Wrong checksum, time
#----------------------------------------------------------------
funcs_1.memory_views : MDEV-11773 - timeout
funcs_1.processlist_val_no_prot : MDEV-11223 - Wrong result
funcs_1.processlist_val_ps : MDEV-12175 - Wrong result
funcs_2/charset.* : MDEV-10999 - test not maintained
funcs_2.innodb_charset : Modified in 10.1.21
funcs_2.memory_charset : MDEV-10290 - Timeout
@ -185,20 +211,24 @@ galera_3nodes.* : MDEV-11490 - Warnings not suppressed
#----------------------------------------------------------------
innodb.101_compatibility : Added in 10.1.21
innodb.alter_key_block_size-11757 : Added in 10.0.30
innodb.binlog_consistent : MDEV-10618 - Server fails to start; also uses binlog_start_pos.inc modified in 10.1.20
innodb.doublewrite : Added in 10.1.21
innodb.group_commit_binlog_pos : Uses binlog_start_pos.inc modified in 10.1.20
innodb.group_commit_binlog_pos_no_optimize_thread : Uses binlog_start_pos.inc modified in 10.1.20
innodb.group_commit_crash : Modified in 10.1.21
innodb.group_commit_crash_no_optimize_thread : Modified in 10.1.21
innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - checksum mismatch
innodb.innodb-alter-table : MDEV-10619 - Testcase timeout
innodb.innodb_blob_unrecoverable_crash : Modified in 10.0.30
innodb.innodb-bug-14068765 : MDEV-9105 - valgrind warnings, assertion failures
innodb.innodb-bug-14084530 : MDEV-9105 - valgrind warnings, assertion failures
innodb.innodb_bug14147491 : MDEV-11808, also modified in 10.1.21
innodb.innodb_bug14676111 : MDEV-11802 - wrong result
innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan
innodb.innodb_bug59641 : Modified in 10.0.30
innodb.innodb-change-buffer-recovery : Modified in 10.1.21
innodb.innodb_defragment_fill_factor : Modified in 10.1.20
innodb.innodb-get-fk : Modified in 10.0.30
innodb.innodb-lock-schedule-algorithm : Modified in 10.1.20
innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem
innodb.innodb_stats : MDEV-10682 - wrong result
@ -206,7 +236,11 @@ innodb.innodb_sys_semaphore_waits : MDEV-10331 - wrong result
innodb.innodb-wl5522 : MDEV-9105 - valgrind warnings, assertion failures
innodb.innodb-wl5522-1 : MDEV-9105 - valgrind warnings, assertion failures
innodb.innodb-wl5522-debug-zip : Modified in 10.1.21
innodb.innodb_monitor : MDEV-10939 - Testcase timeout
innodb.read_only_recovery : Added in 10.0.30
innodb.xa_recovery : Modified in 10.0.30
innodb.log_data_file_size : Added in 10.1.21
innodb.log_file_size : Added in 10.0.30
innodb.table_index_statistics : Added in 10.1.20
innodb.trigger : Modified in 10.1.20
innodb.xa_recovery : Modified in 10.1.21
@ -214,6 +248,7 @@ innodb.xa_recovery : Modified in 10.1.21
#----------------------------------------------------------------
innodb_fts.create : Added in 10.1.20
innodb_fts.innodb_fts_stopword_charset : MDEV-12052 - Crash on shutdown
#----------------------------------------------------------------
@ -233,26 +268,47 @@ mroonga/storage.repair_table_no_index_file : MDEV-9364 -
#----------------------------------------------------------------
multi_source.gtid : MDEV-10620, MDEV-10417 - Timeout in wait condition, fails on Mips
multi_source.gtid : MDEV-10417 - Fails on Mips
multi_source.info_logs : MDEV-10042 - wrong result
multi_source.multisource : MDEV-10417 - Fails on Mips; also uses binlog_start_pos.inc modified in 10.1.20
multi_source.reset_slave : MDEV-10690 - wrong result; also uses binlog_start_pos.inc modified in 10.1.20
multi_source.simple : MDEV-4633 - Wrong slave status output; also uses binlog_start_pos.inc modified in 10.1.20
multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_heartbeats
#----------------------------------------------------------------
parts.partition_float_myisam : MDEV-10621 - Testcase timeout
parts.partition_int_myisam : MDEV-10621 - Testcase timeout
oqgraph.regression_mdev6282 : Modified in 10.0.30
oqgraph.regression_mdev6345 : Modified in 10.0.30
#----------------------------------------------------------------
parts.partition_bigint_innodb : Added in 10.0.30
parts.partition_bigint_myisam : Added in 10.0.30
parts.partition_double_innodb : Added in 10.0.30
parts.partition_double_myisam : Added in 10.0.30
parts.partition_exch_qa_10 : MDEV-11765 - wrong result
parts.partition_float_innodb : Modified in 10.0.30
parts.partition_float_myisam : Modified in 10.0.30
parts.partition_int_innodb : Modified in 10.0.30
parts.partition_int_myisam : Modified in 10.0.30
parts.partition_mediumint_innodb : Added in 10.0.30
parts.partition_mediumint_myisam : Added in 10.0.30
parts.partition_smallint_innodb : Added in 10.0.30
parts.partition_smallint_myisam : Added in 10.0.30
parts.partition_tinyint_innodb : Added in 10.0.30
parts.partition_tinyint_myisam : Added in 10.0.30
#----------------------------------------------------------------
perfschema.func_file_io : MDEV-5708 - fails for s390x
perfschema.func_mutex : MDEV-5708 - fails for s390x
perfschema.hostcache_ipv6_ssl : MDEV-10696 - crash on shutdown
perfschema.setup_actors : MDEV-10679 - rare crash
perfschema.socket_summary_by_event_name_func : MDEV-10622 - Socket summary tables do not match
perfschema.stage_mdl_global : MDEV-11803 - wrong result on slow builders
perfschema.threads_mysql : MDEV-10677 - sporadic wrong result
perfschema.stage_mdl_procedure : MDEV-11545 - Wrong result
perfschema.threads_mysql : MDEV-10677, MDEV-12177 - Wrong result
#----------------------------------------------------------------
@ -264,38 +320,32 @@ plugins.two_password_validations : MDEV-11650 - valgrind warnings
#----------------------------------------------------------------
roles.role_case_sensitive-10744 : Added in 10.1.20
roles.create_and_drop_role : Modified in 10.1.20
#----------------------------------------------------------------
rpl.last_insert_id : MDEV-10625 - warnings in error log
rpl.rpl_alter_extra_persistent : Added in 10.1.21
rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log
rpl.rpl_binlog_index : MDEV-9501 - Warning: failed registering on master
rpl.rpl_checksum : Uses search_pattern_in_file.inc modified in 10.1.20
rpl.rpl_checksum_cache : MDEV-10626 - Testcase timeout
rpl.rpl_circular_for_4_hosts : MDEV-10627 - Testcase timeout
rpl.rpl_checksum_cache : MDEV-12173 - InnoDB error
rpl.rpl_ddl : MDEV-10417 - Fails on Mips
rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result
rpl.rpl_gtid_basic : MDEV-10681 - server startup problem
rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master
rpl.rpl_gtid_errorlog : Uses search_pattern_in_file.inc modified in 10.1.20
rpl.rpl_gtid_master_promote : MDEV-10628 - Timeout in sync_with_master
rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings
rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown
rpl.rpl_gtid_until : MDEV-10625 - warnings in error log
rpl.rpl_heartbeat_basic : MDEV-11668 - wrong result
rpl.rpl_heartbeat_basic : Modified in 10.0.30
rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips
rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips
rpl.rpl_mariadb_slave_capability : MDEV-11018 - sporadic wrong events in binlog
rpl.rpl_mdev10863 : Added in 10.1.20
rpl.rpl_mdev6020 : MDEV-10630, MDEV-10417 - Timeouts, fails on Mips
rpl.rpl_mdev6386 : MDEV-10631 - Wrong result on slave
rpl.rpl_mdev6386 : Modified in 10.0.30
rpl.rpl_parallel : MDEV-10632, MDEV-10653 - Failures to sync, timeouts
rpl.rpl_parallel_optimistic : MDEV-10511 - timeout
rpl.rpl_parallel_retry : MDEV-11119 - Server crash
@ -303,24 +353,21 @@ rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_table
rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips
rpl.rpl_row_annotate : Uses binlog_start_pos.inc modified in 10.1.20
rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings
rpl.rpl_row_drop_create_temp_table : MDEV-10626 - Testcase timeout
rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start
rpl.rpl_row_flsh_tbls : Uses binlog_start_pos.inc modified in 10.1.20
rpl.rpl_row_log_innodb : MDEV-10688 - Wrong result
rpl.rpl_row_mysqlbinlog : Modified in 10.1.21
rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_semi_sync : MDEV-11220 - Wrong result
rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings
rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status
rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition
rpl.rpl_show_slave_hosts : MDEV-10681 - server startup problem
rpl.rpl_show_slave_hosts : MDEV-10681, MDEV-12171 - server startup problem
rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha
rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock
rpl.rpl_special_charset : Modified in 10.1.21
rpl.rpl_stm_flsh_tbls : Uses binlog_start_pos.inc modified in 10.1.20
rpl.rpl_stop_slave_error : Uses search_pattern_in_file.inc modified in 10.1.20
rpl.rpl_sync : MDEV-10633 - Database page corruption
rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries
rpl.sec_behind_master-5114 : Modified in 10.1.21
#----------------------------------------------------------------
@ -353,16 +400,15 @@ sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s39
sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout
sys_vars.innodb_buffer_pool_dump_pct_basic : MDEV-10651 - sporadic failure on file_exists
sys_vars.innodb_fatal_semaphore_wait_threshold : MDEV-10513 - crashes
sys_vars.replicate_do_db_basic : Modified in 10.1.20
sys_vars.replicate_do_table_basic : Modified in 10.1.20
sys_vars.replicate_ignore_db_basic : Modified in 10.1.20
sys_vars.replicate_ignore_table_basic : Modified in 10.1.20
sys_vars.replicate_wild_do_table_basic : Modified in 10.1.20
sys_vars.replicate_wild_ignore_table_basic : Modified in 10.1.20
sys_vars.innodb_force_recovery_crash_basic : Modified in 10.0.30
sys_vars.innodb_stats_include_delete_marked_basic : Added in 10.0.30
sys_vars.innodb_status_output_basic : MDEV-12174 - Timeout
sys_vars.rpl_init_slave_func : MDEV-10149 - wrong results
sys_vars.sysvars_innodb : MDEV-6958 - error-prone rdiffs
sys_vars.sysvars_server_embedded : MDEV-6958 - error-prone rdiffs
sys_vars.table_open_cache_instances_basic : Modified in 10.1.20
sys_vars.secure_file_priv : Modified in 10.0.30
sys_vars.thread_cache_size_func : MDEV-11775 - wrong result
#----------------------------------------------------------------
@ -370,6 +416,10 @@ tokudb.cluster_filter : MDEV-10678 - Wrong execution plan
tokudb.cluster_filter_hidden : MDEV-10678 - Wrong execution plan
tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan
tokudb.dir_per_db : MDEV-11537 - Wrong result
tokudb.dir_per_db_rename_to_nonexisting_schema : Added in 10.0.30
tokudb.gap_lock_error : Added in 10.0.30
tokudb.locks-select-update-3 : Modified in 10.0.30
tokudb.percona_kill_idle_trx_tokudb : Added in 10.0.30
tokudb.table_index_statistics : Added in 10.1.20
tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output
@ -379,6 +429,8 @@ tokudb_bugs.xa : MDEV-11804 - Lock wait timeout
tokudb_rpl.rpl_parallel_optimistic : Added in 10.1.20
tokudb_rpl.rpl_tokudb_rfr_partition_table : Added in 10.1.20
rpl-tokudb.rpl_extra_col_slave_tokudb : Result file modified in 10.0.30
#----------------------------------------------------------------
unit.ma_test_loghandler : MDEV-10638 - record read not ok
@ -387,6 +439,11 @@ unit.ma_test_loghandler : MDEV-10638 - record read not ok
vcol.not_supported : MDEV-10639 - Testcase timeout
vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout
vcol.vcol_misc : Modified in 10.0.30
vcol.vcol_select_myisam : Modified in 10.0.30
vcol.vcol_trigger_sp_innodb : Include file modified in 10.0.30
vcol.vcol_trigger_sp_myisam : Include file modified in 10.0.30
vcol.wrong_arena : Added in 10.0.30
#----------------------------------------------------------------

View File

@ -1129,6 +1129,17 @@
...
fun:pthread_create*
}
<<<<<<< HEAD
{
Memory Leak in loader and valgrind malloc
Memcheck:Leak
match-leak-kinds:reachable
obj:*/vgpreload_memcheck*.so
...
obj:*/ld-*.so
...
}
{
ConnectSE: unixODBC SQLAllocEnv leaves some "still reachable" pointers

View File

@ -97,13 +97,8 @@ char * fn_format(char * to, const char *name, const char *dir,
pos=strmake(strmov(to,dev),name,length);
(void) strmov(pos,ext); /* Don't convert extension */
}
/*
If MY_RETURN_REAL_PATH and MY_RESOLVE_SYMLINK is given, only do
realpath if the file is a symbolic link
*/
if (flag & MY_RETURN_REAL_PATH)
(void) my_realpath(to, to, MYF(flag & MY_RESOLVE_SYMLINKS ?
MY_RESOLVE_LINK: 0));
(void) my_realpath(to, to, MYF(0));
else if (flag & MY_RESOLVE_SYMLINKS)
{
strmov(buff,to);

View File

@ -206,7 +206,8 @@ my_context_spawn(struct my_context *c, void (*f)(void *), void *d)
(
"movq %%rsp, (%[save])\n\t"
"movq %[stack], %%rsp\n\t"
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && !defined(__INTEL_COMPILER)
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __clang__) && \
!defined(__INTEL_COMPILER)
/*
This emits a DWARF DW_CFA_undefined directive to make the return address
undefined. This indicates that this is the top of the stack frame, and

View File

@ -36,7 +36,7 @@
File my_create(const char *FileName, int CreateFlags, int access_flags,
myf MyFlags)
{
int fd, rc;
int fd;
DBUG_ENTER("my_create");
DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %lu",
FileName, CreateFlags, access_flags, MyFlags));
@ -54,21 +54,7 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
fd= -1;
}
rc= my_register_filename(fd, FileName, FILE_BY_CREATE,
fd= my_register_filename(fd, FileName, FILE_BY_CREATE,
EE_CANTCREATEFILE, MyFlags);
/*
my_register_filename() may fail on some platforms even if the call to
*open() above succeeds. In this case, don't leave the stale file because
callers assume the file to not exist if my_create() fails, so they don't
do any cleanups.
*/
if (unlikely(fd >= 0 && rc < 0))
{
int tmp= my_errno;
my_close(fd, MyFlags);
my_delete(FileName, MyFlags);
my_errno= tmp;
}
DBUG_RETURN(rc);
DBUG_RETURN(fd);
} /* my_create */

View File

@ -21,6 +21,12 @@
static int my_win_unlink(const char *name);
#endif
CREATE_NOSYMLINK_FUNCTION(
unlink_nosymlinks(const char *pathname),
unlinkat(dfd, filename, 0),
unlink(pathname)
);
int my_delete(const char *name, myf MyFlags)
{
int err;
@ -30,7 +36,10 @@ int my_delete(const char *name, myf MyFlags)
#ifdef _WIN32
err = my_win_unlink(name);
#else
err = unlink(name);
if (MyFlags & MY_NOSYMLINKS)
err= unlink_nosymlinks(name);
else
err= unlink(name);
#endif
if(err)

View File

@ -27,7 +27,7 @@
char * my_filename(File fd)
{
DBUG_ENTER("my_filename");
if ((uint) fd >= (uint) my_file_limit)
if ((uint) fd >= (uint) my_file_limit || !my_file_info[fd].name)
DBUG_RETURN((char*) "UNKNOWN");
if (fd >= 0 && my_file_info[fd].type != UNOPEN)
{

View File

@ -69,19 +69,13 @@ FILE *my_fopen(const char *filename, int flags, myf MyFlags)
DBUG_RETURN(fd); /* safeguard */
}
mysql_mutex_lock(&THR_LOCK_open);
if ((my_file_info[filedesc].name= (char*)
my_strdup(filename,MyFlags)))
{
my_stream_opened++;
my_file_total_opened++;
my_file_info[filedesc].type= STREAM_BY_FOPEN;
mysql_mutex_unlock(&THR_LOCK_open);
DBUG_PRINT("exit",("stream: 0x%lx", (long) fd));
DBUG_RETURN(fd);
}
my_file_info[filedesc].name= (char*) my_strdup(filename,MyFlags);
my_stream_opened++;
my_file_total_opened++;
my_file_info[filedesc].type= STREAM_BY_FOPEN;
mysql_mutex_unlock(&THR_LOCK_open);
(void) my_fclose(fd,MyFlags);
my_errno=ENOMEM;
DBUG_PRINT("exit",("stream: 0x%lx", (long) fd));
DBUG_RETURN(fd);
}
else
my_errno=errno;

View File

@ -227,7 +227,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
/* At very last, delete mysys key, it is used everywhere including DBUG */
pthread_key_delete(THR_KEY_mysys);
my_init_done=0;
my_init_done= my_thr_key_mysys_exists= 0;
} /* my_end */
#ifndef DBUG_OFF

View File

@ -15,9 +15,14 @@
#include "mysys_priv.h"
#include "mysys_err.h"
#include <my_dir.h>
#include <m_string.h>
#include <errno.h>
CREATE_NOSYMLINK_FUNCTION(
open_nosymlinks(const char *pathname, int flags, int mode),
openat(dfd, filename, O_NOFOLLOW | flags, mode),
open(pathname, O_NOFOLLOW | flags, mode)
);
/*
Open a file
@ -45,10 +50,11 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
MyFlags|= my_global_flags;
#if defined(_WIN32)
fd= my_win_open(FileName, Flags);
#elif !defined(NO_OPEN_3)
fd = open(FileName, Flags | O_CLOEXEC, my_umask); /* Normal unix */
#else
fd = open((char *) FileName, Flags | O_CLOEXEC);
if (MyFlags & MY_NOSYMLINKS)
fd = open_nosymlinks(FileName, Flags | O_CLOEXEC, my_umask);
else
fd = open(FileName, Flags | O_CLOEXEC, my_umask);
#endif
fd= my_register_filename(fd, FileName, FILE_BY_OPEN,
@ -131,25 +137,16 @@ File my_register_filename(File fd, const char *FileName, enum file_type
thread_safe_increment(my_file_opened,&THR_LOCK_open);
DBUG_RETURN(fd); /* safeguard */
}
else
{
mysql_mutex_lock(&THR_LOCK_open);
if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags)))
{
my_file_opened++;
my_file_total_opened++;
my_file_info[fd].type = type_of_file;
mysql_mutex_unlock(&THR_LOCK_open);
DBUG_PRINT("exit",("fd: %d",fd));
DBUG_RETURN(fd);
}
mysql_mutex_unlock(&THR_LOCK_open);
my_errno= ENOMEM;
}
(void) my_close(fd, MyFlags);
mysql_mutex_lock(&THR_LOCK_open);
my_file_info[fd].name = (char*) my_strdup(FileName, MyFlags);
my_file_opened++;
my_file_total_opened++;
my_file_info[fd].type = type_of_file;
mysql_mutex_unlock(&THR_LOCK_open);
DBUG_PRINT("exit",("fd: %d",fd));
DBUG_RETURN(fd);
}
else
my_errno= errno;
my_errno= errno;
DBUG_PRINT("error",("Got error %d on open", my_errno));
if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))

View File

@ -1,5 +1,6 @@
/*
Copyright (c) 2001, 2011, Oracle and/or its affiliates
Copyright (c) 2010, 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -23,6 +24,14 @@
#include <sys/stat.h>
#endif
static int always_valid(const char *filename __attribute__((unused)))
{
return 0;
}
int (*mysys_test_invalid_symlink)(const char *filename)= always_valid;
/*
Reads the content of a symbolic link
If the file is not a symbolic link, return the original file name in to.
@ -120,6 +129,11 @@ int my_is_symlink(const char *filename __attribute__((unused)))
to is guaranteed to never set to a string longer than FN_REFLEN
(including the end \0)
On error returns -1, unless error is file not found, in which case it
is 1.
Sets my_errno to specific error number.
*/
int my_realpath(char *to, const char *filename, myf MyFlags)
@ -145,7 +159,10 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
if (MyFlags & MY_WME)
my_error(EE_REALPATH, MYF(0), filename, my_errno);
my_load_path(to, filename, NullS);
result= -1;
if (my_errno == ENOENT)
result= 1;
else
result= -1;
}
DBUG_RETURN(result);
#elif defined(_WIN32)
@ -168,3 +185,78 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
#endif
return 0;
}
#ifdef HAVE_OPEN_PARENT_DIR_NOSYMLINKS
/** opens the parent dir. walks the path, and does not resolve symlinks
returns the pointer to the file name (basename) within the pathname
or NULL in case of an error
stores the parent dir (dirname) file descriptor in pdfd.
It can be -1 even if there was no error!
This is used for symlinked tables for DATA/INDEX DIRECTORY.
The paths there have been realpath()-ed. So, we can assume here that
* `pathname` is an absolute path
* no '.', '..', and '//' in the path
* file exists
*/
const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd)
{
char buf[PATH_MAX+1];
char *s= buf, *e= buf+1, *end= strnmov(buf, pathname, sizeof(buf));
int fd, dfd= -1;
if (*end)
{
errno= ENAMETOOLONG;
return NULL;
}
if (*s != '/') /* not an absolute path */
{
errno= ENOENT;
return NULL;
}
for (;;)
{
if (*e == '/') /* '//' in the path */
{
errno= ENOENT;
goto err;
}
while (*e && *e != '/')
e++;
*e= 0;
if (!memcmp(s, ".", 2) || !memcmp(s, "..", 3))
{
errno= ENOENT;
goto err;
}
if (++e >= end)
{
*pdfd= dfd;
return pathname + (s - buf);
}
fd = openat(dfd, s, O_NOFOLLOW | O_PATH);
if (fd < 0)
goto err;
if (dfd >= 0)
close(dfd);
dfd= fd;
s= e;
}
err:
if (dfd >= 0)
close(dfd);
return NULL;
}
#endif

View File

@ -91,27 +91,6 @@ File my_create_with_symlink(const char *linkname, const char *filename,
DBUG_RETURN(file);
}
/*
If the file was a symlink, delete both symlink and the file which the
symlink pointed to.
*/
int my_delete_with_symlink(const char *name, myf MyFlags)
{
char link_name[FN_REFLEN];
int was_symlink= (!my_disable_symlinks &&
!my_readlink(link_name, name, MYF(0)));
int result;
DBUG_ENTER("my_delete_with_symlink");
if (!(result=my_delete(name, MyFlags)))
{
if (was_symlink)
result=my_delete(link_name, MyFlags);
}
DBUG_RETURN(result);
}
/*
If the file is a normal file, just rename it.
If the file is a symlink:
@ -182,3 +161,31 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags)
DBUG_RETURN(result);
#endif /* HAVE_READLINK */
}
/** delete a - possibly symlinked - table file
This is used to delete a file that is part of a table (e.g. MYI or MYD
file of MyISAM) when dropping a table. A file might be a symlink -
if the table was created with DATA DIRECTORY or INDEX DIRECTORY -
in this case both the symlink and the symlinked file are deleted,
but only if the symlinked file is not in the datadir.
*/
int my_handler_delete_with_symlink(PSI_file_key key, const char *name,
const char *ext, myf sync_dir)
{
char orig[FN_REFLEN], real[FN_REFLEN];
int res= 0;
DBUG_ENTER("my_handler_delete_with_symlink");
fn_format(orig, name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT);
if (my_is_symlink(orig))
{
/*
Delete the symlinked file only if the symlink is not
pointing into datadir.
*/
if (!(my_realpath(real, orig, MYF(0)) || mysys_test_invalid_symlink(real)))
res= mysql_file_delete(key, real, MYF(MY_NOSYMLINKS | sync_dir));
}
DBUG_RETURN(mysql_file_delete(key, orig, MYF(sync_dir)) || res);
}

View File

@ -196,7 +196,7 @@ int my_sync_dir_by_file(const char *file_name __attribute__((unused)),
char dir_name[FN_REFLEN];
size_t dir_name_length;
dirname_part(dir_name, file_name, &dir_name_length);
return my_sync_dir(dir_name, my_flags);
return my_sync_dir(dir_name, my_flags & ~MY_NOSYMLINKS);
#else
return 0;
#endif

View File

@ -44,6 +44,8 @@ static uint get_thread_lib(void);
/** True if @c my_thread_global_init() has been called. */
static my_bool my_thread_global_init_done= 0;
/* True if THR_KEY_mysys is created */
my_bool my_thr_key_mysys_exists= 0;
/*
@ -167,11 +169,20 @@ my_bool my_thread_global_init(void)
return 0;
my_thread_global_init_done= 1;
if ((pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0)
/*
THR_KEY_mysys is deleted in my_end() as DBUG libraries are using it even
after my_thread_global_end() is called.
my_thr_key_mysys_exist is used to protect against application like QT
that calls my_thread_global_init() + my_thread_global_end() multiple times
without calling my_init() + my_end().
*/
if (!my_thr_key_mysys_exists &&
(pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0)
{
fprintf(stderr, "Can't initialize threads: error %d\n", pth_ret);
return 1;
}
my_thr_key_mysys_exists= 1;
/* Mutex used by my_thread_init() and after my_thread_destroy_mutex() */
my_thread_init_internal_mutex();

View File

@ -108,6 +108,34 @@ size_t sf_malloc_usable_size(void *ptr, my_bool *is_thread_specific);
void my_error_unregister_all(void);
#if !defined(O_PATH) && defined(O_EXEC) /* FreeBSD */
#define O_PATH O_EXEC
#endif
#ifdef O_PATH
#define HAVE_OPEN_PARENT_DIR_NOSYMLINKS
const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd);
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
int dfd, res; \
const char *filename= my_open_parent_dir_nosymlinks(pathname, &dfd); \
if (filename == NULL) return -1; \
res= AT; \
if (dfd >= 0) close(dfd); \
return res;
#elif defined(HAVE_REALPATH)
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
char buf[PATH_MAX+1]; \
if (realpath(pathname, buf) == NULL) return -1; \
if (strcmp(pathname, buf)) { errno= ENOTDIR; return -1; } \
return NOAT;
#else
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
return NOAT;
#endif
#define CREATE_NOSYMLINK_FUNCTION(PROTO,AT,NOAT) \
static int PROTO { NOSYMLINK_FUNCTION_BODY(AT,NOAT) }
#ifdef _WIN32
#include <sys/stat.h>
/* my_winfile.c exports, should not be used outside mysys */

View File

@ -8,7 +8,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
Copyright (c) 1997-2016 University of Cambridge
Copyright (c) 1997-2017 University of Cambridge
All rights reserved
@ -19,7 +19,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
Copyright(c) 2010-2016 Zoltan Herczeg
Copyright(c) 2010-2017 Zoltan Herczeg
All rights reserved.
@ -30,7 +30,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
Copyright(c) 2009-2016 Zoltan Herczeg
Copyright(c) 2009-2017 Zoltan Herczeg
All rights reserved.

View File

@ -66,6 +66,7 @@
# 2013-10-08 PH got rid of the "source" command, which is a bash-ism (use ".")
# 2013-11-05 PH added support for PARENS_NEST_LIMIT
# 2016-03-01 PH applied Chris Wilson's patch for MSVC static build
# 2016-06-24 PH applied Chris Wilson's revised patch (adds a separate option)
PROJECT(PCRE C CXX)

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