Merge branch '10.0' into 10.1

This commit is contained in:
Sergei Golubchik 2018-10-30 13:02:59 +01:00
commit 44f6f44593
250 changed files with 16242 additions and 4270 deletions

1
.gitignore vendored
View File

@ -242,6 +242,7 @@ storage/mroonga/vendor/groonga/src/groonga-benchmark
storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset
storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result
storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
zlib/zconf.h
xxx/*
yyy/*
zzz/*

View File

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2017, Oracle and/or its affiliates.
# Copyright (c) 2008, 2017, MariaDB
# Copyright (c) 2008, 2018, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,5 @@
# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2008, 2018, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1491,7 +1491,7 @@ static struct my_option my_long_options[] =
{"batch", 'B',
"Don't use history file. Disable interactive behavior. (Enables --silent.)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex,
{"binary-as-hex", 0, "Print binary data as hex", &opt_binhex, &opt_binhex,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", &charsets_dir,

View File

@ -136,6 +136,10 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
SET(SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_depends.c)
ADD_LIBRARY(${TARGET} STATIC ${SOURCE_FILE})
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME})
IF(NOT _SKIP_PIC)
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS
"${CMAKE_SHARED_LIBRARY_C_FLAGS}")
ENDIF()
SET(OSLIBS)
FOREACH(LIB ${LIBS_TO_MERGE})
@ -240,11 +244,11 @@ MACRO(MERGE_LIBRARIES)
# check for non-PIC libraries
IF(NOT _SKIP_PIC)
FOREACH(LIB ${LIBS})
GET_TARGET_PROPERTY(${LIB} TYPE LIBTYPE)
IF(LIBTYPE STREQUAL "STATIC_LIBRARY")
GET_TARGET_PROPERTY(LIB COMPILE_FLAGS LIB_COMPILE_FLAGS)
GET_TARGET_PROPERTY(LTYPE ${LIB} TYPE)
IF(LTYPE STREQUAL "STATIC_LIBRARY")
GET_TARGET_PROPERTY(LIB_COMPILE_FLAGS ${LIB} COMPILE_FLAGS)
STRING(REPLACE "${CMAKE_SHARED_LIBRARY_C_FLAGS}"
"<PIC_FLAG>" LIB_COMPILE_FLAGS ${LIB_COMPILE_FLAG})
"<PIC_FLAG>" LIB_COMPILE_FLAGS "${LIB_COMPILE_FLAGS}")
IF(NOT LIB_COMPILE_FLAGS MATCHES "<PIC_FLAG>")
MESSAGE(FATAL_ERROR
"Attempted to link non-PIC static library ${LIB} to shared library ${TARGET}\n"

View File

@ -127,9 +127,8 @@ IF(MSVC)
ENDIF()
# Always link with socket library
LINK_LIBRARIES(ws2_32)
# ..also for tests
SET(CMAKE_REQUIRED_LIBRARIES ws2_32)
STRING(APPEND CMAKE_C_STANDARD_LIBRARIES " ws2_32.lib")
STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " ws2_32.lib")
# System checks
SET(SIGNAL_WITH_VIO_CLOSE 1) # Something that runtime team needs

View File

@ -1,4 +1,5 @@
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2018, Oracle and/or its affiliates.
# Copyright (c) 2011, 2018, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
#
# 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
@ -14,15 +14,12 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MACRO (MYSQL_USE_BUNDLED_ZLIB)
SET(ZLIB_LIBRARY zlib)
SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib)
SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib)
SET(BUILD_BUNDLED_ZLIB 1)
SET(ZLIB_LIBRARY zlib CACHE INTERNAL "Bundled zlib library")
SET(ZLIB_FOUND TRUE)
SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled zlib")
ADD_SUBDIRECTORY(zlib)
GET_TARGET_PROPERTY(src zlib SOURCES)
FOREACH(file ${src})
SET(ZLIB_SOURCES ${ZLIB_SOURCES} ${CMAKE_SOURCE_DIR}/zlib/${file})
ENDFOREACH()
ENDMACRO()
# MYSQL_CHECK_ZLIB_WITH_COMPRESS
@ -37,15 +34,10 @@ ENDMACRO()
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
IF(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR
CMAKE_SYSTEM_NAME STREQUAL "AIX" OR
CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Use bundled zlib on some platforms by default (system one is too
# old or not existent)
# For NDBCLUSTER: Use bundled zlib by default
IF (NOT WITH_ZLIB)
SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
ENDIF()
ENDIF()
IF(WITH_ZLIB STREQUAL "bundled")
MYSQL_USE_BUNDLED_ZLIB()

1
debian/rules vendored
View File

@ -1,6 +1,7 @@
#!/usr/bin/make -f
export DH_VERBOSE=1
export DEB_BUILD_HARDENING=1
PACKAGE=mariadb-10.1

View File

@ -76,7 +76,7 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
/* allocate buffer for incremental backup (4096 pages) */
cp->delta_buf_size = (cursor->page_size / 4) * cursor->page_size;
cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size);
cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size, false);
if (!cp->delta_buf) {
msg("[%02u] mariabackup: Error: "

View File

@ -115,10 +115,10 @@ static inline uint32 my_clear_highest_bit(uint32 v)
static inline uint32 my_reverse_bits(uint32 key)
{
return
(_my_bits_reverse_table[ key & 255] << 24) |
(_my_bits_reverse_table[(key>> 8) & 255] << 16) |
(_my_bits_reverse_table[(key>>16) & 255] << 8) |
_my_bits_reverse_table[(key>>24) ];
((uint32)_my_bits_reverse_table[ key & 255] << 24) |
((uint32)_my_bits_reverse_table[(key>> 8) & 255] << 16) |
((uint32)_my_bits_reverse_table[(key>>16) & 255] << 8) |
(uint32)_my_bits_reverse_table[(key>>24) ];
}
/*

View File

@ -393,6 +393,18 @@ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
#ifdef _WIN64
#define MYSQL_SYSVAR_SIZE_T(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_MYSQL_SYSVAR_SIMPLE(name, size_t) = { \
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
#else
#define MYSQL_SYSVAR_SIZE_T(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_MYSQL_SYSVAR_SIMPLE(name, size_t) = { \
PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
#endif
#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \

View File

@ -1,4 +1,5 @@
# Copyright (c) 2006, 2011, Oracle and/or its affiliates.
# Copyright (c) 2009, 2018, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -188,4 +189,3 @@ IF(NOT DISABLE_SHARED)
ENDIF()
ENDIF()
ENDIF()

View File

@ -0,0 +1,141 @@
# BUG#37656
#
# This test aims at checking whether lower_case_table_names=1 option works
# for database names and table names.
#
# This test checks the following (when lower_case_table_names=1 is set on slave):
# (i) creating a database on upper case on master results in lower case
# database name on slave
# (ii) creating tables with upper case names on master results in lower case
# table names on slave
# (iii) loading data infile into capitalized table name on master replicates to
# lower case table name on slave
# (iv) Propagating changes from upper case table names on into correspondent
# lower case table names on slave works.
# setup: create database and tables
-- echo ******** [ MASTER ] ********
-- let $dbname_upper= BUG_37656
-- let $dbname_lower= `SELECT LOWER('$dbname_upper')`
-- eval CREATE DATABASE $dbname_upper
-- eval use $dbname_upper
# assert: database names are in upper case in master and lower
# case in slave
-- eval show databases like '$dbname_upper'
sync_slave_with_master;
-- echo ******** [ SLAVE ] ********
--eval show databases like '$dbname_lower'
-- connection master
-- echo ******** [ MASTER ] ********
CREATE TABLE T1 (a int);
-- eval CREATE TABLE T2 (b int) ENGINE=$engine
CREATE TABLE T3 (txt TEXT);
# assert: that tables exist on master with upper case names
show tables;
# assert: that tables exist on slave but with lower case names
-- sync_slave_with_master
-- echo ******** [ SLAVE ] ********
-- eval use $dbname_lower
show tables;
# action: lets create t1 for asserting below that t1 does not get changes
# from master (slave configured with --replicate-ignore-db=$dbname_lower.t1)
CREATE TABLE t1 (a INT);
# action: fill data into tables
-- connection master
-- echo ******** [ MASTER ] ********
-- eval use $dbname_upper
INSERT INTO T1 VALUES (1);
INSERT INTO T2 VALUES (1);
if (`SELECT @@session.binlog_format != 'ROW'`)
{
-- eval LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE $dbname_upper.T3
}
if (`SELECT @@session.binlog_format = 'ROW'`)
{
use test;
-- eval INSERT INTO $dbname_upper.T1 VALUES (2)
-- eval INSERT INTO $dbname_upper.T2 VALUES (2)
-- eval LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE $dbname_upper.T3
}
# assert: lower case tables on lower case database on slave
# get updates from upper case tables on upper case
# database on master
-- sync_slave_with_master
-- echo ******** [ SLAVE ] ********
# assert: changes for slave's t1 were filterd out
if (`SELECT count(*) != 0 FROM t1`)
{
-- echo UNEXPECTED DATA on $dbname_lower.t1 as table is filtered by replicate-ignore-table rules
}
-- let $diff_tables=master:$dbname_upper.T2, slave:$dbname_lower.t2
-- source include/diff_tables.inc
-- let $diff_tables=master:$dbname_upper.T3, slave:$dbname_lower.t3
-- source include/diff_tables.inc
# clean up
-- connection master
-- echo ******** [ MASTER ] ********
-- eval DROP DATABASE $dbname_upper
-- sync_slave_with_master
#
# BUG#50653: drop procedure implicitely treats db name in a case sensitive way
#
-- connection master
-- let $dbname= B50653
-- let $procname= b50653_proc
-- eval CREATE DATABASE $dbname
-- eval USE $dbname
-- eval CREATE PROCEDURE $procname() BEGIN SELECT 1; END
if (`SELECT count(*) = 1 FROM mysql.proc WHERE name like '$dbname'`)
{
-- die Procedure not created on MASTER
}
-- sync_slave_with_master
if (`SELECT count(*) = 1 FROM mysql.proc WHERE name like '$dbname'`)
{
-- die Procedure not created on SLAVE
}
-- connection master
-- eval DROP PROCEDURE $procname
if (`SELECT count(*) FROM mysql.proc WHERE name like '$dbname'`)
{
-- die Procedure not dropped on MASTER
}
-- sync_slave_with_master
if (`SELECT count(*) FROM mysql.proc WHERE name like '$dbname'`)
{
-- die Procedure not dropped on SLAVE
}
-- let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
if ($last_error)
{
-- die UNEXPECTED SLAVE SQL error: $last_error
}
-- connection master
-- eval DROP DATABASE $dbname
-- sync_slave_with_master
-- source include/rpl_end.inc

View File

@ -0,0 +1,9 @@
disable_query_log;
disable_warnings;
let $VERSION_COMPILE_64BIT=
`SELECT IF(@@version_compile_machine like '%64%', 1, 0)`;
enable_warnings;
enable_query_log;
if ($VERSION_COMPILE_64BIT) {
skip Need a 32 bit machine/binary;
}

View File

@ -0,0 +1,9 @@
disable_query_log;
disable_warnings;
let $VERSION_COMPILE_64BIT=
`SELECT IF(@@version_compile_machine like '%64%', 1, 0)`;
enable_warnings;
enable_query_log;
if (!$VERSION_COMPILE_64BIT) {
skip Need a 64 bit machine/binary;
}

View File

@ -195,14 +195,10 @@ sub value {
my ($self, $option_name)= @_;
my $option= $self->option($option_name);
if (! defined($option) and defined $ENV{$option_name}) {
if (! defined($option)) {
my $value= $ENV{$option_name};
$option= My::Config::Option->new($option_name, $value);
}
croak "No option named '$option_name' in group '$self->{name}'"
if ! defined($option);
return $option->value();
}

View File

@ -1411,6 +1411,56 @@ t1 CREATE TABLE `t1` (
`consultant_id` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
DROP TABLE t1;
#
# BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATA LOSS
#
SET GLOBAL max_allowed_packet=17825792;
CREATE TABLE t1 (t1_fld1 TEXT);
CREATE TABLE t2 (t2_fld1 MEDIUMTEXT);
CREATE TABLE t3 (t3_fld1 LONGTEXT);
INSERT INTO t1 VALUES (REPEAT('a',300));
INSERT INTO t2 VALUES (REPEAT('b',65680));
INSERT INTO t3 VALUES (REPEAT('c',16777300));
SELECT LENGTH(t1_fld1) FROM t1;
LENGTH(t1_fld1)
300
SELECT LENGTH(t2_fld1) FROM t2;
LENGTH(t2_fld1)
65680
SELECT LENGTH(t3_fld1) FROM t3;
LENGTH(t3_fld1)
16777300
# With strict mode
SET SQL_MODE='STRICT_ALL_TABLES';
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
ERROR 22001: Data too long for column 'my_t1_fld1' at row 1
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
ERROR 22001: Data too long for column 'my_t2_fld1' at row 1
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
ERROR 22001: Data too long for column 'my_t3_fld1' at row 1
# With non-strict mode
SET SQL_MODE='';
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
Warnings:
Warning 1265 Data truncated for column 'my_t1_fld1' at row 1
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
Warnings:
Warning 1265 Data truncated for column 'my_t2_fld1' at row 1
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
Warnings:
Warning 1265 Data truncated for column 'my_t3_fld1' at row 1
SELECT LENGTH(my_t1_fld1) FROM t1;
LENGTH(my_t1_fld1)
255
SELECT LENGTH(my_t2_fld1) FROM t2;
LENGTH(my_t2_fld1)
65535
SELECT LENGTH(my_t3_fld1) FROM t3;
LENGTH(my_t3_fld1)
16777215
DROP TABLE t1, t2, t3;
SET SQL_MODE=default;
SET GLOBAL max_allowed_packet=default;
CREATE TABLE t1 (
id INT(11) NOT NULL,
x_param INT(11) DEFAULT NULL,

View File

@ -486,3 +486,23 @@ CREATE OR REPLACE TABLE t1 (i INT);
UNLOCK TABLES;
INSERT INTO t2 VALUES (1);
DROP TABLE t1, t2, t3;
#
# MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in
# Locked_tables_list::unlock_locked_tables
#
CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2(a INT);
CREATE TABLE t3(a INT);
LOCK TABLE t2 WRITE;
SELECT * FROM t2;
a
CREATE OR REPLACE TEMPORARY TABLE t1(c INT DEFAULT '');
ERROR 42000: Invalid default value for 'c'
SELECT * FROM t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES
CREATE OR REPLACE TEMPORARY TABLE t2(c INT DEFAULT '');
ERROR 42000: Invalid default value for 'c'
SELECT * FROM t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES
UNLOCK TABLES;
DROP TABLE t3;

View File

@ -13952,6 +13952,27 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'oe') and (`test`.`t1`.`a` = 'oe'))
DROP TABLE t1;
#
# MDEV-17064 LIKE function has error behavior on the fields in which the collation is xxx_unicode_xx
#
CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
INSERT INTO t1 VALUES ('radio! test');
SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!';
name
radio! test
ALTER TABLE t1 CHANGE COLUMN name name VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!';
name
radio! test
DROP TABLE t1;
CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
INSERT INTO t1 VALUES ('radio! test');
SELECT name LIKE '%!!%' ESCAPE '!' AS c1,
name LIKE '%!!%' COLLATE utf8_general_ci ESCAPE '!' AS c2
FROM t1;
c1 c2
1 1
DROP TABLE t1;
#
# End of MariaDB-10.0 tests
#
#

View File

@ -268,3 +268,23 @@ SET optimizer_switch=@save_optimizer_switch;
SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1;
c1
0
#
# MDEV-13119 Wrong results with CAST(AS CHAR) and subquery
#
SET optimizer_switch=_utf8'derived_merge=on';
CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
INSERT INTO t1 VALUES('abcdefghi');
SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT CAST(t AS CHAR CHARACTER SET utf8) t2 FROM t1) sub;
c2
abcdefghi-abcdefghi
DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
#
# MDEV-13120 Wrong results with MAKE_SET() and subquery
#
CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
INSERT INTO t1 VALUES('abcdefghi');
SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub;
c2
abcdefghi,abcdefghi-abcdefghi,abcdefghi
DROP TABLE t1;

View File

@ -65,6 +65,69 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1;
DROP TABLE t1;
create database TEST;
create procedure TEST.pr() begin end;
create procedure test.pr() begin end;
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stats OK
mysql.innodb_index_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.roles_mapping OK
mysql.servers OK
mysql.table_stats OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Repairing tables
mysql.innodb_index_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
mysql.innodb_table_stats
Error : Unknown storage engine 'InnoDB'
error : Corrupt
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
TEST
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
drop procedure test.pr;
drop database TEST;
create table t1 (a int);
create trigger t1_bi before insert on t1 for each row set new.a= 1;
show triggers like '%T1%';

View File

@ -24,3 +24,23 @@ Warning 1292 Truncated incorrect CHAR(0) value: '8'
Warning 1292 Truncated incorrect CHAR(0) value: '9'
Warning 1292 Truncated incorrect CHAR(0) value: '10'
drop table t1;
#
# MDEV-17020: Assertion `length > 0' failed in ptr_compare upon ORDER BY with bad conversion
#
set @save_sql_mode= @@sql_mode;
SET @@sql_mode= '';
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2);
explain
SELECT * FROM t1 ORDER BY 'foo', CONVERT(pk, CHAR(0)) LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index; Using filesort
SELECT * FROM t1 ORDER BY 'foo', Cast(pk as CHAR(0)) LIMIT 2;
pk
1
2
Warnings:
Warning 1292 Truncated incorrect CHAR(0) value: '1'
Warning 1292 Truncated incorrect CHAR(0) value: '2'
set @@sql_mode= @save_sql_mode;
drop table t1;

View File

@ -1870,3 +1870,22 @@ CREATE TABLE t2 LIKE t1 PARTITION (p0, p2);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION (p0, p2)' at line 1
DROP TABLE t1;
SET @@default_storage_engine = @old_default_storage_engine;
#
# MDEV-14815 - Server crash or AddressSanitizer errors or valgrind warnings in thr_lock / has_old_lock upon FLUSH TABLES
#
CREATE TABLE t1 (i INT) ENGINE=MEMORY PARTITION BY RANGE (i) (PARTITION p0 VALUES LESS THAN (4), PARTITION pm VALUES LESS THAN MAXVALUE);
CREATE TABLE t2 (i INT) ENGINE=MEMORY;
LOCK TABLE t1 WRITE, t2 WRITE;
SELECT * FROM t1 PARTITION (p0);
i
FLUSH TABLES;
SELECT * FROM t1 PARTITION (p0);
i
ALTER TABLE t1 TRUNCATE PARTITION p0;
SELECT * FROM t1 PARTITION (p0);
i
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
SELECT * FROM t1 PARTITION (p0);
i
UNLOCK TABLES;
DROP TABLE t1, t2;

View File

@ -396,7 +396,14 @@ a
drop table t1;
drop function y2k;
#
# Start of 10.1 tests
# MDEV-17257 Server crashes in Item::field_type_for_temporal_comparison or in get_datetime_value on SELECT with YEAR field and IN
#
CREATE TABLE t1 (y YEAR);
SELECT * FROM t1 WHERE y IN ( CAST( '1993-03-26 10:14:20' AS DATE ), NULL );
y
DROP TABLE t1;
#
# End of 10.0 tests
#
#
# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010

View File

@ -379,3 +379,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uniq_id uniq_id 8 NULL 4 Using where
drop table t1;
End of 5.3 tests
create table t1 (id int, a varchar(300) not null, key using btree(a)) engine=heap;
insert t1 values (1, repeat('a', 300));
drop table t1;
End of 5.5 tests

View File

@ -279,3 +279,12 @@ explain select 0+a from t1 where a in (869751,736494,226312,802616);
drop table t1;
--echo End of 5.3 tests
#
# Bug#27799513: POTENTIAL DOUBLE FREE OR CORRUPTION OF HEAP INFO (HP_INFO)
#
create table t1 (id int, a varchar(300) not null, key using btree(a)) engine=heap;
insert t1 values (1, repeat('a', 300));
drop table t1;
--echo End of 5.5 tests

View File

@ -0,0 +1,15 @@
update performance_schema.setup_instruments set enabled='yes';
update performance_schema.setup_consumers set enabled='yes';
CREATE TABLE t1 (a serial, b varchar(255)) ENGINE=InnoDB;
BEGIN;
COMMIT;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
SET DEBUG_SYNC = 'now WAIT_FOR go';
SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
object_name
tmp/Innodb Merge Temp File
SET DEBUG_SYNC = 'now SIGNAL gone';
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;

View File

@ -17,3 +17,35 @@ SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
DROP TABLES staff, store;
SET FOREIGN_KEY_CHECKS=1;
#
# MDEV-17531 Crash in RENAME TABLE with FOREIGN KEY and FULLTEXT INDEX
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE DATABASE best;
CREATE TABLE t3 (a INT PRIMARY KEY,
CONSTRAINT t2_ibfk_1 FOREIGN KEY (a) REFERENCES t1(a)) ENGINE=InnoDB;
CREATE TABLE best.t2 (a INT PRIMARY KEY, b TEXT, FULLTEXT INDEX(b),
FOREIGN KEY (a) REFERENCES test.t1(a)) ENGINE=InnoDB;
RENAME TABLE best.t2 TO test.t2;
ERROR 42S01: Table 't2' already exists
SHOW CREATE TABLE best.t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) NOT NULL,
`b` text,
PRIMARY KEY (`a`),
FULLTEXT KEY `b` (`b`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP DATABASE best;
#
# MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
#
INSERT INTO t1 SET a=1;
BEGIN;
DELETE FROM t1;
INSERT INTO t3 SET a=1;
kill query @id;
ERROR 70100: Query execution was interrupted
DROP TABLE t3,t1;

View File

@ -54,3 +54,17 @@ SET DEBUG_SYNC = 'now SIGNAL s2';
ERROR 23000: Duplicate entry '1' for key 'uk'
SET DEBUG_SYNC = 'RESET';
drop table t1;
#
# Bug #27753193 ASSERTION `PREBUILT->TRX->ERROR_KEY_NUM <
# HA_ALTER_INFO->KEY_COUNT'
CREATE TABLE t1 (a INT, UNIQUE KEY(a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET DEBUG_SYNC = 'row_log_table_apply1_before signal S1 WAIT_FOR S2';
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
SET DEBUG_SYNC = 'now WAIT_FOR S1';
INSERT INTO t1 VALUES (1);
ERROR 23000: Duplicate entry '1' for key 'a'
SET DEBUG_SYNC = 'now SIGNAL S2';
ERROR 23000: Duplicate entry '1' for key 'a'
SET DEBUG_SYNC='RESET';
DROP TABLE t1;

View File

@ -0,0 +1,2 @@
--innodb-sort-buffer-size=64k
--tmpdir=$MYSQLTEST_VARDIR/tmp

View File

@ -0,0 +1,40 @@
--source include/have_innodb.inc
--source include/have_perfschema.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/not_embedded.inc
connect (ddl, localhost, root,,);
update performance_schema.setup_instruments set enabled='yes';
update performance_schema.setup_consumers set enabled='yes';
CREATE TABLE t1 (a serial, b varchar(255)) ENGINE=InnoDB;
BEGIN;
let $n=10;
--disable_query_log
while ($n) {
dec $n;
INSERT INTO t1 SELECT NULL, REPEAT('b',255);
}
--enable_query_log
COMMIT;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
send ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR go';
--replace_regex /.*[\\\/]tmp/tmp/
SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
#--exec lsof -p `pidof mysqld`
SET DEBUG_SYNC = 'now SIGNAL gone';
connection ddl;
reap;
disconnect ddl;
connection default;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;

View File

@ -23,3 +23,53 @@ SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
DROP TABLES staff, store;
SET FOREIGN_KEY_CHECKS=1;
--echo #
--echo # MDEV-17531 Crash in RENAME TABLE with FOREIGN KEY and FULLTEXT INDEX
--echo #
--disable_query_log
call mtr.add_suppression("InnoDB: Error; possible reasons:");
--enable_query_log
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE DATABASE best;
CREATE TABLE t3 (a INT PRIMARY KEY,
CONSTRAINT t2_ibfk_1 FOREIGN KEY (a) REFERENCES t1(a)) ENGINE=InnoDB;
CREATE TABLE best.t2 (a INT PRIMARY KEY, b TEXT, FULLTEXT INDEX(b),
FOREIGN KEY (a) REFERENCES test.t1(a)) ENGINE=InnoDB;
--replace_regex /Table '.*t2'/Table 't2'/
--error ER_TABLE_EXISTS_ERROR
RENAME TABLE best.t2 TO test.t2;
SHOW CREATE TABLE best.t2;
DROP DATABASE best;
--echo #
--echo # MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
--echo #
connect (fk, localhost, root,,);
INSERT INTO t1 SET a=1;
BEGIN;
DELETE FROM t1;
connection default;
let $ID= `SELECT @id := CONNECTION_ID()`;
send INSERT INTO t3 SET a=1;
connection fk;
# Check that the above SELECT is blocked
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'update' and info = 'INSERT INTO t3 SET a=1';
--source include/wait_condition.inc
let $ignore= `SELECT @id := $ID`;
kill query @id;
connection default;
--error ER_QUERY_INTERRUPTED
reap;
disconnect fk;
DROP TABLE t3,t1;

View File

@ -64,7 +64,6 @@ set DEBUG_SYNC = 'now WAIT_FOR s1';
--error ER_DUP_ENTRY
update t1 set a=1 where id=2;
SET DEBUG_SYNC = 'now SIGNAL s2';
disconnect con1;
--echo /* connection default */
connection default;
@ -75,5 +74,29 @@ SET DEBUG_SYNC = 'RESET';
drop table t1;
--echo #
--echo # Bug #27753193 ASSERTION `PREBUILT->TRX->ERROR_KEY_NUM <
--echo # HA_ALTER_INFO->KEY_COUNT'
CREATE TABLE t1 (a INT, UNIQUE KEY(a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET DEBUG_SYNC = 'row_log_table_apply1_before signal S1 WAIT_FOR S2';
send ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR S1';
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (1);
SET DEBUG_SYNC = 'now SIGNAL S2';
disconnect con1;
CONNECTION default;
--error ER_DUP_ENTRY
reap;
SET DEBUG_SYNC='RESET';
DROP TABLE t1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1,86 @@
CREATE TABLE t1 (
i int(10) unsigned not null auto_increment primary key,
a varchar(255) not null,
FULLTEXT KEY (a)
) ENGINE=Aria ROW_FORMAT=DYNAMIC MAX_ROWS=2000000000000;
repair table t1 quick;
Table Op Msg_type Msg_text
test.t1 repair status OK
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
repair table t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
repair table t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
select count(*) from t1 where match a against ('aaaxxx');
count(*)
0
select count(*) from t1 where match a against ('aaayyy');
count(*)
150
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
count(*)
1024
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
count(*)
150
select count(*) from t1 where match a against ('aaax*' in boolean mode);
count(*)
1024
select count(*) from t1 where match a against ('aaay*' in boolean mode);
count(*)
150
select count(*) from t1 where match a against ('aaa*' in boolean mode);
count(*)
1174
insert t1 (a) values ('aaaxxx'),('aaayyy');
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
count(*)
1025
select count(*) from t1 where match a against ('aaayyy');
count(*)
151
insert t1 (a) values ('aaaxxx 000000');
select count(*) from t1 where match a against ('000000');
count(*)
1
delete from t1 where match a against ('000000');
select count(*) from t1 where match a against ('000000');
count(*)
0
select count(*) from t1 where match a against ('aaaxxx');
count(*)
0
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
count(*)
1025
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
count(*)
151
select count(*) from t1 where a = 'aaaxxx';
count(*)
1025
select count(*) from t1 where a = 'aaayyy';
count(*)
151
insert t1 (a) values ('aaaxxx 000000');
select count(*) from t1 where match a against ('000000');
count(*)
1
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
count(*)
1026
update t1 set a='aaaxxx' where a = 'aaayyy';
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
count(*)
1177
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
count(*)
0
drop table t1;

View File

@ -0,0 +1,77 @@
#
# test of new fulltext search features
#
let collation=utf8_unicode_ci;
source include/have_collation.inc;
#
# two-level tree
#
CREATE TABLE t1 (
i int(10) unsigned not null auto_increment primary key,
a varchar(255) not null,
FULLTEXT KEY (a)
) ENGINE=Aria ROW_FORMAT=DYNAMIC MAX_ROWS=2000000000000;
# two-level entry, second-level tree with depth 2
disable_query_log;
let $1=1024;
while ($1)
{
eval insert t1 (a) values ('aaaxxx');
dec $1;
}
# one-level entry (entries)
let $1=150;
while ($1)
{
eval insert t1 (a) values ('aaayyy');
dec $1;
}
enable_query_log;
repair table t1 quick;
check table t1;
repair table t1;
check table t1;
repair table t1;
select count(*) from t1 where match a against ('aaaxxx');
select count(*) from t1 where match a against ('aaayyy');
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
select count(*) from t1 where match a against ('aaax*' in boolean mode);
select count(*) from t1 where match a against ('aaay*' in boolean mode);
select count(*) from t1 where match a against ('aaa*' in boolean mode);
# mi_write:
insert t1 (a) values ('aaaxxx'),('aaayyy');
# call to enlarge_root() below
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
select count(*) from t1 where match a against ('aaayyy');
# mi_delete
insert t1 (a) values ('aaaxxx 000000');
select count(*) from t1 where match a against ('000000');
delete from t1 where match a against ('000000');
select count(*) from t1 where match a against ('000000');
select count(*) from t1 where match a against ('aaaxxx');
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
# double-check without index
select count(*) from t1 where a = 'aaaxxx';
select count(*) from t1 where a = 'aaayyy';
# update
insert t1 (a) values ('aaaxxx 000000');
select count(*) from t1 where match a against ('000000');
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
update t1 set a='aaaxxx' where a = 'aaayyy';
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
drop table t1;

View File

@ -0,0 +1,16 @@
include/master-slave.inc
[connection master]
create table RPL(a int);
insert into RPL values(1);
select * from rpl;
a
1
insert into RPL values(3);
insert into rpl values(4);
select * from rpl;
a
1
3
4
drop table RPL;
include/rpl_end.inc

View File

@ -0,0 +1,33 @@
include/master-slave.inc
[connection master]
SET SQL_LOG_BIN=0;
CREATE DATABASE B37656;
SET SQL_LOG_BIN=1;
CREATE DATABASE BUG37656;
### action: show that database on slave is created in lowercase
SHOW DATABASES LIKE '%37656';
Database (%37656)
bug37656
USE B37656;
CREATE TABLE T1 (a int);
INSERT INTO T1 VALUES (1);
### assertion: master contains capitalized case table
SHOW TABLES;
Tables_in_B37656
T1
use bug37656;
### assertion: slave contains lowered case table
SHOW TABLES;
Tables_in_bug37656
t1
### assertion: master and slave tables do not differ
include/diff_tables.inc [master:B37656.T1, slave:bug37656.t1]
SET SQL_LOG_BIN=0;
DROP DATABASE B37656;
SET SQL_LOG_BIN=1;
SHOW DATABASES LIKE '%37656';
Database (%37656)
DROP DATABASE BUG37656;
SHOW DATABASES LIKE '%37656';
Database (%37656)
include/rpl_end.inc

View File

@ -0,0 +1,47 @@
include/master-slave.inc
[connection master]
******** [ MASTER ] ********
CREATE DATABASE BUG_37656;
use BUG_37656;
show databases like 'BUG_37656';
Database (BUG_37656)
BUG_37656
******** [ SLAVE ] ********
show databases like 'bug_37656';
Database (bug_37656)
bug_37656
******** [ MASTER ] ********
CREATE TABLE T1 (a int);
CREATE TABLE T2 (b int) ENGINE=InnoDB;
CREATE TABLE T3 (txt TEXT);
show tables;
Tables_in_BUG_37656
T1
T2
T3
******** [ SLAVE ] ********
use bug_37656;
show tables;
Tables_in_bug_37656
t2
t3
CREATE TABLE t1 (a INT);
******** [ MASTER ] ********
use BUG_37656;
INSERT INTO T1 VALUES (1);
INSERT INTO T2 VALUES (1);
use test;
INSERT INTO BUG_37656.T1 VALUES (2);
INSERT INTO BUG_37656.T2 VALUES (2);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE BUG_37656.T3;
******** [ SLAVE ] ********
include/diff_tables.inc [master:BUG_37656.T2, slave:bug_37656.t2]
include/diff_tables.inc [master:BUG_37656.T3, slave:bug_37656.t3]
******** [ MASTER ] ********
DROP DATABASE BUG_37656;
CREATE DATABASE B50653;
USE B50653;
CREATE PROCEDURE b50653_proc() BEGIN SELECT 1; END;
DROP PROCEDURE b50653_proc;
DROP DATABASE B50653;
include/rpl_end.inc

View File

@ -0,0 +1,44 @@
include/master-slave.inc
[connection master]
******** [ MASTER ] ********
CREATE DATABASE BUG_37656;
use BUG_37656;
show databases like 'BUG_37656';
Database (BUG_37656)
BUG_37656
******** [ SLAVE ] ********
show databases like 'bug_37656';
Database (bug_37656)
bug_37656
******** [ MASTER ] ********
CREATE TABLE T1 (a int);
CREATE TABLE T2 (b int) ENGINE=InnoDB;
CREATE TABLE T3 (txt TEXT);
show tables;
Tables_in_BUG_37656
T1
T2
T3
******** [ SLAVE ] ********
use bug_37656;
show tables;
Tables_in_bug_37656
t2
t3
CREATE TABLE t1 (a INT);
******** [ MASTER ] ********
use BUG_37656;
INSERT INTO T1 VALUES (1);
INSERT INTO T2 VALUES (1);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE BUG_37656.T3;
******** [ SLAVE ] ********
include/diff_tables.inc [master:BUG_37656.T2, slave:bug_37656.t2]
include/diff_tables.inc [master:BUG_37656.T3, slave:bug_37656.t3]
******** [ MASTER ] ********
DROP DATABASE BUG_37656;
CREATE DATABASE B50653;
USE B50653;
CREATE PROCEDURE b50653_proc() BEGIN SELECT 1; END;
DROP PROCEDURE b50653_proc;
DROP DATABASE B50653;
include/rpl_end.inc

View File

@ -0,0 +1 @@
--lower_case_table_names=1

View File

@ -0,0 +1,18 @@
--source include/have_case_sensitive_file_system.inc
--source include/have_innodb.inc
--source include/master-slave.inc
--connection master
create table RPL(a int);
insert into RPL values(1);
--sync_slave_with_master
select * from rpl;
insert into RPL values(3);
insert into rpl values(4);
select * from rpl;
--connection master
drop table RPL;
--source include/rpl_end.inc

View File

@ -0,0 +1 @@
--lower-case-table-names=1 "--replicate-rewrite-db=b37656->bug37656"

View File

@ -0,0 +1,60 @@
# BUG#37656
#
# DESCRIPTION
#
#
# This test case is tests whether replication works properly when
# slave is configured with --lower-case-table-names=1 and replication
# rewrite rules are in effect.
#
# It checks four issues:
#
# (i) master contains capitalized table name
#
# (ii) slave contains lowered case table name
#
# (iii) master and slave tables do not differ
#
-- source include/master-slave.inc
-- source include/not_windows.inc
SET SQL_LOG_BIN=0;
CREATE DATABASE B37656;
SET SQL_LOG_BIN=1;
-- connection slave
CREATE DATABASE BUG37656;
-- echo ### action: show that database on slave is created in lowercase
SHOW DATABASES LIKE '%37656';
-- connection master
USE B37656;
CREATE TABLE T1 (a int);
INSERT INTO T1 VALUES (1);
-- echo ### assertion: master contains capitalized case table
SHOW TABLES;
-- sync_slave_with_master
use bug37656;
-- echo ### assertion: slave contains lowered case table
SHOW TABLES;
-- echo ### assertion: master and slave tables do not differ
let $diff_tables= master:B37656.T1, slave:bug37656.t1;
-- source include/diff_tables.inc
-- connection master
SET SQL_LOG_BIN=0;
DROP DATABASE B37656;
SET SQL_LOG_BIN=1;
SHOW DATABASES LIKE '%37656';
-- connection slave
DROP DATABASE BUG37656;
SHOW DATABASES LIKE '%37656';
--source include/rpl_end.inc

View File

@ -0,0 +1 @@
--replicate-do-db=bug_37656 --replicate-ignore-table=buG_37656.T1 --replicate-do-table=bUg_37656.T2 --replicate-do-table=bUg_37656.T3 --lower-case-table-names=1

View File

@ -0,0 +1,12 @@
# BUG#37656
#
# For details look into extra/rpl_tests/rpl_lower_case_table_names.test
#
-- source include/master-slave.inc
-- source include/have_innodb.inc
-- source include/not_windows.inc
-- source include/have_binlog_format_row.inc
-- let $engine=InnoDB
-- source extra/rpl_tests/rpl_lower_case_table_names.test

View File

@ -0,0 +1 @@
--replicate-do-db=bug_37656 --replicate-ignore-table=bug_37656.t1 --replicate-do-table=bug_37656.t2 --replicate-do-table=bug_37656.t3 --lower-case-table-names=1

View File

@ -0,0 +1,12 @@
# BUG#37656
#
# For details look into extra/rpl_tests/rpl_lower_case_table_names.test
#
-- source include/master-slave.inc
-- source include/have_innodb.inc
-- source include/not_windows.inc
-- source include/have_binlog_format_mixed_or_statement.inc
-- let $engine=InnoDB
-- source extra/rpl_tests/rpl_lower_case_table_names.test

View File

@ -0,0 +1,7 @@
set global innodb_ft_result_cache_limit=5000000000;
Warnings:
Warning 1292 Truncated incorrect innodb_ft_result_cache_limit value: '5000000000'
select @@innodb_ft_result_cache_limit;
@@innodb_ft_result_cache_limit
4294967295
set global innodb_ft_result_cache_limit=2000000000;

View File

@ -0,0 +1,5 @@
set global innodb_ft_result_cache_limit=5000000000;
select @@innodb_ft_result_cache_limit;
@@innodb_ft_result_cache_limit
5000000000
set global innodb_ft_result_cache_limit=2000000000;

View File

@ -1210,8 +1210,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.41
+GLOBAL_VALUE 5.6.39-83.1
-GLOBAL_VALUE 5.6.42
+GLOBAL_VALUE 5.6.41-83.1
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL

View File

@ -684,8 +684,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.41
+GLOBAL_VALUE 5.6.39-83.1
-GLOBAL_VALUE 5.6.42
+GLOBAL_VALUE 5.6.41-84.1
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL

View File

@ -1176,7 +1176,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT InnoDB Fulltext search query result cache limit in bytes
NUMERIC_MIN_VALUE 1000000
NUMERIC_MAX_VALUE 4294967295
NUMERIC_MAX_VALUE 18446744073709551615
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
@ -2401,7 +2401,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
GLOBAL_VALUE 5.6.41
GLOBAL_VALUE 5.6.42
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL

View File

@ -1,3 +1,4 @@
call mtr.add_suppression("Could not increase number of max_open_files to more than");
SELECT @@global.thread_pool_size;
@@global.thread_pool_size
200

View File

@ -0,0 +1,9 @@
--source include/have_32bit.inc
--source include/have_innodb.inc
let $innodb_ft_result_cache_limit_orig=`select @@innodb_ft_result_cache_limit`;
set global innodb_ft_result_cache_limit=5000000000;
select @@innodb_ft_result_cache_limit;
eval set global innodb_ft_result_cache_limit=$innodb_ft_result_cache_limit_orig;

View File

@ -0,0 +1,9 @@
--source include/have_64bit.inc
--source include/have_innodb.inc
let $innodb_ft_result_cache_limit_orig=`select @@innodb_ft_result_cache_limit`;
set global innodb_ft_result_cache_limit=5000000000;
select @@innodb_ft_result_cache_limit;
eval set global innodb_ft_result_cache_limit=$innodb_ft_result_cache_limit_orig;

View File

@ -1,6 +1,7 @@
--source include/not_windows.inc
--source include/not_embedded.inc
--source include/have_pool_of_threads.inc
call mtr.add_suppression("Could not increase number of max_open_files to more than");
SELECT @@global.thread_pool_size;

View File

@ -1296,6 +1296,56 @@ MODIFY COLUMN `consultant_id` BIGINT;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATA LOSS
--echo #
SET GLOBAL max_allowed_packet=17825792;
--connect(con1, localhost, root,,)
CREATE TABLE t1 (t1_fld1 TEXT);
CREATE TABLE t2 (t2_fld1 MEDIUMTEXT);
CREATE TABLE t3 (t3_fld1 LONGTEXT);
INSERT INTO t1 VALUES (REPEAT('a',300));
INSERT INTO t2 VALUES (REPEAT('b',65680));
INSERT INTO t3 VALUES (REPEAT('c',16777300));
SELECT LENGTH(t1_fld1) FROM t1;
SELECT LENGTH(t2_fld1) FROM t2;
SELECT LENGTH(t3_fld1) FROM t3;
--echo # With strict mode
SET SQL_MODE='STRICT_ALL_TABLES';
--error ER_DATA_TOO_LONG
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
--error ER_DATA_TOO_LONG
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
--error ER_DATA_TOO_LONG
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
--echo # With non-strict mode
SET SQL_MODE='';
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
SELECT LENGTH(my_t1_fld1) FROM t1;
SELECT LENGTH(my_t2_fld1) FROM t2;
SELECT LENGTH(my_t3_fld1) FROM t3;
# Cleanup
--disconnect con1
--source include/wait_until_disconnected.inc
--connection default
DROP TABLE t1, t2, t3;
SET SQL_MODE=default;
SET GLOBAL max_allowed_packet=default;
#
# Test of ALTER TABLE IF [NOT] EXISTS
#

View File

@ -442,3 +442,27 @@ INSERT INTO t2 VALUES (1);
# Cleanup
DROP TABLE t1, t2, t3;
--echo #
--echo # MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in
--echo # Locked_tables_list::unlock_locked_tables
--echo #
CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2(a INT);
CREATE TABLE t3(a INT);
LOCK TABLE t2 WRITE;
SELECT * FROM t2;
# drops t2
--error ER_INVALID_DEFAULT
CREATE OR REPLACE TEMPORARY TABLE t1(c INT DEFAULT '');
# make sure we didn't leave locked tables mode
--error ER_TABLE_NOT_LOCKED
SELECT * FROM t3;
# drops t1
--error ER_INVALID_DEFAULT
CREATE OR REPLACE TEMPORARY TABLE t2(c INT DEFAULT '');
# make sure we didn't leave locked tables mode
--error ER_TABLE_NOT_LOCKED
SELECT * FROM t3;
UNLOCK TABLES;
DROP TABLE t3;

View File

@ -618,6 +618,24 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_c
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe';
DROP TABLE t1;
--echo #
--echo # MDEV-17064 LIKE function has error behavior on the fields in which the collation is xxx_unicode_xx
--echo #
CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
INSERT INTO t1 VALUES ('radio! test');
SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!';
ALTER TABLE t1 CHANGE COLUMN name name VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!';
DROP TABLE t1;
CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
INSERT INTO t1 VALUES ('radio! test');
SELECT name LIKE '%!!%' ESCAPE '!' AS c1,
name LIKE '%!!%' COLLATE utf8_general_ci ESCAPE '!' AS c2
FROM t1;
DROP TABLE t1;
--echo #
--echo # End of MariaDB-10.0 tests
--echo #

View File

@ -242,3 +242,25 @@ SET optimizer_switch=@save_optimizer_switch;
--echo #
SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1;
--echo #
--echo # MDEV-13119 Wrong results with CAST(AS CHAR) and subquery
--echo #
SET optimizer_switch=_utf8'derived_merge=on';
CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
INSERT INTO t1 VALUES('abcdefghi');
SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT CAST(t AS CHAR CHARACTER SET utf8) t2 FROM t1) sub;
DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
--echo #
--echo # MDEV-13120 Wrong results with MAKE_SET() and subquery
--echo #
CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
INSERT INTO t1 VALUES('abcdefghi');
SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub;
DROP TABLE t1;

View File

@ -105,6 +105,18 @@ RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1;
DROP TABLE t1;
#
# MDEV-13912 mysql_upgrade: case (in)sensitivity for stored procedures
#
create database TEST;
create procedure TEST.pr() begin end;
create procedure test.pr() begin end;
--exec $MYSQL_UPGRADE --force 2>&1
drop procedure test.pr;
drop database TEST;
# End of 5.5 tests
#
# MDEV-9014 SHOW TRIGGERS not case sensitive
#
@ -113,4 +125,7 @@ create trigger t1_bi before insert on t1 for each row set new.a= 1;
show triggers like '%T1%';
drop table t1;
let $datadir= `select @@datadir`;
remove_file $datadir/mysql_upgrade_info;
set GLOBAL sql_mode=default;

View File

@ -6,3 +6,16 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t1 order by now(), cast(pk as char(0));
drop table t1;
--echo #
--echo # MDEV-17020: Assertion `length > 0' failed in ptr_compare upon ORDER BY with bad conversion
--echo #
set @save_sql_mode= @@sql_mode;
SET @@sql_mode= '';
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2);
explain
SELECT * FROM t1 ORDER BY 'foo', CONVERT(pk, CHAR(0)) LIMIT 2;
SELECT * FROM t1 ORDER BY 'foo', Cast(pk as CHAR(0)) LIMIT 2;
set @@sql_mode= @save_sql_mode;
drop table t1;

View File

@ -858,3 +858,22 @@ CREATE TABLE t2 LIKE t1 PARTITION (p0, p2);
DROP TABLE t1;
SET @@default_storage_engine = @old_default_storage_engine;
--echo #
--echo # MDEV-14815 - Server crash or AddressSanitizer errors or valgrind warnings in thr_lock / has_old_lock upon FLUSH TABLES
--echo #
CREATE TABLE t1 (i INT) ENGINE=MEMORY PARTITION BY RANGE (i) (PARTITION p0 VALUES LESS THAN (4), PARTITION pm VALUES LESS THAN MAXVALUE);
CREATE TABLE t2 (i INT) ENGINE=MEMORY;
LOCK TABLE t1 WRITE, t2 WRITE;
SELECT * FROM t1 PARTITION (p0);
FLUSH TABLES;
SELECT * FROM t1 PARTITION (p0);
ALTER TABLE t1 TRUNCATE PARTITION p0;
SELECT * FROM t1 PARTITION (p0);
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
SELECT * FROM t1 PARTITION (p0);
UNLOCK TABLES;
# Cleanup
DROP TABLE t1, t2;

View File

@ -175,12 +175,12 @@ set @@sql_mode= @org_mode;
## ( Bug#29290 type_datetime.test failure in 5.1 )
## Therefore we sleep a bit if we are too close to midnight.
## The complete test itself needs around 1 second.
## Therefore a time_distance to midnight of 5 seconds should be sufficient.
if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`)
## Therefore a time_distance to midnight of 10 seconds should be sufficient.
if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 10)`)
{
# We are here when CURTIME() is between '23:59:56' and '23:59:59'.
# So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'.
--real_sleep 5
# We are here when CURTIME() is between '23:59:51' and '23:59:59'.
# So a sleep time of 10 seconds brings us between '00:00:01' and '00:00:09'.
--real_sleep 10
}
create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1(f1) values(curdate());

View File

@ -187,9 +187,16 @@ select a from t1 where a=b; # not a constant
drop table t1;
drop function y2k;
--echo #
--echo # MDEV-17257 Server crashes in Item::field_type_for_temporal_comparison or in get_datetime_value on SELECT with YEAR field and IN
--echo #
CREATE TABLE t1 (y YEAR);
SELECT * FROM t1 WHERE y IN ( CAST( '1993-03-26 10:14:20' AS DATE ), NULL );
DROP TABLE t1;
--echo #
--echo # Start of 10.1 tests
--echo # End of 10.0 tests
--echo #
--echo #

View File

@ -1,4 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates
# Copyright (c) 2009, 2018, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -491,4 +492,3 @@ process_flags:
err:
return (size_t) -1;
}

