mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
This commit is contained in:
@@ -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}")
|
||||
|
||||
8
debian/rules
vendored
8
debian/rules
vendored
@@ -162,12 +162,12 @@ override_dh_auto_install:
|
||||
install -D -m 644 debian/mariadb-server-10.2.py $(TMP)/usr/share/apport/package-hooks/source_mariadb-10.2.py
|
||||
|
||||
# Install libmariadbclient18 compatibility links
|
||||
ln -s $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadbclient.so.18
|
||||
ln -s /usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadbclient.so.18
|
||||
|
||||
# Install libmysqlclientclientXX compatibility links
|
||||
ln -s $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.18
|
||||
ln -s $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.19
|
||||
ln -s $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.20
|
||||
ln -s /usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.18
|
||||
ln -s /usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.19
|
||||
ln -s /usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.20
|
||||
|
||||
touch $@
|
||||
|
||||
|
||||
@@ -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,32 @@ 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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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,28 @@ 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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)))
|
||||
|
||||
@@ -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. */
|
||||
@@ -2800,9 +2819,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;
|
||||
|
||||
@@ -2201,10 +2201,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 +2218,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 +2289,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 +3102,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 +3473,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(),
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3302,14 +3302,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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -5206,7 +5206,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;
|
||||
|
||||
@@ -37,11 +37,6 @@ Created 1/8/1996 Heikki Tuuri
|
||||
#include "fil0fil.h"
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "dict0dict.ic"
|
||||
#include "dict0priv.ic"
|
||||
#endif
|
||||
|
||||
/** dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records */
|
||||
dict_index_t* dict_ind_redundant;
|
||||
|
||||
@@ -793,6 +788,7 @@ dict_table_autoinc_lock(
|
||||
|
||||
/** Acquire the zip_pad_mutex latch.
|
||||
@param[in,out] index the index whose zip_pad_mutex to acquire.*/
|
||||
static
|
||||
void
|
||||
dict_index_zip_pad_lock(
|
||||
dict_index_t* index)
|
||||
@@ -5393,23 +5389,6 @@ try_find_index:
|
||||
goto loop;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
Determines whether a string starts with the specified keyword.
|
||||
@return TRUE if str starts with keyword */
|
||||
ibool
|
||||
dict_str_starts_with_keyword(
|
||||
/*=========================*/
|
||||
THD* thd, /*!< in: MySQL thread handle */
|
||||
const char* str, /*!< in: string to scan for keyword */
|
||||
const char* keyword) /*!< in: keyword to look for */
|
||||
{
|
||||
CHARSET_INFO* cs = innobase_get_charset(thd);
|
||||
ibool success;
|
||||
|
||||
dict_accept(cs, str, keyword, &success);
|
||||
return(success);
|
||||
}
|
||||
|
||||
/** Scans a table create SQL string and adds to the data dictionary
|
||||
the foreign key constraints declared in the string. This function
|
||||
should be called after the indexes for a table have been created.
|
||||
|
||||
@@ -28,9 +28,6 @@ Created 4/24/1996 Heikki Tuuri
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "dict0load.h"
|
||||
#ifdef UNIV_NONINL
|
||||
#include "dict0load.ic"
|
||||
#endif
|
||||
|
||||
#include "mysql_version.h"
|
||||
#include "btr0pcur.h"
|
||||
@@ -92,22 +89,116 @@ dict_load_table_one(
|
||||
dict_err_ignore_t ignore_err,
|
||||
dict_names_t& fk_tables);
|
||||
|
||||
/** Loads a table definition from a SYS_TABLES record to dict_table_t.
|
||||
Does not load any columns or indexes.
|
||||
/** Load a table definition from a SYS_TABLES record to dict_table_t.
|
||||
Do not load any columns or indexes.
|
||||
@param[in] name Table name
|
||||
@param[in] rec SYS_TABLES record
|
||||
@param[out,own] table Table, or NULL
|
||||
@return error message, or NULL on success */
|
||||
@param[out,own] table table, or NULL
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_table_low(
|
||||
table_name_t& name,
|
||||
const rec_t* rec,
|
||||
dict_table_t** table);
|
||||
dict_load_table_low(table_name_t& name, const rec_t* rec, dict_table_t** table)
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
|
||||
/** Load an index definition from a SYS_INDEXES record to dict_index_t.
|
||||
If allocate=TRUE, we will create a dict_index_t structure and fill it
|
||||
accordingly. If allocated=FALSE, the dict_index_t will be supplied by
|
||||
the caller and filled with information read from the record.
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_index_low(
|
||||
byte* table_id, /*!< in/out: table id (8 bytes),
|
||||
an "in" value if allocate=TRUE
|
||||
and "out" when allocate=FALSE */
|
||||
const char* table_name, /*!< in: table name */
|
||||
mem_heap_t* heap, /*!< in/out: temporary memory heap */
|
||||
const rec_t* rec, /*!< in: SYS_INDEXES record */
|
||||
ibool allocate, /*!< in: TRUE=allocate *index,
|
||||
FALSE=fill in a pre-allocated
|
||||
*index */
|
||||
dict_index_t** index); /*!< out,own: index, or NULL */
|
||||
|
||||
/** Load a table column definition from a SYS_COLUMNS record to dict_table_t.
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_column_low(
|
||||
dict_table_t* table, /*!< in/out: table, could be NULL
|
||||
if we just populate a dict_column_t
|
||||
struct with information from
|
||||
a SYS_COLUMNS record */
|
||||
mem_heap_t* heap, /*!< in/out: memory heap
|
||||
for temporary storage */
|
||||
dict_col_t* column, /*!< out: dict_column_t to fill,
|
||||
or NULL if table != NULL */
|
||||
table_id_t* table_id, /*!< out: table id */
|
||||
const char** col_name, /*!< out: column name */
|
||||
const rec_t* rec, /*!< in: SYS_COLUMNS record */
|
||||
ulint* nth_v_col); /*!< out: if not NULL, this
|
||||
records the "n" of "nth" virtual
|
||||
column */
|
||||
|
||||
/** Load a virtual column "mapping" (to base columns) information
|
||||
from a SYS_VIRTUAL record
|
||||
@param[in,out] table table
|
||||
@param[in,out] heap memory heap
|
||||
@param[in,out] column mapped base column's dict_column_t
|
||||
@param[in,out] table_id table id
|
||||
@param[in,out] pos virtual column position
|
||||
@param[in,out] base_pos base column position
|
||||
@param[in] rec SYS_VIRTUAL record
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_virtual_low(
|
||||
dict_table_t* table,
|
||||
mem_heap_t* heap,
|
||||
dict_col_t** column,
|
||||
table_id_t* table_id,
|
||||
ulint* pos,
|
||||
ulint* base_pos,
|
||||
const rec_t* rec);
|
||||
|
||||
/** Load an index field definition from a SYS_FIELDS record to dict_index_t.
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_field_low(
|
||||
byte* index_id, /*!< in/out: index id (8 bytes)
|
||||
an "in" value if index != NULL
|
||||
and "out" if index == NULL */
|
||||
dict_index_t* index, /*!< in/out: index, could be NULL
|
||||
if we just populate a dict_field_t
|
||||
struct with information from
|
||||
a SYS_FIELDS record */
|
||||
dict_field_t* sys_field, /*!< out: dict_field_t to be
|
||||
filled */
|
||||
ulint* pos, /*!< out: Field position */
|
||||
byte* last_index_id, /*!< in: last index id */
|
||||
mem_heap_t* heap, /*!< in/out: memory heap
|
||||
for temporary storage */
|
||||
const rec_t* rec); /*!< in: SYS_FIELDS record */
|
||||
|
||||
/** Load a table definition from a SYS_TABLES record to dict_table_t.
|
||||
Do not load any columns or indexes.
|
||||
@param[in] name Table name
|
||||
@param[in] rec SYS_TABLES record
|
||||
@param[out,own] table table, or NULL
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_table_low(table_name_t& name, const rec_t* rec, dict_table_t** table);
|
||||
|
||||
/* If this flag is TRUE, then we will load the cluster index's (and tables')
|
||||
metadata even if it is marked as "corrupted". */
|
||||
my_bool srv_load_corrupted = FALSE;
|
||||
my_bool srv_load_corrupted;
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
/****************************************************************//**
|
||||
@@ -427,6 +518,7 @@ dict_process_sys_virtual_rec(
|
||||
|
||||
return(err_msg);
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
This function parses a SYS_FIELDS record and populates a dict_field_t
|
||||
structure with the information from the record.
|
||||
@@ -1315,13 +1407,12 @@ dict_check_tablespaces_and_store_max_id(
|
||||
/** Error message for a delete-marked record in dict_load_column_low() */
|
||||
static const char* dict_load_column_del = "delete-marked record in SYS_COLUMN";
|
||||
|
||||
/********************************************************************//**
|
||||
Loads a table column definition from a SYS_COLUMNS record to
|
||||
dict_table_t.
|
||||
@return error message, or NULL on success */
|
||||
/** Load a table column definition from a SYS_COLUMNS record to dict_table_t.
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_column_low(
|
||||
/*=================*/
|
||||
dict_table_t* table, /*!< in/out: table, could be NULL
|
||||
if we just populate a dict_column_t
|
||||
struct with information from
|
||||
@@ -1484,7 +1575,7 @@ err_len:
|
||||
/** Error message for a delete-marked record in dict_load_virtual_low() */
|
||||
static const char* dict_load_virtual_del = "delete-marked record in SYS_VIRTUAL";
|
||||
|
||||
/** Loads a virtual column "mapping" (to base columns) information
|
||||
/** Load a virtual column "mapping" (to base columns) information
|
||||
from a SYS_VIRTUAL record
|
||||
@param[in,out] table table
|
||||
@param[in,out] heap memory heap
|
||||
@@ -1493,7 +1584,9 @@ from a SYS_VIRTUAL record
|
||||
@param[in,out] pos virtual column position
|
||||
@param[in,out] base_pos base column position
|
||||
@param[in] rec SYS_VIRTUAL record
|
||||
@return error message, or NULL on success */
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_virtual_low(
|
||||
dict_table_t* table,
|
||||
@@ -1569,6 +1662,7 @@ err_len:
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
Loads definitions for table columns. */
|
||||
static
|
||||
@@ -1798,13 +1892,12 @@ dict_load_virtual(
|
||||
/** Error message for a delete-marked record in dict_load_field_low() */
|
||||
static const char* dict_load_field_del = "delete-marked record in SYS_FIELDS";
|
||||
|
||||
/********************************************************************//**
|
||||
Loads an index field definition from a SYS_FIELDS record to
|
||||
dict_index_t.
|
||||
@return error message, or NULL on success */
|
||||
/** Load an index field definition from a SYS_FIELDS record to dict_index_t.
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_field_low(
|
||||
/*================*/
|
||||
byte* index_id, /*!< in/out: index id (8 bytes)
|
||||
an "in" value if index != NULL
|
||||
and "out" if index == NULL */
|
||||
@@ -1999,15 +2092,15 @@ static const char* dict_load_index_del = "delete-marked record in SYS_INDEXES";
|
||||
/** Error message for table->id mismatch in dict_load_index_low() */
|
||||
static const char* dict_load_index_id_err = "SYS_INDEXES.TABLE_ID mismatch";
|
||||
|
||||
/********************************************************************//**
|
||||
Loads an index definition from a SYS_INDEXES record to dict_index_t.
|
||||
/** Load an index definition from a SYS_INDEXES record to dict_index_t.
|
||||
If allocate=TRUE, we will create a dict_index_t structure and fill it
|
||||
accordingly. If allocated=FALSE, the dict_index_t will be supplied by
|
||||
the caller and filled with information read from the record. @return
|
||||
error message, or NULL on success */
|
||||
the caller and filled with information read from the record.
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_index_low(
|
||||
/*================*/
|
||||
byte* table_id, /*!< in/out: table id (8 bytes),
|
||||
an "in" value if allocate=TRUE
|
||||
and "out" when allocate=FALSE */
|
||||
@@ -2422,18 +2515,16 @@ func_exit:
|
||||
return(error);
|
||||
}
|
||||
|
||||
/** Loads a table definition from a SYS_TABLES record to dict_table_t.
|
||||
Does not load any columns or indexes.
|
||||
/** Load a table definition from a SYS_TABLES record to dict_table_t.
|
||||
Do not load any columns or indexes.
|
||||
@param[in] name Table name
|
||||
@param[in] rec SYS_TABLES record
|
||||
@param[out,own] table table, or NULL
|
||||
@return error message, or NULL on success */
|
||||
@return error message
|
||||
@retval NULL on success */
|
||||
static
|
||||
const char*
|
||||
dict_load_table_low(
|
||||
table_name_t& name,
|
||||
const rec_t* rec,
|
||||
dict_table_t** table)
|
||||
dict_load_table_low(table_name_t& name, const rec_t* rec, dict_table_t** table)
|
||||
{
|
||||
table_id_t table_id;
|
||||
ulint space_id;
|
||||
@@ -2471,6 +2562,7 @@ table->data_dir_path and replace the 'databasename/tablename.ibd'
|
||||
portion with 'tablename'.
|
||||
This allows SHOW CREATE TABLE to return the correct DATA DIRECTORY path.
|
||||
Make this data directory path only if it has not yet been saved. */
|
||||
static
|
||||
void
|
||||
dict_save_data_dir_path(
|
||||
/*====================*/
|
||||
|
||||
@@ -29,11 +29,6 @@ Created 1/8/1996 Heikki Tuuri
|
||||
#include <mysql_com.h>
|
||||
|
||||
#include "dict0mem.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "dict0mem.ic"
|
||||
#endif
|
||||
|
||||
#include "rem0rec.h"
|
||||
#include "data0type.h"
|
||||
#include "mach0data.h"
|
||||
|
||||
@@ -925,6 +925,7 @@ is relatively quick and is used to calculate transient statistics that
|
||||
are not saved on disk.
|
||||
This was the only way to calculate statistics before the
|
||||
Persistent Statistics feature was introduced. */
|
||||
static
|
||||
void
|
||||
dict_stats_update_transient(
|
||||
/*========================*/
|
||||
@@ -1083,7 +1084,7 @@ dict_stats_analyze_index_level(
|
||||
on the desired level. */
|
||||
|
||||
btr_pcur_open_at_index_side(
|
||||
true, index, BTR_SEARCH_TREE | BTR_ALREADY_S_LATCHED,
|
||||
true, index, BTR_SEARCH_TREE_ALREADY_S_LATCHED,
|
||||
&pcur, true, level, mtr);
|
||||
btr_pcur_move_to_next_on_page(&pcur);
|
||||
|
||||
@@ -1700,7 +1701,7 @@ dict_stats_analyze_index_for_n_prefix(
|
||||
on the desired level. */
|
||||
|
||||
btr_pcur_open_at_index_side(
|
||||
true, index, BTR_SEARCH_TREE | BTR_ALREADY_S_LATCHED,
|
||||
true, index, BTR_SEARCH_TREE_ALREADY_S_LATCHED,
|
||||
&pcur, true, n_diff_data->level, mtr);
|
||||
btr_pcur_move_to_next_on_page(&pcur);
|
||||
|
||||
|
||||
@@ -32,10 +32,6 @@ Created Apr 25, 2012 Vasil Dimov
|
||||
#include "srv0start.h"
|
||||
#include "ut0new.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
# include "dict0stats_bg.ic"
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
/** Minimum time interval between stats recalc for a given table */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@@ -25,11 +25,6 @@ Created 12/29/1997 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "eval0eval.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "eval0eval.ic"
|
||||
#endif
|
||||
|
||||
#include "data0data.h"
|
||||
#include "row0sel.h"
|
||||
#include "rem0cmp.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1998, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 1998, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@@ -25,10 +25,6 @@ Created 1/20/1998 Heikki Tuuri
|
||||
|
||||
#include "eval0proc.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "eval0proc.ic"
|
||||
#endif
|
||||
|
||||
/**********************************************************************//**
|
||||
Performs an execution step of an if-statement node.
|
||||
@return query thread to run next or NULL */
|
||||
|
||||
@@ -156,14 +156,10 @@ initialized. */
|
||||
fil_system_t* fil_system = NULL;
|
||||
|
||||
/** Determine if user has explicitly disabled fsync(). */
|
||||
#ifndef _WIN32
|
||||
# define fil_buffering_disabled(s) \
|
||||
((s)->purpose == FIL_TYPE_TABLESPACE \
|
||||
&& srv_unix_file_flush_method \
|
||||
== SRV_UNIX_O_DIRECT_NO_FSYNC)
|
||||
#else /* _WIN32 */
|
||||
# define fil_buffering_disabled(s) (0)
|
||||
#endif /* __WIN32 */
|
||||
&& srv_file_flush_method \
|
||||
== SRV_O_DIRECT_NO_FSYNC)
|
||||
|
||||
/** Determine if the space id is a user tablespace id or not.
|
||||
@param[in] space_id Space ID to check
|
||||
|
||||
@@ -27,11 +27,6 @@ Created 11/29/1995 Heikki Tuuri
|
||||
#include "ha_prototypes.h"
|
||||
|
||||
#include "fsp0fsp.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "fsp0fsp.ic"
|
||||
#endif
|
||||
|
||||
#include "buf0buf.h"
|
||||
#include "fil0fil.h"
|
||||
#include "fil0crypt.h"
|
||||
@@ -499,6 +494,7 @@ try to add new extents to the space free list
|
||||
@param[in] page_size page size
|
||||
@param[in,out] mtr mini-transaction
|
||||
@return the extent descriptor */
|
||||
MY_ATTRIBUTE((warn_unused_result))
|
||||
static
|
||||
xdes_t*
|
||||
xdes_get_descriptor(
|
||||
@@ -3533,126 +3529,6 @@ fseg_get_first_extent(
|
||||
: xdes_lst_get_descriptor(space, page_size, first, mtr));
|
||||
}
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
/*******************************************************************//**
|
||||
Validates a segment.
|
||||
@return TRUE if ok */
|
||||
static
|
||||
ibool
|
||||
fseg_validate_low(
|
||||
/*==============*/
|
||||
fseg_inode_t* inode, /*!< in: segment inode */
|
||||
mtr_t* mtr2) /*!< in/out: mini-transaction */
|
||||
{
|
||||
ulint space_id;
|
||||
ib_id_t seg_id;
|
||||
mtr_t mtr;
|
||||
fil_addr_t node_addr;
|
||||
ulint n_used = 0;
|
||||
ulint n_used2 = 0;
|
||||
|
||||
ut_ad(mtr_memo_contains_page(mtr2, inode, MTR_MEMO_PAGE_SX_FIX));
|
||||
ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
|
||||
|
||||
space_id = page_get_space_id(page_align(inode));
|
||||
|
||||
seg_id = mach_read_from_8(inode + FSEG_ID);
|
||||
n_used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED,
|
||||
MLOG_4BYTES, mtr2);
|
||||
flst_validate(inode + FSEG_FREE, mtr2);
|
||||
flst_validate(inode + FSEG_NOT_FULL, mtr2);
|
||||
flst_validate(inode + FSEG_FULL, mtr2);
|
||||
|
||||
/* Validate FSEG_FREE list */
|
||||
node_addr = flst_get_first(inode + FSEG_FREE, mtr2);
|
||||
|
||||
while (!fil_addr_is_null(node_addr)) {
|
||||
mtr_start(&mtr);
|
||||
const fil_space_t* space = mtr_x_lock_space(
|
||||
space_id, &mtr);
|
||||
const xdes_t* descr = xdes_lst_get_descriptor(
|
||||
space, page_size_t(space->flags), node_addr, &mtr);
|
||||
|
||||
ut_a(xdes_get_n_used(descr, &mtr) == 0);
|
||||
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
|
||||
ut_a(mach_read_from_8(descr + XDES_ID) == seg_id);
|
||||
|
||||
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
|
||||
mtr_commit(&mtr);
|
||||
}
|
||||
|
||||
/* Validate FSEG_NOT_FULL list */
|
||||
|
||||
node_addr = flst_get_first(inode + FSEG_NOT_FULL, mtr2);
|
||||
|
||||
while (!fil_addr_is_null(node_addr)) {
|
||||
mtr_start(&mtr);
|
||||
const fil_space_t* space = mtr_x_lock_space(
|
||||
space_id, &mtr);
|
||||
const xdes_t* descr = xdes_lst_get_descriptor(
|
||||
space, page_size_t(space->flags), node_addr, &mtr);
|
||||
|
||||
ut_a(xdes_get_n_used(descr, &mtr) > 0);
|
||||
ut_a(xdes_get_n_used(descr, &mtr) < FSP_EXTENT_SIZE);
|
||||
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
|
||||
ut_a(mach_read_from_8(descr + XDES_ID) == seg_id);
|
||||
|
||||
n_used2 += xdes_get_n_used(descr, &mtr);
|
||||
|
||||
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
|
||||
mtr_commit(&mtr);
|
||||
}
|
||||
|
||||
/* Validate FSEG_FULL list */
|
||||
|
||||
node_addr = flst_get_first(inode + FSEG_FULL, mtr2);
|
||||
|
||||
while (!fil_addr_is_null(node_addr)) {
|
||||
mtr_start(&mtr);
|
||||
const fil_space_t* space = mtr_x_lock_space(
|
||||
space_id, &mtr);
|
||||
const xdes_t* descr = xdes_lst_get_descriptor(
|
||||
space, page_size_t(space->flags), node_addr, &mtr);
|
||||
|
||||
ut_a(xdes_get_n_used(descr, &mtr) == FSP_EXTENT_SIZE);
|
||||
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
|
||||
ut_a(mach_read_from_8(descr + XDES_ID) == seg_id);
|
||||
|
||||
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
|
||||
mtr_commit(&mtr);
|
||||
}
|
||||
|
||||
ut_a(n_used == n_used2);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Validates a segment.
|
||||
@return TRUE if ok */
|
||||
ibool
|
||||
fseg_validate(
|
||||
/*==========*/
|
||||
fseg_header_t* header, /*!< in: segment header */
|
||||
mtr_t* mtr) /*!< in/out: mini-transaction */
|
||||
{
|
||||
fseg_inode_t* inode;
|
||||
ibool ret;
|
||||
ulint space_id;
|
||||
|
||||
space_id = page_get_space_id(page_align(header));
|
||||
|
||||
const fil_space_t* space = mtr_x_lock_space(space_id, mtr);
|
||||
const page_size_t page_size(space->flags);
|
||||
|
||||
inode = fseg_inode_get(header, space_id, page_size, mtr);
|
||||
|
||||
ret = fseg_validate_low(inode, mtr);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
#ifdef UNIV_BTR_PRINT
|
||||
/*******************************************************************//**
|
||||
Writes info of a segment. */
|
||||
|
||||
@@ -55,6 +55,23 @@ fts_ast_node_create(void)
|
||||
return(node);
|
||||
}
|
||||
|
||||
/** Track node allocations, in case there is an error during parsing. */
|
||||
static
|
||||
void
|
||||
fts_ast_state_add_node(
|
||||
fts_ast_state_t*state, /*!< in: ast instance */
|
||||
fts_ast_node_t* node) /*!< in: node to add to ast */
|
||||
{
|
||||
if (!state->list.head) {
|
||||
ut_a(!state->list.tail);
|
||||
|
||||
state->list.head = state->list.tail = node;
|
||||
} else {
|
||||
state->list.tail->next_alloc = node;
|
||||
state->list.tail = node;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Create a operator fts_ast_node_t.
|
||||
@return new node */
|
||||
@@ -379,25 +396,6 @@ fts_ast_add_node(
|
||||
return(node);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
For tracking node allocations, in case there is an error during
|
||||
parsing. */
|
||||
void
|
||||
fts_ast_state_add_node(
|
||||
/*===================*/
|
||||
fts_ast_state_t*state, /*!< in: ast instance */
|
||||
fts_ast_node_t* node) /*!< in: node to add to ast */
|
||||
{
|
||||
if (!state->list.head) {
|
||||
ut_a(!state->list.tail);
|
||||
|
||||
state->list.head = state->list.tail = node;
|
||||
} else {
|
||||
state->list.tail->next_alloc = node;
|
||||
state->list.tail = node;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Set the wildcard attribute of a term. */
|
||||
void
|
||||
@@ -469,6 +467,20 @@ fts_ast_state_free(
|
||||
state->root = state->list.head = state->list.tail = NULL;
|
||||
}
|
||||
|
||||
/** Print the ast string
|
||||
@param[in] str string to print */
|
||||
static
|
||||
void
|
||||
fts_ast_string_print(
|
||||
const fts_ast_string_t* ast_str)
|
||||
{
|
||||
for (ulint i = 0; i < ast_str->len; ++i) {
|
||||
printf("%c", ast_str->str[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Print an ast node recursively. */
|
||||
static
|
||||
@@ -770,48 +782,7 @@ fts_ast_string_to_ul(
|
||||
NULL, base));
|
||||
}
|
||||
|
||||
/**
|
||||
Print the ast string
|
||||
@param[in] str string to print */
|
||||
void
|
||||
fts_ast_string_print(
|
||||
const fts_ast_string_t* ast_str)
|
||||
{
|
||||
for (ulint i = 0; i < ast_str->len; ++i) {
|
||||
printf("%c", ast_str->str[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
const char*
|
||||
fts_ast_oper_name_get(fts_ast_oper_t oper)
|
||||
{
|
||||
switch(oper) {
|
||||
case FTS_NONE:
|
||||
return("FTS_NONE");
|
||||
case FTS_IGNORE:
|
||||
return("FTS_IGNORE");
|
||||
case FTS_EXIST:
|
||||
return("FTS_EXIST");
|
||||
case FTS_NEGATE:
|
||||
return("FTS_NEGATE");
|
||||
case FTS_INCR_RATING:
|
||||
return("FTS_INCR_RATING");
|
||||
case FTS_DECR_RATING:
|
||||
return("FTS_DECR_RATING");
|
||||
case FTS_DISTANCE:
|
||||
return("FTS_DISTANCE");
|
||||
case FTS_IGNORE_SKIP:
|
||||
return("FTS_IGNORE_SKIP");
|
||||
case FTS_EXIST_SKIP:
|
||||
return("FTS_EXIST_SKIP");
|
||||
}
|
||||
ut_ad(0);
|
||||
return("FTS_UNKNOWN");
|
||||
}
|
||||
|
||||
const char*
|
||||
fts_ast_node_type_get(fts_ast_type_t type)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@@ -28,11 +28,6 @@ Created 2007/5/9 Sunny Bains
|
||||
|
||||
#include "fts0priv.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "fts0types.ic"
|
||||
#include "fts0vlc.ic"
|
||||
#endif
|
||||
|
||||
/******************************************************************//**
|
||||
Callback function for fetching the config value.
|
||||
@return always returns TRUE */
|
||||
@@ -296,6 +291,7 @@ fts_config_set_index_value(
|
||||
return(error);
|
||||
}
|
||||
|
||||
#ifdef FTS_OPTIMIZE_DEBUG
|
||||
/******************************************************************//**
|
||||
Get an ulint value from the config table.
|
||||
@return DB_SUCCESS if all OK else error code */
|
||||
@@ -367,6 +363,7 @@ fts_config_set_index_ulint(
|
||||
|
||||
return(error);
|
||||
}
|
||||
#endif /* FTS_OPTIMIZE_DEBUG */
|
||||
|
||||
/******************************************************************//**
|
||||
Get an ulint value from the config table.
|
||||
@@ -439,118 +436,3 @@ fts_config_set_ulint(
|
||||
return(error);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Increment the value in the config table for column name.
|
||||
@return DB_SUCCESS or error code */
|
||||
dberr_t
|
||||
fts_config_increment_value(
|
||||
/*=======================*/
|
||||
trx_t* trx, /*!< transaction */
|
||||
fts_table_t* fts_table, /*!< in: the indexed
|
||||
FTS table */
|
||||
const char* name, /*!< in: increment config value
|
||||
for this parameter name */
|
||||
ulint delta) /*!< in: increment by this
|
||||
much */
|
||||
{
|
||||
dberr_t error;
|
||||
fts_string_t value;
|
||||
que_t* graph = NULL;
|
||||
ulint name_len = strlen(name);
|
||||
pars_info_t* info = pars_info_create();
|
||||
char table_name[MAX_FULL_NAME_LEN];
|
||||
|
||||
/* We set the length of value to the max bytes it can hold. This
|
||||
information is used by the callback that reads the value.*/
|
||||
value.f_len = FTS_MAX_CONFIG_VALUE_LEN;
|
||||
value.f_str = static_cast<byte*>(ut_malloc_nokey(value.f_len + 1));
|
||||
|
||||
*value.f_str = '\0';
|
||||
|
||||
pars_info_bind_varchar_literal(info, "name", (byte*) name, name_len);
|
||||
|
||||
pars_info_bind_function(
|
||||
info, "my_func", fts_config_fetch_value, &value);
|
||||
|
||||
fts_table->suffix = "CONFIG";
|
||||
fts_get_table_name(fts_table, table_name);
|
||||
pars_info_bind_id(info, true, "config_table", table_name);
|
||||
|
||||
graph = fts_parse_sql(
|
||||
fts_table, info,
|
||||
"DECLARE FUNCTION my_func;\n"
|
||||
"DECLARE CURSOR c IS SELECT value FROM $config_table"
|
||||
" WHERE key = :name FOR UPDATE;\n"
|
||||
"BEGIN\n"
|
||||
""
|
||||
"OPEN c;\n"
|
||||
"WHILE 1 = 1 LOOP\n"
|
||||
" FETCH c INTO my_func();\n"
|
||||
" IF c % NOTFOUND THEN\n"
|
||||
" EXIT;\n"
|
||||
" END IF;\n"
|
||||
"END LOOP;\n"
|
||||
"CLOSE c;");
|
||||
|
||||
trx->op_info = "read FTS config value";
|
||||
|
||||
error = fts_eval_sql(trx, graph);
|
||||
|
||||
fts_que_graph_free_check_lock(fts_table, NULL, graph);
|
||||
|
||||
if (UNIV_UNLIKELY(error == DB_SUCCESS)) {
|
||||
ulint int_value;
|
||||
|
||||
int_value = strtoul((char*) value.f_str, NULL, 10);
|
||||
|
||||
int_value += delta;
|
||||
|
||||
ut_a(FTS_MAX_CONFIG_VALUE_LEN > FTS_MAX_INT_LEN);
|
||||
|
||||
value.f_len = my_snprintf(
|
||||
(char*) value.f_str, FTS_MAX_INT_LEN, "%lu", int_value);
|
||||
|
||||
fts_config_set_value(trx, fts_table, name, &value);
|
||||
}
|
||||
|
||||
if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
|
||||
|
||||
ib::error() << "(" << ut_strerr(error) << ") while"
|
||||
" incrementing " << name << ".";
|
||||
}
|
||||
|
||||
ut_free(value.f_str);
|
||||
|
||||
return(error);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Increment the per index value in the config table for column name.
|
||||
@return DB_SUCCESS or error code */
|
||||
dberr_t
|
||||
fts_config_increment_index_value(
|
||||
/*=============================*/
|
||||
trx_t* trx, /*!< transaction */
|
||||
dict_index_t* index, /*!< in: FTS index */
|
||||
const char* param, /*!< in: increment config value
|
||||
for this parameter name */
|
||||
ulint delta) /*!< in: increment by this
|
||||
much */
|
||||
{
|
||||
char* name;
|
||||
dberr_t error;
|
||||
fts_table_t fts_table;
|
||||
|
||||
FTS_INIT_FTS_TABLE(&fts_table, "CONFIG", FTS_COMMON_TABLE,
|
||||
index->table);
|
||||
|
||||
/* We are responsible for free'ing name. */
|
||||
name = fts_config_create_index_param_name(param, index);
|
||||
|
||||
error = fts_config_increment_value(trx, &fts_table, name, delta);
|
||||
|
||||
ut_free(name);
|
||||
|
||||
return(error);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,8 +76,8 @@ ulong fts_min_token_size;
|
||||
|
||||
|
||||
// FIXME: testing
|
||||
ib_time_t elapsed_time = 0;
|
||||
ulint n_nodes = 0;
|
||||
static ib_time_t elapsed_time = 0;
|
||||
static ulint n_nodes = 0;
|
||||
|
||||
#ifdef FTS_CACHE_SIZE_DEBUG
|
||||
/** The cache size permissible lower limit (1K) */
|
||||
@@ -149,20 +149,6 @@ struct fts_aux_table_t {
|
||||
char* name; /*!< Name of the table */
|
||||
};
|
||||
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
/** Template for creating the FTS auxiliary index specific tables. This is
|
||||
mainly designed for the statistics work in the future */
|
||||
static const char* fts_create_index_tables_sql = {
|
||||
"BEGIN\n"
|
||||
""
|
||||
"CREATE TABLE $doc_id_table (\n"
|
||||
" doc_id BIGINT UNSIGNED,\n"
|
||||
" word_count INTEGER UNSIGNED NOT NULL\n"
|
||||
") COMPACT;\n"
|
||||
"CREATE UNIQUE CLUSTERED INDEX IND ON $doc_id_table(doc_id);\n"
|
||||
};
|
||||
#endif
|
||||
|
||||
/** FTS auxiliary table suffixes that are common to all FT indexes. */
|
||||
const char* fts_common_tables[] = {
|
||||
"BEING_DELETED",
|
||||
@@ -255,22 +241,6 @@ fts_add_doc_by_id(
|
||||
doc_id_t doc_id, /*!< in: doc id */
|
||||
ib_vector_t* fts_indexes MY_ATTRIBUTE((unused)));
|
||||
/*!< in: affected fts indexes */
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
/****************************************************************//**
|
||||
Check whether a particular word (term) exists in the FTS index.
|
||||
@return DB_SUCCESS if all went fine */
|
||||
static
|
||||
dberr_t
|
||||
fts_is_word_in_index(
|
||||
/*=================*/
|
||||
trx_t* trx, /*!< in: FTS query state */
|
||||
que_t** graph, /*!< out: Query graph */
|
||||
fts_table_t* fts_table, /*!< in: table instance */
|
||||
const fts_string_t* word, /*!< in: the word to check */
|
||||
ibool* found) /*!< out: TRUE if exists */
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
/******************************************************************//**
|
||||
Update the last document id. This function could create a new
|
||||
transaction to update the last document id.
|
||||
@@ -285,6 +255,62 @@ fts_update_sync_doc_id(
|
||||
trx_t* trx) /*!< in: update trx, or NULL */
|
||||
MY_ATTRIBUTE((nonnull(1)));
|
||||
|
||||
/** Tokenize a document.
|
||||
@param[in,out] doc document to tokenize
|
||||
@param[out] result tokenization result
|
||||
@param[in] parser pluggable parser */
|
||||
static
|
||||
void
|
||||
fts_tokenize_document(
|
||||
fts_doc_t* doc,
|
||||
fts_doc_t* result,
|
||||
st_mysql_ftparser* parser);
|
||||
|
||||
/** Continue to tokenize a document.
|
||||
@param[in,out] doc document to tokenize
|
||||
@param[in] add_pos add this position to all tokens from this tokenization
|
||||
@param[out] result tokenization result
|
||||
@param[in] parser pluggable parser */
|
||||
static
|
||||
void
|
||||
fts_tokenize_document_next(
|
||||
fts_doc_t* doc,
|
||||
ulint add_pos,
|
||||
fts_doc_t* result,
|
||||
st_mysql_ftparser* parser);
|
||||
|
||||
/** Create the vector of fts_get_doc_t instances.
|
||||
@param[in,out] cache fts cache
|
||||
@return vector of fts_get_doc_t instances */
|
||||
static
|
||||
ib_vector_t*
|
||||
fts_get_docs_create(
|
||||
fts_cache_t* cache);
|
||||
|
||||
/** Free the FTS cache.
|
||||
@param[in,out] cache to be freed */
|
||||
static
|
||||
void
|
||||
fts_cache_destroy(fts_cache_t* cache)
|
||||
{
|
||||
rw_lock_free(&cache->lock);
|
||||
rw_lock_free(&cache->init_lock);
|
||||
mutex_free(&cache->optimize_lock);
|
||||
mutex_free(&cache->deleted_lock);
|
||||
mutex_free(&cache->doc_id_lock);
|
||||
os_event_destroy(cache->sync->event);
|
||||
|
||||
if (cache->stopword_info.cached_stopword) {
|
||||
rbt_free(cache->stopword_info.cached_stopword);
|
||||
}
|
||||
|
||||
if (cache->sync_heap->arg) {
|
||||
mem_heap_free(static_cast<mem_heap_t*>(cache->sync_heap->arg));
|
||||
}
|
||||
|
||||
mem_heap_free(cache->cache_heap);
|
||||
}
|
||||
|
||||
/** Get a character set based on precise type.
|
||||
@param prtype precise type
|
||||
@return the corresponding character set */
|
||||
@@ -1153,31 +1179,6 @@ fts_get_index_get_doc(
|
||||
}
|
||||
#endif
|
||||
|
||||
/**********************************************************************//**
|
||||
Free the FTS cache. */
|
||||
void
|
||||
fts_cache_destroy(
|
||||
/*==============*/
|
||||
fts_cache_t* cache) /*!< in: cache*/
|
||||
{
|
||||
rw_lock_free(&cache->lock);
|
||||
rw_lock_free(&cache->init_lock);
|
||||
mutex_free(&cache->optimize_lock);
|
||||
mutex_free(&cache->deleted_lock);
|
||||
mutex_free(&cache->doc_id_lock);
|
||||
os_event_destroy(cache->sync->event);
|
||||
|
||||
if (cache->stopword_info.cached_stopword) {
|
||||
rbt_free(cache->stopword_info.cached_stopword);
|
||||
}
|
||||
|
||||
if (cache->sync_heap->arg) {
|
||||
mem_heap_free(static_cast<mem_heap_t*>(cache->sync_heap->arg));
|
||||
}
|
||||
|
||||
mem_heap_free(cache->cache_heap);
|
||||
}
|
||||
|
||||
/**********************************************************************//**
|
||||
Find an existing word, or if not found, create one and return it.
|
||||
@return specified word token */
|
||||
@@ -1608,6 +1609,7 @@ fts_drop_common_tables(
|
||||
Since we do a horizontal split on the index table, we need to drop
|
||||
all the split tables.
|
||||
@return DB_SUCCESS or error code */
|
||||
static
|
||||
dberr_t
|
||||
fts_drop_index_split_tables(
|
||||
/*========================*/
|
||||
@@ -1649,43 +1651,7 @@ fts_drop_index_tables(
|
||||
trx_t* trx, /*!< in: transaction */
|
||||
dict_index_t* index) /*!< in: Index to drop */
|
||||
{
|
||||
dberr_t error = DB_SUCCESS;
|
||||
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
fts_table_t fts_table;
|
||||
static const char* index_tables[] = {
|
||||
"DOC_ID",
|
||||
NULL
|
||||
};
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
dberr_t err = fts_drop_index_split_tables(trx, index);
|
||||
|
||||
/* We only return the status of the last error. */
|
||||
if (err != DB_SUCCESS) {
|
||||
error = err;
|
||||
}
|
||||
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
FTS_INIT_INDEX_TABLE(&fts_table, NULL, FTS_INDEX_TABLE, index);
|
||||
|
||||
for (ulint i = 0; index_tables[i] != NULL; ++i) {
|
||||
char table_name[MAX_FULL_NAME_LEN];
|
||||
|
||||
fts_table.suffix = index_tables[i];
|
||||
|
||||
fts_get_table_name(&fts_table, table_name);
|
||||
|
||||
err = fts_drop_table(trx, table_name);
|
||||
|
||||
/* We only return the status of the last error. */
|
||||
if (err != DB_SUCCESS && err != DB_FAIL) {
|
||||
error = err;
|
||||
}
|
||||
}
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
return(error);
|
||||
return(fts_drop_index_split_tables(trx, index));
|
||||
}
|
||||
|
||||
/****************************************************************//**
|
||||
@@ -2100,23 +2066,6 @@ fts_create_index_tables_low(
|
||||
fts_table.parent = table_name;
|
||||
fts_table.table = index->table;
|
||||
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
/* Create the FTS auxiliary tables that are specific
|
||||
to an FTS index. */
|
||||
info = pars_info_create();
|
||||
|
||||
fts_table.suffix = "DOC_ID";
|
||||
fts_get_table_name(&fts_table, fts_name);
|
||||
|
||||
pars_info_bind_id(info, true, "doc_id_table", fts_name);
|
||||
|
||||
graph = fts_parse_sql_no_dict_lock(NULL, info,
|
||||
fts_create_index_tables_sql);
|
||||
|
||||
error = fts_eval_sql(trx, graph);
|
||||
que_graph_free(graph);
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
/* aux_idx_tables vector is used for dropping FTS AUX INDEX
|
||||
tables on error condition. */
|
||||
std::vector<dict_table_t*> aux_idx_tables;
|
||||
@@ -2648,46 +2597,6 @@ fts_get_max_cache_size(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
/*********************************************************************//**
|
||||
Get the total number of words in the FTS for a particular FTS index.
|
||||
@return DB_SUCCESS if all OK else error code */
|
||||
dberr_t
|
||||
fts_get_total_word_count(
|
||||
/*=====================*/
|
||||
trx_t* trx, /*!< in: transaction */
|
||||
dict_index_t* index, /*!< in: for this index */
|
||||
ulint* total) /* out: total words */
|
||||
{
|
||||
dberr_t error;
|
||||
fts_string_t value;
|
||||
|
||||
*total = 0;
|
||||
|
||||
/* We set the length of value to the max bytes it can hold. This
|
||||
information is used by the callback that reads the value. */
|
||||
value.f_n_char = 0;
|
||||
value.f_len = FTS_MAX_CONFIG_VALUE_LEN;
|
||||
value.f_str = static_cast<byte*>(ut_malloc_nokey(value.f_len + 1));
|
||||
|
||||
error = fts_config_get_index_value(
|
||||
trx, index, FTS_TOTAL_WORD_COUNT, &value);
|
||||
|
||||
if (error == DB_SUCCESS) {
|
||||
|
||||
value.f_str[value.f_len] = 0;
|
||||
*total = strtoul((char*) value.f_str, NULL, 10);
|
||||
} else {
|
||||
ib::error() << "(" << ut_strerr(error) << ") reading total"
|
||||
" words value from config table";
|
||||
}
|
||||
|
||||
ut_free(value.f_str);
|
||||
|
||||
return(error);
|
||||
}
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
/*********************************************************************//**
|
||||
Update the next and last Doc ID in the CONFIG table to be the input
|
||||
"doc_id" value (+ 1). We would do so after each FTS index build or
|
||||
@@ -3285,31 +3194,6 @@ fts_doc_free(
|
||||
mem_heap_free(heap);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Callback function for fetch that stores a row id to the location pointed.
|
||||
The column's type must be DATA_FIXBINARY, DATA_BINARY_TYPE, length = 8.
|
||||
@return always returns NULL */
|
||||
void*
|
||||
fts_fetch_row_id(
|
||||
/*=============*/
|
||||
void* row, /*!< in: sel_node_t* */
|
||||
void* user_arg) /*!< in: data pointer */
|
||||
{
|
||||
sel_node_t* node = static_cast<sel_node_t*>(row);
|
||||
|
||||
dfield_t* dfield = que_node_get_val(node->select_list);
|
||||
dtype_t* type = dfield_get_type(dfield);
|
||||
ulint len = dfield_get_len(dfield);
|
||||
|
||||
ut_a(dtype_get_mtype(type) == DATA_FIXBINARY);
|
||||
ut_a(dtype_get_prtype(type) & DATA_BINARY_TYPE);
|
||||
ut_a(len == 8);
|
||||
|
||||
memcpy(user_arg, dfield_get_data(dfield), 8);
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Callback function for fetch that stores the text of an FTS document,
|
||||
converting each column to UTF-16.
|
||||
@@ -4053,9 +3937,6 @@ fts_sync_write_words(
|
||||
dberr_t error = DB_SUCCESS;
|
||||
ibool print_error = FALSE;
|
||||
dict_table_t* table = index_cache->index->table;
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
ulint n_new_words = 0;
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
FTS_INIT_INDEX_TABLE(
|
||||
&fts_table, NULL, FTS_INDEX_TABLE, index_cache->index);
|
||||
@@ -4080,25 +3961,6 @@ fts_sync_write_words(
|
||||
|
||||
fts_table.suffix = fts_get_suffix(selected);
|
||||
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
/* Check if the word exists in the FTS index and if not
|
||||
then we need to increment the total word count stats. */
|
||||
if (error == DB_SUCCESS && fts_enable_diag_print) {
|
||||
ibool found = FALSE;
|
||||
|
||||
error = fts_is_word_in_index(
|
||||
trx,
|
||||
&index_cache->sel_graph[selected],
|
||||
&fts_table,
|
||||
&word->text, &found);
|
||||
|
||||
if (error == DB_SUCCESS && !found) {
|
||||
|
||||
++n_new_words;
|
||||
}
|
||||
}
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
/* We iterate over all the nodes even if there was an error */
|
||||
for (i = 0; i < ib_vector_size(word->nodes); ++i) {
|
||||
|
||||
@@ -4147,19 +4009,6 @@ fts_sync_write_words(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
if (error == DB_SUCCESS && n_new_words > 0 && fts_enable_diag_print) {
|
||||
fts_table_t fts_table;
|
||||
|
||||
FTS_INIT_FTS_TABLE(&fts_table, NULL, FTS_COMMON_TABLE, table);
|
||||
|
||||
/* Increment the total number of words in the FTS index */
|
||||
error = fts_config_increment_index_value(
|
||||
trx, index_cache->index, FTS_TOTAL_WORD_COUNT,
|
||||
n_new_words);
|
||||
}
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
if (fts_enable_diag_print) {
|
||||
printf("Avg number of nodes: %lf\n",
|
||||
(double) n_nodes / (double) (n_words > 1 ? n_words : 1));
|
||||
@@ -4168,236 +4017,6 @@ fts_sync_write_words(
|
||||
return(error);
|
||||
}
|
||||
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
/*********************************************************************//**
|
||||
Write a single documents statistics to disk.
|
||||
@return DB_SUCCESS if all went well else error code */
|
||||
static MY_ATTRIBUTE((nonnull, warn_unused_result))
|
||||
dberr_t
|
||||
fts_sync_write_doc_stat(
|
||||
/*====================*/
|
||||
trx_t* trx, /*!< in: transaction */
|
||||
dict_index_t* index, /*!< in: index */
|
||||
que_t** graph, /* out: query graph */
|
||||
const fts_doc_stats_t* doc_stat) /*!< in: doc stats to write */
|
||||
{
|
||||
pars_info_t* info;
|
||||
doc_id_t doc_id;
|
||||
dberr_t error = DB_SUCCESS;
|
||||
ib_uint32_t word_count;
|
||||
char table_name[MAX_FULL_NAME_LEN];
|
||||
|
||||
if (*graph) {
|
||||
info = (*graph)->info;
|
||||
} else {
|
||||
info = pars_info_create();
|
||||
}
|
||||
|
||||
/* Convert to "storage" byte order. */
|
||||
mach_write_to_4((byte*) &word_count, doc_stat->word_count);
|
||||
pars_info_bind_int4_literal(
|
||||
info, "count", (const ib_uint32_t*) &word_count);
|
||||
|
||||
/* Convert to "storage" byte order. */
|
||||
fts_write_doc_id((byte*) &doc_id, doc_stat->doc_id);
|
||||
fts_bind_doc_id(info, "doc_id", &doc_id);
|
||||
|
||||
if (!*graph) {
|
||||
fts_table_t fts_table;
|
||||
|
||||
FTS_INIT_INDEX_TABLE(
|
||||
&fts_table, "DOC_ID", FTS_INDEX_TABLE, index);
|
||||
|
||||
fts_get_table_name(&fts_table, table_name);
|
||||
|
||||
pars_info_bind_id(info, true, "doc_id_table", table_name);
|
||||
|
||||
*graph = fts_parse_sql(
|
||||
&fts_table,
|
||||
info,
|
||||
"BEGIN"
|
||||
" INSERT INTO $doc_id_table VALUES (:doc_id, :count);");
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
error = fts_eval_sql(trx, *graph);
|
||||
|
||||
if (error == DB_SUCCESS) {
|
||||
|
||||
break; /* Exit the loop. */
|
||||
} else {
|
||||
|
||||
if (error == DB_LOCK_WAIT_TIMEOUT) {
|
||||
ib::warn() << "Lock wait timeout writing to"
|
||||
" FTS doc_id. Retrying!";
|
||||
|
||||
trx->error_state = DB_SUCCESS;
|
||||
} else {
|
||||
ib::error() << "(" << ut_strerr(error)
|
||||
<< ") while writing to FTS doc_id.";
|
||||
|
||||
break; /* Exit the loop. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(error);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Write document statistics to disk.
|
||||
@return DB_SUCCESS if all OK */
|
||||
static
|
||||
ulint
|
||||
fts_sync_write_doc_stats(
|
||||
/*=====================*/
|
||||
trx_t* trx, /*!< in: transaction */
|
||||
const fts_index_cache_t*index_cache) /*!< in: index cache */
|
||||
{
|
||||
dberr_t error = DB_SUCCESS;
|
||||
que_t* graph = NULL;
|
||||
fts_doc_stats_t* doc_stat;
|
||||
|
||||
if (ib_vector_is_empty(index_cache->doc_stats)) {
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
doc_stat = static_cast<ts_doc_stats_t*>(
|
||||
ib_vector_pop(index_cache->doc_stats));
|
||||
|
||||
while (doc_stat) {
|
||||
error = fts_sync_write_doc_stat(
|
||||
trx, index_cache->index, &graph, doc_stat);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ib_vector_is_empty(index_cache->doc_stats)) {
|
||||
break;
|
||||
}
|
||||
|
||||
doc_stat = static_cast<ts_doc_stats_t*>(
|
||||
ib_vector_pop(index_cache->doc_stats));
|
||||
}
|
||||
|
||||
if (graph != NULL) {
|
||||
fts_que_graph_free_check_lock(NULL, index_cache, graph);
|
||||
}
|
||||
|
||||
return(error);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Callback to check the existince of a word.
|
||||
@return always return NULL */
|
||||
static
|
||||
ibool
|
||||
fts_lookup_word(
|
||||
/*============*/
|
||||
void* row, /*!< in: sel_node_t* */
|
||||
void* user_arg) /*!< in: fts_doc_t* */
|
||||
{
|
||||
|
||||
que_node_t* exp;
|
||||
sel_node_t* node = static_cast<sel_node_t*>(row);
|
||||
ibool* found = static_cast<ibool*>(user_arg);
|
||||
|
||||
exp = node->select_list;
|
||||
|
||||
while (exp) {
|
||||
dfield_t* dfield = que_node_get_val(exp);
|
||||
ulint len = dfield_get_len(dfield);
|
||||
|
||||
if (len != UNIV_SQL_NULL && len != 0) {
|
||||
*found = TRUE;
|
||||
}
|
||||
|
||||
exp = que_node_get_next(exp);
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Check whether a particular word (term) exists in the FTS index.
|
||||
@return DB_SUCCESS if all went well else error code */
|
||||
static
|
||||
dberr_t
|
||||
fts_is_word_in_index(
|
||||
/*=================*/
|
||||
trx_t* trx, /*!< in: FTS query state */
|
||||
que_t** graph, /* out: Query graph */
|
||||
fts_table_t* fts_table, /*!< in: table instance */
|
||||
const fts_string_t*
|
||||
word, /*!< in: the word to check */
|
||||
ibool* found) /* out: TRUE if exists */
|
||||
{
|
||||
pars_info_t* info;
|
||||
dberr_t error;
|
||||
char table_name[MAX_FULL_NAME_LEN];
|
||||
|
||||
trx->op_info = "looking up word in FTS index";
|
||||
|
||||
if (*graph) {
|
||||
info = (*graph)->info;
|
||||
} else {
|
||||
info = pars_info_create();
|
||||
}
|
||||
|
||||
fts_get_table_name(fts_table, table_name);
|
||||
pars_info_bind_id(info, true, "table_name", table_name);
|
||||
pars_info_bind_function(info, "my_func", fts_lookup_word, found);
|
||||
pars_info_bind_varchar_literal(info, "word", word->f_str, word->f_len);
|
||||
|
||||
if (*graph == NULL) {
|
||||
*graph = fts_parse_sql(
|
||||
fts_table,
|
||||
info,
|
||||
"DECLARE FUNCTION my_func;\n"
|
||||
"DECLARE CURSOR c IS"
|
||||
" SELECT doc_count\n"
|
||||
" FROM $table_name\n"
|
||||
" WHERE word = :word"
|
||||
" ORDER BY first_doc_id;\n"
|
||||
"BEGIN\n"
|
||||
"\n"
|
||||
"OPEN c;\n"
|
||||
"WHILE 1 = 1 LOOP\n"
|
||||
" FETCH c INTO my_func();\n"
|
||||
" IF c % NOTFOUND THEN\n"
|
||||
" EXIT;\n"
|
||||
" END IF;\n"
|
||||
"END LOOP;\n"
|
||||
"CLOSE c;");
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
error = fts_eval_sql(trx, *graph);
|
||||
|
||||
if (error == DB_SUCCESS) {
|
||||
|
||||
break; /* Exit the loop. */
|
||||
} else {
|
||||
|
||||
if (error == DB_LOCK_WAIT_TIMEOUT) {
|
||||
ib::warn() << "Lock wait timeout reading"
|
||||
" FTS index. Retrying!";
|
||||
|
||||
trx->error_state = DB_SUCCESS;
|
||||
} else {
|
||||
ib::error() << "(" << ut_strerr(error)
|
||||
<< ") while reading FTS index.";
|
||||
|
||||
break; /* Exit the loop. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(error);
|
||||
}
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
/*********************************************************************//**
|
||||
Begin Sync, create transaction, acquire locks, etc. */
|
||||
static
|
||||
@@ -4435,7 +4054,6 @@ fts_sync_index(
|
||||
fts_index_cache_t* index_cache) /*!< in: index cache */
|
||||
{
|
||||
trx_t* trx = sync->trx;
|
||||
dberr_t error = DB_SUCCESS;
|
||||
|
||||
trx->op_info = "doing SYNC index";
|
||||
|
||||
@@ -4445,20 +4063,7 @@ fts_sync_index(
|
||||
|
||||
ut_ad(rbt_validate(index_cache->words));
|
||||
|
||||
error = fts_sync_write_words(trx, index_cache, sync->unlock_cache);
|
||||
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
/* FTS_RESOLVE: the word counter info in auxiliary table "DOC_ID"
|
||||
is not used currently for ranking. We disable fts_sync_write_doc_stats()
|
||||
for now */
|
||||
/* Write the per doc statistics that will be used for ranking. */
|
||||
if (error == DB_SUCCESS) {
|
||||
|
||||
error = fts_sync_write_doc_stats(trx, index_cache);
|
||||
}
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
return(error);
|
||||
return(fts_sync_write_words(trx, index_cache, sync->unlock_cache));
|
||||
}
|
||||
|
||||
/** Check if index cache has been synced completely
|
||||
@@ -5134,16 +4739,16 @@ fts_tokenize_by_parser(
|
||||
PARSER_DEINIT(parser, ¶m);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Tokenize a document. */
|
||||
/** Tokenize a document.
|
||||
@param[in,out] doc document to tokenize
|
||||
@param[out] result tokenization result
|
||||
@param[in] parser pluggable parser */
|
||||
static
|
||||
void
|
||||
fts_tokenize_document(
|
||||
/*==================*/
|
||||
fts_doc_t* doc, /* in/out: document to
|
||||
tokenize */
|
||||
fts_doc_t* result, /* out: if provided, save
|
||||
the result token here */
|
||||
st_mysql_ftparser* parser) /* in: plugin fts parser */
|
||||
fts_doc_t* doc,
|
||||
fts_doc_t* result,
|
||||
st_mysql_ftparser* parser)
|
||||
{
|
||||
ut_a(!doc->tokens);
|
||||
ut_a(doc->charset);
|
||||
@@ -5168,18 +4773,18 @@ fts_tokenize_document(
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Continue to tokenize a document. */
|
||||
/** Continue to tokenize a document.
|
||||
@param[in,out] doc document to tokenize
|
||||
@param[in] add_pos add this position to all tokens from this tokenization
|
||||
@param[out] result tokenization result
|
||||
@param[in] parser pluggable parser */
|
||||
static
|
||||
void
|
||||
fts_tokenize_document_next(
|
||||
/*=======================*/
|
||||
fts_doc_t* doc, /*!< in/out: document to
|
||||
tokenize */
|
||||
ulint add_pos, /*!< in: add this position to all
|
||||
tokens from this tokenization */
|
||||
fts_doc_t* result, /*!< out: if provided, save
|
||||
the result token here */
|
||||
st_mysql_ftparser* parser) /* in: plugin fts parser */
|
||||
fts_doc_t* doc,
|
||||
ulint add_pos,
|
||||
fts_doc_t* result,
|
||||
st_mysql_ftparser* parser)
|
||||
{
|
||||
ut_a(doc->tokens);
|
||||
|
||||
@@ -5200,14 +4805,13 @@ fts_tokenize_document_next(
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
Create the vector of fts_get_doc_t instances. */
|
||||
/** Create the vector of fts_get_doc_t instances.
|
||||
@param[in,out] cache fts cache
|
||||
@return vector of fts_get_doc_t instances */
|
||||
static
|
||||
ib_vector_t*
|
||||
fts_get_docs_create(
|
||||
/*================*/
|
||||
/* out: vector of
|
||||
fts_get_doc_t instances */
|
||||
fts_cache_t* cache) /*!< in: fts cache */
|
||||
fts_cache_t* cache)
|
||||
{
|
||||
ib_vector_t* get_docs;
|
||||
|
||||
@@ -5680,32 +5284,6 @@ fts_cache_find_word(
|
||||
return(nodes);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Check cache for deleted doc id.
|
||||
@return TRUE if deleted */
|
||||
ibool
|
||||
fts_cache_is_deleted_doc_id(
|
||||
/*========================*/
|
||||
const fts_cache_t* cache, /*!< in: cache ito search */
|
||||
doc_id_t doc_id) /*!< in: doc id to search for */
|
||||
{
|
||||
ut_ad(mutex_own(&cache->deleted_lock));
|
||||
|
||||
for (ulint i = 0; i < ib_vector_size(cache->deleted_doc_ids); ++i) {
|
||||
const fts_update_t* update;
|
||||
|
||||
update = static_cast<const fts_update_t*>(
|
||||
ib_vector_get_const(cache->deleted_doc_ids, i));
|
||||
|
||||
if (doc_id == update->doc_id) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Append deleted doc ids to vector. */
|
||||
void
|
||||
@@ -5870,18 +5448,6 @@ fts_update_doc_id(
|
||||
return(doc_id);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Check if the table has an FTS index. This is the non-inline version
|
||||
of dict_table_has_fts_index().
|
||||
@return TRUE if table has an FTS index */
|
||||
ibool
|
||||
fts_dict_table_has_fts_index(
|
||||
/*=========================*/
|
||||
dict_table_t* table) /*!< in: table */
|
||||
{
|
||||
return(dict_table_has_fts_index(table));
|
||||
}
|
||||
|
||||
/** fts_t constructor.
|
||||
@param[in] table table with FTS indexes
|
||||
@param[in,out] heap memory heap where 'this' is stored */
|
||||
@@ -5960,6 +5526,7 @@ fts_free(
|
||||
table->fts = NULL;
|
||||
}
|
||||
|
||||
#if 0 // TODO: Enable this in WL#6608
|
||||
/*********************************************************************//**
|
||||
Signal FTS threads to initiate shutdown. */
|
||||
void
|
||||
@@ -5993,6 +5560,7 @@ fts_shutdown(
|
||||
|
||||
mutex_exit(&fts->bg_threads_mutex);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*********************************************************************//**
|
||||
Take a FTS savepoint. */
|
||||
@@ -6512,6 +6080,7 @@ fts_set_hex_format(
|
||||
/*****************************************************************//**
|
||||
Update the DICT_TF2_FTS_AUX_HEX_NAME flag in SYS_TABLES.
|
||||
@return DB_SUCCESS or error code. */
|
||||
static
|
||||
dberr_t
|
||||
fts_update_hex_format_flag(
|
||||
/*=======================*/
|
||||
|
||||
@@ -38,11 +38,6 @@ Completed 2011/7/10 Sunny and Jimmy Yang
|
||||
#include "ut0list.h"
|
||||
#include "zlib.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "fts0types.ic"
|
||||
#include "fts0vlc.ic"
|
||||
#endif
|
||||
|
||||
/** The FTS optimize thread's work queue. */
|
||||
static ib_wqueue_t* fts_optimize_wq;
|
||||
|
||||
@@ -343,6 +338,7 @@ fts_zip_init(
|
||||
/**********************************************************************//**
|
||||
Create a fts_optimizer_word_t instance.
|
||||
@return new instance */
|
||||
static
|
||||
fts_word_t*
|
||||
fts_word_init(
|
||||
/*==========*/
|
||||
@@ -2578,8 +2574,10 @@ fts_optimize_add_table(
|
||||
ib_wqueue_add(fts_optimize_wq, msg, msg->heap);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**********************************************************************//**
|
||||
Optimize a table. */
|
||||
static
|
||||
void
|
||||
fts_optimize_do_table(
|
||||
/*==================*/
|
||||
@@ -2596,6 +2594,7 @@ fts_optimize_do_table(
|
||||
|
||||
ib_wqueue_add(fts_optimize_wq, msg, msg->heap);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**********************************************************************//**
|
||||
Remove the table from the OPTIMIZER's list. We do wait for
|
||||
@@ -2982,6 +2981,7 @@ fts_optimize_sync_table(
|
||||
/**********************************************************************//**
|
||||
Optimize all FTS tables.
|
||||
@return Dummy return */
|
||||
static
|
||||
os_thread_ret_t
|
||||
fts_optimize_thread(
|
||||
/*================*/
|
||||
@@ -3166,16 +3166,6 @@ fts_optimize_init(void)
|
||||
os_thread_create(fts_optimize_thread, fts_optimize_wq, NULL);
|
||||
}
|
||||
|
||||
/**********************************************************************//**
|
||||
Check whether the work queue is initialized.
|
||||
@return TRUE if optimze queue is initialized. */
|
||||
ibool
|
||||
fts_optimize_is_init(void)
|
||||
/*======================*/
|
||||
{
|
||||
return(fts_optimize_wq != NULL);
|
||||
}
|
||||
|
||||
/** Shutdown fts optimize thread. */
|
||||
void
|
||||
fts_optimize_shutdown()
|
||||
|
||||
@@ -108,6 +108,7 @@ Note:
|
||||
a. Parse logic refers to 'ftb_query_add_word' from ft_boolean_search.c in MYISAM;
|
||||
b. Parse node or tree refers to fts0pars.y.
|
||||
@return 0 if add successfully, or return non-zero. */
|
||||
static
|
||||
int
|
||||
fts_query_add_word_for_parser(
|
||||
/*==========================*/
|
||||
|
||||
@@ -37,11 +37,6 @@ Completed 2011/7/10 Sunny and Jimmy Yang
|
||||
#include "fts0plugin.h"
|
||||
#include "ut0new.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "fts0types.ic"
|
||||
#include "fts0vlc.ic"
|
||||
#endif
|
||||
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
|
||||
@@ -307,6 +302,20 @@ fts_query_filter_doc_ids(
|
||||
ibool calc_doc_count);/*!< in: whether to remember doc
|
||||
count */
|
||||
|
||||
/** Process (nested) sub-expression, create a new result set to store the
|
||||
sub-expression result by processing nodes under current sub-expression
|
||||
list. Merge the sub-expression result with that of parent expression list.
|
||||
@param[in,out] node current root node
|
||||
@param[in,out] visitor callback function
|
||||
@param[in,out] arg argument for callback
|
||||
@return DB_SUCCESS if all go well */
|
||||
static
|
||||
dberr_t
|
||||
fts_ast_visit_sub_exp(
|
||||
fts_ast_node_t* node,
|
||||
fts_ast_callback visitor,
|
||||
void* arg);
|
||||
|
||||
#if 0
|
||||
/*****************************************************************//***
|
||||
Find a doc_id in a word's ilist.
|
||||
@@ -3063,17 +3072,19 @@ fts_query_visitor(
|
||||
DBUG_RETURN(query->error);
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
Process (nested) sub-expression, create a new result set to store the
|
||||
/** Process (nested) sub-expression, create a new result set to store the
|
||||
sub-expression result by processing nodes under current sub-expression
|
||||
list. Merge the sub-expression result with that of parent expression list.
|
||||
@param[in,out] node current root node
|
||||
@param[in,out] visitor callback function
|
||||
@param[in,out] arg argument for callback
|
||||
@return DB_SUCCESS if all go well */
|
||||
static
|
||||
dberr_t
|
||||
fts_ast_visit_sub_exp(
|
||||
/*==================*/
|
||||
fts_ast_node_t* node, /*!< in,out: current root node */
|
||||
fts_ast_callback visitor, /*!< in: callback function */
|
||||
void* arg) /*!< in,out: arg for callback */
|
||||
fts_ast_node_t* node,
|
||||
fts_ast_callback visitor,
|
||||
void* arg)
|
||||
{
|
||||
fts_ast_oper_t cur_oper;
|
||||
fts_query_t* query = static_cast<fts_query_t*>(arg);
|
||||
@@ -4004,19 +4015,6 @@ fts_query(
|
||||
query.limit = limit;
|
||||
|
||||
query.n_docs = 0;
|
||||
#ifdef FTS_DOC_STATS_DEBUG
|
||||
if (ft_enable_diag_print) {
|
||||
error = fts_get_total_word_count(
|
||||
trx, query.index, &query.total_words);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
goto func_exit;
|
||||
}
|
||||
|
||||
ib::info() << "Total docs: " << query.total_docs
|
||||
<< " Total words: " << query.total_words;
|
||||
}
|
||||
#endif /* FTS_DOC_STATS_DEBUG */
|
||||
|
||||
query.fts_common_table.suffix = "DELETED";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@@ -30,11 +30,6 @@ Created 2007-03-27 Sunny Bains
|
||||
#include "fts0types.h"
|
||||
#include "fts0priv.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "fts0types.ic"
|
||||
#include "fts0vlc.ic"
|
||||
#endif
|
||||
|
||||
/** SQL statements for creating the ancillary FTS tables. */
|
||||
|
||||
/** Preamble to all SQL statements. */
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************//**
|
||||
@file fut/fut0fut.cc
|
||||
File-based utilities
|
||||
|
||||
Created 12/13/1995 Heikki Tuuri
|
||||
***********************************************************************/
|
||||
|
||||
#include "fut0fut.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "fut0fut.ic"
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@@ -23,13 +23,7 @@ File-based list utilities
|
||||
Created 11/28/1995 Heikki Tuuri
|
||||
***********************************************************************/
|
||||
|
||||
#include "univ.i"
|
||||
#include "fut0lst.h"
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
#include "fut0lst.ic"
|
||||
#endif
|
||||
|
||||
#include "buf0buf.h"
|
||||
#include "page0page.h"
|
||||
|
||||
@@ -73,6 +67,27 @@ flst_add_to_empty(
|
||||
mlog_write_ulint(base + FLST_LEN, len + 1, MLOG_4BYTES, mtr);
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
Inserts a node after another in a list. */
|
||||
static
|
||||
void
|
||||
flst_insert_after(
|
||||
/*==============*/
|
||||
flst_base_node_t* base, /*!< in: pointer to base node of list */
|
||||
flst_node_t* node1, /*!< in: node to insert after */
|
||||
flst_node_t* node2, /*!< in: node to add */
|
||||
mtr_t* mtr); /*!< in: mini-transaction handle */
|
||||
/********************************************************************//**
|
||||
Inserts a node before another in a list. */
|
||||
static
|
||||
void
|
||||
flst_insert_before(
|
||||
/*===============*/
|
||||
flst_base_node_t* base, /*!< in: pointer to base node of list */
|
||||
flst_node_t* node2, /*!< in: node to insert */
|
||||
flst_node_t* node3, /*!< in: node to insert before */
|
||||
mtr_t* mtr); /*!< in: mini-transaction handle */
|
||||
|
||||
/********************************************************************//**
|
||||
Adds a node as the last node in a list. */
|
||||
void
|
||||
@@ -176,6 +191,7 @@ flst_add_first(
|
||||
|
||||
/********************************************************************//**
|
||||
Inserts a node after another in a list. */
|
||||
static
|
||||
void
|
||||
flst_insert_after(
|
||||
/*==============*/
|
||||
@@ -240,6 +256,7 @@ flst_insert_after(
|
||||
|
||||
/********************************************************************//**
|
||||
Inserts a node before another in a list. */
|
||||
static
|
||||
void
|
||||
flst_insert_before(
|
||||
/*===============*/
|
||||
@@ -455,29 +472,3 @@ flst_validate(
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
Prints info of a file-based list. */
|
||||
void
|
||||
flst_print(
|
||||
/*=======*/
|
||||
const flst_base_node_t* base, /*!< in: pointer to base node of list */
|
||||
mtr_t* mtr) /*!< in: mtr */
|
||||
{
|
||||
const buf_frame_t* frame;
|
||||
ulint len;
|
||||
|
||||
ut_ad(base && mtr);
|
||||
ut_ad(mtr_memo_contains_page_flagged(mtr, base,
|
||||
MTR_MEMO_PAGE_X_FIX
|
||||
| MTR_MEMO_PAGE_SX_FIX));
|
||||
frame = page_align((byte*) base);
|
||||
|
||||
len = flst_get_len(base);
|
||||
|
||||
ib::info() << "FILE-BASED LIST: Base node in space "
|
||||
<< page_get_space_id(frame)
|
||||
<< "; page " << page_get_page_no(frame)
|
||||
<< "; byte offset " << page_offset(base)
|
||||
<< "; len " << len;
|
||||
}
|
||||
|
||||
@@ -803,6 +803,7 @@ This has to be done either within the same mini-transaction,
|
||||
or by invoking ibuf_reset_free_bits() before mtr_commit().
|
||||
|
||||
@return TRUE on success; FALSE on compression failure */
|
||||
static
|
||||
ibool
|
||||
rtr_split_page_move_rec_list(
|
||||
/*=========================*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user