Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3
This commit is contained in:
commit
ab96710bb7
@ -66,7 +66,7 @@ ENDMACRO()
|
||||
# FIXME until we have a --cxxflags, we need to remove -AC99
|
||||
# to make --cflags usable for HP C++ (aCC)
|
||||
REPLACE_FOR_CLIENTS(CFLAGS "[DU]DBUG_OFF" "[DU]SAFE_MUTEX" "[DU]NDEBUG"
|
||||
"[DU]UNIV_MUST_NOT_INLINE" "[DU]FORCE_INIT_OF_VARS" "[DU]EXTRA_DEBUG" "[DU]HAVE_valgrind"
|
||||
"[DU]FORCE_INIT_OF_VARS" "[DU]EXTRA_DEBUG" "[DU]HAVE_valgrind"
|
||||
"O" "O[0-9]" "xO[0-9]" "W[-A-Za-z]*" "mtune=[-A-Za-z0-9]*" "g" "fPIC"
|
||||
"mcpu=[-A-Za-z0-9]*" "unroll2" "ip" "mp" "march=[-A-Za-z0-9]*" "Xa"
|
||||
"xstrconst" "xc99=none" "AC99" "restrict" "W[-A-Za-z]*=[-A-Za-z0-9]*")
|
||||
|
@ -119,55 +119,19 @@ MACRO (MYSQL_CHECK_SSL)
|
||||
WITH_SSL STREQUAL "yes" OR
|
||||
WITH_SSL_PATH
|
||||
)
|
||||
# First search in WITH_SSL_PATH.
|
||||
FIND_PATH(OPENSSL_ROOT_DIR
|
||||
NAMES include/openssl/ssl.h
|
||||
NO_CMAKE_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
HINTS ${WITH_SSL_PATH}
|
||||
)
|
||||
# Then search in standard places (if not found above).
|
||||
FIND_PATH(OPENSSL_ROOT_DIR
|
||||
NAMES include/openssl/ssl.h
|
||||
)
|
||||
|
||||
FIND_PATH(OPENSSL_INCLUDE_DIR
|
||||
NAMES openssl/ssl.h
|
||||
HINTS ${OPENSSL_ROOT_DIR}/include
|
||||
)
|
||||
|
||||
IF (WIN32)
|
||||
FIND_FILE(OPENSSL_APPLINK_C
|
||||
NAMES openssl/applink.c
|
||||
HINTS ${OPENSSL_ROOT_DIR}/include
|
||||
)
|
||||
MESSAGE_ONCE(OPENSSL_APPLINK_C "OPENSSL_APPLINK_C ${OPENSSL_APPLINK_C}")
|
||||
IF(NOT OPENSSL_ROOT_DIR)
|
||||
IF(WITH_SSL_PATH)
|
||||
SET(OPENSSL_ROOT_DIR ${WITH_SSL_PATH})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# On mac this list is <.dylib;.so;.a>
|
||||
# We prefer static libraries, so we revert it here.
|
||||
IF (WITH_SSL_PATH)
|
||||
LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
ENDIF()
|
||||
FIND_LIBRARY(OPENSSL_SSL_LIBRARY
|
||||
NAMES ssl ssleay32 ssleay32MD
|
||||
HINTS ${OPENSSL_ROOT_DIR}/lib)
|
||||
FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY
|
||||
NAMES crypto libeay32
|
||||
HINTS ${OPENSSL_ROOT_DIR}/lib)
|
||||
MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY OPENSSL_ROOT_DIR
|
||||
OPENSSL_INCLUDE_DIR)
|
||||
IF (WITH_SSL_PATH)
|
||||
LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(CheckSymbolExists)
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||
CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
|
||||
HAVE_SHA512_DIGEST_LENGTH)
|
||||
SET(CMAKE_REQUIRED_INCLUDES)
|
||||
IF(OPENSSL_INCLUDE_DIR AND OPENSSL_SSL_LIBRARY AND
|
||||
OPENSSL_CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH)
|
||||
FIND_PACKAGE(OpenSSL)
|
||||
IF(OPENSSL_FOUND)
|
||||
SET(OPENSSL_LIBRARY ${OPENSSL_SSL_LIBRARY})
|
||||
INCLUDE(CheckSymbolExists)
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||
CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
|
||||
HAVE_SHA512_DIGEST_LENGTH)
|
||||
SET(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(SSL_SOURCES "")
|
||||
SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||
@ -177,16 +141,6 @@ MACRO (MYSQL_CHECK_SSL)
|
||||
SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBDL})
|
||||
ENDIF()
|
||||
|
||||
# Verify version number. Version information looks like:
|
||||
# #define OPENSSL_VERSION_NUMBER 0x1000103fL
|
||||
# Encoded as MNNFFPPS: major minor fix patch status
|
||||
FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h"
|
||||
OPENSSL_VERSION_TEXT
|
||||
REGEX "^# *define[\t ]+OPENSSL_VERSION_TEXT[\t ]+")
|
||||
STRING(REGEX REPLACE
|
||||
"^.*OPENSSL_VERSION_TEXT[\t ]+\"OpenSSL ([-0-9a-z.]+).*$" "\\1"
|
||||
OPENSSL_VERSION "${OPENSSL_VERSION_TEXT}")
|
||||
|
||||
MESSAGE_ONCE(OPENSSL_INCLUDE_DIR "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}")
|
||||
MESSAGE_ONCE(OPENSSL_SSL_LIBRARY "OPENSSL_SSL_LIBRARY = ${OPENSSL_SSL_LIBRARY}")
|
||||
MESSAGE_ONCE(OPENSSL_CRYPTO_LIBRARY "OPENSSL_CRYPTO_LIBRARY = ${OPENSSL_CRYPTO_LIBRARY}")
|
||||
|
@ -60,12 +60,6 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
|
||||
#include "ut0byte.h"
|
||||
#include "mach0data.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
# include "fsp0fsp.ic"
|
||||
# include "mach0data.ic"
|
||||
# include "ut0rnd.ic"
|
||||
#endif
|
||||
|
||||
#ifndef PRIuMAX
|
||||
#define PRIuMAX "llu"
|
||||
#endif
|
||||
|
@ -203,6 +203,7 @@ typedef struct st_json_engine_t
|
||||
enum json_value_types value_type; /* type of the value.*/
|
||||
const uchar *value; /* Points to the value. */
|
||||
const uchar *value_begin;/* Points to where the value starts in the JSON. */
|
||||
int value_escaped; /* Flag telling if the string value has escaping.*/
|
||||
uint num_flags; /* the details of the JSON_VALUE_NUMBER, is it negative,
|
||||
or if it has the fractional part.
|
||||
See the enum json_num_flags. */
|
||||
|
@ -111,7 +111,7 @@ enum enum_server_command
|
||||
COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,
|
||||
COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE,
|
||||
COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON,
|
||||
COM_UNIMPLEMENTED, // COM_BINLOG_DUMP_GTID in MySQL
|
||||
COM_UNIMPLEMENTED, /* COM_BINLOG_DUMP_GTID in MySQL */
|
||||
COM_RESET_CONNECTION,
|
||||
/* don't forget to update const char *command_name[] in sql_parse.cc */
|
||||
COM_MDB_GAP_BEG,
|
||||
@ -311,8 +311,7 @@ enum enum_indicator_type
|
||||
CLIENT_SESSION_TRACK |\
|
||||
CLIENT_DEPRECATE_EOF |\
|
||||
CLIENT_CONNECT_ATTRS |\
|
||||
MARIADB_CLIENT_COM_MULTI |\
|
||||
MARIADB_CLIENT_STMT_BULK_OPERATIONS)
|
||||
MARIADB_CLIENT_COM_MULTI)
|
||||
|
||||
/*
|
||||
To be added later:
|
||||
|
@ -4419,7 +4419,6 @@ sub extract_warning_lines ($$) {
|
||||
qr|InnoDB: TABLE to scan your table for corruption|,
|
||||
qr/InnoDB: See also */,
|
||||
qr/InnoDB: Cannot open .*ib_buffer_pool.* for reading: No such file or directory*/,
|
||||
qr|InnoDB: Creating foreign key constraint system tables.|,
|
||||
qr/InnoDB: Table .*mysql.*innodb_table_stats.* not found./,
|
||||
qr/InnoDB: User stopword table .* does not exist./
|
||||
|
||||
|
10
mysql-test/r/analyze_debug.result
Normal file
10
mysql-test/r/analyze_debug.result
Normal file
@ -0,0 +1,10 @@
|
||||
SET @save_use_stat_tables= @@use_stat_tables;
|
||||
SET use_stat_tables= PREFERABLY;
|
||||
CREATE TABLE t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
SET STATEMENT debug_dbug="d,fail_2call_open_only_one_table" for
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Operation failed
|
||||
drop table t1;
|
||||
SET use_stat_tables= @save_use_stat_tables;
|
@ -1080,5 +1080,21 @@ f
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-11363: Assertion `!derived->first_sel ect()->first_inner_unit() ||
|
||||
# derived->first_select()->first_inner_unit()->first_select()->
|
||||
# exclude_from_table_unique_test' failed in
|
||||
# TABLE_LIST::set_check_materialized()
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
CREATE TABLE t2 (f2 INT);
|
||||
CREATE TABLE t3 (f3 INT);
|
||||
CREATE VIEW v1 AS ( SELECT f1 AS f FROM t1 ) UNION ( SELECT f2 AS f FROM t2 );
|
||||
CREATE VIEW v2 AS SELECT f3 AS f FROM t3;
|
||||
CREATE VIEW v3 AS SELECT f FROM ( SELECT f3 AS f FROM v1, t3 ) AS sq;
|
||||
CREATE VIEW v4 AS SELECT COUNT(*) as f FROM v3;
|
||||
REPLACE INTO v2 ( SELECT * FROM v4 ) UNION ( SELECT f FROM v2 );
|
||||
drop view v1,v2,v3,v4;
|
||||
drop table t1,t2,t3;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
@ -589,3 +589,43 @@ json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
|
||||
"bb": "v2"
|
||||
}
|
||||
}
|
||||
SELECT JSON_search( '{"x": "\\""}', "one", '"');
|
||||
JSON_search( '{"x": "\\""}', "one", '"')
|
||||
"$.x"
|
||||
SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
|
||||
JSON_search( '{"x": "\\""}', "one", '\\"')
|
||||
"$.x"
|
||||
set @@global.net_buffer_length=1024;
|
||||
set @@global.max_allowed_packet=2048;
|
||||
connect newconn, localhost, root,,;
|
||||
show variables like 'net_buffer_length';
|
||||
Variable_name Value
|
||||
net_buffer_length 1024
|
||||
show variables like 'max_allowed_packet';
|
||||
Variable_name Value
|
||||
max_allowed_packet 2048
|
||||
select json_array(repeat('a',1024),repeat('a',1024));
|
||||
json_array(repeat('a',1024),repeat('a',1024))
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1301 Result of json_array() was larger than max_allowed_packet (2048) - truncated
|
||||
select json_object("a", repeat('a',1024),"b", repeat('a',1024));
|
||||
json_object("a", repeat('a',1024),"b", repeat('a',1024))
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1301 Result of json_object() was larger than max_allowed_packet (2048) - truncated
|
||||
connection default;
|
||||
set @@global.max_allowed_packet = default;
|
||||
set @@global.net_buffer_length = default;
|
||||
disconnect newconn;
|
||||
create table t1(j longtext, p longtext);
|
||||
insert into t1 values
|
||||
('{"a":1,"b":2,"c":3}','$.a'),
|
||||
('{"a":1,"b":2,"c":3}','$.b'),
|
||||
('{"a":1,"b":2,"c":3}','$.c');
|
||||
select j, p, json_remove(j, p) from t1;
|
||||
j p json_remove(j, p)
|
||||
{"a":1,"b":2,"c":3} $.a {"b": 2, "c": 3}
|
||||
{"a":1,"b":2,"c":3} $.b {"a": 1, "c": 3}
|
||||
{"a":1,"b":2,"c":3} $.c {"a": 1, "b": 2}
|
||||
drop table t1;
|
||||
|
@ -60,3 +60,25 @@ fid AsText(g)
|
||||
45 LINESTRING(51 51,60 60)
|
||||
DROP TABLE t1;
|
||||
End of 5.5 tests.
|
||||
CREATE TABLE t1 (
|
||||
coordinate point NOT NULL,
|
||||
SPATIAL KEY coordinate (coordinate)
|
||||
) ENGINE=Aria DEFAULT CHARSET=ascii PAGE_CHECKSUM=1;
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
coordinate point NO MUL NULL
|
||||
INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(0 0)"));
|
||||
INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(10 0)"));
|
||||
INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(10 10)"));
|
||||
INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(0 10)"));
|
||||
INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(5 5)"));
|
||||
SELECT astext(coordinate) FROM t1 WHERE ST_Intersects(ST_LineFromText("LINESTRING(0 0, 10 0, 10 10, 0 10)"), coordinate);
|
||||
astext(coordinate)
|
||||
POINT(0 0)
|
||||
POINT(10 0)
|
||||
POINT(10 10)
|
||||
POINT(0 10)
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
coordinate point NO MUL NULL
|
||||
DROP TABLE t1;
|
||||
|
@ -3749,5 +3749,34 @@ ERROR HY000: Illegal parameter data type geometry for operation 'ceiling'
|
||||
SELECT FLOOR(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'floor'
|
||||
#
|
||||
# MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec()
|
||||
#
|
||||
CREATE TABLE t1 (a GEOMETRY);
|
||||
SELECT SUM(POINT(1,1)) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'sum'
|
||||
SELECT SUM(a) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'sum'
|
||||
SELECT SUM(COALESCE(a)) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'sum'
|
||||
SELECT AVG(POINT(1,1)) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
|
||||
SELECT AVG(a) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
|
||||
SELECT AVG(COALESCE(a)) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
|
||||
SELECT VARIANCE(POINT(1,1)) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'variance('
|
||||
SELECT VARIANCE(a) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'variance('
|
||||
SELECT VARIANCE(COALESCE(a)) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'variance('
|
||||
SELECT STDDEV(POINT(1,1)) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'std('
|
||||
SELECT STDDEV(a) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'std('
|
||||
SELECT STDDEV(COALESCE(a)) FROM t1;
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'std('
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -2136,6 +2136,38 @@ Qcache_hits 1
|
||||
use test;
|
||||
drop database `foo.bar`;
|
||||
End of 10.0 tests
|
||||
#
|
||||
# MDEV-10766 Queries which start with WITH clause do not get
|
||||
# inserted into query cache
|
||||
#
|
||||
flush status;
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 0
|
||||
create table t1 (i int);
|
||||
with cte as (select * from t1) select * from cte;
|
||||
i
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
with cte as (select * from t1) select * from cte;
|
||||
i
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
drop table t1;
|
||||
restore defaults
|
||||
SET GLOBAL query_cache_type= default;
|
||||
SET GLOBAL query_cache_size= default;
|
||||
|
@ -5263,9 +5263,7 @@ UNION ALL
|
||||
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
|
||||
AS foo
|
||||
;
|
||||
coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
|
||||
0.0000
|
||||
0.0000
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
|
||||
CREATE table t1(a text);
|
||||
INSERT INTO t1 VALUES (''), ('');
|
||||
SELECT avg(distinct(t1.a)) FROM t1, t1 t2
|
||||
|
@ -5274,9 +5274,7 @@ UNION ALL
|
||||
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
|
||||
AS foo
|
||||
;
|
||||
coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
|
||||
0.0000
|
||||
0.0000
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
|
||||
CREATE table t1(a text);
|
||||
INSERT INTO t1 VALUES (''), ('');
|
||||
SELECT avg(distinct(t1.a)) FROM t1, t1 t2
|
||||
|
@ -5263,9 +5263,7 @@ UNION ALL
|
||||
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
|
||||
AS foo
|
||||
;
|
||||
coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
|
||||
0.0000
|
||||
0.0000
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
|
||||
CREATE table t1(a text);
|
||||
INSERT INTO t1 VALUES (''), ('');
|
||||
SELECT avg(distinct(t1.a)) FROM t1, t1 t2
|
||||
|
@ -1,4 +1,3 @@
|
||||
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
|
||||
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
|
||||
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
|
||||
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
|
||||
|
@ -1,5 +1,2 @@
|
||||
call mtr.add_suppression("InnoDB: New log files created, LSN");
|
||||
call mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
|
||||
shutdown;
|
||||
create table t1 (a int);
|
||||
drop table t1;
|
||||
|
@ -5,8 +5,6 @@
|
||||
--source include/have_innodb_32k.inc
|
||||
--source include/have_file_key_management_plugin.inc
|
||||
|
||||
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
|
||||
|
||||
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
|
||||
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
|
@ -5,25 +5,14 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_file_key_management_plugin.inc
|
||||
|
||||
call mtr.add_suppression("InnoDB: New log files created, LSN");
|
||||
call mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
|
||||
|
||||
let datadir=`select @@datadir`;
|
||||
|
||||
--exec echo wait > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
|
||||
shutdown;
|
||||
|
||||
--source include/wait_until_disconnected.inc
|
||||
let $datadir=`select @@datadir`;
|
||||
--source include/shutdown_mysqld.inc
|
||||
|
||||
--remove_file $datadir/ib_logfile0
|
||||
--remove_file $datadir/ib_logfile1
|
||||
--remove_file $datadir/ibdata1
|
||||
|
||||
--exec echo restart > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
create table t1 (a int);
|
||||
|
||||
|
@ -16,8 +16,6 @@ DROP USER sst;
|
||||
--connection node_2
|
||||
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
|
||||
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
|
||||
CALL mtr.add_suppression("InnoDB: New log files created");
|
||||
CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
|
||||
CALL mtr.add_suppression("Can't open and lock time zone table");
|
||||
CALL mtr.add_suppression("Can't open and lock privilege tables");
|
||||
CALL mtr.add_suppression("Info table is not ready to be used");
|
||||
|
@ -277,8 +277,6 @@ CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the
|
||||
DROP USER sst;
|
||||
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
|
||||
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
|
||||
CALL mtr.add_suppression("InnoDB: New log files created");
|
||||
CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
|
||||
CALL mtr.add_suppression("Can't open and lock time zone table");
|
||||
CALL mtr.add_suppression("Can't open and lock privilege tables");
|
||||
CALL mtr.add_suppression("Info table is not ready to be used");
|
||||
|
@ -452,8 +452,6 @@ CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the
|
||||
DROP USER sst;
|
||||
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
|
||||
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
|
||||
CALL mtr.add_suppression("InnoDB: New log files created");
|
||||
CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
|
||||
CALL mtr.add_suppression("Can't open and lock time zone table");
|
||||
CALL mtr.add_suppression("Can't open and lock privilege tables");
|
||||
CALL mtr.add_suppression("Info table is not ready to be used");
|
||||
|
@ -98,8 +98,6 @@ CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the
|
||||
DROP USER sst;
|
||||
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
|
||||
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
|
||||
CALL mtr.add_suppression("InnoDB: New log files created");
|
||||
CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
|
||||
CALL mtr.add_suppression("Can't open and lock time zone table");
|
||||
CALL mtr.add_suppression("Can't open and lock privilege tables");
|
||||
CALL mtr.add_suppression("Info table is not ready to be used");
|
||||
|
@ -94,8 +94,6 @@ CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the
|
||||
DROP USER sst;
|
||||
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
|
||||
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
|
||||
CALL mtr.add_suppression("InnoDB: New log files created");
|
||||
CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
|
||||
CALL mtr.add_suppression("Can't open and lock time zone table");
|
||||
CALL mtr.add_suppression("Can't open and lock privilege tables");
|
||||
CALL mtr.add_suppression("Info table is not ready to be used");
|
||||
|
@ -6,26 +6,16 @@
|
||||
source include/not_embedded.inc;
|
||||
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("InnoDB: New log files created");
|
||||
call mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
|
||||
|
||||
let $innodb_index_stats = query_get_value(show create table mysql.innodb_index_stats, Create Table, 1);
|
||||
let $innodb_table_stats = query_get_value(show create table mysql.innodb_table_stats, Create Table, 1);
|
||||
let $database=`select database()`;
|
||||
drop table mysql.innodb_index_stats, mysql.innodb_table_stats;
|
||||
|
||||
let $_server_id= `SELECT @@server_id`;
|
||||
let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect;
|
||||
let $datadir= `SELECT @@datadir`;
|
||||
exec echo "wait" > $_expect_file_name;
|
||||
shutdown_server;
|
||||
remove_file $datadir/ib_logfile0;
|
||||
remove_file $datadir/ib_logfile1;
|
||||
--source include/shutdown_mysqld.inc
|
||||
remove_files_wildcard $datadir ib_logfile*;
|
||||
remove_file $datadir/ibdata1;
|
||||
exec echo "restart" > $_expect_file_name;
|
||||
enable_reconnect;
|
||||
source include/wait_until_connected_again.inc;
|
||||
disable_reconnect;
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
--disable_query_log
|
||||
use mysql;
|
||||
|
@ -1,4 +1,3 @@
|
||||
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
|
||||
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
|
||||
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
|
||||
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
|
||||
@ -117,9 +116,9 @@ UPDATE t2 SET qa=@l,ra=@l,sa=@l,ta=@l,ua=@l;
|
||||
UPDATE t2 SET va=@l,wa=@l,xa=@l,ya=@l,za=@l;
|
||||
COMMIT;
|
||||
INSERT INTO t1 SELECT * from t2;
|
||||
SET DEBUG_DBUG='+d,crash_commit_before';
|
||||
BEGIN;
|
||||
UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
# Kill and restart
|
||||
UPDATE t1 SET a=@f,b=@f,c=@f,d=@f,e=@f,f=@f,g=@f,h=@f,i=@f,j=@f,
|
||||
k=@f,l=@f,m=@f,n=@f,o=@f,p=@f,q=@f,r=@f,s=@f,t=@f,u=@f,
|
||||
v=@f,w=@f,x=@b,y=@f,z=@f,
|
||||
|
@ -1,4 +1,3 @@
|
||||
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
|
||||
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
|
||||
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
|
||||
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
|
||||
@ -259,7 +258,7 @@ UPDATE t2 SET kc=@i,lc=@i,mc=@i,nc=@i,oc=@i,pc=@i;
|
||||
UPDATE t2 SET qc=@i,rc=@i,sc=@i,tc=@i,uc=@i;
|
||||
UPDATE t2 SET vc=@i,wc=@i,xc=@i,yc=@i,zc=@i;
|
||||
COMMIT;
|
||||
SET DEBUG_DBUG='+d,crash_commit_before';
|
||||
BEGIN;
|
||||
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
|
||||
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c,
|
||||
v=@c,w=@c,x=@c,y=@c,z=@c,
|
||||
@ -272,7 +271,7 @@ vb=@c,wb=@c,xb=@c,yb=@c,zb=@c,
|
||||
ac=@c,bc=@c,cc=@c,dc=@c,ec=@c,fc=@c,gc=@c,hc=@c,ic=@c,jc=@c,
|
||||
kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c,
|
||||
vc=@c,wc=@c,xc=@c,yc=@c,zc=@c;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
# Kill and restart
|
||||
UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e,f=@e,g=@e,h=@e,i=@e,j=@e,
|
||||
k=@e,l=@e,m=@e,n=@e,o=@e,p=@e,q=@e,r=@e,s=@e,t=@e,u=@e,
|
||||
v=@e,w=@e,x=@e,y=@e,z=@e,
|
||||
|
28
mysql-test/suite/innodb/r/innodb_bug59307.result
Normal file
28
mysql-test/suite/innodb/r/innodb_bug59307.result
Normal file
@ -0,0 +1,28 @@
|
||||
CREATE TABLE t1 (
|
||||
t1_int INT,
|
||||
t1_time TIME
|
||||
) ENGINE=innodb;
|
||||
CREATE TABLE t2 (
|
||||
t2_int int PRIMARY KEY,
|
||||
t2_int2 INT
|
||||
) ENGINE=INNODB;
|
||||
INSERT IGNORE INTO t2 VALUES ();
|
||||
Warnings:
|
||||
Warning 1364 Field 't2_int' doesn't have a default value
|
||||
INSERT INTO t1 VALUES ();
|
||||
SELECT *
|
||||
FROM t1 AS t1a
|
||||
WHERE NOT EXISTS
|
||||
(SELECT *
|
||||
FROM t1 AS t1b
|
||||
WHERE t1b.t1_int NOT IN
|
||||
(SELECT t2.t2_int
|
||||
FROM t2
|
||||
WHERE t1b.t1_time LIKE t1b.t1_int
|
||||
OR t1b.t1_time <> t2.t2_int2
|
||||
AND 6=7
|
||||
)
|
||||
)
|
||||
;
|
||||
t1_int t1_time
|
||||
DROP TABLE t1,t2;
|
28
mysql-test/suite/innodb/r/trigger_error.result
Normal file
28
mysql-test/suite/innodb/r/trigger_error.result
Normal file
@ -0,0 +1,28 @@
|
||||
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (i INT) ENGINE=InnoDB;
|
||||
CREATE OR REPLACE TRIGGER tr1
|
||||
AFTER UPDATE ON t2
|
||||
FOR EACH ROW
|
||||
INSERT INTO tlog (i) VALUES (1);
|
||||
INSERT IGNORE INTO t2 VALUES (1);
|
||||
CREATE TRIGGER IF NOT EXISTS tr2
|
||||
BEFORE INSERT ON t2
|
||||
FOR EACH ROW
|
||||
INSERT INTO tlog (i) VALUES (2);
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
UPDATE t2 SET i = 3;
|
||||
ERROR 42S02: Table 'test.tlog' doesn't exist
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t2 VALUES (4);
|
||||
ERROR 42S02: Table 'test.tlog' doesn't exist
|
||||
UPDATE t1 SET i = 4 LIMIT 1;
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
4
|
||||
2
|
||||
SELECT * FROM t2;
|
||||
i
|
||||
1
|
||||
DROP TABLE t1,t2;
|
@ -1,6 +1,5 @@
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_windows.inc
|
||||
|
||||
--disable_query_log
|
||||
CALL mtr.add_suppression(".*Failed to set O_DIRECT on file.*");
|
||||
|
@ -1,14 +1,7 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_innodb_32k.inc
|
||||
--source include/have_debug.inc
|
||||
# Valgrind would complain about memory leaks when we crash on purpose.
|
||||
--source include/not_valgrind.inc
|
||||
# Embedded server does not support crashing
|
||||
# Embedded server does not support restarting
|
||||
--source include/not_embedded.inc
|
||||
# Avoid CrashReporter popup on Mac
|
||||
--source include/not_crashrep.inc
|
||||
|
||||
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
@ -148,15 +141,9 @@ COMMIT;
|
||||
|
||||
INSERT INTO t1 SELECT * from t2;
|
||||
|
||||
SET DEBUG_DBUG='+d,crash_commit_before';
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--error 2013
|
||||
BEGIN;
|
||||
UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e;
|
||||
|
||||
# Write file to make mysql-test-run.pl restart the server
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
--disable_reconnect
|
||||
--source include/kill_and_restart_mysqld.inc
|
||||
|
||||
UPDATE t1 SET a=@f,b=@f,c=@f,d=@f,e=@f,f=@f,g=@f,h=@f,i=@f,j=@f,
|
||||
k=@f,l=@f,m=@f,n=@f,o=@f,p=@f,q=@f,r=@f,s=@f,t=@f,u=@f,
|
||||
|
@ -1,14 +1,7 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_innodb_64k.inc
|
||||
--source include/have_debug.inc
|
||||
# Valgrind would complain about memory leaks when we crash on purpose.
|
||||
--source include/not_valgrind.inc
|
||||
# Embedded server does not support crashing
|
||||
# Embedded server does not support restarting
|
||||
--source include/not_embedded.inc
|
||||
# Avoid CrashReporter popup on Mac
|
||||
--source include/not_crashrep.inc
|
||||
|
||||
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
@ -293,9 +286,7 @@ UPDATE t2 SET vc=@i,wc=@i,xc=@i,yc=@i,zc=@i;
|
||||
COMMIT;
|
||||
|
||||
|
||||
SET DEBUG_DBUG='+d,crash_commit_before';
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--error 2013
|
||||
BEGIN;
|
||||
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
|
||||
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c,
|
||||
v=@c,w=@c,x=@c,y=@c,z=@c,
|
||||
@ -308,11 +299,7 @@ UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
|
||||
ac=@c,bc=@c,cc=@c,dc=@c,ec=@c,fc=@c,gc=@c,hc=@c,ic=@c,jc=@c,
|
||||
kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c,
|
||||
vc=@c,wc=@c,xc=@c,yc=@c,zc=@c;
|
||||
|
||||
# Write file to make mysql-test-run.pl restart the server
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
--disable_reconnect
|
||||
--source include/kill_and_restart_mysqld.inc
|
||||
|
||||
UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e,f=@e,g=@e,h=@e,i=@e,j=@e,
|
||||
k=@e,l=@e,m=@e,n=@e,o=@e,p=@e,q=@e,r=@e,s=@e,t=@e,u=@e,
|
||||
|
@ -1,13 +1,9 @@
|
||||
# Test for bug #12400341: INNODB CAN LEAVE ORPHAN IBD FILES AROUND
|
||||
|
||||
-- source include/have_debug.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_innodb_16k.inc
|
||||
|
||||
if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_TRX_RSEG_N_SLOTS_DEBUG'`)
|
||||
{
|
||||
--skip Test requires InnoDB built with UNIV_DEBUG definition.
|
||||
}
|
||||
|
||||
# Don't test under valgrind, undo slots of the previous test might exist still
|
||||
# and cause unstable result.
|
||||
--source include/not_valgrind.inc
|
||||
|
@ -3,11 +3,6 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_debug.inc
|
||||
|
||||
if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`)
|
||||
{
|
||||
--skip Test requires InnoDB built with UNIV_DEBUG definition.
|
||||
}
|
||||
|
||||
--disable_query_log
|
||||
set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
|
||||
set @old_innodb_undo_logs = @@innodb_undo_logs;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
# This is a symbolic test, it would not fail if the bug is present.
|
||||
# Rather those SQL commands have been used during manual testing under
|
||||
# UNIV_DEBUG & UNIV_SYNC_DEBUG to test all changed codepaths for locking
|
||||
# innodb_sync_debug to test all changed codepaths for locking
|
||||
# correctness.
|
||||
#
|
||||
|
||||
|
32
mysql-test/suite/innodb/t/innodb_bug59307.test
Normal file
32
mysql-test/suite/innodb/t/innodb_bug59307.test
Normal file
@ -0,0 +1,32 @@
|
||||
-- source include/have_innodb.inc
|
||||
# Bug #59307 uninitialized value in rw_lock_set_writer_id_and_recursion_flag()
|
||||
# when Valgrind instrumentation (HAVE_VALGRIND) is not enabled
|
||||
|
||||
CREATE TABLE t1 (
|
||||
t1_int INT,
|
||||
t1_time TIME
|
||||
) ENGINE=innodb;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
t2_int int PRIMARY KEY,
|
||||
t2_int2 INT
|
||||
) ENGINE=INNODB;
|
||||
|
||||
INSERT IGNORE INTO t2 VALUES ();
|
||||
INSERT INTO t1 VALUES ();
|
||||
|
||||
SELECT *
|
||||
FROM t1 AS t1a
|
||||
WHERE NOT EXISTS
|
||||
(SELECT *
|
||||
FROM t1 AS t1b
|
||||
WHERE t1b.t1_int NOT IN
|
||||
(SELECT t2.t2_int
|
||||
FROM t2
|
||||
WHERE t1b.t1_time LIKE t1b.t1_int
|
||||
OR t1b.t1_time <> t2.t2_int2
|
||||
AND 6=7
|
||||
)
|
||||
)
|
||||
;
|
||||
DROP TABLE t1,t2;
|
31
mysql-test/suite/innodb/t/trigger_error.test
Normal file
31
mysql-test/suite/innodb/t/trigger_error.test
Normal file
@ -0,0 +1,31 @@
|
||||
--source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (i INT) ENGINE=InnoDB;
|
||||
|
||||
CREATE OR REPLACE TRIGGER tr1
|
||||
AFTER UPDATE ON t2
|
||||
FOR EACH ROW
|
||||
INSERT INTO tlog (i) VALUES (1);
|
||||
|
||||
INSERT IGNORE INTO t2 VALUES (1);
|
||||
|
||||
CREATE TRIGGER IF NOT EXISTS tr2
|
||||
BEFORE INSERT ON t2
|
||||
FOR EACH ROW
|
||||
INSERT INTO tlog (i) VALUES (2);
|
||||
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
--error ER_NO_SUCH_TABLE
|
||||
UPDATE t2 SET i = 3;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
--error ER_NO_SUCH_TABLE
|
||||
INSERT INTO t2 VALUES (4);
|
||||
UPDATE t1 SET i = 4 LIMIT 1;
|
||||
COMMIT;
|
||||
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
DROP TABLE t1,t2;
|
@ -109,7 +109,7 @@ tab CREATE TABLE `tab` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` point NOT NULL,
|
||||
`c3` linestring NOT NULL,
|
||||
`c4` geometry NOT NULL,
|
||||
`c4` polygon NOT NULL,
|
||||
`c5` geometry NOT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
SPATIAL KEY `idx2` (`c2`),
|
||||
@ -271,7 +271,7 @@ temp_tab CREATE TEMPORARY TABLE `temp_tab` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` point NOT NULL,
|
||||
`c3` linestring NOT NULL,
|
||||
`c4` geometry NOT NULL,
|
||||
`c4` polygon NOT NULL,
|
||||
`c5` geometry NOT NULL,
|
||||
SPATIAL KEY `idx2` (`c2`),
|
||||
SPATIAL KEY `idx3` (`c3`),
|
||||
@ -294,7 +294,7 @@ tab CREATE TABLE `tab` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` point NOT NULL,
|
||||
`c3` linestring NOT NULL,
|
||||
`c4` geometry NOT NULL,
|
||||
`c4` polygon NOT NULL,
|
||||
`c5` geometry NOT NULL,
|
||||
SPATIAL KEY `idx3` (`c3`),
|
||||
SPATIAL KEY `idx4` (`c4`) COMMENT 'testing spatial index on Polygon',
|
||||
@ -317,7 +317,7 @@ tab CREATE TABLE `tab` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` point NOT NULL,
|
||||
`c3` linestring NOT NULL,
|
||||
`c4` geometry NOT NULL,
|
||||
`c4` polygon NOT NULL,
|
||||
`c5` geometry NOT NULL,
|
||||
PRIMARY KEY (`c2`(25)),
|
||||
UNIQUE KEY `const_1` (`c2`(25)),
|
||||
@ -351,7 +351,7 @@ tab CREATE TABLE `tab` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` point NOT NULL,
|
||||
`c3` linestring NOT NULL,
|
||||
`c4` geometry NOT NULL,
|
||||
`c4` polygon NOT NULL,
|
||||
`c5` geometry NOT NULL,
|
||||
PRIMARY KEY (`c5`(10)),
|
||||
UNIQUE KEY `const_1` (`c5`(10)),
|
||||
|
13
mysql-test/t/analyze_debug.test
Normal file
13
mysql-test/t/analyze_debug.test
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
--source include/have_debug.inc
|
||||
|
||||
SET @save_use_stat_tables= @@use_stat_tables;
|
||||
SET use_stat_tables= PREFERABLY;
|
||||
CREATE TABLE t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
|
||||
SET STATEMENT debug_dbug="d,fail_2call_open_only_one_table" for
|
||||
ANALYZE TABLE t1;
|
||||
|
||||
drop table t1;
|
||||
SET use_stat_tables= @save_use_stat_tables;
|
@ -928,6 +928,25 @@ EXECUTE stmt;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-11363: Assertion `!derived->first_sel ect()->first_inner_unit() ||
|
||||
--echo # derived->first_select()->first_inner_unit()->first_select()->
|
||||
--echo # exclude_from_table_unique_test' failed in
|
||||
--echo # TABLE_LIST::set_check_materialized()
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
CREATE TABLE t2 (f2 INT);
|
||||
CREATE TABLE t3 (f3 INT);
|
||||
CREATE VIEW v1 AS ( SELECT f1 AS f FROM t1 ) UNION ( SELECT f2 AS f FROM t2 );
|
||||
CREATE VIEW v2 AS SELECT f3 AS f FROM t3;
|
||||
CREATE VIEW v3 AS SELECT f FROM ( SELECT f3 AS f FROM v1, t3 ) AS sq;
|
||||
CREATE VIEW v4 AS SELECT COUNT(*) as f FROM v3;
|
||||
REPLACE INTO v2 ( SELECT * FROM v4 ) UNION ( SELECT f FROM v2 );
|
||||
|
||||
drop view v1,v2,v3,v4;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
@ -238,3 +238,39 @@ select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') ;
|
||||
select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
|
||||
select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
|
||||
select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
|
||||
|
||||
#
|
||||
# MDEV-11856 json_search doesn't search for values with double quotes character (")
|
||||
#
|
||||
|
||||
SELECT JSON_search( '{"x": "\\""}', "one", '"');
|
||||
SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
|
||||
|
||||
#
|
||||
# MDEV-11833 JSON functions don't seem to respect max_allowed_packet.
|
||||
#
|
||||
set @@global.net_buffer_length=1024;
|
||||
set @@global.max_allowed_packet=2048;
|
||||
--connect (newconn, localhost, root,,)
|
||||
|
||||
show variables like 'net_buffer_length';
|
||||
show variables like 'max_allowed_packet';
|
||||
select json_array(repeat('a',1024),repeat('a',1024));
|
||||
select json_object("a", repeat('a',1024),"b", repeat('a',1024));
|
||||
--connection default
|
||||
|
||||
set @@global.max_allowed_packet = default;
|
||||
set @@global.net_buffer_length = default;
|
||||
--disconnect newconn
|
||||
|
||||
|
||||
#
|
||||
# MDEV-12262 Assertion `!null_value' failed in virtual bool Item::send on JSON_REMOVE.
|
||||
#
|
||||
create table t1(j longtext, p longtext);
|
||||
insert into t1 values
|
||||
('{"a":1,"b":2,"c":3}','$.a'),
|
||||
('{"a":1,"b":2,"c":3}','$.b'),
|
||||
('{"a":1,"b":2,"c":3}','$.c');
|
||||
select j, p, json_remove(j, p) from t1;
|
||||
drop table t1;
|
||||
|
@ -62,3 +62,25 @@ SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.5 tests.
|
||||
|
||||
#
|
||||
# MDEV-12078 Using spatial index changes type from point to geometry.
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
coordinate point NOT NULL,
|
||||
SPATIAL KEY coordinate (coordinate)
|
||||
) ENGINE=Aria DEFAULT CHARSET=ascii PAGE_CHECKSUM=1;
|
||||
|
||||
SHOW COLUMNS FROM t1;
|
||||
|
||||
INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(0 0)"));
|
||||
INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(10 0)"));
|
||||
INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(10 10)"));
|
||||
INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(0 10)"));
|
||||
INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(5 5)"));
|
||||
|
||||
SELECT astext(coordinate) FROM t1 WHERE ST_Intersects(ST_LineFromText("LINESTRING(0 0, 10 0, 10 10, 0 10)"), coordinate);
|
||||
|
||||
SHOW COLUMNS FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -1915,6 +1915,44 @@ SELECT CEILING(POINT(1,1));
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT FLOOR(POINT(1,1));
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec()
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a GEOMETRY);
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT SUM(POINT(1,1)) FROM t1;
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT SUM(a) FROM t1;
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT SUM(COALESCE(a)) FROM t1;
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT AVG(POINT(1,1)) FROM t1;
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT AVG(a) FROM t1;
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT AVG(COALESCE(a)) FROM t1;
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT VARIANCE(POINT(1,1)) FROM t1;
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT VARIANCE(a) FROM t1;
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT VARIANCE(COALESCE(a)) FROM t1;
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT STDDEV(POINT(1,1)) FROM t1;
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT STDDEV(a) FROM t1;
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT STDDEV(COALESCE(a)) FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -1750,6 +1750,23 @@ drop database `foo.bar`;
|
||||
|
||||
--echo End of 10.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-10766 Queries which start with WITH clause do not get
|
||||
--echo # inserted into query cache
|
||||
--echo #
|
||||
flush status;
|
||||
show status like "Qcache_inserts";
|
||||
create table t1 (i int);
|
||||
with cte as (select * from t1) select * from cte;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
with cte as (select * from t1) select * from cte;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
drop table t1;
|
||||
|
||||
--echo restore defaults
|
||||
SET GLOBAL query_cache_type= default;
|
||||
SET GLOBAL query_cache_size= default;
|
||||
|
@ -4427,6 +4427,7 @@ DROP TABLE t1;
|
||||
--echo # Bug #57203 Assertion `field_length <= 255' failed.
|
||||
--echo #
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
|
||||
UNION ALL
|
||||
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
|
||||
|
@ -483,7 +483,18 @@ void my_write_core(int sig)
|
||||
|
||||
#else /* __WIN__*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* Silence warning in OS header dbghelp.h */
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4091)
|
||||
#endif
|
||||
|
||||
#include <dbghelp.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <tlhelp32.h>
|
||||
#include <my_sys.h>
|
||||
#if _MSC_VER
|
||||
|
@ -94,7 +94,7 @@ frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
|
||||
if (mysql_file_seek(file, 0, SEEK_SET, MYF(MY_WME)))
|
||||
goto err;
|
||||
|
||||
if (read_string(file, &frm_image, state.st_size))
|
||||
if (read_string(file, &frm_image, (size_t)state.st_size))
|
||||
goto err;
|
||||
|
||||
if ((n_length= uint4korr(frm_image+55)))
|
||||
|
134
sql/item.cc
134
sql/item.cc
@ -5670,6 +5670,25 @@ error:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
const Type_handler *Item_field::real_type_handler() const
|
||||
{
|
||||
/*
|
||||
Item_field::field_type ask Field_type() but sometimes field return
|
||||
a different type, like for enum/set, so we need to ask real type.
|
||||
*/
|
||||
if (field->is_created_from_null_item)
|
||||
return &type_handler_null;
|
||||
/* work around about varchar type field detection */
|
||||
enum_field_types type= field->real_type();
|
||||
// TODO: We should add Field::real_type_handler() eventually
|
||||
if (type == MYSQL_TYPE_STRING && field->type() == MYSQL_TYPE_VAR_STRING)
|
||||
type= MYSQL_TYPE_VAR_STRING;
|
||||
return Type_handler::get_handler_by_real_type(type);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@brief
|
||||
Mark virtual columns as used in a partitioning expression
|
||||
@ -10009,7 +10028,7 @@ void Item_cache_row::set_null()
|
||||
|
||||
Item_type_holder::Item_type_holder(THD *thd, Item *item)
|
||||
:Item(thd, item),
|
||||
Type_handler_hybrid_real_field_type(get_real_type(item)),
|
||||
Type_handler_hybrid_field_type(item->real_type_handler()),
|
||||
enum_set_typelib(0)
|
||||
{
|
||||
DBUG_ASSERT(item->fixed);
|
||||
@ -10024,87 +10043,6 @@ Item_type_holder::Item_type_holder(THD *thd, Item *item)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Find real field type of item.
|
||||
|
||||
@return
|
||||
type of field which should be created to store item value
|
||||
*/
|
||||
|
||||
enum_field_types Item_type_holder::get_real_type(Item *item)
|
||||
{
|
||||
if (item->type() == REF_ITEM)
|
||||
item= item->real_item();
|
||||
switch(item->type())
|
||||
{
|
||||
case FIELD_ITEM:
|
||||
{
|
||||
/*
|
||||
Item_field::field_type ask Field_type() but sometimes field return
|
||||
a different type, like for enum/set, so we need to ask real type.
|
||||
*/
|
||||
Field *field= ((Item_field *) item)->field;
|
||||
enum_field_types type= field->real_type();
|
||||
if (field->is_created_from_null_item)
|
||||
return MYSQL_TYPE_NULL;
|
||||
/* work around about varchar type field detection */
|
||||
if (type == MYSQL_TYPE_STRING && field->type() == MYSQL_TYPE_VAR_STRING)
|
||||
return MYSQL_TYPE_VAR_STRING;
|
||||
return type;
|
||||
}
|
||||
case SUM_FUNC_ITEM:
|
||||
{
|
||||
/*
|
||||
Argument of aggregate function sometimes should be asked about field
|
||||
type
|
||||
*/
|
||||
Item_sum *item_sum= (Item_sum *) item;
|
||||
if (item_sum->keep_field_type())
|
||||
return get_real_type(item_sum->get_arg(0));
|
||||
break;
|
||||
}
|
||||
case FUNC_ITEM:
|
||||
if (((Item_func *) item)->functype() == Item_func::GUSERVAR_FUNC)
|
||||
{
|
||||
/*
|
||||
There are work around of problem with changing variable type on the
|
||||
fly and variable always report "string" as field type to get
|
||||
acceptable information for client in send_field, so we make field
|
||||
type from expression type.
|
||||
*/
|
||||
switch (item->result_type()) {
|
||||
case STRING_RESULT:
|
||||
return MYSQL_TYPE_VARCHAR;
|
||||
case INT_RESULT:
|
||||
return MYSQL_TYPE_LONGLONG;
|
||||
case REAL_RESULT:
|
||||
return MYSQL_TYPE_DOUBLE;
|
||||
case DECIMAL_RESULT:
|
||||
return MYSQL_TYPE_NEWDECIMAL;
|
||||
case ROW_RESULT:
|
||||
case TIME_RESULT:
|
||||
DBUG_ASSERT(0);
|
||||
return MYSQL_TYPE_VARCHAR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TYPE_HOLDER:
|
||||
/*
|
||||
Item_type_holder and Item_blob should not appear in this context.
|
||||
In case they for some reasons do, returning field_type() is wrong anyway.
|
||||
They must return Item_type_holder::real_field_type() instead, to make
|
||||
the code in sql_type.cc and sql_type.h happy, as it expectes
|
||||
Field::real_type()-compatible rather than Field::field_type()-compatible
|
||||
valies in some places, and may in the future add some asserts preventing
|
||||
use of field_type() instead of real_type() and the other way around.
|
||||
*/
|
||||
DBUG_ASSERT(0);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return item->field_type();
|
||||
}
|
||||
|
||||
/**
|
||||
Find field type which can carry current Item_type_holder type and
|
||||
type of given Item.
|
||||
@ -10123,14 +10061,13 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
|
||||
uint max_length_orig= max_length;
|
||||
uint decimals_orig= decimals;
|
||||
DBUG_ENTER("Item_type_holder::join_types");
|
||||
DBUG_PRINT("info:", ("was type %d len %d, dec %d name %s",
|
||||
real_field_type(), max_length, decimals,
|
||||
DBUG_PRINT("info:", ("was type %s len %d, dec %d name %s",
|
||||
real_type_handler()->name().ptr(), max_length, decimals,
|
||||
(name ? name : "<NULL>")));
|
||||
DBUG_PRINT("info:", ("in type %d len %d, dec %d",
|
||||
get_real_type(item),
|
||||
DBUG_PRINT("info:", ("in type %s len %d, dec %d",
|
||||
item->real_type_handler()->name().ptr(),
|
||||
item->max_length, item->decimals));
|
||||
const Type_handler *item_type_handler=
|
||||
Type_handler::get_handler_by_real_type(get_real_type(item));
|
||||
const Type_handler *item_type_handler= item->real_type_handler();
|
||||
if (aggregate_for_result(item_type_handler))
|
||||
{
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0),
|
||||
@ -10218,13 +10155,13 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
|
||||
int delta1= max_length_orig - decimals_orig;
|
||||
int delta2= item->max_length - item->decimals;
|
||||
max_length= MY_MAX(delta1, delta2) + decimals;
|
||||
if (Item_type_holder::real_field_type() == MYSQL_TYPE_FLOAT &&
|
||||
if (Item_type_holder::real_type_handler() == &type_handler_float &&
|
||||
max_length > FLT_DIG + 2)
|
||||
{
|
||||
max_length= MAX_FLOAT_STR_LENGTH;
|
||||
decimals= NOT_FIXED_DEC;
|
||||
}
|
||||
else if (Item_type_holder::real_field_type() == MYSQL_TYPE_DOUBLE &&
|
||||
else if (Item_type_holder::real_type_handler() == &type_handler_double &&
|
||||
max_length > DBL_DIG + 2)
|
||||
{
|
||||
max_length= MAX_DOUBLE_STR_LENGTH;
|
||||
@ -10245,8 +10182,9 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
|
||||
|
||||
/* Remember decimal integer part to be used in DECIMAL_RESULT handleng */
|
||||
prev_decimal_int_part= decimal_int_part();
|
||||
DBUG_PRINT("info", ("become type: %d len: %u dec: %u",
|
||||
(int) real_field_type(), max_length, (uint) decimals));
|
||||
DBUG_PRINT("info", ("become type: %s len: %u dec: %u",
|
||||
real_type_handler()->name().ptr(),
|
||||
max_length, (uint) decimals));
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
@ -10269,7 +10207,7 @@ Field *Item_type_holder::make_field_by_type(TABLE *table)
|
||||
uchar *null_ptr= maybe_null ? (uchar*) "" : 0;
|
||||
Field *field;
|
||||
|
||||
switch (Item_type_holder::real_field_type()) {
|
||||
switch (Item_type_holder::real_type_handler()->real_field_type()) {
|
||||
case MYSQL_TYPE_ENUM:
|
||||
DBUG_ASSERT(enum_set_typelib);
|
||||
field= new Field_enum((uchar *) 0, max_length, null_ptr, 0,
|
||||
@ -10305,8 +10243,8 @@ Field *Item_type_holder::make_field_by_type(TABLE *table)
|
||||
*/
|
||||
void Item_type_holder::get_full_info(Item *item)
|
||||
{
|
||||
if (Item_type_holder::real_field_type() == MYSQL_TYPE_ENUM ||
|
||||
Item_type_holder::real_field_type() == MYSQL_TYPE_SET)
|
||||
if (Item_type_holder::real_type_handler() == &type_handler_enum ||
|
||||
Item_type_holder::real_type_handler() == &type_handler_set)
|
||||
{
|
||||
if (item->type() == Item::SUM_FUNC_ITEM &&
|
||||
(((Item_sum*)item)->sum_func() == Item_sum::MAX_FUNC ||
|
||||
@ -10317,11 +10255,11 @@ void Item_type_holder::get_full_info(Item *item)
|
||||
field (or MIN|MAX(enum|set field)) and number of NULL fields
|
||||
*/
|
||||
DBUG_ASSERT((enum_set_typelib &&
|
||||
get_real_type(item) == MYSQL_TYPE_NULL) ||
|
||||
item->real_type_handler() == &type_handler_null) ||
|
||||
(!enum_set_typelib &&
|
||||
item->real_item()->type() == Item::FIELD_ITEM &&
|
||||
(get_real_type(item->real_item()) == MYSQL_TYPE_ENUM ||
|
||||
get_real_type(item->real_item()) == MYSQL_TYPE_SET) &&
|
||||
(item->real_type_handler() == &type_handler_enum ||
|
||||
item->real_type_handler() == &type_handler_set) &&
|
||||
((Field_enum*)((Item_field *) item->real_item())->field)->typelib));
|
||||
if (!enum_set_typelib)
|
||||
{
|
||||
|
28
sql/item.h
28
sql/item.h
@ -699,6 +699,10 @@ public:
|
||||
{
|
||||
return Type_handler::get_handler_by_field_type(field_type());
|
||||
}
|
||||
virtual const Type_handler *real_type_handler() const
|
||||
{
|
||||
return type_handler();
|
||||
}
|
||||
virtual const Type_handler *cast_to_int_type_handler() const
|
||||
{
|
||||
return type_handler();
|
||||
@ -2409,6 +2413,7 @@ public:
|
||||
{
|
||||
return field->type();
|
||||
}
|
||||
const Type_handler *real_type_handler() const;
|
||||
enum_monotonicity_info get_monotonicity_info() const
|
||||
{
|
||||
return MONOTONIC_STRICT_INCREASING;
|
||||
@ -3355,6 +3360,12 @@ public:
|
||||
{ max_length= length; }
|
||||
enum Type type() const { return TYPE_HOLDER; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
|
||||
const Type_handler *real_type_handler() const
|
||||
{
|
||||
// Should not be called, Item_blob is used for SHOW purposes only.
|
||||
DBUG_ASSERT(0);
|
||||
return &type_handler_varchar;
|
||||
}
|
||||
Field *create_field_for_schema(THD *thd, TABLE *table)
|
||||
{ return tmp_table_field_from_field_type(table, false, true); }
|
||||
};
|
||||
@ -4072,6 +4083,8 @@ public:
|
||||
{ return (*ref)->setup_fast_field_copier(field); }
|
||||
enum Item_result result_type () const { return (*ref)->result_type(); }
|
||||
enum_field_types field_type() const { return (*ref)->field_type(); }
|
||||
const Type_handler *real_type_handler() const
|
||||
{ return (*ref)->real_type_handler(); }
|
||||
Field *get_tmp_table_field()
|
||||
{ return result_field ? result_field : (*ref)->get_tmp_table_field(); }
|
||||
Item *get_tmp_table_item(THD *thd);
|
||||
@ -5602,7 +5615,7 @@ public:
|
||||
single SP/PS execution.
|
||||
*/
|
||||
class Item_type_holder: public Item,
|
||||
public Type_handler_hybrid_real_field_type
|
||||
public Type_handler_hybrid_field_type
|
||||
{
|
||||
protected:
|
||||
TYPELIB *enum_set_typelib;
|
||||
@ -5616,11 +5629,11 @@ public:
|
||||
Item_type_holder(THD*, Item*);
|
||||
|
||||
const Type_handler *type_handler() const
|
||||
{ return Type_handler_hybrid_real_field_type::type_handler(); }
|
||||
{ return Type_handler_hybrid_field_type::type_handler(); }
|
||||
enum_field_types field_type() const
|
||||
{ return Type_handler_hybrid_real_field_type::field_type(); }
|
||||
{ return Type_handler_hybrid_field_type::field_type(); }
|
||||
enum_field_types real_field_type() const
|
||||
{ return Type_handler_hybrid_real_field_type::real_field_type(); }
|
||||
{ return Type_handler_hybrid_field_type::real_field_type(); }
|
||||
enum Item_result result_type () const
|
||||
{
|
||||
/*
|
||||
@ -5635,7 +5648,11 @@ public:
|
||||
As soon as we get BIT as one of the joined types, the result field
|
||||
type cannot be numeric: it's either BIT, or VARBINARY.
|
||||
*/
|
||||
return Type_handler_hybrid_real_field_type::result_type();
|
||||
return Type_handler_hybrid_field_type::result_type();
|
||||
}
|
||||
const Type_handler *real_type_handler() const
|
||||
{
|
||||
return Item_type_holder::type_handler();
|
||||
}
|
||||
|
||||
enum Type type() const { return TYPE_HOLDER; }
|
||||
@ -5645,7 +5662,6 @@ public:
|
||||
String *val_str(String*);
|
||||
bool join_types(THD *thd, Item *);
|
||||
Field *make_field_by_type(TABLE *table);
|
||||
static enum_field_types get_real_type(Item *);
|
||||
Field::geometry_type get_geometry_type() const { return geometry_type; };
|
||||
Item* get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
|
||||
};
|
||||
|
@ -767,7 +767,7 @@ public:
|
||||
Reserve max_length to fit at least one character for one digit,
|
||||
plus one character for the sign (if signed).
|
||||
*/
|
||||
set_if_bigger(char_length, 1 + (unsigned_flag ? 0 : 1));
|
||||
set_if_bigger(char_length, 1U + (unsigned_flag ? 0 : 1));
|
||||
fix_char_length(char_length);
|
||||
}
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
|
@ -1407,6 +1407,7 @@ void Item_func_json_array::fix_length_and_dec()
|
||||
|
||||
fix_char_length_ulonglong(char_length);
|
||||
tmp_val.set_charset(collation.collation);
|
||||
result_limit= 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1431,7 +1432,16 @@ String *Item_func_json_array::val_str(String *str)
|
||||
if (str->append("]", 1))
|
||||
goto err_return;
|
||||
|
||||
return str;
|
||||
if (result_limit == 0)
|
||||
result_limit= current_thd->variables.max_allowed_packet;
|
||||
|
||||
if (str->length() <= result_limit)
|
||||
return str;
|
||||
|
||||
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
|
||||
ER_THD(current_thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
|
||||
func_name(), result_limit);
|
||||
|
||||
err_return:
|
||||
/*TODO: Launch out of memory error. */
|
||||
@ -1749,7 +1759,16 @@ String *Item_func_json_object::val_str(String *str)
|
||||
if (str->append("}", 1))
|
||||
goto err_return;
|
||||
|
||||
return str;
|
||||
if (result_limit == 0)
|
||||
result_limit= current_thd->variables.max_allowed_packet;
|
||||
|
||||
if (str->length() <= result_limit)
|
||||
return str;
|
||||
|
||||
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
|
||||
ER_THD(current_thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
|
||||
func_name(), result_limit);
|
||||
|
||||
err_return:
|
||||
/*TODO: Launch out of memory error. */
|
||||
@ -2614,6 +2633,7 @@ v_found:
|
||||
str->length(0);
|
||||
|
||||
if (append_simple(str, js->ptr(), rem_start - js->ptr()) ||
|
||||
(je.state == JST_KEY && n_item > 0 && str->append(",", 1)) ||
|
||||
append_simple(str, rem_end, js->end() - rem_end))
|
||||
goto js_error; /* Out of memory. */
|
||||
|
||||
@ -2639,6 +2659,7 @@ v_found:
|
||||
if (json_nice(&je, str, Item_func_json_format::LOOSE))
|
||||
goto js_error;
|
||||
|
||||
null_value= 0;
|
||||
return str;
|
||||
|
||||
js_error:
|
||||
@ -2800,9 +2821,28 @@ void Item_func_json_search::fix_length_and_dec()
|
||||
int Item_func_json_search::compare_json_value_wild(json_engine_t *je,
|
||||
const String *cmp_str)
|
||||
{
|
||||
return my_wildcmp(collation.collation,
|
||||
(const char *) je->value, (const char *) (je->value + je->value_len),
|
||||
cmp_str->ptr(), cmp_str->end(), escape, wild_one, wild_many) ? 0 : 1;
|
||||
if (je->value_type != JSON_VALUE_STRING || !je->value_escaped)
|
||||
return my_wildcmp(collation.collation,
|
||||
(const char *) je->value, (const char *) (je->value + je->value_len),
|
||||
cmp_str->ptr(), cmp_str->end(), escape, wild_one, wild_many) ? 0 : 1;
|
||||
|
||||
{
|
||||
int esc_len;
|
||||
if (esc_value.alloced_length() < (uint) je->value_len &&
|
||||
esc_value.alloc((je->value_len / 1024 + 1) * 1024))
|
||||
return 0;
|
||||
|
||||
esc_len= json_unescape(je->s.cs, je->value, je->value + je->value_len,
|
||||
je->s.cs, (uchar *) esc_value.ptr(),
|
||||
(uchar *) (esc_value.ptr() +
|
||||
esc_value.alloced_length()));
|
||||
if (esc_len <= 0)
|
||||
return 0;
|
||||
|
||||
return my_wildcmp(collation.collation,
|
||||
esc_value.ptr(), esc_value.ptr() + esc_len,
|
||||
cmp_str->ptr(), cmp_str->end(), escape, wild_one, wild_many) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -216,6 +216,7 @@ class Item_func_json_array: public Item_str_func
|
||||
{
|
||||
protected:
|
||||
String tmp_val;
|
||||
ulong result_limit;
|
||||
public:
|
||||
Item_func_json_array(THD *thd):
|
||||
Item_str_func(thd) {}
|
||||
@ -392,7 +393,7 @@ public:
|
||||
class Item_func_json_search: public Item_json_str_multipath
|
||||
{
|
||||
protected:
|
||||
String tmp_js;
|
||||
String tmp_js, esc_value;
|
||||
bool mode_one;
|
||||
bool ooa_constant, ooa_parsed;
|
||||
int escape;
|
||||
|
@ -5079,9 +5079,10 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
|
||||
case DYN_COL_UINT:
|
||||
if (signed_value || val.x.ulong_value <= LONGLONG_MAX)
|
||||
{
|
||||
bool neg= val.x.ulong_value > LONGLONG_MAX;
|
||||
if (int_to_datetime_with_warn(neg, neg ? -val.x.ulong_value :
|
||||
val.x.ulong_value,
|
||||
longlong llval = (longlong)val.x.ulong_value;
|
||||
bool neg = llval < 0;
|
||||
if (int_to_datetime_with_warn(neg, (ulonglong)(neg ? -llval :
|
||||
llval),
|
||||
ltime, fuzzy_date, 0 /* TODO */))
|
||||
goto null;
|
||||
return 0;
|
||||
|
163
sql/item_sum.cc
163
sql/item_sum.cc
@ -1290,41 +1290,35 @@ void Item_sum_sum::clear()
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_sum::fix_length_and_dec_double()
|
||||
{
|
||||
set_handler(&type_handler_double); // Change FLOAT to DOUBLE
|
||||
decimals= args[0]->decimals;
|
||||
sum= 0.0;
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_sum::fix_length_and_dec_decimal()
|
||||
{
|
||||
set_handler(&type_handler_newdecimal); // Change temporal to new DECIMAL
|
||||
decimals= args[0]->decimals;
|
||||
/* SUM result can't be longer than length(arg) + length(MAX_ROWS) */
|
||||
int precision= args[0]->decimal_precision() + DECIMAL_LONGLONG_DIGITS;
|
||||
max_length= my_decimal_precision_to_length_no_truncation(precision,
|
||||
decimals,
|
||||
unsigned_flag);
|
||||
curr_dec_buff= 0;
|
||||
my_decimal_set_zero(dec_buffs);
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_sum::fix_length_and_dec()
|
||||
{
|
||||
DBUG_ENTER("Item_sum_sum::fix_length_and_dec");
|
||||
maybe_null=null_value=1;
|
||||
decimals= args[0]->decimals;
|
||||
switch (args[0]->cast_to_int_type_handler()->cmp_type()) {
|
||||
case REAL_RESULT:
|
||||
case STRING_RESULT:
|
||||
set_handler_by_field_type(MYSQL_TYPE_DOUBLE);
|
||||
sum= 0.0;
|
||||
break;
|
||||
case INT_RESULT:
|
||||
case TIME_RESULT:
|
||||
case DECIMAL_RESULT:
|
||||
{
|
||||
/* SUM result can't be longer than length(arg) + length(MAX_ROWS) */
|
||||
int precision= args[0]->decimal_precision() + DECIMAL_LONGLONG_DIGITS;
|
||||
max_length= my_decimal_precision_to_length_no_truncation(precision,
|
||||
decimals,
|
||||
unsigned_flag);
|
||||
curr_dec_buff= 0;
|
||||
set_handler_by_field_type(MYSQL_TYPE_NEWDECIMAL);
|
||||
my_decimal_set_zero(dec_buffs);
|
||||
break;
|
||||
}
|
||||
case ROW_RESULT:
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
DBUG_PRINT("info", ("Type: %s (%d, %d)",
|
||||
(result_type() == REAL_RESULT ? "REAL_RESULT" :
|
||||
result_type() == DECIMAL_RESULT ? "DECIMAL_RESULT" :
|
||||
result_type() == INT_RESULT ? "INT_RESULT" :
|
||||
"--ILLEGAL!!!--"),
|
||||
max_length,
|
||||
(int)decimals));
|
||||
args[0]->cast_to_int_type_handler()->Item_sum_sum_fix_length_and_dec(this);
|
||||
DBUG_PRINT("info", ("Type: %s (%d, %d)", type_handler()->name().ptr(),
|
||||
max_length, (int) decimals));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -1625,28 +1619,39 @@ void Item_sum_count::cleanup()
|
||||
/*
|
||||
Avgerage
|
||||
*/
|
||||
|
||||
void Item_sum_avg::fix_length_and_dec_decimal()
|
||||
{
|
||||
Item_sum_sum::fix_length_and_dec_decimal();
|
||||
int precision= args[0]->decimal_precision() + prec_increment;
|
||||
decimals= MY_MIN(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE);
|
||||
max_length= my_decimal_precision_to_length_no_truncation(precision,
|
||||
decimals,
|
||||
unsigned_flag);
|
||||
f_precision= MY_MIN(precision+DECIMAL_LONGLONG_DIGITS, DECIMAL_MAX_PRECISION);
|
||||
f_scale= args[0]->decimals;
|
||||
dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale);
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_avg::fix_length_and_dec_double()
|
||||
{
|
||||
Item_sum_sum::fix_length_and_dec_double();
|
||||
decimals= MY_MIN(args[0]->decimals + prec_increment,
|
||||
FLOATING_POINT_DECIMALS);
|
||||
max_length= MY_MIN(args[0]->max_length + prec_increment, float_length(decimals));
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_avg::fix_length_and_dec()
|
||||
{
|
||||
Item_sum_sum::fix_length_and_dec();
|
||||
maybe_null=null_value=1;
|
||||
DBUG_ENTER("Item_sum_avg::fix_length_and_dec");
|
||||
prec_increment= current_thd->variables.div_precincrement;
|
||||
if (Item_sum_avg::result_type() == DECIMAL_RESULT)
|
||||
{
|
||||
int precision= args[0]->decimal_precision() + prec_increment;
|
||||
decimals= MY_MIN(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE);
|
||||
max_length= my_decimal_precision_to_length_no_truncation(precision,
|
||||
decimals,
|
||||
unsigned_flag);
|
||||
f_precision= MY_MIN(precision+DECIMAL_LONGLONG_DIGITS, DECIMAL_MAX_PRECISION);
|
||||
f_scale= args[0]->decimals;
|
||||
dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
decimals= MY_MIN(args[0]->decimals + prec_increment,
|
||||
FLOATING_POINT_DECIMALS);
|
||||
max_length= MY_MIN(args[0]->max_length + prec_increment, float_length(decimals));
|
||||
}
|
||||
maybe_null=null_value=1;
|
||||
args[0]->cast_to_int_type_handler()->Item_sum_avg_fix_length_and_dec(this);
|
||||
DBUG_PRINT("info", ("Type: %s (%d, %d)", type_handler()->name().ptr(),
|
||||
max_length, (int) decimals));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
@ -1845,6 +1850,25 @@ Item_sum_variance::Item_sum_variance(THD *thd, Item_sum_variance *item):
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_variance::fix_length_and_dec_double()
|
||||
{
|
||||
DBUG_ASSERT(Item_sum_variance::type_handler() == &type_handler_double);
|
||||
decimals= MY_MIN(args[0]->decimals + 4, FLOATING_POINT_DECIMALS);
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_variance::fix_length_and_dec_decimal()
|
||||
{
|
||||
DBUG_ASSERT(Item_sum_variance::type_handler() == &type_handler_double);
|
||||
int precision= args[0]->decimal_precision() * 2 + prec_increment;
|
||||
decimals= MY_MIN(args[0]->decimals + prec_increment,
|
||||
FLOATING_POINT_DECIMALS - 1);
|
||||
max_length= my_decimal_precision_to_length_no_truncation(precision,
|
||||
decimals,
|
||||
unsigned_flag);
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_variance::fix_length_and_dec()
|
||||
{
|
||||
DBUG_ENTER("Item_sum_variance::fix_length_and_dec");
|
||||
@ -1858,28 +1882,9 @@ void Item_sum_variance::fix_length_and_dec()
|
||||
type.
|
||||
*/
|
||||
|
||||
switch (args[0]->result_type()) {
|
||||
case REAL_RESULT:
|
||||
case STRING_RESULT:
|
||||
decimals= MY_MIN(args[0]->decimals + 4, FLOATING_POINT_DECIMALS);
|
||||
break;
|
||||
case INT_RESULT:
|
||||
case DECIMAL_RESULT:
|
||||
{
|
||||
int precision= args[0]->decimal_precision()*2 + prec_increment;
|
||||
decimals= MY_MIN(args[0]->decimals + prec_increment,
|
||||
FLOATING_POINT_DECIMALS-1);
|
||||
max_length= my_decimal_precision_to_length_no_truncation(precision,
|
||||
decimals,
|
||||
unsigned_flag);
|
||||
|
||||
break;
|
||||
}
|
||||
case ROW_RESULT:
|
||||
case TIME_RESULT:
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
DBUG_PRINT("info", ("Type: REAL_RESULT (%d, %d)", max_length, (int)decimals));
|
||||
args[0]->type_handler()->Item_sum_variance_fix_length_and_dec(this);
|
||||
DBUG_PRINT("info", ("Type: %s (%d, %d)", type_handler()->name().ptr(),
|
||||
max_length, (int)decimals));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -2201,10 +2206,10 @@ bool Item_sum_bit::remove_as_window(ulonglong value)
|
||||
if (!bit_counters[i])
|
||||
{
|
||||
// Don't attempt to remove values that were never added.
|
||||
DBUG_ASSERT((value & (1 << i)) == 0);
|
||||
DBUG_ASSERT((value & (1ULL << i)) == 0);
|
||||
continue;
|
||||
}
|
||||
bit_counters[i]-= (value & (1 << i)) ? 1 : 0;
|
||||
bit_counters[i]-= (value & (1ULL << i)) ? 1 : 0;
|
||||
}
|
||||
|
||||
// Prevent overflow;
|
||||
@ -2218,7 +2223,7 @@ bool Item_sum_bit::add_as_window(ulonglong value)
|
||||
DBUG_ASSERT(as_window_function);
|
||||
for (int i= 0; i < NUM_BIT_COUNTERS; i++)
|
||||
{
|
||||
bit_counters[i]+= (value & (1 << i)) ? 1 : 0;
|
||||
bit_counters[i]+= (value & (1ULL << i)) ? 1 : 0;
|
||||
}
|
||||
// Prevent overflow;
|
||||
num_values_added = std::max(num_values_added, num_values_added + 1);
|
||||
@ -2289,7 +2294,7 @@ void Item_sum_and::set_bits_from_counters()
|
||||
{
|
||||
// We've only added values of 1 for this bit.
|
||||
if (bit_counters[i] == num_values_added)
|
||||
value|= (1 << i);
|
||||
value|= (1ULL << i);
|
||||
}
|
||||
bits= value & reset_bits;
|
||||
}
|
||||
@ -3102,7 +3107,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
|
||||
{
|
||||
Item_func_group_concat *item= (Item_func_group_concat *) item_arg;
|
||||
TABLE *table= item->table;
|
||||
uint max_length= table->in_use->variables.group_concat_max_len;
|
||||
uint max_length= (uint)table->in_use->variables.group_concat_max_len;
|
||||
String tmp((char *)table->record[1], table->s->reclength,
|
||||
default_charset_info);
|
||||
String tmp2;
|
||||
@ -3473,9 +3478,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
|
||||
result.set_charset(collation.collation);
|
||||
result_field= 0;
|
||||
null_value= 1;
|
||||
max_length= thd->variables.group_concat_max_len
|
||||
max_length= (uint32)(thd->variables.group_concat_max_len
|
||||
/ collation.collation->mbminlen
|
||||
* collation.collation->mbmaxlen;
|
||||
* collation.collation->mbmaxlen);
|
||||
|
||||
uint32 offset;
|
||||
if (separator->needs_conversion(separator->length(), separator->charset(),
|
||||
|
@ -456,7 +456,6 @@ public:
|
||||
Updated value is then saved in the field.
|
||||
*/
|
||||
virtual void update_field()=0;
|
||||
virtual bool keep_field_type(void) const { return 0; }
|
||||
virtual void fix_length_and_dec() { maybe_null=1; null_value=1; }
|
||||
virtual Item *result_item(THD *thd, Field *field);
|
||||
|
||||
@ -520,7 +519,7 @@ public:
|
||||
st_select_lex *depended_from()
|
||||
{ return (nest_level == aggr_level ? 0 : aggr_sel); }
|
||||
|
||||
Item *get_arg(uint i) { return args[i]; }
|
||||
Item *get_arg(uint i) const { return args[i]; }
|
||||
Item *set_arg(uint i, THD *thd, Item *new_val);
|
||||
uint get_arg_count() const { return arg_count; }
|
||||
|
||||
@ -790,6 +789,8 @@ public:
|
||||
{ return Type_handler_hybrid_field_type::result_type(); }
|
||||
enum Item_result cmp_type () const
|
||||
{ return Type_handler_hybrid_field_type::cmp_type(); }
|
||||
void fix_length_and_dec_double();
|
||||
void fix_length_and_dec_decimal();
|
||||
void reset_field();
|
||||
void update_field();
|
||||
void no_rows_in_result() {}
|
||||
@ -889,6 +890,8 @@ public:
|
||||
:Item_sum_sum(thd, item), count(item->count),
|
||||
prec_increment(item->prec_increment) {}
|
||||
|
||||
void fix_length_and_dec_double();
|
||||
void fix_length_and_dec_decimal();
|
||||
void fix_length_and_dec();
|
||||
enum Sumfunctype sum_func () const
|
||||
{
|
||||
@ -963,6 +966,8 @@ public:
|
||||
{}
|
||||
Item_sum_variance(THD *thd, Item_sum_variance *item);
|
||||
enum Sumfunctype sum_func () const { return VARIANCE_FUNC; }
|
||||
void fix_length_and_dec_double();
|
||||
void fix_length_and_dec_decimal();
|
||||
void clear();
|
||||
bool add();
|
||||
double val_real();
|
||||
@ -1041,7 +1046,10 @@ protected:
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
void reset_field();
|
||||
String *val_str(String *);
|
||||
bool keep_field_type(void) const { return 1; }
|
||||
const Type_handler *real_type_handler() const
|
||||
{
|
||||
return get_arg(0)->real_type_handler();
|
||||
}
|
||||
const Type_handler *type_handler() const
|
||||
{ return Type_handler_hybrid_field_type::type_handler(); }
|
||||
enum Item_result result_type () const
|
||||
|
@ -303,8 +303,6 @@ class Item_sum_hybrid_simple : public Item_sum,
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
void reset_field();
|
||||
String *val_str(String *);
|
||||
/* TODO(cvicentiu) copied from Item_sum_hybrid, what does it do? */
|
||||
bool keep_field_type(void) const { return 1; }
|
||||
enum Item_result result_type() const
|
||||
{ return Type_handler_hybrid_field_type::result_type(); }
|
||||
enum Item_result cmp_type() const
|
||||
|
@ -47,6 +47,7 @@ static char *opt_datadir;
|
||||
static char *opt_service;
|
||||
static char *opt_password;
|
||||
static int opt_port;
|
||||
static int opt_innodb_page_size;
|
||||
static char *opt_socket;
|
||||
static char *opt_os_user;
|
||||
static char *opt_os_password;
|
||||
@ -56,6 +57,7 @@ static my_bool opt_skip_networking;
|
||||
static my_bool opt_verbose_bootstrap;
|
||||
static my_bool verbose_errors;
|
||||
|
||||
#define DEFAULT_INNODB_PAGE_SIZE 16*1024
|
||||
|
||||
static struct my_option my_long_options[]=
|
||||
{
|
||||
@ -81,6 +83,8 @@ static struct my_option my_long_options[]=
|
||||
{"skip-networking", 'N', "Do not use TCP connections, use pipe instead",
|
||||
&opt_skip_networking, &opt_skip_networking, 0 , GET_BOOL, OPT_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
{ "innodb-page-size", 'i', "Page size for innodb",
|
||||
&opt_innodb_page_size, &opt_innodb_page_size, 0, GET_INT, REQUIRED_ARG, DEFAULT_INNODB_PAGE_SIZE, 1*1024, 64*1024, 0, 0, 0 },
|
||||
{"silent", 's', "Print less information", &opt_silent,
|
||||
&opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"verbose-bootstrap", 'o', "Include mysqld bootstrap output",&opt_verbose_bootstrap,
|
||||
@ -259,13 +263,13 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size)
|
||||
char basedir[MAX_PATH];
|
||||
get_basedir(basedir, sizeof(basedir), mysqld_path);
|
||||
|
||||
my_snprintf(cmdline, size-1,
|
||||
"\"\"%s\" --no-defaults %s --bootstrap"
|
||||
my_snprintf(cmdline, size - 1,
|
||||
"\"\"%s\" --no-defaults %s --innodb-page-size=%d --bootstrap"
|
||||
" \"--lc-messages-dir=%s/share\""
|
||||
" --basedir=. --datadir=. --default-storage-engine=myisam"
|
||||
" --max_allowed_packet=9M "
|
||||
" --net-buffer-length=16k\"", mysqld_path,
|
||||
opt_verbose_bootstrap?"--console":"", basedir );
|
||||
opt_verbose_bootstrap ? "--console" : "", opt_innodb_page_size, basedir);
|
||||
return cmdline;
|
||||
}
|
||||
|
||||
@ -316,7 +320,10 @@ static int create_myini()
|
||||
{
|
||||
fprintf(myini,"port=%d\n", opt_port);
|
||||
}
|
||||
|
||||
if (opt_innodb_page_size != DEFAULT_INNODB_PAGE_SIZE)
|
||||
{
|
||||
fprintf(myini, "innodb-page-size=%d\n", opt_innodb_page_size);
|
||||
}
|
||||
/* Write out client settings. */
|
||||
fprintf(myini, "[client]\n");
|
||||
|
||||
@ -652,13 +659,6 @@ static int create_db_instance()
|
||||
goto end;
|
||||
}
|
||||
|
||||
/*
|
||||
Remove innodb log files if they exist (this works around "different size logs"
|
||||
error in MSI installation). TODO : remove this with the next Innodb, where
|
||||
different size is handled gracefully.
|
||||
*/
|
||||
DeleteFile("ib_logfile0");
|
||||
DeleteFile("ib_logfile1");
|
||||
|
||||
/* Create my.ini file in data directory.*/
|
||||
ret= create_myini();
|
||||
|
@ -2221,6 +2221,7 @@ void clean_up(bool print_message)
|
||||
#endif
|
||||
wsrep_thr_deinit();
|
||||
my_uuid_end();
|
||||
delete type_handler_data;
|
||||
delete binlog_filter;
|
||||
delete global_rpl_filter;
|
||||
end_ssl();
|
||||
@ -4126,6 +4127,13 @@ static int init_common_variables()
|
||||
sf_malloc_dbug_id= mariadb_dbug_id;
|
||||
#endif
|
||||
|
||||
if (!(type_handler_data= new Type_handler_data) ||
|
||||
type_handler_data->init())
|
||||
{
|
||||
sql_perror("Could not allocate type_handler_data");
|
||||
return 1;
|
||||
}
|
||||
|
||||
max_system_variables.pseudo_thread_id= ~(my_thread_id) 0;
|
||||
server_start_time= flush_status_time= my_time(0);
|
||||
my_disable_copystat_in_redel= 1;
|
||||
|
@ -7291,8 +7291,10 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
|
||||
table_map param_comp= ~(param->prev_tables | param->read_tables |
|
||||
param->current_table);
|
||||
#ifdef HAVE_SPATIAL
|
||||
Field::geometry_type sav_geom_type;
|
||||
if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
|
||||
{
|
||||
sav_geom_type= ((Field_geom*) field_item->field)->geom_type;
|
||||
/* We have to be able to store all sorts of spatial features here */
|
||||
((Field_geom*) field_item->field)->geom_type= Field::GEOM_GEOMETRY;
|
||||
}
|
||||
@ -7323,6 +7325,13 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
|
||||
{
|
||||
((Field_geom*) field_item->field)->geom_type= sav_geom_type;
|
||||
}
|
||||
#endif /*HAVE_SPATIAL*/
|
||||
DBUG_RETURN(ftree);
|
||||
}
|
||||
|
||||
|
@ -1617,16 +1617,14 @@ bool Protocol_binary::send_out_parameters(List<Item_param> *sp_params)
|
||||
if (write())
|
||||
return TRUE;
|
||||
|
||||
/* Restore THD::server_status. */
|
||||
thd->server_status&= ~SERVER_PS_OUT_PARAMS;
|
||||
|
||||
ret= net_send_eof(thd, thd->server_status, 0);
|
||||
|
||||
/*
|
||||
Reset SERVER_MORE_RESULTS_EXISTS bit, because this is the last packet
|
||||
for sure.
|
||||
Reset server_status:
|
||||
- SERVER_MORE_RESULTS_EXISTS bit, because this is the last packet for sure.
|
||||
- Restore SERVER_PS_OUT_PARAMS status.
|
||||
*/
|
||||
thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
|
||||
thd->server_status&= ~(SERVER_PS_OUT_PARAMS | SERVER_MORE_RESULTS_EXISTS);
|
||||
|
||||
return ret ? FALSE : TRUE;
|
||||
}
|
||||
|
@ -1172,7 +1172,7 @@ bool Master_info_index::init_all_master_info()
|
||||
else if (succ_num) // Have some Error and some Success
|
||||
{
|
||||
sql_print_warning("Reading of some Master_info entries failed");
|
||||
DBUG_RETURN(2);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
else // All failed
|
||||
{
|
||||
|
@ -522,7 +522,7 @@ public:
|
||||
}
|
||||
|
||||
int32 get_sql_delay() { return sql_delay; }
|
||||
void set_sql_delay(time_t _sql_delay) { sql_delay= _sql_delay; }
|
||||
void set_sql_delay(int32 _sql_delay) { sql_delay= _sql_delay; }
|
||||
time_t get_sql_delay_end() { return sql_delay_end; }
|
||||
|
||||
private:
|
||||
|
@ -401,7 +401,7 @@ double sys_var::val_real(bool *is_null,
|
||||
switch (show_type())
|
||||
{
|
||||
case_get_string_as_lex_string;
|
||||
case_for_integers(return val);
|
||||
case_for_integers(return (double)val);
|
||||
case_for_double(return val);
|
||||
case SHOW_MY_BOOL: return *(my_bool*)value;
|
||||
default:
|
||||
|
@ -7448,6 +7448,8 @@ ER_GEOJSON_NOT_CLOSED
|
||||
eng "Incorrect GeoJSON format - polygon not closed."
|
||||
ER_JSON_PATH_EMPTY
|
||||
eng "Path expression '$' is not allowed in argument %d to function '%s'."
|
||||
ER_SLAVE_SAME_ID
|
||||
eng "A slave with the same server_uuid/server_id as this slave has connected to the master"
|
||||
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
||||
eng "Illegal parameter data types %s and %s for operation '%s'"
|
||||
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
|
@ -201,6 +201,9 @@ extern "C" sig_handler handle_fatal_signal(int sig)
|
||||
case ABORT_QUERY_HARD:
|
||||
kreason= "ABORT_QUERY";
|
||||
break;
|
||||
case KILL_SLAVE_SAME_ID:
|
||||
kreason= "KILL_SLAVE_SAME_ID";
|
||||
break;
|
||||
}
|
||||
my_safe_printf_stderr("%s", "\n"
|
||||
"Trying to get some variables.\n"
|
||||
|
@ -3445,7 +3445,7 @@ sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi)
|
||||
// The time we will have to sleep before executing the event.
|
||||
unsigned long nap_time= 0;
|
||||
if (sql_delay_end > now)
|
||||
nap_time= sql_delay_end - now;
|
||||
nap_time= (ulong)(sql_delay_end - now);
|
||||
|
||||
DBUG_PRINT("info", ("sql_delay= %lu "
|
||||
"ev->when= %lu "
|
||||
|
@ -372,7 +372,7 @@ Geometry *Geometry::create_from_json(Geometry_buffer *buffer,
|
||||
key_len=0;
|
||||
break;
|
||||
}
|
||||
key_buf[key_len++]= je->s.c_next | 0x20; /* make it lowercase. */
|
||||
key_buf[key_len++]= (uchar)je->s.c_next | 0x20; /* make it lowercase. */
|
||||
}
|
||||
|
||||
if (je->s.error)
|
||||
|
@ -12462,7 +12462,7 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
|
||||
{
|
||||
my_message(ER_UNKNOWN_COM_ERROR, ER_THD(thd, ER_UNKNOWN_COM_ERROR),
|
||||
MYF(0));
|
||||
DBUG_RETURN(packet_error);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
DBUG_PRINT("info", ("client_plugin=%s, restart", client_plugin));
|
||||
|
116
sql/sql_admin.cc
116
sql/sql_admin.cc
@ -295,6 +295,10 @@ static inline bool table_not_corrupt_error(uint sql_errno)
|
||||
sql_errno == ER_WRONG_OBJECT);
|
||||
}
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
// It is counter for debugging fail on second call of open_only_one_table
|
||||
static int debug_fail_counter= 0;
|
||||
#endif
|
||||
|
||||
static bool open_only_one_table(THD* thd, TABLE_LIST* table,
|
||||
bool repair_table_use_frm,
|
||||
@ -319,6 +323,16 @@ static bool open_only_one_table(THD* thd, TABLE_LIST* table,
|
||||
lex->query_tables_last= &table->next_global;
|
||||
lex->query_tables_own_last= 0;
|
||||
|
||||
DBUG_EXECUTE_IF("fail_2call_open_only_one_table", {
|
||||
if (debug_fail_counter)
|
||||
{
|
||||
open_error= TRUE;
|
||||
goto dbug_err;
|
||||
}
|
||||
else
|
||||
debug_fail_counter++;
|
||||
});
|
||||
|
||||
/*
|
||||
CHECK TABLE command is allowed for views as well. Check on alter flags
|
||||
to differentiate from ALTER TABLE...CHECK PARTITION on which view is not
|
||||
@ -378,6 +392,9 @@ static bool open_only_one_table(THD* thd, TABLE_LIST* table,
|
||||
open_error= (thd->open_temporary_tables(table) ||
|
||||
open_and_lock_tables(thd, table, TRUE, 0));
|
||||
}
|
||||
|
||||
dbug_err:
|
||||
|
||||
thd->prepare_derived_at_open= FALSE;
|
||||
|
||||
/*
|
||||
@ -807,59 +824,64 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
repair_table_use_frm, FALSE);
|
||||
thd->open_options&= ~extra_open_options;
|
||||
|
||||
TABLE *tab= table->table;
|
||||
Field **field_ptr= tab->field;
|
||||
if (!lex->column_list)
|
||||
if (!open_error)
|
||||
{
|
||||
bitmap_clear_all(tab->read_set);
|
||||
for (uint fields= 0; *field_ptr; field_ptr++, fields++)
|
||||
TABLE *tab= table->table;
|
||||
Field **field_ptr= tab->field;
|
||||
if (!lex->column_list)
|
||||
{
|
||||
enum enum_field_types type= (*field_ptr)->type();
|
||||
if (type < MYSQL_TYPE_MEDIUM_BLOB ||
|
||||
type > MYSQL_TYPE_BLOB)
|
||||
bitmap_set_bit(tab->read_set, fields);
|
||||
else
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_NO_EIS_FOR_FIELD,
|
||||
ER_THD(thd, ER_NO_EIS_FOR_FIELD),
|
||||
(*field_ptr)->field_name);
|
||||
bitmap_clear_all(tab->read_set);
|
||||
for (uint fields= 0; *field_ptr; field_ptr++, fields++)
|
||||
{
|
||||
enum enum_field_types type= (*field_ptr)->type();
|
||||
if (type < MYSQL_TYPE_MEDIUM_BLOB ||
|
||||
type > MYSQL_TYPE_BLOB)
|
||||
bitmap_set_bit(tab->read_set, fields);
|
||||
else
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_NO_EIS_FOR_FIELD,
|
||||
ER_THD(thd, ER_NO_EIS_FOR_FIELD),
|
||||
(*field_ptr)->field_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int pos;
|
||||
LEX_STRING *column_name;
|
||||
List_iterator_fast<LEX_STRING> it(*lex->column_list);
|
||||
|
||||
bitmap_clear_all(tab->read_set);
|
||||
while ((column_name= it++))
|
||||
{
|
||||
if (tab->s->fieldnames.type_names == 0 ||
|
||||
(pos= find_type(&tab->s->fieldnames, column_name->str,
|
||||
column_name->length, 1)) <= 0)
|
||||
{
|
||||
compl_result_code= result_code= HA_ADMIN_INVALID;
|
||||
break;
|
||||
}
|
||||
pos--;
|
||||
enum enum_field_types type= tab->field[pos]->type();
|
||||
if (type < MYSQL_TYPE_MEDIUM_BLOB ||
|
||||
type > MYSQL_TYPE_BLOB)
|
||||
bitmap_set_bit(tab->read_set, pos);
|
||||
else
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_NO_EIS_FOR_FIELD,
|
||||
ER_THD(thd, ER_NO_EIS_FOR_FIELD),
|
||||
column_name->str);
|
||||
}
|
||||
tab->file->column_bitmaps_signal();
|
||||
}
|
||||
if (!(compl_result_code=
|
||||
alloc_statistics_for_table(thd, table->table)) &&
|
||||
!(compl_result_code=
|
||||
collect_statistics_for_table(thd, table->table)))
|
||||
compl_result_code= update_statistics_for_table(thd, table->table);
|
||||
}
|
||||
else
|
||||
{
|
||||
int pos;
|
||||
LEX_STRING *column_name;
|
||||
List_iterator_fast<LEX_STRING> it(*lex->column_list);
|
||||
compl_result_code= HA_ADMIN_FAILED;
|
||||
|
||||
bitmap_clear_all(tab->read_set);
|
||||
while ((column_name= it++))
|
||||
{
|
||||
if (tab->s->fieldnames.type_names == 0 ||
|
||||
(pos= find_type(&tab->s->fieldnames, column_name->str,
|
||||
column_name->length, 1)) <= 0)
|
||||
{
|
||||
compl_result_code= result_code= HA_ADMIN_INVALID;
|
||||
break;
|
||||
}
|
||||
pos--;
|
||||
enum enum_field_types type= tab->field[pos]->type();
|
||||
if (type < MYSQL_TYPE_MEDIUM_BLOB ||
|
||||
type > MYSQL_TYPE_BLOB)
|
||||
bitmap_set_bit(tab->read_set, pos);
|
||||
else
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_NO_EIS_FOR_FIELD,
|
||||
ER_THD(thd, ER_NO_EIS_FOR_FIELD),
|
||||
column_name->str);
|
||||
}
|
||||
tab->file->column_bitmaps_signal();
|
||||
}
|
||||
if (!open_error &&
|
||||
!(compl_result_code=
|
||||
alloc_statistics_for_table(thd, table->table)) &&
|
||||
!(compl_result_code=
|
||||
collect_statistics_for_table(thd, table->table)))
|
||||
compl_result_code= update_statistics_for_table(thd, table->table);
|
||||
if (compl_result_code)
|
||||
result_code= HA_ADMIN_FAILED;
|
||||
else
|
||||
|
@ -1060,7 +1060,7 @@ next:
|
||||
{
|
||||
/* Try to fix */
|
||||
TABLE_LIST *derived= res->belong_to_derived;
|
||||
if (derived->is_merged_derived())
|
||||
if (derived->is_merged_derived() && !derived->derived->is_excluded())
|
||||
{
|
||||
DBUG_PRINT("info",
|
||||
("convert merged to materialization to resolve the conflict"));
|
||||
|
@ -1828,7 +1828,10 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
|
||||
}
|
||||
if ((my_toupper(system_charset_info, sql[0]) != 'S' ||
|
||||
my_toupper(system_charset_info, sql[1]) != 'E' ||
|
||||
my_toupper(system_charset_info, sql[2]) != 'L'))
|
||||
my_toupper(system_charset_info, sql[2]) != 'L') &&
|
||||
(my_toupper(system_charset_info, sql[0]) != 'W' ||
|
||||
my_toupper(system_charset_info, sql[1]) != 'I' ||
|
||||
my_toupper(system_charset_info, sql[2]) != 'T'))
|
||||
{
|
||||
DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
|
||||
goto err;
|
||||
|
@ -1987,6 +1987,8 @@ int killed_errno(killed_state killed)
|
||||
case KILL_SERVER:
|
||||
case KILL_SERVER_HARD:
|
||||
DBUG_RETURN(ER_SERVER_SHUTDOWN);
|
||||
case KILL_SLAVE_SAME_ID:
|
||||
DBUG_RETURN(ER_SLAVE_SAME_ID);
|
||||
}
|
||||
DBUG_RETURN(0); // Keep compiler happy
|
||||
}
|
||||
|
@ -477,17 +477,23 @@ enum killed_state
|
||||
ABORT_QUERY_HARD= 7,
|
||||
KILL_TIMEOUT= 8,
|
||||
KILL_TIMEOUT_HARD= 9,
|
||||
/*
|
||||
When binlog reading thread connects to the server it kills
|
||||
all the binlog threads with the same ID.
|
||||
*/
|
||||
KILL_SLAVE_SAME_ID= 10,
|
||||
/*
|
||||
All of the following killed states will kill the connection
|
||||
KILL_CONNECTION must be the first of these and it must start with
|
||||
an even number (becasue of HARD bit)!
|
||||
*/
|
||||
KILL_CONNECTION= 10,
|
||||
KILL_CONNECTION_HARD= 11,
|
||||
KILL_SYSTEM_THREAD= 12,
|
||||
KILL_SYSTEM_THREAD_HARD= 13,
|
||||
KILL_SERVER= 14,
|
||||
KILL_SERVER_HARD= 15
|
||||
KILL_CONNECTION= 12,
|
||||
KILL_CONNECTION_HARD= 13,
|
||||
KILL_SYSTEM_THREAD= 14,
|
||||
KILL_SYSTEM_THREAD_HARD= 15,
|
||||
KILL_SERVER= 16,
|
||||
KILL_SERVER_HARD= 17,
|
||||
|
||||
};
|
||||
|
||||
extern int killed_errno(killed_state killed);
|
||||
|
@ -832,7 +832,11 @@ bool init_new_connection_handler_thread()
|
||||
statistic_increment(connection_errors_internal, &LOCK_status);
|
||||
return 1;
|
||||
}
|
||||
DBUG_EXECUTE_IF("simulate_failed_connection_1", return(1); );
|
||||
DBUG_EXECUTE_IF("simulate_failed_connection_1",
|
||||
{
|
||||
DBUG_SET("-d,simulate_failed_connection_1");
|
||||
return(1);
|
||||
});
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,7 @@ int my_wc_mb_utf8_with_escape(CHARSET_INFO *cs, my_wc_t escape, my_wc_t wc,
|
||||
DBUG_ASSERT(escape > 0);
|
||||
if (str + 1 >= end)
|
||||
return MY_CS_TOOSMALL2; // Not enough space, need at least two bytes.
|
||||
*str= escape;
|
||||
*str= (uchar)escape;
|
||||
int cnvres= my_charset_utf8_handler.wc_mb(cs, wc, str + 1, end);
|
||||
if (cnvres > 0)
|
||||
return cnvres + 1; // The character was normally put
|
||||
|
@ -3303,14 +3303,14 @@ uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type)
|
||||
{
|
||||
switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
|
||||
case PLUGIN_VAR_BOOL:
|
||||
thd->sys_var_tmp.my_bool_value= option.def_value;
|
||||
thd->sys_var_tmp.my_bool_value= (my_bool)option.def_value;
|
||||
return (uchar*) &thd->sys_var_tmp.my_bool_value;
|
||||
case PLUGIN_VAR_INT:
|
||||
thd->sys_var_tmp.int_value= option.def_value;
|
||||
thd->sys_var_tmp.int_value= (int)option.def_value;
|
||||
return (uchar*) &thd->sys_var_tmp.int_value;
|
||||
case PLUGIN_VAR_LONG:
|
||||
case PLUGIN_VAR_ENUM:
|
||||
thd->sys_var_tmp.long_value= option.def_value;
|
||||
thd->sys_var_tmp.long_value= (long)option.def_value;
|
||||
return (uchar*) &thd->sys_var_tmp.long_value;
|
||||
case PLUGIN_VAR_LONGLONG:
|
||||
case PLUGIN_VAR_SET:
|
||||
|
@ -1591,7 +1591,7 @@ static int mysql_test_select(Prepared_statement *stmt,
|
||||
*/
|
||||
if (unit->prepare(thd, 0, 0))
|
||||
goto error;
|
||||
if (!lex->describe && !stmt->is_sql_prepare())
|
||||
if (!lex->describe && !thd->lex->analyze_stmt && !stmt->is_sql_prepare())
|
||||
{
|
||||
/* Make copy of item list, as change_columns may change it */
|
||||
List<Item> fields(lex->select_lex.item_list);
|
||||
|
@ -2910,6 +2910,13 @@ err:
|
||||
THD_STAGE_INFO(thd, stage_waiting_to_finalize_termination);
|
||||
RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
|
||||
|
||||
if (info->thd->killed == KILL_SLAVE_SAME_ID)
|
||||
{
|
||||
info->errmsg= "A slave with the same server_uuid/server_id as this slave "
|
||||
"has connected to the master";
|
||||
info->error= ER_SLAVE_SAME_ID;
|
||||
}
|
||||
|
||||
const bool binlog_open = my_b_inited(&log);
|
||||
if (file >= 0)
|
||||
{
|
||||
@ -2921,7 +2928,8 @@ err:
|
||||
thd->variables.max_allowed_packet= old_max_allowed_packet;
|
||||
delete info->fdev;
|
||||
|
||||
if (info->error == ER_MASTER_FATAL_ERROR_READING_BINLOG && binlog_open)
|
||||
if ((info->error == ER_MASTER_FATAL_ERROR_READING_BINLOG ||
|
||||
info->error == ER_SLAVE_SAME_ID) && binlog_open)
|
||||
{
|
||||
/*
|
||||
detailing the fatal error message with coordinates
|
||||
@ -3392,7 +3400,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
|
||||
it will be slow because it will iterate through the list
|
||||
again. We just to do kill the thread ourselves.
|
||||
*/
|
||||
tmp->awake(KILL_QUERY);
|
||||
tmp->awake(KILL_SLAVE_SAME_ID);
|
||||
mysql_mutex_unlock(&tmp->LOCK_thd_data);
|
||||
}
|
||||
}
|
||||
|
@ -6017,7 +6017,7 @@ double matching_candidates_in_table(JOIN_TAB *s, bool with_found_constraint,
|
||||
{
|
||||
TABLE *table= s->table;
|
||||
double sel= table->cond_selectivity;
|
||||
double table_records= table->stat_records();
|
||||
double table_records= (double)table->stat_records();
|
||||
dbl_records= table_records * sel;
|
||||
return dbl_records;
|
||||
}
|
||||
@ -6043,7 +6043,7 @@ double matching_candidates_in_table(JOIN_TAB *s, bool with_found_constraint,
|
||||
if (s->table->quick_condition_rows != s->found_records)
|
||||
records= s->table->quick_condition_rows;
|
||||
|
||||
dbl_records= records;
|
||||
dbl_records= (double)records;
|
||||
return dbl_records;
|
||||
}
|
||||
|
||||
|
239
sql/sql_type.cc
239
sql/sql_type.cc
@ -25,7 +25,6 @@ static Type_handler_short type_handler_short;
|
||||
static Type_handler_long type_handler_long;
|
||||
static Type_handler_int24 type_handler_int24;
|
||||
static Type_handler_year type_handler_year;
|
||||
static Type_handler_float type_handler_float;
|
||||
static Type_handler_time type_handler_time;
|
||||
static Type_handler_time2 type_handler_time2;
|
||||
static Type_handler_date type_handler_date;
|
||||
@ -39,65 +38,59 @@ static Type_handler_tiny_blob type_handler_tiny_blob;
|
||||
static Type_handler_medium_blob type_handler_medium_blob;
|
||||
static Type_handler_long_blob type_handler_long_blob;
|
||||
static Type_handler_blob type_handler_blob;
|
||||
static Type_handler_enum type_handler_enum;
|
||||
static Type_handler_set type_handler_set;
|
||||
|
||||
|
||||
Type_handler_null type_handler_null;
|
||||
Type_handler_row type_handler_row;
|
||||
Type_handler_varchar type_handler_varchar;
|
||||
Type_handler_longlong type_handler_longlong;
|
||||
Type_handler_float type_handler_float;
|
||||
Type_handler_double type_handler_double;
|
||||
Type_handler_newdecimal type_handler_newdecimal;
|
||||
Type_handler_datetime type_handler_datetime;
|
||||
Type_handler_bit type_handler_bit;
|
||||
Type_handler_enum type_handler_enum;
|
||||
Type_handler_set type_handler_set;
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
Type_handler_geometry type_handler_geometry;
|
||||
#endif
|
||||
|
||||
|
||||
Type_aggregator type_aggregator_for_result;
|
||||
Type_aggregator type_aggregator_for_comparison;
|
||||
|
||||
|
||||
class Static_data_initializer
|
||||
bool Type_handler_data::init()
|
||||
{
|
||||
public:
|
||||
static Static_data_initializer m_singleton;
|
||||
Static_data_initializer()
|
||||
{
|
||||
#ifdef HAVE_SPATIAL
|
||||
type_aggregator_for_result.add(&type_handler_geometry,
|
||||
&type_handler_null,
|
||||
&type_handler_geometry);
|
||||
type_aggregator_for_result.add(&type_handler_geometry,
|
||||
&type_handler_geometry,
|
||||
&type_handler_geometry);
|
||||
type_aggregator_for_result.add(&type_handler_geometry,
|
||||
&type_handler_blob,
|
||||
&type_handler_long_blob);
|
||||
type_aggregator_for_result.add(&type_handler_geometry,
|
||||
&type_handler_varchar,
|
||||
&type_handler_long_blob);
|
||||
type_aggregator_for_result.add(&type_handler_geometry,
|
||||
&type_handler_string,
|
||||
&type_handler_long_blob);
|
||||
|
||||
type_aggregator_for_comparison.add(&type_handler_geometry,
|
||||
&type_handler_geometry,
|
||||
&type_handler_geometry);
|
||||
type_aggregator_for_comparison.add(&type_handler_geometry,
|
||||
&type_handler_null,
|
||||
&type_handler_geometry);
|
||||
type_aggregator_for_comparison.add(&type_handler_geometry,
|
||||
&type_handler_long_blob,
|
||||
&type_handler_long_blob);
|
||||
return
|
||||
m_type_aggregator_for_result.add(&type_handler_geometry,
|
||||
&type_handler_null,
|
||||
&type_handler_geometry) ||
|
||||
m_type_aggregator_for_result.add(&type_handler_geometry,
|
||||
&type_handler_geometry,
|
||||
&type_handler_geometry) ||
|
||||
m_type_aggregator_for_result.add(&type_handler_geometry,
|
||||
&type_handler_blob,
|
||||
&type_handler_long_blob) ||
|
||||
m_type_aggregator_for_result.add(&type_handler_geometry,
|
||||
&type_handler_varchar,
|
||||
&type_handler_long_blob) ||
|
||||
m_type_aggregator_for_result.add(&type_handler_geometry,
|
||||
&type_handler_string,
|
||||
&type_handler_long_blob) ||
|
||||
m_type_aggregator_for_comparison.add(&type_handler_geometry,
|
||||
&type_handler_geometry,
|
||||
&type_handler_geometry) ||
|
||||
m_type_aggregator_for_comparison.add(&type_handler_geometry,
|
||||
&type_handler_null,
|
||||
&type_handler_geometry) ||
|
||||
m_type_aggregator_for_comparison.add(&type_handler_geometry,
|
||||
&type_handler_long_blob,
|
||||
&type_handler_long_blob);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
Static_data_initializer Static_data_initializer::m_singleton;
|
||||
|
||||
Type_handler_data *type_handler_data= NULL;
|
||||
|
||||
|
||||
void Type_std_attributes::set(const Field *field)
|
||||
@ -293,7 +286,8 @@ Type_handler_hybrid_field_type::aggregate_for_result(const Type_handler *other)
|
||||
Type_handler::aggregate_for_result_traditional(m_type_handler, other);
|
||||
return false;
|
||||
}
|
||||
other= type_aggregator_for_result.find_handler(m_type_handler, other);
|
||||
other= type_handler_data->
|
||||
m_type_aggregator_for_result.find_handler(m_type_handler, other);
|
||||
if (!other)
|
||||
return true;
|
||||
m_type_handler= other;
|
||||
@ -407,7 +401,8 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h)
|
||||
if (!m_type_handler->is_traditional_type() ||
|
||||
!h->is_traditional_type())
|
||||
{
|
||||
h= type_aggregator_for_comparison.find_handler(m_type_handler, h);
|
||||
h= type_handler_data->
|
||||
m_type_aggregator_for_comparison.find_handler(m_type_handler, h);
|
||||
if (!h)
|
||||
return true;
|
||||
m_type_handler= h;
|
||||
@ -1398,6 +1393,166 @@ bool Type_handler_temporal_result::
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
bool Type_handler_int_result::
|
||||
Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const
|
||||
{
|
||||
item->fix_length_and_dec_decimal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_decimal_result::
|
||||
Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const
|
||||
{
|
||||
item->fix_length_and_dec_decimal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_temporal_result::
|
||||
Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const
|
||||
{
|
||||
item->fix_length_and_dec_decimal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_real_result::
|
||||
Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const
|
||||
{
|
||||
item->fix_length_and_dec_double();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_string_result::
|
||||
Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const
|
||||
{
|
||||
item->fix_length_and_dec_double();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
bool Type_handler_geometry::
|
||||
Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const
|
||||
{
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
type_handler_geometry.name().ptr(), "sum");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
bool Type_handler_int_result::
|
||||
Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const
|
||||
{
|
||||
item->fix_length_and_dec_decimal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_decimal_result::
|
||||
Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const
|
||||
{
|
||||
item->fix_length_and_dec_decimal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_temporal_result::
|
||||
Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const
|
||||
{
|
||||
item->fix_length_and_dec_decimal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_real_result::
|
||||
Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const
|
||||
{
|
||||
item->fix_length_and_dec_double();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_string_result::
|
||||
Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const
|
||||
{
|
||||
item->fix_length_and_dec_double();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
bool Type_handler_geometry::
|
||||
Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const
|
||||
{
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
type_handler_geometry.name().ptr(), "avg");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
bool Type_handler_int_result::
|
||||
Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const
|
||||
{
|
||||
item->fix_length_and_dec_decimal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_decimal_result::
|
||||
Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const
|
||||
{
|
||||
item->fix_length_and_dec_decimal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_temporal_result::
|
||||
Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const
|
||||
{
|
||||
item->fix_length_and_dec_decimal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_real_result::
|
||||
Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const
|
||||
{
|
||||
item->fix_length_and_dec_double();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_string_result::
|
||||
Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const
|
||||
{
|
||||
item->fix_length_and_dec_double();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
bool Type_handler_geometry::
|
||||
Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const
|
||||
{
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
type_handler_geometry.name().ptr(), item->func_name());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
String *
|
||||
|
@ -28,6 +28,9 @@ class Field;
|
||||
class Item;
|
||||
class Item_cache;
|
||||
class Item_sum_hybrid;
|
||||
class Item_sum_sum;
|
||||
class Item_sum_avg;
|
||||
class Item_sum_variance;
|
||||
class Item_func_hex;
|
||||
class Item_hybrid_func;
|
||||
class Item_func_min_max;
|
||||
@ -403,6 +406,11 @@ public:
|
||||
Item **items,
|
||||
uint nitems) const= 0;
|
||||
virtual bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const= 0;
|
||||
virtual bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const= 0;
|
||||
virtual bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const= 0;
|
||||
virtual
|
||||
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const= 0;
|
||||
|
||||
virtual String *Item_func_hex_val_str_ascii(Item_func_hex *item,
|
||||
String *str) const= 0;
|
||||
|
||||
@ -540,6 +548,21 @@ public:
|
||||
DBUG_ASSERT(0);
|
||||
return true;
|
||||
}
|
||||
bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return true;
|
||||
}
|
||||
bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return true;
|
||||
}
|
||||
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return true;
|
||||
}
|
||||
String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
@ -662,6 +685,9 @@ public:
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
|
||||
Item **items, uint nitems) const;
|
||||
bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
|
||||
bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
|
||||
bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
|
||||
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
|
||||
String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
|
||||
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
|
||||
String *) const;
|
||||
@ -709,6 +735,9 @@ public:
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
|
||||
Item **items, uint nitems) const;
|
||||
bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
|
||||
bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
|
||||
bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
|
||||
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
|
||||
String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
|
||||
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
|
||||
String *) const;
|
||||
@ -754,6 +783,9 @@ public:
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
|
||||
Item **items, uint nitems) const;
|
||||
bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
|
||||
bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
|
||||
bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
|
||||
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
|
||||
String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
|
||||
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
|
||||
String *) const;
|
||||
@ -799,6 +831,9 @@ public:
|
||||
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
|
||||
bool set_comparator_func(Arg_comparator *cmp) const;
|
||||
bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
|
||||
bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
|
||||
bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
|
||||
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
|
||||
String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
|
||||
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
|
||||
String *) const;
|
||||
@ -860,6 +895,9 @@ public:
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
|
||||
Item **items, uint nitems) const;
|
||||
bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
|
||||
bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
|
||||
bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
|
||||
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
|
||||
String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
|
||||
String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
|
||||
String *) const;
|
||||
@ -1307,6 +1345,9 @@ public:
|
||||
bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const;
|
||||
bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const;
|
||||
bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const;
|
||||
bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
|
||||
bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
|
||||
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
|
||||
};
|
||||
|
||||
extern Type_handler_geometry type_handler_geometry;
|
||||
@ -1409,29 +1450,19 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
This class is used for Item_type_holder, which preserves real_type.
|
||||
*/
|
||||
class Type_handler_hybrid_real_field_type:
|
||||
public Type_handler_hybrid_field_type
|
||||
{
|
||||
public:
|
||||
Type_handler_hybrid_real_field_type(enum_field_types type)
|
||||
:Type_handler_hybrid_field_type(Type_handler::
|
||||
get_handler_by_real_type(type))
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
extern Type_handler_row type_handler_row;
|
||||
extern Type_handler_null type_handler_null;
|
||||
extern Type_handler_varchar type_handler_varchar;
|
||||
extern Type_handler_longlong type_handler_longlong;
|
||||
extern Type_handler_float type_handler_float;
|
||||
extern Type_handler_double type_handler_double;
|
||||
extern Type_handler_newdecimal type_handler_newdecimal;
|
||||
extern Type_handler_datetime type_handler_datetime;
|
||||
extern Type_handler_longlong type_handler_longlong;
|
||||
extern Type_handler_bit type_handler_bit;
|
||||
extern Type_handler_enum type_handler_enum;
|
||||
extern Type_handler_set type_handler_set;
|
||||
|
||||
|
||||
class Type_aggregator
|
||||
{
|
||||
@ -1481,7 +1512,16 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
extern Type_aggregator type_aggregator_for_result;
|
||||
extern Type_aggregator type_aggregator_for_comparison;
|
||||
|
||||
class Type_handler_data
|
||||
{
|
||||
public:
|
||||
Type_aggregator m_type_aggregator_for_result;
|
||||
Type_aggregator m_type_aggregator_for_comparison;
|
||||
bool init();
|
||||
};
|
||||
|
||||
|
||||
extern Type_handler_data *type_handler_data;
|
||||
|
||||
#endif /* SQL_TYPE_H_INCLUDED */
|
||||
|
@ -5227,7 +5227,7 @@ int default_regex_flags_pcre(const THD *thd)
|
||||
int i, res;
|
||||
for (i= res= 0; default_regex_flags_to_pcre[i]; i++)
|
||||
{
|
||||
if (src & (1 << i))
|
||||
if (src & (1ULL << i))
|
||||
res|= default_regex_flags_to_pcre[i];
|
||||
}
|
||||
return res;
|
||||
|
@ -58,7 +58,7 @@ static bool make_empty_rec(THD *, uchar *, uint, List<Create_field> &, uint,
|
||||
static uchar *extra2_write_len(uchar *pos, size_t len)
|
||||
{
|
||||
if (len <= 255)
|
||||
*pos++= len;
|
||||
*pos++= (uchar)len;
|
||||
else
|
||||
{
|
||||
/*
|
||||
|
@ -376,6 +376,27 @@ unsigned int ha_archive::pack_row_v1(uchar *record)
|
||||
uchar *pos;
|
||||
DBUG_ENTER("pack_row_v1");
|
||||
memcpy(record_buffer->buffer, record, table->s->reclength);
|
||||
|
||||
/*
|
||||
The end of VARCHAR fields are filled with garbage,so here
|
||||
we explicitly set the end of the VARCHAR fields with zeroes
|
||||
*/
|
||||
|
||||
for (Field** field= table->field; (*field) ; field++)
|
||||
{
|
||||
Field *fld= *field;
|
||||
if (fld->type() == MYSQL_TYPE_VARCHAR)
|
||||
{
|
||||
if (!(fld->is_real_null(record - table->record[0])))
|
||||
{
|
||||
ptrdiff_t start= (fld->ptr - table->record[0]);
|
||||
Field_varstring *const field_var= (Field_varstring *)fld;
|
||||
uint offset= field_var->data_length() + field_var->length_size();
|
||||
memset(record_buffer->buffer + start + offset, 0,
|
||||
fld->field_length - offset + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
pos= record_buffer->buffer + table->s->reclength;
|
||||
for (blob= table->s->blob_field, end= blob + table->s->blob_fields;
|
||||
blob != end; blob++)
|
||||
|
@ -71,7 +71,6 @@ SET(INNOBASE_SOURCES
|
||||
fsp/fsp0file.cc
|
||||
fsp/fsp0space.cc
|
||||
fsp/fsp0sysspace.cc
|
||||
fut/fut0fut.cc
|
||||
fut/fut0lst.cc
|
||||
ha/ha0ha.cc
|
||||
ha/ha0storage.cc
|
||||
@ -155,7 +154,6 @@ SET(INNOBASE_SOURCES
|
||||
trx/trx0trx.cc
|
||||
trx/trx0undo.cc
|
||||
usr/usr0sess.cc
|
||||
ut/ut0byte.cc
|
||||
ut/ut0crc32.cc
|
||||
ut/ut0dbg.cc
|
||||
ut/ut0list.cc
|
||||
|
@ -28,10 +28,6 @@ Created 6/2/1994 Heikki Tuuri
|
||||
#include "btr0btr.h"
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "btr0btr.ic"
|
||||
#endif
|
||||
|
||||
#include "fsp0sysspace.h"
|
||||
#include "page0page.h"
|
||||
#include "page0zip.h"
|
||||
@ -55,6 +51,7 @@ Created 6/2/1994 Heikki Tuuri
|
||||
Checks if the page in the cursor can be merged with given page.
|
||||
If necessary, re-organize the merge_page.
|
||||
@return true if possible to merge. */
|
||||
static
|
||||
bool
|
||||
btr_can_merge_with_page(
|
||||
/*====================*/
|
||||
@ -5313,6 +5310,7 @@ node_ptr_fails:
|
||||
/**************************************************************//**
|
||||
Do an index level validation of spaital index tree.
|
||||
@return true if no error found */
|
||||
static
|
||||
bool
|
||||
btr_validate_spatial_index(
|
||||
/*=======================*/
|
||||
@ -5414,6 +5412,7 @@ btr_validate_index(
|
||||
Checks if the page in the cursor can be merged with given page.
|
||||
If necessary, re-organize the merge_page.
|
||||
@return true if possible to merge. */
|
||||
static
|
||||
bool
|
||||
btr_can_merge_with_page(
|
||||
/*====================*/
|
||||
|
@ -44,11 +44,6 @@ Created 10/16/1994 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "btr0cur.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "btr0cur.ic"
|
||||
#endif
|
||||
|
||||
#include "row0upd.h"
|
||||
#include "mtr0log.h"
|
||||
#include "page0page.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2016, 2017, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
@ -25,11 +25,6 @@ Created 2/23/1996 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "btr0pcur.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "btr0pcur.ic"
|
||||
#endif
|
||||
|
||||
#include "ut0byte.h"
|
||||
#include "rem0cmp.h"
|
||||
#include "trx0trx.h"
|
||||
@ -466,6 +461,7 @@ alphabetical position of the cursor is guaranteed to be sensible on
|
||||
return, but it may happen that the cursor is not positioned on the last
|
||||
record of any page, because the structure of the tree may have changed
|
||||
during the time when the cursor had no latches. */
|
||||
static
|
||||
void
|
||||
btr_pcur_move_backward_from_page(
|
||||
/*=============================*/
|
||||
|
@ -143,7 +143,7 @@ btr_scrub_lock_dict_func(ulint space, bool lock_to_close_table,
|
||||
"WARNING: %s:%u waited %lu seconds for"
|
||||
" dict_sys lock, space: %lu"
|
||||
" lock_to_close_table: %u\n",
|
||||
file, line, now - start, space,
|
||||
file, line, (unsigned long)(now - start), space,
|
||||
lock_to_close_table);
|
||||
|
||||
last = now;
|
||||
|
@ -33,10 +33,6 @@ Created 2/17/1996 Heikki Tuuri
|
||||
|
||||
#include "btr0sea.h"
|
||||
#ifdef BTR_CUR_HASH_ADAPT
|
||||
#ifdef UNIV_NONINL
|
||||
#include "btr0sea.ic"
|
||||
#endif /* UNIV_NOINL */
|
||||
|
||||
#include "buf0buf.h"
|
||||
#include "page0page.h"
|
||||
#include "page0cur.h"
|
||||
@ -568,12 +564,6 @@ btr_search_update_block_hash_info(
|
||||
block->left_side = info->left_side;
|
||||
}
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
if (cursor->index->table->does_not_fit_in_memory) {
|
||||
block->n_hash_helps = 0;
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
if ((block->n_hash_helps > page_get_n_recs(block->frame)
|
||||
/ BTR_SEARCH_PAGE_BUILD_LIMIT)
|
||||
&& (info->n_hash_potential >= BTR_SEARCH_BUILD_LIMIT)) {
|
||||
|
@ -24,9 +24,6 @@ Created December 2006 by Marko Makela
|
||||
*******************************************************/
|
||||
|
||||
#include "buf0buddy.h"
|
||||
#ifdef UNIV_NONINL
|
||||
# include "buf0buddy.ic"
|
||||
#endif
|
||||
#include "buf0buf.h"
|
||||
#include "buf0lru.h"
|
||||
#include "buf0flu.h"
|
||||
|
@ -37,9 +37,6 @@ Created 11/5/1995 Heikki Tuuri
|
||||
#include "buf0buf.h"
|
||||
#include "os0api.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "buf0buf.ic"
|
||||
#endif
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
#include "string.h"
|
||||
#include "mach0data.h"
|
||||
@ -1836,6 +1833,7 @@ buf_pool_set_sizes(void)
|
||||
/********************************************************************//**
|
||||
Initialize a buffer pool instance.
|
||||
@return DB_SUCCESS if all goes well. */
|
||||
static
|
||||
ulint
|
||||
buf_pool_init_instance(
|
||||
/*===================*/
|
||||
@ -2695,6 +2693,7 @@ buf_pool_resize_chunk_make_null(buf_chunk_t** new_chunks)
|
||||
|
||||
/** Resize the buffer pool based on srv_buf_pool_size from
|
||||
srv_buf_pool_old_size. */
|
||||
static
|
||||
void
|
||||
buf_pool_resize()
|
||||
{
|
||||
@ -3451,6 +3450,7 @@ hash_lock and reacquire it.
|
||||
@param[in] page_id page id
|
||||
@param[in,out] hash_lock hash_lock currently latched
|
||||
@return NULL if watch set, block if the page is in the buffer pool */
|
||||
static
|
||||
buf_page_t*
|
||||
buf_pool_watch_set(
|
||||
const page_id_t& page_id,
|
||||
@ -6286,6 +6286,17 @@ buf_all_freed_instance(
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/** Refreshes the statistics used to print per-second averages.
|
||||
@param[in,out] buf_pool buffer pool instance */
|
||||
static
|
||||
void
|
||||
buf_refresh_io_stats(
|
||||
buf_pool_t* buf_pool)
|
||||
{
|
||||
buf_pool->last_printout_time = ut_time();
|
||||
buf_pool->old_stat = buf_pool->stat;
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Invalidates file pages in one buffer pool instance */
|
||||
static
|
||||
@ -6729,6 +6740,7 @@ buf_print(void)
|
||||
/*********************************************************************//**
|
||||
Returns the number of latched pages in the buffer pool.
|
||||
@return number of latched pages */
|
||||
static
|
||||
ulint
|
||||
buf_get_latched_pages_number_instance(
|
||||
/*==================================*/
|
||||
@ -7073,6 +7085,7 @@ buf_stats_get_pool_info(
|
||||
|
||||
/*********************************************************************//**
|
||||
Prints info of the buffer i/o. */
|
||||
static
|
||||
void
|
||||
buf_print_io_instance(
|
||||
/*==================*/
|
||||
@ -7226,17 +7239,6 @@ buf_print_io(
|
||||
ut_free(pool_info);
|
||||
}
|
||||
|
||||
/**********************************************************************//**
|
||||
Refreshes the statistics used to print per-second averages. */
|
||||
void
|
||||
buf_refresh_io_stats(
|
||||
/*=================*/
|
||||
buf_pool_t* buf_pool) /*!< in: buffer pool instance */
|
||||
{
|
||||
buf_pool->last_printout_time = ut_time();
|
||||
buf_pool->old_stat = buf_pool->stat;
|
||||
}
|
||||
|
||||
/**********************************************************************//**
|
||||
Refreshes the statistics used to print per-second averages. */
|
||||
void
|
||||
|
@ -26,11 +26,6 @@ Created 2011/12/19
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
#include "buf0dblwr.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "buf0buf.ic"
|
||||
#endif
|
||||
|
||||
#include "buf0buf.h"
|
||||
#include "buf0checksum.h"
|
||||
#include "srv0start.h"
|
||||
|
@ -30,11 +30,6 @@ Created 11/11/1995 Heikki Tuuri
|
||||
#include <my_dbug.h>
|
||||
|
||||
#include "buf0flu.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "buf0flu.ic"
|
||||
#endif
|
||||
|
||||
#include "buf0buf.h"
|
||||
#include "buf0mtflu.h"
|
||||
#include "buf0checksum.h"
|
||||
@ -2318,29 +2313,6 @@ buf_flush_LRU_list(
|
||||
|
||||
return(n.flushed);
|
||||
}
|
||||
/*********************************************************************//**
|
||||
Clears up tail of the LRU lists:
|
||||
* Put replaceable pages at the tail of LRU to the free list
|
||||
* Flush dirty pages at the tail of LRU to the disk
|
||||
The depth to which we scan each buffer pool is controlled by dynamic
|
||||
config parameter innodb_LRU_scan_depth.
|
||||
@return total pages flushed */
|
||||
ulint
|
||||
buf_flush_LRU_lists(void)
|
||||
/*=====================*/
|
||||
{
|
||||
ulint n_flushed = 0;
|
||||
for (ulint i = 0; i < srv_buf_pool_instances; i++) {
|
||||
|
||||
n_flushed += buf_flush_LRU_list(buf_pool_from_array(i));
|
||||
}
|
||||
|
||||
if (n_flushed) {
|
||||
buf_flush_stats(0, n_flushed);
|
||||
}
|
||||
|
||||
return(n_flushed);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Wait for any possible LRU flushes that are in progress to end. */
|
||||
@ -3720,6 +3692,7 @@ buf_pool_get_dirty_pages_count(
|
||||
/******************************************************************//**
|
||||
Check if there are any dirty pages that belong to a space id in the flush list.
|
||||
@return number of dirty pages present in all the buffer pools */
|
||||
static
|
||||
ulint
|
||||
buf_flush_get_dirty_pages_count(
|
||||
/*============================*/
|
||||
|
@ -24,10 +24,6 @@ Created 11/5/1995 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "buf0lru.h"
|
||||
#ifdef UNIV_NONINL
|
||||
#include "buf0lru.ic"
|
||||
#endif /* UNIV_NOINL */
|
||||
|
||||
#include "ut0byte.h"
|
||||
#include "ut0rnd.h"
|
||||
#include "sync0rw.h"
|
||||
@ -629,14 +625,6 @@ rescan:
|
||||
processed = 0;
|
||||
}
|
||||
|
||||
#ifdef DBUG_OFF
|
||||
if (flush) {
|
||||
DBUG_EXECUTE_IF("ib_export_flush_crash",
|
||||
static ulint n_pages;
|
||||
if (++n_pages == 4) {DBUG_SUICIDE();});
|
||||
}
|
||||
#endif /* DBUG_OFF */
|
||||
|
||||
/* The check for trx is interrupted is expensive, we want
|
||||
to check every N iterations. */
|
||||
if (!processed && trx && trx_is_interrupted(trx)) {
|
||||
@ -1660,55 +1648,6 @@ buf_unzip_LRU_add_block(
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Adds a block to the LRU list end. Please make sure that the page_size is
|
||||
already set when invoking the function, so that we can get correct
|
||||
page_size from the buffer page when adding a block into LRU */
|
||||
static
|
||||
void
|
||||
buf_LRU_add_block_to_end_low(
|
||||
/*=========================*/
|
||||
buf_page_t* bpage) /*!< in: control block */
|
||||
{
|
||||
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
|
||||
|
||||
ut_ad(buf_pool_mutex_own(buf_pool));
|
||||
|
||||
ut_a(buf_page_in_file(bpage));
|
||||
|
||||
ut_ad(!bpage->in_LRU_list);
|
||||
UT_LIST_ADD_LAST(buf_pool->LRU, bpage);
|
||||
ut_d(bpage->in_LRU_list = TRUE);
|
||||
|
||||
incr_LRU_size_in_bytes(bpage, buf_pool);
|
||||
|
||||
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
|
||||
|
||||
ut_ad(buf_pool->LRU_old);
|
||||
|
||||
/* Adjust the length of the old block list if necessary */
|
||||
|
||||
buf_page_set_old(bpage, TRUE);
|
||||
buf_pool->LRU_old_len++;
|
||||
buf_LRU_old_adjust_len(buf_pool);
|
||||
|
||||
} else if (UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN) {
|
||||
|
||||
/* The LRU list is now long enough for LRU_old to become
|
||||
defined: init it */
|
||||
|
||||
buf_LRU_old_init(buf_pool);
|
||||
} else {
|
||||
buf_page_set_old(bpage, buf_pool->LRU_old != NULL);
|
||||
}
|
||||
|
||||
/* If this is a zipped block with decompressed frame as well
|
||||
then put it on the unzip_LRU list */
|
||||
if (buf_page_belongs_to_unzip_LRU(bpage)) {
|
||||
buf_unzip_LRU_add_block((buf_block_t*) bpage, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Adds a block to the LRU list. Please make sure that the page_size is
|
||||
already set when invoking the function, so that we can get correct
|
||||
@ -1817,17 +1756,6 @@ buf_LRU_make_block_young(
|
||||
buf_LRU_add_block_low(bpage, FALSE);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Moves a block to the end of the LRU list. */
|
||||
void
|
||||
buf_LRU_make_block_old(
|
||||
/*===================*/
|
||||
buf_page_t* bpage) /*!< in: control block */
|
||||
{
|
||||
buf_LRU_remove_block(bpage);
|
||||
buf_LRU_add_block_to_end_low(bpage);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Try to free a block. If bpage is a descriptor of a compressed-only
|
||||
page, the descriptor object will be freed as well.
|
||||
@ -2714,6 +2642,7 @@ buf_LRU_validate(void)
|
||||
#if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
|
||||
/**********************************************************************//**
|
||||
Prints the LRU list for one buffer pool instance. */
|
||||
static
|
||||
void
|
||||
buf_LRU_print_instance(
|
||||
/*===================*/
|
||||
|
@ -27,11 +27,6 @@ Created 5/30/1994 Heikki Tuuri
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "data0data.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "data0data.ic"
|
||||
#endif
|
||||
|
||||
#include "rem0rec.h"
|
||||
#include "rem0cmp.h"
|
||||
#include "page0page.h"
|
||||
@ -45,11 +40,6 @@ Created 5/30/1994 Heikki Tuuri
|
||||
debug version, dtuple_create() will make all fields of dtuple_t point
|
||||
to data_error. */
|
||||
byte data_error;
|
||||
|
||||
# ifndef UNIV_DEBUG_VALGRIND
|
||||
/** this is used to fool the compiler in dtuple_validate */
|
||||
ulint data_dummy;
|
||||
# endif /* !UNIV_DEBUG_VALGRIND */
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/** Compare two data tuples.
|
||||
@ -126,6 +116,7 @@ dfield_check_typed_no_assert(
|
||||
/**********************************************************//**
|
||||
Checks that a data tuple is typed.
|
||||
@return TRUE if ok */
|
||||
static
|
||||
ibool
|
||||
dtuple_check_typed_no_assert(
|
||||
/*=========================*/
|
||||
@ -233,10 +224,6 @@ dtuple_validate(
|
||||
ulint j;
|
||||
|
||||
for (j = 0; j < len; j++) {
|
||||
|
||||
data_dummy += *data; /* fool the compiler not
|
||||
to optimize out this
|
||||
code */
|
||||
data++;
|
||||
}
|
||||
#endif /* !UNIV_DEBUG_VALGRIND */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
@ -28,10 +28,6 @@ Created 1/16/1996 Heikki Tuuri
|
||||
|
||||
#include "data0type.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "data0type.ic"
|
||||
#endif
|
||||
|
||||
/* At the database startup we store the default-charset collation number of
|
||||
this MySQL installation to this global variable. If we have < 4.1.2 format
|
||||
column definitions, or records in the insert buffer, we use this
|
||||
@ -161,12 +157,11 @@ dtype_validate(
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Prints a data type structure. */
|
||||
#ifdef UNIV_DEBUG
|
||||
/** Print a data type structure.
|
||||
@param[in] type data type */
|
||||
void
|
||||
dtype_print(
|
||||
/*========*/
|
||||
const dtype_t* type) /*!< in: type */
|
||||
dtype_print(const dtype_t* type)
|
||||
{
|
||||
ulint mtype;
|
||||
ulint prtype;
|
||||
@ -278,3 +273,4 @@ dtype_print(
|
||||
|
||||
fprintf(stderr, " len %lu", (ulong) len);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2016, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
@ -27,11 +27,6 @@ Created 4/18/1996 Heikki Tuuri
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "dict0boot.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "dict0boot.ic"
|
||||
#endif
|
||||
|
||||
#include "dict0crea.h"
|
||||
#include "btr0btr.h"
|
||||
#include "dict0load.h"
|
||||
|
@ -26,11 +26,6 @@ Created 1/8/1996 Heikki Tuuri
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "dict0crea.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "dict0crea.ic"
|
||||
#endif
|
||||
|
||||
#include "btr0pcur.h"
|
||||
#include "btr0btr.h"
|
||||
#include "page0page.h"
|
||||
@ -1702,7 +1697,7 @@ dict_create_or_check_foreign_constraint_tables(void)
|
||||
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE, TRUE);
|
||||
}
|
||||
|
||||
ib::warn() << "Creating foreign key constraint system tables.";
|
||||
ib::info() << "Creating foreign key constraint system tables.";
|
||||
|
||||
/* NOTE: in dict_load_foreigns we use the fact that
|
||||
there are 2 secondary indexes on SYS_FOREIGN, and they
|
||||
@ -1767,10 +1762,6 @@ dict_create_or_check_foreign_constraint_tables(void)
|
||||
|
||||
srv_file_per_table = srv_file_per_table_backup;
|
||||
|
||||
if (err == DB_SUCCESS) {
|
||||
ib::info() << "Foreign key constraint system tables created";
|
||||
}
|
||||
|
||||
/* Note: The master thread has not been started at this point. */
|
||||
/* Confirm and move to the non-LRU part of the table LRU list. */
|
||||
sys_foreign_err = dict_check_if_system_table_exists(
|
||||
@ -1875,10 +1866,6 @@ dict_create_or_check_sys_virtual()
|
||||
|
||||
srv_file_per_table = srv_file_per_table_backup;
|
||||
|
||||
if (err == DB_SUCCESS) {
|
||||
ib::info() << "sys_virtual table created";
|
||||
}
|
||||
|
||||
/* Note: The master thread has not been started at this point. */
|
||||
/* Confirm and move to the non-LRU part of the table LRU list. */
|
||||
dberr_t sys_virtual_err = dict_check_if_system_table_exists(
|
||||
@ -2543,7 +2530,6 @@ dict_create_or_check_sys_tablespace(void)
|
||||
srv_file_per_table = srv_file_per_table_backup;
|
||||
|
||||
if (err == DB_SUCCESS) {
|
||||
ib::info() << "Tablespace and datafile system tables created.";
|
||||
srv_sys_tablespaces_open = true;
|
||||
}
|
||||
|
||||
|
@ -31,10 +31,6 @@ Created 25/08/2016 Jan Lindström
|
||||
#include "srv0start.h"
|
||||
#include "ut0new.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
# include "dict0stats_bg.ic"
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
static ib_mutex_t defrag_pool_mutex;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user