View File

@ -52,6 +52,11 @@ static int ptr_compare_0(size_t *compare_length, uchar **a, uchar **b);
static int ptr_compare_1(size_t *compare_length, uchar **a, uchar **b);
static int ptr_compare_2(size_t *compare_length, uchar **a, uchar **b);
static int ptr_compare_3(size_t *compare_length, uchar **a, uchar **b);
static int degenerate_compare_func(size_t *compare_length, uchar **a, uchar **b)
{
DBUG_ASSERT(*compare_length == 0);
return 0;
}
#endif /* __sun */
/* Get a pointer to a optimal byte-compare function for a given size */
@ -64,6 +69,8 @@ qsort2_cmp get_ptr_compare (size_t size __attribute__((unused)))
#else
qsort2_cmp get_ptr_compare (size_t size)
{
if (size == 0)
return (qsort2_cmp) degenerate_compare_func;
if (size < 4)
return (qsort2_cmp) ptr_compare;
switch (size & 3) {

View File

@ -456,14 +456,11 @@ ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
DEFAULT CHARACTER SET utf8;
# Correct the character set and collation
ALTER TABLE proc CONVERT TO CHARACTER SET utf8;
# Reset some fields after the conversion
ALTER TABLE proc MODIFY db
char(64) collate utf8_bin DEFAULT '' NOT NULL,
MODIFY definer
char(141) collate utf8_bin DEFAULT '' NOT NULL,
MODIFY comment
text collate utf8_bin NOT NULL;
ALTER TABLE proc CONVERT TO CHARACTER SET utf8,
MODIFY db char(64) binary DEFAULT '' NOT NULL,
MODIFY definer char(141) binary DEFAULT '' NOT NULL,
MODIFY comment text binary NOT NULL;
ALTER TABLE proc ADD character_set_client
char(32) collate utf8_bin DEFAULT NULL

View File

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates.
# Copyright (c) 2010, 2018, MariaDB
# Copyright (c) 2010, 2018, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -294,7 +294,7 @@ DTRACE_INSTRUMENT_STATIC_LIBS(mysqld
SET(WITH_MYSQLD_LDFLAGS "" CACHE STRING "Additional linker flags for mysqld")
MARK_AS_ADVANCED(WITH_MYSQLD_LDFLAGS)
IF(WITH_MYSQLD_LDFLAGS)
GET_TARGET_PROPERTY(mysqld LINK_FLAGS MYSQLD_LINK_FLAGS)
GET_TARGET_PROPERTY(MYSQLD_LINK_FLAGS mysqld LINK_FLAGS)
IF(NOT MYSQLD_LINK_FLAGS)
SET(MYSQLD_LINK_FLAGS)
ENDIF()

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
Copyright (c) 2010, 2018, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -3889,9 +3889,14 @@ THR_LOCK_DATA **ha_partition::store_lock(THD *thd,
}
else
{
for (i= bitmap_get_first_set(&(m_part_info->lock_partitions));
MY_BITMAP *used_partitions= lock_type == TL_UNLOCK ||
lock_type == TL_IGNORE ?
&m_locked_partitions :
&m_part_info->lock_partitions;
for (i= bitmap_get_first_set(used_partitions);
i < m_tot_parts;
i= bitmap_get_next_set(&m_part_info->lock_partitions, i))
i= bitmap_get_next_set(used_partitions, i))
{
DBUG_PRINT("info", ("store lock %d iteration", i));
to= m_file[i]->store_lock(thd, to, lock_type);

View File

@ -251,7 +251,6 @@ private:
/*
Variables for lock structures.
*/
THR_LOCK_DATA lock; /* MySQL lock */
bool auto_increment_lock; /**< lock reading/updating auto_inc */
/**

View File

@ -4329,11 +4329,20 @@ void Item_func_in::fix_length_and_dec()
if (field_item->field_type() == MYSQL_TYPE_LONGLONG ||
field_item->field_type() == MYSQL_TYPE_YEAR)
{
bool all_converted= TRUE;
bool all_converted= true;
for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
{
if (!convert_const_to_int(thd, field_item, &arg[0]))
all_converted= FALSE;
/*
Explicit NULLs should not affect data cmp_type resolution:
- we ignore NULLs when calling collect_cmp_type()
- we ignore NULLs here
So this expression:
year_column IN (DATE'2001-01-01', NULL)
switches from TIME_RESULT to INT_RESULT.
*/
if (arg[0]->type() != Item::NULL_ITEM &&
!convert_const_to_int(thd, field_item, &arg[0]))
all_converted= false;
}
if (all_converted)
m_compare_type= INT_RESULT;

View File

@ -557,22 +557,6 @@ void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table)
}
/** Abort all other threads waiting to get lock in table. */
void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock)
{
MYSQL_LOCK *locked;
DBUG_ENTER("mysql_lock_abort");
if ((locked= get_lock_data(thd, &table, 1, GET_LOCK_UNLOCK | GET_LOCK_ON_THD)))
{
for (uint i=0; i < locked->lock_count; i++)
thr_abort_locks(locked->locks[i]->lock, upgrade_lock);
}
DBUG_VOID_RETURN;
}
/**
Abort one thread / table combination.

View File

@ -33,7 +33,6 @@ void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count);
void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock);
bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b);
/* Lock based on name */

View File

@ -262,6 +262,27 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error,
}
#endif
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
static void set_thd_db(THD *thd, Rpl_filter *rpl_filter,
const char *db, uint32 db_len)
{
char lcase_db_buf[NAME_LEN +1];
LEX_STRING new_db;
new_db.length= db_len;
if (lower_case_table_names == 1)
{
strmov(lcase_db_buf, db);
my_casedn_str(system_charset_info, lcase_db_buf);
new_db.str= lcase_db_buf;
}
else
new_db.str= (char*) db;
/* TODO WARNING this makes rewrite_db respect lower_case_table_names values
* for more info look MDEV-17446 */
new_db.str= (char*) rpl_filter->get_rewrite_db(new_db.str, &new_db.length);
thd->set_db(new_db.str, new_db.length);
}
#endif
/*
Cache that will automatically be written to a dedicated file on
destruction.
@ -4241,7 +4262,6 @@ bool test_if_equal_repl_errors(int expected_error, int actual_error)
int Query_log_event::do_apply_event(rpl_group_info *rgi,
const char *query_arg, uint32 q_len_arg)
{
LEX_STRING new_db;
int expected_error,actual_error= 0;
Schema_specification_st db_options;
uint64 sub_id= 0;
@ -4273,9 +4293,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
goto end;
}
new_db.length= db_len;
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
thd->set_db(new_db.str, new_db.length); /* allocates a copy of 'db' */
set_thd_db(thd, rpl_filter, db, db_len);
/*
Setting the character set and collation of the current database thd->db.
@ -6058,15 +6076,12 @@ void Load_log_event::set_fields(const char* affected_db,
int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
bool use_rli_only_for_errors)
{
LEX_STRING new_db;
Relay_log_info const *rli= rgi->rli;
Rpl_filter *rpl_filter= rli->mi->rpl_filter;
DBUG_ENTER("Load_log_event::do_apply_event");
new_db.length= db_len;
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
thd->set_db(new_db.str, new_db.length);
DBUG_ASSERT(thd->query() == 0);
set_thd_db(thd, rpl_filter, db, db_len);
thd->clear_error(1);
/* see Query_log_event::do_apply_event() and BUG#13360 */
@ -6109,6 +6124,8 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
TABLE_LIST tables;
if (lower_case_table_names)
my_casedn_str(system_charset_info, (char *)table_name);
tables.init_one_table(thd->strmake(thd->db, thd->db_length),
thd->db_length,
table_name, strlen(table_name),
@ -11140,7 +11157,7 @@ check_table_map(rpl_group_info *rgi, RPL_TABLE_LIST *table_list)
int Table_map_log_event::do_apply_event(rpl_group_info *rgi)
{
RPL_TABLE_LIST *table_list;
char *db_mem, *tname_mem;
char *db_mem, *tname_mem, *ptr;
size_t dummy_len;
void *memory;
Rpl_filter *filter;
@ -11157,10 +11174,20 @@ int Table_map_log_event::do_apply_event(rpl_group_info *rgi)
NullS)))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
strmov(db_mem, m_dbnam);
strmov(tname_mem, m_tblnam);
if (lower_case_table_names)
{
my_casedn_str(files_charset_info, (char*)tname_mem);
my_casedn_str(files_charset_info, (char*)db_mem);
}
/* call from mysql_client_binlog_statement() will not set rli->mi */
filter= rgi->thd->slave_thread ? rli->mi->rpl_filter : global_rpl_filter;
strmov(db_mem, filter->get_rewrite_db(m_dbnam, &dummy_len));
strmov(tname_mem, m_tblnam);
/* rewrite rules changed the database */
if (((ptr= (char*) filter->get_rewrite_db(db_mem, &dummy_len)) != db_mem))
strmov(db_mem, ptr);
table_list->init_one_table(db_mem, strlen(db_mem),
tname_mem, strlen(tname_mem),

View File

@ -1725,7 +1725,14 @@ static void close_connections(void)
tmp->thread_id,
(tmp->main_security_ctx.user ?
tmp->main_security_ctx.user : ""));
/*
close_connection() might need a valid current_thd
for memory allocation tracking.
*/
THD* save_thd= current_thd;
set_current_thd(tmp);
close_connection(tmp,ER_SERVER_SHUTDOWN);
set_current_thd(save_thd);
}
#endif
#ifdef WITH_WSREP
@ -4299,6 +4306,11 @@ static int init_common_variables()
/* MyISAM requires two file handles per table. */
wanted_files= (extra_files + max_connections + extra_max_connections +
tc_size * 2);
#if defined(HAVE_POOL_OF_THREADS) && !defined(__WIN__)
// add epoll or kevent fd for each threadpool group, in case pool of threads is used
wanted_files+= (thread_handling > SCHEDULER_NO_THREADS) ? 0 : threadpool_size;
#endif
min_tc_size= MY_MIN(tc_size, TABLE_OPEN_CACHE_MIN);
org_max_connections= max_connections;
org_tc_size= tc_size;

View File

@ -163,7 +163,7 @@ public:
// Columns and keys to be dropped.
List<Alter_drop> drop_list;
// Columns for ALTER_COLUMN_CHANGE_DEFAULT.
// Columns for ALTER_CHANGE_COLUMN_DEFAULT.
List<Alter_column> alter_list;
// List of keys, used by both CREATE and ALTER TABLE.
List<Key> key_list;

View File

@ -9249,84 +9249,6 @@ my_bool mysql_rm_tmp_tables(void)
unireg support functions
*****************************************************************************/
/**
A callback to the server internals that is used to address
special cases of the locking protocol.
Invoked when acquiring an exclusive lock, for each thread that
has a conflicting shared metadata lock.
This function:
- aborts waiting of the thread on a data lock, to make it notice
the pending exclusive lock and back off.
- if the thread is an INSERT DELAYED thread, sends it a KILL
signal to terminate it.
@note This function does not wait for the thread to give away its
locks. Waiting is done outside for all threads at once.
@param thd Current thread context
@param in_use The thread to wake up
@param needs_thr_lock_abort Indicates that to wake up thread
this call needs to abort its waiting
on table-level lock.
@retval TRUE if the thread was woken up
@retval FALSE otherwise.
@note It is one of two places where border between MDL and the
rest of the server is broken.
*/
bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
bool needs_thr_lock_abort)
{
bool signalled= FALSE;
if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) &&
!in_use->killed)
{
in_use->set_killed(KILL_SYSTEM_THREAD);
mysql_mutex_lock(&in_use->mysys_var->mutex);
if (in_use->mysys_var->current_cond)
{
mysql_mutex_lock(in_use->mysys_var->current_mutex);
mysql_cond_broadcast(in_use->mysys_var->current_cond);
mysql_mutex_unlock(in_use->mysys_var->current_mutex);
}
mysql_mutex_unlock(&in_use->mysys_var->mutex);
signalled= TRUE;
}
if (needs_thr_lock_abort)
{
mysql_mutex_lock(&in_use->LOCK_thd_data);
for (TABLE *thd_table= in_use->open_tables;
thd_table ;
thd_table= thd_table->next)
{
/*
Check for TABLE::needs_reopen() is needed since in some places we call
handler::close() for table instance (and set TABLE::db_stat to 0)
and do not remove such instances from the THD::open_tables
for some time, during which other thread can see those instances
(e.g. see partitioning code).
*/
if (!thd_table->needs_reopen())
{
signalled|= mysql_lock_abort_for_thread(thd, thd_table);
if (thd && WSREP(thd) && wsrep_thd_is_BF(thd, true))
{
WSREP_DEBUG("remove_table_from_cache: %llu",
(unsigned long long) thd->real_id);
wsrep_abort_thd((void *)thd, (void *)in_use, FALSE);
}
}
}
mysql_mutex_unlock(&in_use->LOCK_thd_data);
}
return signalled;
}
int setup_ftfuncs(SELECT_LEX *select_lex)
{
List_iterator<Item_func_match> li(*(select_lex->ftfunc_list)),

View File

@ -2396,7 +2396,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
The thread could be killed with an error message if
di->handle_inserts() or di->open_and_lock_table() fails.
The thread could be killed without an error message if
killed using mysql_notify_thread_having_shared_lock() or
killed using THD::notify_shared_lock() or
kill_delayed_threads_for_table().
*/
if (!thd.is_error())

View File

@ -5102,7 +5102,7 @@ err:
/* Write log if no error or if we already deleted a table */
if (!result || thd->log_current_statement)
{
if (result && create_info->table_was_deleted)
if (result && create_info->table_was_deleted && pos_in_locked_tables)
{
/*
Possible locked table was dropped. We should remove meta data locks

View File

@ -109,6 +109,7 @@ IF(CONNECT_WITH_LIBXML2)
FIND_PACKAGE(LibXml2)
IF (LIBXML2_FOUND)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
SET(ZLIB_LIBRARY "z") # see ZLIB_INCLUDE_DIR below
SET(XML_LIBRARY ${LIBXML2_LIBRARIES})
SET(CONNECT_SOURCES ${CONNECT_SOURCES} libdoc.cpp libdoc.h)
add_definitions(-DLIBXML2_SUPPORT)
@ -326,6 +327,14 @@ IF(NOT TARGET connect)
RETURN()
ENDIF()
# Don't link with bundled zlib and systel libxml2 at the same time.
# System libxml2 uses system zlib, might conflict with the bundled one.
IF (XML_LIBRARY AND BUILD_BUNDLED_ZLIB)
GET_PROPERTY(INCS TARGET connect PROPERTY INCLUDE_DIRECTORIES)
LIST(REMOVE_ITEM INCS ${ZLIB_INCLUDE_DIR})
SET_PROPERTY(TARGET connect PROPERTY INCLUDE_DIRECTORIES ${INCS})
ENDIF()
IF(WIN32)
IF (libmongoc-1.0_FOUND)
SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS

View File

@ -254,7 +254,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
try {
if (!c1) {
if (mode == MODE_INSERT)
// if (mode == MODE_INSERT) or CHECK TABLE
// Allocate all column blocks for that table
tdbp->ColDB(g, NULL, 0);

View File

@ -84,7 +84,7 @@ DOMDOC::DOMDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
: XMLDOCUMENT(nsl, nsdf, enc)
{
assert (!fp || fp->Type == TYPE_FB_XML);
Docp = (fp) ? ((PXBLOCK)fp)->Docp : NULL;
Docp = (fp) ? ((PXBLOCK)fp)->Docp : (MSXML2::IXMLDOMDocumentPtr)NULL;
Nlist = NULL;
Hr = 0;
} // end of DOMDOC constructor

View File

@ -427,7 +427,7 @@ int TXTFAM::DeleteSortedRows(PGLOBAL g)
for (i = 0; i < Posar->GetNval(); i++) {
if ((irc = InitDelete(g, Posar->GetIntValue(ix[i]),
Sosar->GetIntValue(ix[i])) == RC_FX))
Sosar->GetIntValue(ix[i]))) == RC_FX)
goto err;
// Now delete the sorted rows
@ -1173,11 +1173,11 @@ int DOSFAM::RenameTempFile(PGLOBAL g)
remove(filetemp); // May still be there from previous error
if (rename(filename, filetemp)) { // Save file for security
sprintf(g->Message, MSG(RENAME_ERROR),
snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR),
filename, filetemp, strerror(errno));
throw 51;
} else if (rename(tempname, filename)) {
sprintf(g->Message, MSG(RENAME_ERROR),
snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR),
tempname, filename, strerror(errno));
rc = rename(filetemp, filename); // Restore saved file
throw 52;

View File

@ -510,7 +510,8 @@ bool VCTFAM::AllocateBuffer(PGLOBAL g)
for (; cp; cp = (PVCTCOL)cp->Next)
cp->Blk = AllocValBlock(g, NewBlock + Nrec * cp->Deplac,
cp->Buf_Type, Nrec, cp->Format.Length,
cp->Format.Prec, chk);
cp->Format.Prec, chk, true,
cp->IsUnsigned());
return InitInsert(g); // Initialize inserting
} else {
@ -544,7 +545,8 @@ bool VCTFAM::AllocateBuffer(PGLOBAL g)
for (; cp; cp = (PVCTCOL)cp->Next)
if (!cp->IsSpecial()) // Not a pseudo column
cp->Blk = AllocValBlock(g, NULL, cp->Buf_Type, Nrec,
cp->Format.Length, cp->Format.Prec);
cp->Format.Length, cp->Format.Prec,
true, true, cp->IsUnsigned());
} //endif mode
@ -1511,7 +1513,8 @@ bool VCMFAM::AllocateBuffer(PGLOBAL g)
for (cp = (PVCTCOL)Tdbp->GetColumns(); cp; cp = (PVCTCOL)cp->Next)
if (!cp->IsSpecial()) { // Not a pseudo column
cp->Blk = AllocValBlock(g, (void*)1, cp->Buf_Type, Nrec,
cp->Format.Length, cp->Format.Prec);
cp->Format.Length, cp->Format.Prec,
true, true, cp->IsUnsigned());
cp->AddStatus(BUF_MAPPED);
} // endif IsSpecial
@ -2062,7 +2065,7 @@ bool VECFAM::AllocateBuffer(PGLOBAL g)
for (cp = (PVCTCOL)tdbp->Columns; cp; cp = (PVCTCOL)cp->Next)
cp->Blk = AllocValBlock(g, To_Bufs[cp->Index - 1],
cp->Buf_Type, Nrec, cp->Format.Length,
cp->Format.Prec, chk);
cp->Format.Prec, chk, true, cp->IsUnsigned());
return InitInsert(g);
} else {
@ -2111,7 +2114,8 @@ bool VECFAM::AllocateBuffer(PGLOBAL g)
for (cp = (PVCTCOL)tdbp->Columns; cp; cp = (PVCTCOL)cp->Next)
if (!cp->IsSpecial()) // Not a pseudo column
cp->Blk = AllocValBlock(g, NULL, cp->Buf_Type, Nrec,
cp->Format.Length, cp->Format.Prec);
cp->Format.Length, cp->Format.Prec,
true, true, cp->IsUnsigned());
} // endif mode
@ -2449,11 +2453,11 @@ int VECFAM::RenameTempFile(PGLOBAL g)
remove(filetemp); // May still be there from previous error
if (rename(filename, filetemp)) { // Save file for security
sprintf(g->Message, MSG(RENAME_ERROR),
snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR),
filename, filetemp, strerror(errno));
rc = RC_FX;
} else if (rename(tempname, filename)) {
sprintf(g->Message, MSG(RENAME_ERROR),
snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR),
tempname, filename, strerror(errno));
rc = rename(filetemp, filename); // Restore saved file
rc = RC_FX;
@ -2882,7 +2886,8 @@ bool VMPFAM::AllocateBuffer(PGLOBAL g)
for (cp = (PVCTCOL)Tdbp->GetColumns(); cp; cp = (PVCTCOL)cp->Next)
if (!cp->IsSpecial()) { // Not a pseudo column
cp->Blk = AllocValBlock(g, (void*)1, cp->Buf_Type, Nrec,
cp->Format.Length, cp->Format.Prec);
cp->Format.Length, cp->Format.Prec,
true, true, cp->IsUnsigned());
cp->AddStatus(BUF_MAPPED);
} // endif IsSpecial
@ -3664,7 +3669,7 @@ bool BGVFAM::AllocateBuffer(PGLOBAL g)
for (; cp; cp = (PVCTCOL)cp->Next)
cp->Blk = AllocValBlock(g, NewBlock + Nrec * cp->Deplac,
cp->Buf_Type, Nrec, cp->Format.Length,
cp->Format.Prec, chk);
cp->Format.Prec, chk, true, cp->IsUnsigned());
InitInsert(g); // Initialize inserting
@ -3712,7 +3717,8 @@ bool BGVFAM::AllocateBuffer(PGLOBAL g)
for (; cp; cp = (PVCTCOL)cp->Next)
if (!cp->IsSpecial()) // Not a pseudo column
cp->Blk = AllocValBlock(g, NULL, cp->Buf_Type, Nrec,
cp->Format.Length, cp->Format.Prec);
cp->Format.Length, cp->Format.Prec,
true, true, cp->IsUnsigned());
} //endif mode

View File

@ -1,7 +1,7 @@
/***********************************************************************/
/* GLOBAL.H: Declaration file used by all CONNECT implementations. */
/* (C) Copyright MariaDB Corporation Ab */
/* Author Olivier Bertrand 1993-2017 */
/* Author Olivier Bertrand 1993-2018 */
/***********************************************************************/
/***********************************************************************/
@ -192,7 +192,7 @@ typedef struct _global { /* Global structure */
PACTIVITY Activityp;
char Message[MAX_STR];
ulong More; /* Used by jsonudf */
int Createas; /* To pass info to created table */
int Createas; /* To pass multi to ext tables */
void *Xchk; /* indexes in create/alter */
short Alchecked; /* Checked for ALTER */
short Mrr; /* True when doing mrr */

View File

@ -107,13 +107,9 @@
#define MYSQL_SERVER 1
#define DONT_DEFINE_VOID
#include "sql_class.h"
#include "create_options.h"
#include "mysql_com.h"
#include "field.h"
#include <my_global.h>
#include "sql_parse.h"
#include "sql_base.h"
#include <sys/stat.h>
#include "sql_partition.h"
#undef OFFSET
@ -174,9 +170,9 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
char version[]= "Version 1.06.0007 March 11, 2018";
char version[]= "Version 1.06.0008 October 06, 2018";
#if defined(__WIN__)
char compver[]= "Version 1.06.0007 " __DATE__ " " __TIME__;
char compver[]= "Version 1.06.0008 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !__WIN__
char slash= '/';
@ -2813,7 +2809,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
htrc("Cond type=%d\n", cond->type());
if (cond->type() == COND::COND_ITEM) {
char *pb0, *pb1, *pb2, *ph0, *ph1, *ph2;
char *pb0, *pb1, *pb2, *ph0= 0, *ph1= 0, *ph2= 0;
bool bb = false, bh = false;
Item_cond *cond_item= (Item_cond *)cond;
@ -3294,6 +3290,58 @@ ha_rows ha_connect::records()
} // end of records
int ha_connect::check(THD* thd, HA_CHECK_OPT* check_opt)
{
int rc = HA_ADMIN_OK;
PGLOBAL g = ((table && table->in_use) ? GetPlug(table->in_use, xp) :
(xp) ? xp->g : NULL);
DBUG_ENTER("ha_connect::check");
if (!g || !table || xmod != MODE_READ)
DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR);
// Do not close the table if it was opened yet (possible?)
if (IsOpened()) {
if (IsPartitioned() && CheckColumnList(g)) // map can have been changed
rc = HA_ADMIN_CORRUPT;
else if (tdbp->OpenDB(g)) // Rewind table
rc = HA_ADMIN_CORRUPT;
} else if (xp->CheckQuery(valid_query_id)) {
tdbp = NULL; // Not valid anymore
if (OpenTable(g, false))
rc = HA_ADMIN_CORRUPT;
} else // possible?
DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR);
if (rc == HA_ADMIN_OK) {
TABTYPE type = GetTypeID(GetStringOption("Type", "*"));
if (IsFileType(type)) {
if (check_opt->flags & T_MEDIUM) {
// TO DO
do {
if ((rc = CntReadNext(g, tdbp)) == RC_FX)
break;
} while (rc != RC_EF);
rc = (rc == RC_EF) ? HA_ADMIN_OK : HA_ADMIN_CORRUPT;
} else if (check_opt->flags & T_EXTEND) {
// TO DO
} // endif's flags
} // endif file type
} else
PushWarning(g, thd, 1);
DBUG_RETURN(rc);
} // end of check
/**
Return an error message specific to this handler.
@ -3308,22 +3356,15 @@ bool ha_connect::get_error_message(int error, String* buf)
DBUG_ENTER("ha_connect::get_error_message");
if (xp && xp->g) {
PGLOBAL g= xp->g;
char msg[3072]; // MAX_STR * 3
uint dummy_errors;
uint32 len= copy_and_convert(msg, strlen(g->Message) * 3,
system_charset_info,
g->Message, strlen(g->Message),
&my_charset_latin1,
&dummy_errors);
PGLOBAL g = xp->g;
if (trace(1))
htrc("GEM(%d): len=%u %s\n", error, len, g->Message);
htrc("GEM(%d): %s\n", error, g->Message);
msg[len]= '\0';
buf->copy(msg, (uint)strlen(msg), system_charset_info);
buf->append(ErrConvString(g->Message, strlen(g->Message),
&my_charset_latin1).ptr());
} else
buf->copy("Cannot retrieve msg", 19, system_charset_info);
buf->append("Cannot retrieve error message");
DBUG_RETURN(false);
} // end of get_error_message
@ -3436,7 +3477,7 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
rc = 0;
} else
rc = HA_ERR_INTERNAL_ERROR;
rc = HA_ERR_CRASHED_ON_USAGE; // Table must be repaired
} // endif rc
@ -3452,6 +3493,9 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*)
rc = HA_ERR_INTERNAL_ERROR;
} // end catch
if (rc)
my_message(ER_WARN_DATA_OUT_OF_RANGE, g->Message, MYF(0));
return rc;
} // end of optimize
@ -4513,13 +4557,15 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
// case SQLCOM_REPLACE_SELECT:
// newmode= MODE_UPDATE; // To be checked
// break;
case SQLCOM_DELETE:
case SQLCOM_DELETE_MULTI:
*cras = true;
case SQLCOM_DELETE:
case SQLCOM_TRUNCATE:
newmode= MODE_DELETE;
break;
case SQLCOM_UPDATE:
case SQLCOM_UPDATE_MULTI:
*cras = true;
case SQLCOM_UPDATE:
newmode= MODE_UPDATE;
break;
case SQLCOM_SELECT:
@ -4545,7 +4591,9 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
newmode= MODE_ANY;
break;
// } // endif partitioned
case SQLCOM_REPAIR: // TODO implement it
newmode = MODE_UPDATE;
break;
default:
htrc("Unsupported sql_command=%d\n", thd_sql_command(thd));
strcpy(g->Message, "CONNECT Unsupported command");
@ -4558,6 +4606,9 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
switch (thd_sql_command(thd)) {
case SQLCOM_CREATE_TABLE:
*chk= true;
break;
case SQLCOM_UPDATE_MULTI:
case SQLCOM_DELETE_MULTI:
*cras= true;
case SQLCOM_INSERT:
case SQLCOM_LOAD:
@ -4565,10 +4616,8 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
// case SQLCOM_REPLACE:
// case SQLCOM_REPLACE_SELECT:
case SQLCOM_DELETE:
case SQLCOM_DELETE_MULTI:
case SQLCOM_TRUNCATE:
case SQLCOM_UPDATE:
case SQLCOM_UPDATE_MULTI:
case SQLCOM_SELECT:
case SQLCOM_OPTIMIZE:
case SQLCOM_SET_OPTION:
@ -4597,6 +4646,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
// } // endif partitioned
case SQLCOM_CHECK: // TODO implement it
case SQLCOM_ANALYZE: // TODO implement it
case SQLCOM_END: // Met in procedures: IF(EXISTS(SELECT...
newmode= MODE_READ;
break;
@ -4879,7 +4929,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
#endif // 0
if (cras)
g->Createas= 1; // To tell created table to ignore FLAG
g->Createas= 1; // To tell external tables of a multi-table command
if (trace(1)) {
#if 0
@ -5570,7 +5620,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
} // endif p
} else if (ttp != TAB_ODBC || !(fnc & (FNC_TABLE | FNC_COL)))
tab = table_s->table_name.str; // Default value
tab = (char*)table_s->table_name.str; // Default value
} // endif tab
@ -6202,9 +6252,9 @@ int ha_connect::create(const char *name, TABLE *table_arg,
LEX_STRING cnc = table_arg->s->connect_string;
#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *part_info= table_arg->part_info;
#else
#else // !WITH_PARTITION_STORAGE_ENGINE
#define part_info 0
#endif // WITH_PARTITION_STORAGE_ENGINE
#endif // !WITH_PARTITION_STORAGE_ENGINE
xp= GetUser(thd, xp);
PGLOBAL g= xp->g;
@ -7260,7 +7310,7 @@ maria_declare_plugin(connect)
0x0107, /* version number (1.05) */
NULL, /* status variables */
connect_system_variables, /* system variables */
"1.06.0007", /* string version */
"1.06.0008", /* string version */
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
}
maria_declare_plugin_end;

View File

@ -347,11 +347,7 @@ PFIL CondFilter(PGLOBAL g, Item *cond);
//PFIL CheckFilter(PGLOBAL g);
/** admin commands - called from mysql_admin_table */
virtual int check(THD* thd, HA_CHECK_OPT* check_opt)
{
// TODO: implement it
return HA_ADMIN_OK; // Just to avoid error message with checktables
} // end of check
virtual int check(THD* thd, HA_CHECK_OPT* check_opt);
/**
Number of rows in table. It will only be called if

View File

@ -81,29 +81,6 @@ GETDEF JAVAConn::GetDefaultJavaVMInitArgs = NULL;
#define DEBUG_ONLY(f) ((void)0)
#endif // !_DEBUG
/***********************************************************************/
/* Allocate the structure used to refer to the result set. */
/***********************************************************************/
static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, PCSZ db,
PCSZ tab, PQRYRES qrp)
{
JCATPARM *cap;
#if defined(_DEBUG)
assert(qrp);
#endif
if ((cap = (JCATPARM *)PlgDBSubAlloc(g, NULL, sizeof(JCATPARM)))) {
memset(cap, 0, sizeof(JCATPARM));
cap->Id = fid;
cap->Qrp = qrp;
cap->DB = db;
cap->Tab = tab;
} // endif cap
return cap;
} // end of AllocCatInfo
/***********************************************************************/
/* JAVAConn construction/destruction. */
/***********************************************************************/
@ -138,6 +115,16 @@ JAVAConn::JAVAConn(PGLOBAL g, PCSZ wrapper)
// EndCom();
// } // end of ~JAVAConn
char *JAVAConn::GetUTFString(jstring s)
{
char *str;
const char *utf = env->GetStringUTFChars(s, nullptr);
str = PlugDup(m_G, utf);
env->ReleaseStringUTFChars(s, utf);
env->DeleteLocalRef(s);
return str;
} // end of GetUTFString
/***********************************************************************/
/* Screen for errors. */
@ -152,17 +139,15 @@ bool JAVAConn::Check(jint rc)
"toString", "()Ljava/lang/String;");
if (exc != nullptr && tid != nullptr) {
jstring s = (jstring)env->CallObjectMethod(exc, tid);
const char *utf = env->GetStringUTFChars(s, NULL);
env->DeleteLocalRef(s);
Msg = PlugDup(m_G, utf);
s = (jstring)env->CallObjectMethod(exc, tid);
Msg = GetUTFString(s);
} else
Msg = "Exception occured";
env->ExceptionClear();
} else if (rc < 0) {
s = (jstring)env->CallObjectMethod(job, errid);
Msg = (char*)env->GetStringUTFChars(s, NULL);
Msg = GetUTFString(s);
} else
Msg = NULL;

View File

@ -90,6 +90,7 @@ public:
// Java operations
protected:
char *GetUTFString(jstring s);
bool gmID(PGLOBAL g, jmethodID& mid, const char *name, const char *sig);
bool Check(jint rc = 0);

View File

@ -314,10 +314,6 @@ static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, PCSZ db,
{
JCATPARM *cap;
#if defined(_DEBUG)
assert(qrp);
#endif
if ((cap = (JCATPARM *)PlgDBSubAlloc(g, NULL, sizeof(JCATPARM)))) {
memset(cap, 0, sizeof(JCATPARM));
cap->Id = fid;
@ -699,20 +695,13 @@ bool JDBConn::SetUUID(PGLOBAL g, PTDBJDBC tjp)
goto err;
} // endif rc
// Returns 666 is case of error
//jtyp = env->CallIntMethod(job, typid, 5, nullptr);
//if (Check((jtyp == 666) ? -1 : 1)) {
// sprintf(g->Message, "Getting jtyp: %s", Msg);
// goto err;
//} // endif ctyp
// Should return 666 is case of error (not done yet)
ctyp = (int)env->CallIntMethod(job, intfldid, 5, nullptr);
if (Check(ctyp)) {
sprintf(g->Message, "Getting ctyp: %s", Msg);
goto err;
} // endif ctyp
//if (Check((ctyp == 666) ? -1 : 1)) {
// sprintf(g->Message, "Getting ctyp: %s", Msg);
// goto err;
//} // endif ctyp
if (ctyp == 1111)
((PJDBCCOL)colp)->uuid = true;
@ -828,11 +817,11 @@ bool JDBConn::Connect(PJPARM sop)
jstring s = (jstring)env->CallObjectMethod(job, qcid);
if (s != nullptr) {
char *qch = (char*)env->GetStringUTFChars(s, NULL);
char *qch = GetUTFString(s);
m_IDQuoteChar[0] = *qch;
} else {
s = (jstring)env->CallObjectMethod(job, errid);
Msg = (char*)env->GetStringUTFChars(s, NULL);
Msg = GetUTFString(s);
} // endif s
} // endif qcid
@ -1010,7 +999,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
cn = nullptr;
if (cn) {
field = env->GetStringUTFChars(cn, NULL);
field = GetUTFString(cn);
val->SetValue_psz((PSZ)field);
} else
val->Reset();
@ -1084,8 +1073,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
cn = nullptr;
if (cn) {
const char *field = env->GetStringUTFChars(cn, NULL);
val->SetValue_psz((PSZ)field);
val->SetValue_psz((PSZ)GetUTFString(cn));
} else
val->Reset();
@ -1364,19 +1352,19 @@ bool JDBConn::SetParam(JDBCCOL *colp)
for (i = 0, n = 0; i < size; i++) {
crp = qrp->Colresp;
js = (jstring)env->GetObjectArrayElement(s, n++);
sval = (PSZ)env->GetStringUTFChars(js, 0);
sval = GetUTFString(js);
crp->Kdata->SetValue(sval, i);
crp = crp->Next;
js = (jstring)env->GetObjectArrayElement(s, n++);
sval = (PSZ)env->GetStringUTFChars(js, 0);
sval = GetUTFString(js);
crp->Kdata->SetValue(sval, i);
crp = crp->Next;
js = (jstring)env->GetObjectArrayElement(s, n++);
sval = (PSZ)env->GetStringUTFChars(js, 0);
sval = GetUTFString(js);
crp->Kdata->SetValue(sval, i);
crp = crp->Next;
js = (jstring)env->GetObjectArrayElement(s, n++);
sval = (PSZ)env->GetStringUTFChars(js, 0);
sval = GetUTFString(js);
crp->Kdata->SetValue(sval, i);
} // endfor i
@ -1462,7 +1450,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
return NULL;
} // endif label
name = env->GetStringUTFChars(label, NULL);
name = GetUTFString(label);
crp = qrp->Colresp; // Column_Name
crp->Kdata->SetValue((char*)name, i);
n = env->GetIntArrayElements(val, 0);

View File

@ -522,7 +522,7 @@ PSZ JMgoConn::GetDocument(void)
jdc = (jstring)env->CallObjectMethod(job, getdocid);
if (jdc)
doc = (PSZ)env->GetStringUTFChars(jdc, NULL);
doc = (PSZ)GetUTFString(jdc);
} // endif getdocid
@ -807,7 +807,7 @@ PSZ JMgoConn::GetColumnValue(PSZ path)
fn = (jstring)env->CallObjectMethod(job, objfldid, jn);
if (fn)
fld = (PSZ)env->GetStringUTFChars(fn, NULL);
fld = (PSZ)GetUTFString(fn);
} // endif objfldid

View File

@ -44,6 +44,9 @@ typedef struct {
int len;
} STRG, *PSG;
char *NextChr(PSZ s, char sep);
char *GetJsonNull(void);
PJSON ParseJson(PGLOBAL g, char *s, int n, int *prty = NULL, bool *b = NULL);
PJAR ParseArray(PGLOBAL g, int& i, STRG& src, bool *pty);
PJOB ParseObject(PGLOBAL g, int& i, STRG& src, bool *pty);

View File

@ -1620,7 +1620,7 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n,
if (AllocSarea(g, ml)) {
char errmsg[MAX_STR];
snprintf(errmsg, sizeof(errmsg)-1, MSG(WORK_AREA), g->Message);
snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
return true;
} // endif SareaAlloc
@ -1673,7 +1673,7 @@ static PCSZ MakeKey(PGLOBAL g, UDF_ARGS *args, int i)
n = strlen(s);
if (IsJson(args, i))
j = strchr(s, '_') - s + 1;
j = (int)(strchr(s, '_') - s + 1);
if (j && n > j) {
s += j;
@ -4631,7 +4631,7 @@ char *jbin_array(UDF_INIT *initid, UDF_ARGS *args, char *result,
bsp = NULL;
if (!bsp && (bsp = JbinAlloc(g, args, initid->max_length, NULL)))
strncpy(bsp->Msg, g->Message, 139);
strncpy(bsp->Msg, g->Message, BMX);
// Keep result of constant function
g->Xchk = (initid->const_item) ? bsp : NULL;

View File

@ -18,7 +18,7 @@
/* ------------- */
/* Version 1.6 */
/* */
/* Author: Olivier Bertrand 2012 - 2017 */
/* Author: Olivier Bertrand 2012 - 2018 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@ -28,20 +28,13 @@
/***********************************************************************/
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include <my_config.h>
#define DONT_DEFINE_VOID
#include <my_global.h>
#if defined(__WIN__)
//#include <windows.h>
//#include <sqlext.h>
#elif defined(UNIX)
#include <sys/types.h>
#if defined(UNIX)
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#endif
#define DONT_DEFINE_VOID
//#include <mysql/plugin.h>
#include "handler.h"
#undef OFFSET

View File

@ -9,6 +9,7 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
infoschema-9739 : Crashes with MariaDB 10.0
jdbc : Variable settings depend on machine configuration
jdbc_new : Variable settings depend on machine configuration
jdbc_oracle : Variable settings depend on machine configuration

View File

@ -238,8 +238,7 @@ DROP TABLE t1, connect.emp;
CREATE TABLE t2 (command varchar(128) not null,number int(5) not null flag=1,message varchar(255) flag=2) ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mariadb://localhost:PORT/connect' OPTION_LIST='User=root,Execsrc=1';
SELECT * FROM t2 WHERE command='drop table tx1';
command number message
drop table tx1 0 Execute: java.sql.SQLSyntaxErrorException: Unknown table 'connect.tx1'
Query is : drop table tx1
drop table tx1 0 Execute: java.sql.SQLSyntaxErrorException: (conn:23) Unknown table 'connect.tx1'
SELECT * FROM t2 WHERE command = 'create table tx1 (a int not null, b char(32), c double(8,2))';
command number message
create table tx1 (a int not null, b char(32), c double(8,2)) 0 Affected rows

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