diff --git a/cmake/for_clients.cmake b/cmake/for_clients.cmake index f6a076f9632ac..636610e7fba54 100644 --- a/cmake/for_clients.cmake +++ b/cmake/for_clients.cmake @@ -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]*") diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index 9f2c8797d2cdf..d407ea3d26fe7 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -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}") - 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) + IF(NOT OPENSSL_ROOT_DIR) + IF(WITH_SSL_PATH) + SET(OPENSSL_ROOT_DIR ${WITH_SSL_PATH}) + ENDIF() 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}") diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 393b1af062c35..819b05364f848 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -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 diff --git a/include/json_lib.h b/include/json_lib.h index cdfcffad38a92..567b04dbdc054 100644 --- a/include/json_lib.h +++ b/include/json_lib.h @@ -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. */ diff --git a/include/mysql_com.h b/include/mysql_com.h index 2cb4656ceef6a..ace54767b0680 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -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: diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4fe0c253a7804..dbc2c775e7276 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4419,7 +4419,6 @@ ($$) 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./ diff --git a/mysql-test/r/analyze_debug.result b/mysql-test/r/analyze_debug.result new file mode 100644 index 0000000000000..2a11578a84104 --- /dev/null +++ b/mysql-test/r/analyze_debug.result @@ -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; diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 122875bac9245..8c2f88067ca9f 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -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 # diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index 91640974b2236..eff8f5c9c9225 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -589,3 +589,43 @@ json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') "bb": "v2" } } +SELECT JSON_search( '{"x": "\\""}', "one", '"'); +JSON_search( '{"x": "\\""}', "one", '"') +"$.x" +SELECT JSON_search( '{"x": "\\""}', "one", '\\"'); +JSON_search( '{"x": "\\""}', "one", '\\"') +"$.x" +set @@global.net_buffer_length=1024; +set @@global.max_allowed_packet=2048; +connect newconn, localhost, root,,; +show variables like 'net_buffer_length'; +Variable_name Value +net_buffer_length 1024 +show variables like 'max_allowed_packet'; +Variable_name Value +max_allowed_packet 2048 +select json_array(repeat('a',1024),repeat('a',1024)); +json_array(repeat('a',1024),repeat('a',1024)) +NULL +Warnings: +Warning 1301 Result of json_array() was larger than max_allowed_packet (2048) - truncated +select json_object("a", repeat('a',1024),"b", repeat('a',1024)); +json_object("a", repeat('a',1024),"b", repeat('a',1024)) +NULL +Warnings: +Warning 1301 Result of json_object() was larger than max_allowed_packet (2048) - truncated +connection default; +set @@global.max_allowed_packet = default; +set @@global.net_buffer_length = default; +disconnect newconn; +create table t1(j longtext, p longtext); +insert into t1 values +('{"a":1,"b":2,"c":3}','$.a'), +('{"a":1,"b":2,"c":3}','$.b'), +('{"a":1,"b":2,"c":3}','$.c'); +select j, p, json_remove(j, p) from t1; +j p json_remove(j, p) +{"a":1,"b":2,"c":3} $.a {"b": 2, "c": 3} +{"a":1,"b":2,"c":3} $.b {"a": 1, "c": 3} +{"a":1,"b":2,"c":3} $.c {"a": 1, "b": 2} +drop table t1; diff --git a/mysql-test/r/gis-rt-precise.result b/mysql-test/r/gis-rt-precise.result index 3f4f014fb781a..65583a0ce0dfb 100644 --- a/mysql-test/r/gis-rt-precise.result +++ b/mysql-test/r/gis-rt-precise.result @@ -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; diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 649c3aba32f7f..484d2ba427766 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -3749,5 +3749,34 @@ ERROR HY000: Illegal parameter data type geometry for operation 'ceiling' SELECT FLOOR(POINT(1,1)); ERROR HY000: Illegal parameter data type geometry for operation 'floor' # +# MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec() +# +CREATE TABLE t1 (a GEOMETRY); +SELECT SUM(POINT(1,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'sum' +SELECT SUM(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'sum' +SELECT SUM(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'sum' +SELECT AVG(POINT(1,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'avg' +SELECT AVG(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'avg' +SELECT AVG(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'avg' +SELECT VARIANCE(POINT(1,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'variance(' +SELECT VARIANCE(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'variance(' +SELECT VARIANCE(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'variance(' +SELECT STDDEV(POINT(1,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'std(' +SELECT STDDEV(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'std(' +SELECT STDDEV(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'std(' +DROP TABLE t1; +# # End of 10.3 tests # diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index d34c96cd56892..eb9b1d1601153 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -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; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index a39ca3379c6af..1a0ee6b743a36 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -5263,9 +5263,7 @@ UNION ALL SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) AS foo ; -coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) -0.0000 -0.0000 +ERROR HY000: Illegal parameter data type geometry for operation 'avg' CREATE table t1(a text); INSERT INTO t1 VALUES (''), (''); SELECT avg(distinct(t1.a)) FROM t1, t1 t2 diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result index 482fca0d53002..ef4872d2bc9ba 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -5274,9 +5274,7 @@ UNION ALL SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) AS foo ; -coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) -0.0000 -0.0000 +ERROR HY000: Illegal parameter data type geometry for operation 'avg' CREATE table t1(a text); INSERT INTO t1 VALUES (''), (''); SELECT avg(distinct(t1.a)) FROM t1, t1 t2 diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index a39ca3379c6af..1a0ee6b743a36 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -5263,9 +5263,7 @@ UNION ALL SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) AS foo ; -coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) -0.0000 -0.0000 +ERROR HY000: Illegal parameter data type geometry for operation 'avg' CREATE table t1(a text); INSERT INTO t1 VALUES (''), (''); SELECT avg(distinct(t1.a)) FROM t1, t1 t2 diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption-32k.result b/mysql-test/suite/encryption/r/innodb-page_encryption-32k.result index fdebf23ce8f6a..72cd3e089315b 100644 --- a/mysql-test/suite/encryption/r/innodb-page_encryption-32k.result +++ b/mysql-test/suite/encryption/r/innodb-page_encryption-32k.result @@ -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; diff --git a/mysql-test/suite/encryption/r/innodb_first_page.result b/mysql-test/suite/encryption/r/innodb_first_page.result index c2bbdb5695bad..aaef462e639fd 100644 --- a/mysql-test/suite/encryption/r/innodb_first_page.result +++ b/mysql-test/suite/encryption/r/innodb_first_page.result @@ -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; diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test b/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test index 29d821d1fc1d3..03c9c93ff06d9 100644 --- a/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test +++ b/mysql-test/suite/encryption/t/innodb-page_encryption-32k.test @@ -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 diff --git a/mysql-test/suite/encryption/t/innodb_first_page.test b/mysql-test/suite/encryption/t/innodb_first_page.test index a0c563b185484..58095e5e11034 100644 --- a/mysql-test/suite/encryption/t/innodb_first_page.test +++ b/mysql-test/suite/encryption/t/innodb_first_page.test @@ -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); diff --git a/mysql-test/suite/galera/include/galera_sst_restore.inc b/mysql-test/suite/galera/include/galera_sst_restore.inc index a08b148c31a3e..7c9a08090ad25 100644 --- a/mysql-test/suite/galera/include/galera_sst_restore.inc +++ b/mysql-test/suite/galera/include/galera_sst_restore.inc @@ -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"); diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump.result b/mysql-test/suite/galera/r/galera_ist_mysqldump.result index 788d60051b54a..8d0010afc444b 100644 --- a/mysql-test/suite/galera/r/galera_ist_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result @@ -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"); diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result index 5c0d9a45d41fa..304ce165f3ef2 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result @@ -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"); diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result index 227e1c15444ec..0a88b290e59cb 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result @@ -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"); diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result index fc647a2000daf..1c4bbc3f369cb 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#33.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result @@ -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"); diff --git a/mysql-test/suite/innodb/include/restart_and_reinit.inc b/mysql-test/suite/innodb/include/restart_and_reinit.inc index 9df66196edf46..b3f7cae6d1780 100644 --- a/mysql-test/suite/innodb/include/restart_and_reinit.inc +++ b/mysql-test/suite/innodb/include/restart_and_reinit.inc @@ -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; diff --git a/mysql-test/suite/innodb/r/innodb-32k-crash.result b/mysql-test/suite/innodb/r/innodb-32k-crash.result index 1fd5cd9b5212c..4fcb6ab19efe7 100644 --- a/mysql-test/suite/innodb/r/innodb-32k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-32k-crash.result @@ -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, diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash.result b/mysql-test/suite/innodb/r/innodb-64k-crash.result index 7e2941b8e3b33..bfeec58bda92a 100644 --- a/mysql-test/suite/innodb/r/innodb-64k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-64k-crash.result @@ -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, diff --git a/mysql-test/suite/innodb/r/innodb_bug59307.result b/mysql-test/suite/innodb/r/innodb_bug59307.result new file mode 100644 index 0000000000000..e247393b970e1 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug59307.result @@ -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; diff --git a/mysql-test/suite/innodb/r/trigger_error.result b/mysql-test/suite/innodb/r/trigger_error.result new file mode 100644 index 0000000000000..ef5f910e1a28e --- /dev/null +++ b/mysql-test/suite/innodb/r/trigger_error.result @@ -0,0 +1,28 @@ +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +CREATE TABLE t2 (i INT) ENGINE=InnoDB; +CREATE OR REPLACE TRIGGER tr1 +AFTER UPDATE ON t2 +FOR EACH ROW +INSERT INTO tlog (i) VALUES (1); +INSERT IGNORE INTO t2 VALUES (1); +CREATE TRIGGER IF NOT EXISTS tr2 +BEFORE INSERT ON t2 +FOR EACH ROW +INSERT INTO tlog (i) VALUES (2); +START TRANSACTION; +INSERT INTO t1 VALUES (1); +UPDATE t2 SET i = 3; +ERROR 42S02: Table 'test.tlog' doesn't exist +INSERT INTO t1 VALUES (2); +INSERT INTO t2 VALUES (4); +ERROR 42S02: Table 'test.tlog' doesn't exist +UPDATE t1 SET i = 4 LIMIT 1; +COMMIT; +SELECT * FROM t1; +i +4 +2 +SELECT * FROM t2; +i +1 +DROP TABLE t1,t2; diff --git a/mysql-test/suite/innodb/t/create_isl_with_direct.test b/mysql-test/suite/innodb/t/create_isl_with_direct.test index 83c7507e025e1..1427264e13e84 100644 --- a/mysql-test/suite/innodb/t/create_isl_with_direct.test +++ b/mysql-test/suite/innodb/t/create_isl_with_direct.test @@ -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.*"); diff --git a/mysql-test/suite/innodb/t/innodb-32k-crash.test b/mysql-test/suite/innodb/t/innodb-32k-crash.test index b9d96fd92c8d7..42d2b5adc9f63 100644 --- a/mysql-test/suite/innodb/t/innodb-32k-crash.test +++ b/mysql-test/suite/innodb/t/innodb-32k-crash.test @@ -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, diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.test b/mysql-test/suite/innodb/t/innodb-64k-crash.test index b61396bf22cde..39fbf974efe09 100644 --- a/mysql-test/suite/innodb/t/innodb-64k-crash.test +++ b/mysql-test/suite/innodb/t/innodb-64k-crash.test @@ -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, diff --git a/mysql-test/suite/innodb/t/innodb_bug12400341.test b/mysql-test/suite/innodb/t/innodb_bug12400341.test index 2cacefc659500..5fb0d63ebe7ba 100644 --- a/mysql-test/suite/innodb/t/innodb_bug12400341.test +++ b/mysql-test/suite/innodb/t/innodb_bug12400341.test @@ -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 diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111.test b/mysql-test/suite/innodb/t/innodb_bug14676111.test index 02ef5e5e7f02b..68054d7654f8e 100644 --- a/mysql-test/suite/innodb/t/innodb_bug14676111.test +++ b/mysql-test/suite/innodb/t/innodb_bug14676111.test @@ -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; diff --git a/mysql-test/suite/innodb/t/innodb_bug53046.test b/mysql-test/suite/innodb/t/innodb_bug53046.test index dddff8a235f02..a202c0c52c756 100644 --- a/mysql-test/suite/innodb/t/innodb_bug53046.test +++ b/mysql-test/suite/innodb/t/innodb_bug53046.test @@ -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. # diff --git a/mysql-test/suite/innodb/t/innodb_bug59307.test b/mysql-test/suite/innodb/t/innodb_bug59307.test new file mode 100644 index 0000000000000..c89050b9c55ac --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug59307.test @@ -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; diff --git a/mysql-test/suite/innodb/t/trigger_error.test b/mysql-test/suite/innodb/t/trigger_error.test new file mode 100644 index 0000000000000..0334f2b353c55 --- /dev/null +++ b/mysql-test/suite/innodb/t/trigger_error.test @@ -0,0 +1,31 @@ +--source include/have_innodb.inc + +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +CREATE TABLE t2 (i INT) ENGINE=InnoDB; + +CREATE OR REPLACE TRIGGER tr1 + AFTER UPDATE ON t2 + FOR EACH ROW + INSERT INTO tlog (i) VALUES (1); + +INSERT IGNORE INTO t2 VALUES (1); + +CREATE TRIGGER IF NOT EXISTS tr2 + BEFORE INSERT ON t2 + FOR EACH ROW + INSERT INTO tlog (i) VALUES (2); + +START TRANSACTION; +INSERT INTO t1 VALUES (1); +--error ER_NO_SUCH_TABLE +UPDATE t2 SET i = 3; +INSERT INTO t1 VALUES (2); +--error ER_NO_SUCH_TABLE +INSERT INTO t2 VALUES (4); +UPDATE t1 SET i = 4 LIMIT 1; +COMMIT; + +SELECT * FROM t1; +SELECT * FROM t2; + +DROP TABLE t1,t2; diff --git a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result index 2b11be44198d9..973377cb14127 100644 --- a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result +++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result @@ -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)), diff --git a/mysql-test/t/analyze_debug.test b/mysql-test/t/analyze_debug.test new file mode 100644 index 0000000000000..684011c5aeaab --- /dev/null +++ b/mysql-test/t/analyze_debug.test @@ -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; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 318cf584348f1..121e274ceebda 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -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 # diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index 09e4f30c3256a..72b8681ac4408 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -238,3 +238,39 @@ select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') ; select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}'); select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}'); select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}'); + +# +# MDEV-11856 json_search doesn't search for values with double quotes character (") +# + +SELECT JSON_search( '{"x": "\\""}', "one", '"'); +SELECT JSON_search( '{"x": "\\""}', "one", '\\"'); + +# +# MDEV-11833 JSON functions don't seem to respect max_allowed_packet. +# +set @@global.net_buffer_length=1024; +set @@global.max_allowed_packet=2048; +--connect (newconn, localhost, root,,) + +show variables like 'net_buffer_length'; +show variables like 'max_allowed_packet'; +select json_array(repeat('a',1024),repeat('a',1024)); +select json_object("a", repeat('a',1024),"b", repeat('a',1024)); +--connection default + +set @@global.max_allowed_packet = default; +set @@global.net_buffer_length = default; +--disconnect newconn + + +# +# MDEV-12262 Assertion `!null_value' failed in virtual bool Item::send on JSON_REMOVE. +# +create table t1(j longtext, p longtext); +insert into t1 values + ('{"a":1,"b":2,"c":3}','$.a'), + ('{"a":1,"b":2,"c":3}','$.b'), + ('{"a":1,"b":2,"c":3}','$.c'); +select j, p, json_remove(j, p) from t1; +drop table t1; diff --git a/mysql-test/t/gis-rt-precise.test b/mysql-test/t/gis-rt-precise.test index 4cae10a9076e2..9c26aa055989d 100644 --- a/mysql-test/t/gis-rt-precise.test +++ b/mysql-test/t/gis-rt-precise.test @@ -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; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index c486484f0d237..1d86a64fc5978 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1915,6 +1915,44 @@ SELECT CEILING(POINT(1,1)); --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT FLOOR(POINT(1,1)); + +--echo # +--echo # MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec() +--echo # + +CREATE TABLE t1 (a GEOMETRY); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SUM(POINT(1,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SUM(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SUM(COALESCE(a)) FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT AVG(POINT(1,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT AVG(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT AVG(COALESCE(a)) FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT VARIANCE(POINT(1,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT VARIANCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT VARIANCE(COALESCE(a)) FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT STDDEV(POINT(1,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT STDDEV(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT STDDEV(COALESCE(a)) FROM t1; + +DROP TABLE t1; + + --echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index a97b0b1c815e0..c354032bc36e1 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -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; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index a0caf4992bf2f..e8d5f9fa44558 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4427,6 +4427,7 @@ DROP TABLE t1; --echo # Bug #57203 Assertion `field_length <= 255' failed. --echo # +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) UNION ALL SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index e22fb4162ecd6..841a52944df5e 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -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 + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + #include #include #if _MSC_VER diff --git a/sql/datadict.cc b/sql/datadict.cc index 287e8568d9019..c1e1e85c37712 100644 --- a/sql/datadict.cc +++ b/sql/datadict.cc @@ -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))) diff --git a/sql/item.cc b/sql/item.cc index b0337efff9ec3..2f2b773b79502 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5670,6 +5670,25 @@ bool Item_field::fix_fields(THD *thd, Item **reference) return TRUE; } + +const Type_handler *Item_field::real_type_handler() const +{ + /* + Item_field::field_type ask Field_type() but sometimes field return + a different type, like for enum/set, so we need to ask real type. + */ + if (field->is_created_from_null_item) + return &type_handler_null; + /* work around about varchar type field detection */ + enum_field_types type= field->real_type(); + // TODO: We should add Field::real_type_handler() eventually + if (type == MYSQL_TYPE_STRING && field->type() == MYSQL_TYPE_VAR_STRING) + type= MYSQL_TYPE_VAR_STRING; + return Type_handler::get_handler_by_real_type(type); + +} + + /* @brief Mark virtual columns as used in a partitioning expression @@ -10009,7 +10028,7 @@ void Item_cache_row::set_null() Item_type_holder::Item_type_holder(THD *thd, Item *item) :Item(thd, item), - Type_handler_hybrid_real_field_type(get_real_type(item)), + Type_handler_hybrid_field_type(item->real_type_handler()), enum_set_typelib(0) { DBUG_ASSERT(item->fixed); @@ -10024,87 +10043,6 @@ Item_type_holder::Item_type_holder(THD *thd, Item *item) } -/** - Find real field type of item. - - @return - type of field which should be created to store item value -*/ - -enum_field_types Item_type_holder::get_real_type(Item *item) -{ - if (item->type() == REF_ITEM) - item= item->real_item(); - switch(item->type()) - { - case FIELD_ITEM: - { - /* - Item_field::field_type ask Field_type() but sometimes field return - a different type, like for enum/set, so we need to ask real type. - */ - Field *field= ((Item_field *) item)->field; - enum_field_types type= field->real_type(); - if (field->is_created_from_null_item) - return MYSQL_TYPE_NULL; - /* work around about varchar type field detection */ - if (type == MYSQL_TYPE_STRING && field->type() == MYSQL_TYPE_VAR_STRING) - return MYSQL_TYPE_VAR_STRING; - return type; - } - case SUM_FUNC_ITEM: - { - /* - Argument of aggregate function sometimes should be asked about field - type - */ - Item_sum *item_sum= (Item_sum *) item; - if (item_sum->keep_field_type()) - return get_real_type(item_sum->get_arg(0)); - break; - } - case FUNC_ITEM: - if (((Item_func *) item)->functype() == Item_func::GUSERVAR_FUNC) - { - /* - There are work around of problem with changing variable type on the - fly and variable always report "string" as field type to get - acceptable information for client in send_field, so we make field - type from expression type. - */ - switch (item->result_type()) { - case STRING_RESULT: - return MYSQL_TYPE_VARCHAR; - case INT_RESULT: - return MYSQL_TYPE_LONGLONG; - case REAL_RESULT: - return MYSQL_TYPE_DOUBLE; - case DECIMAL_RESULT: - return MYSQL_TYPE_NEWDECIMAL; - case ROW_RESULT: - case TIME_RESULT: - DBUG_ASSERT(0); - return MYSQL_TYPE_VARCHAR; - } - } - break; - case TYPE_HOLDER: - /* - Item_type_holder and Item_blob should not appear in this context. - In case they for some reasons do, returning field_type() is wrong anyway. - They must return Item_type_holder::real_field_type() instead, to make - the code in sql_type.cc and sql_type.h happy, as it expectes - Field::real_type()-compatible rather than Field::field_type()-compatible - valies in some places, and may in the future add some asserts preventing - use of field_type() instead of real_type() and the other way around. - */ - DBUG_ASSERT(0); - default: - break; - } - return item->field_type(); -} - /** Find field type which can carry current Item_type_holder type and type of given Item. @@ -10123,14 +10061,13 @@ bool Item_type_holder::join_types(THD *thd, Item *item) uint max_length_orig= max_length; uint decimals_orig= decimals; DBUG_ENTER("Item_type_holder::join_types"); - DBUG_PRINT("info:", ("was type %d len %d, dec %d name %s", - real_field_type(), max_length, decimals, + DBUG_PRINT("info:", ("was type %s len %d, dec %d name %s", + real_type_handler()->name().ptr(), max_length, decimals, (name ? name : ""))); - DBUG_PRINT("info:", ("in type %d len %d, dec %d", - get_real_type(item), + DBUG_PRINT("info:", ("in type %s len %d, dec %d", + item->real_type_handler()->name().ptr(), item->max_length, item->decimals)); - const Type_handler *item_type_handler= - Type_handler::get_handler_by_real_type(get_real_type(item)); + const Type_handler *item_type_handler= item->real_type_handler(); if (aggregate_for_result(item_type_handler)) { my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0), @@ -10218,13 +10155,13 @@ bool Item_type_holder::join_types(THD *thd, Item *item) int delta1= max_length_orig - decimals_orig; int delta2= item->max_length - item->decimals; max_length= MY_MAX(delta1, delta2) + decimals; - if (Item_type_holder::real_field_type() == MYSQL_TYPE_FLOAT && + if (Item_type_holder::real_type_handler() == &type_handler_float && max_length > FLT_DIG + 2) { max_length= MAX_FLOAT_STR_LENGTH; decimals= NOT_FIXED_DEC; } - else if (Item_type_holder::real_field_type() == MYSQL_TYPE_DOUBLE && + else if (Item_type_holder::real_type_handler() == &type_handler_double && max_length > DBL_DIG + 2) { max_length= MAX_DOUBLE_STR_LENGTH; @@ -10245,8 +10182,9 @@ bool Item_type_holder::join_types(THD *thd, Item *item) /* Remember decimal integer part to be used in DECIMAL_RESULT handleng */ prev_decimal_int_part= decimal_int_part(); - DBUG_PRINT("info", ("become type: %d len: %u dec: %u", - (int) real_field_type(), max_length, (uint) decimals)); + DBUG_PRINT("info", ("become type: %s len: %u dec: %u", + real_type_handler()->name().ptr(), + max_length, (uint) decimals)); DBUG_RETURN(FALSE); } @@ -10269,7 +10207,7 @@ Field *Item_type_holder::make_field_by_type(TABLE *table) uchar *null_ptr= maybe_null ? (uchar*) "" : 0; Field *field; - switch (Item_type_holder::real_field_type()) { + switch (Item_type_holder::real_type_handler()->real_field_type()) { case MYSQL_TYPE_ENUM: DBUG_ASSERT(enum_set_typelib); field= new Field_enum((uchar *) 0, max_length, null_ptr, 0, @@ -10305,8 +10243,8 @@ Field *Item_type_holder::make_field_by_type(TABLE *table) */ void Item_type_holder::get_full_info(Item *item) { - if (Item_type_holder::real_field_type() == MYSQL_TYPE_ENUM || - Item_type_holder::real_field_type() == MYSQL_TYPE_SET) + if (Item_type_holder::real_type_handler() == &type_handler_enum || + Item_type_holder::real_type_handler() == &type_handler_set) { if (item->type() == Item::SUM_FUNC_ITEM && (((Item_sum*)item)->sum_func() == Item_sum::MAX_FUNC || @@ -10317,11 +10255,11 @@ void Item_type_holder::get_full_info(Item *item) field (or MIN|MAX(enum|set field)) and number of NULL fields */ DBUG_ASSERT((enum_set_typelib && - get_real_type(item) == MYSQL_TYPE_NULL) || + item->real_type_handler() == &type_handler_null) || (!enum_set_typelib && item->real_item()->type() == Item::FIELD_ITEM && - (get_real_type(item->real_item()) == MYSQL_TYPE_ENUM || - get_real_type(item->real_item()) == MYSQL_TYPE_SET) && + (item->real_type_handler() == &type_handler_enum || + item->real_type_handler() == &type_handler_set) && ((Field_enum*)((Item_field *) item->real_item())->field)->typelib)); if (!enum_set_typelib) { diff --git a/sql/item.h b/sql/item.h index d3b1189f80fe3..e7086a5cbb39b 100644 --- a/sql/item.h +++ b/sql/item.h @@ -699,6 +699,10 @@ class Item: public Value_source, { return Type_handler::get_handler_by_field_type(field_type()); } + virtual const Type_handler *real_type_handler() const + { + return type_handler(); + } virtual const Type_handler *cast_to_int_type_handler() const { return type_handler(); @@ -2409,6 +2413,7 @@ class Item_field :public Item_ident { return field->type(); } + const Type_handler *real_type_handler() const; enum_monotonicity_info get_monotonicity_info() const { return MONOTONIC_STRICT_INCREASING; @@ -3355,6 +3360,12 @@ class Item_blob :public Item_partition_func_safe_string { max_length= length; } enum Type type() const { return TYPE_HOLDER; } enum_field_types field_type() const { return MYSQL_TYPE_BLOB; } + const Type_handler *real_type_handler() const + { + // Should not be called, Item_blob is used for SHOW purposes only. + DBUG_ASSERT(0); + return &type_handler_varchar; + } Field *create_field_for_schema(THD *thd, TABLE *table) { return tmp_table_field_from_field_type(table, false, true); } }; @@ -4072,6 +4083,8 @@ class Item_ref :public Item_ident { return (*ref)->setup_fast_field_copier(field); } enum Item_result result_type () const { return (*ref)->result_type(); } enum_field_types field_type() const { return (*ref)->field_type(); } + const Type_handler *real_type_handler() const + { return (*ref)->real_type_handler(); } Field *get_tmp_table_field() { return result_field ? result_field : (*ref)->get_tmp_table_field(); } Item *get_tmp_table_item(THD *thd); @@ -5602,7 +5615,7 @@ class Item_cache_row: public Item_cache single SP/PS execution. */ class Item_type_holder: public Item, - public Type_handler_hybrid_real_field_type + public Type_handler_hybrid_field_type { protected: TYPELIB *enum_set_typelib; @@ -5616,11 +5629,11 @@ class Item_type_holder: public Item, Item_type_holder(THD*, Item*); const Type_handler *type_handler() const - { return Type_handler_hybrid_real_field_type::type_handler(); } + { return Type_handler_hybrid_field_type::type_handler(); } enum_field_types field_type() const - { return Type_handler_hybrid_real_field_type::field_type(); } + { return Type_handler_hybrid_field_type::field_type(); } enum_field_types real_field_type() const - { return Type_handler_hybrid_real_field_type::real_field_type(); } + { return Type_handler_hybrid_field_type::real_field_type(); } enum Item_result result_type () const { /* @@ -5635,7 +5648,11 @@ class Item_type_holder: public Item, As soon as we get BIT as one of the joined types, the result field type cannot be numeric: it's either BIT, or VARBINARY. */ - return Type_handler_hybrid_real_field_type::result_type(); + return Type_handler_hybrid_field_type::result_type(); + } + const Type_handler *real_type_handler() const + { + return Item_type_holder::type_handler(); } enum Type type() const { return TYPE_HOLDER; } @@ -5645,7 +5662,6 @@ class Item_type_holder: public Item, String *val_str(String*); bool join_types(THD *thd, Item *); Field *make_field_by_type(TABLE *table); - static enum_field_types get_real_type(Item *); Field::geometry_type get_geometry_type() const { return geometry_type; }; Item* get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; } }; diff --git a/sql/item_func.h b/sql/item_func.h index 8b53631dfb934..f372cedbcb910 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -767,7 +767,7 @@ class Item_func_signed :public Item_int_func 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); diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 925a7e437f269..b8471dc82441d 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -1407,6 +1407,7 @@ void Item_func_json_array::fix_length_and_dec() fix_char_length_ulonglong(char_length); tmp_val.set_charset(collation.collation); + result_limit= 0; } @@ -1431,7 +1432,16 @@ String *Item_func_json_array::val_str(String *str) if (str->append("]", 1)) goto err_return; - return str; + if (result_limit == 0) + result_limit= current_thd->variables.max_allowed_packet; + + if (str->length() <= result_limit) + return str; + + push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(current_thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), result_limit); err_return: /*TODO: Launch out of memory error. */ @@ -1749,7 +1759,16 @@ String *Item_func_json_object::val_str(String *str) if (str->append("}", 1)) goto err_return; - return str; + if (result_limit == 0) + result_limit= current_thd->variables.max_allowed_packet; + + if (str->length() <= result_limit) + return str; + + push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(current_thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), result_limit); err_return: /*TODO: Launch out of memory error. */ @@ -2614,6 +2633,7 @@ String *Item_func_json_remove::val_str(String *str) str->length(0); if (append_simple(str, js->ptr(), rem_start - js->ptr()) || + (je.state == JST_KEY && n_item > 0 && str->append(",", 1)) || append_simple(str, rem_end, js->end() - rem_end)) goto js_error; /* Out of memory. */ @@ -2639,6 +2659,7 @@ String *Item_func_json_remove::val_str(String *str) if (json_nice(&je, str, Item_func_json_format::LOOSE)) goto js_error; + null_value= 0; return str; js_error: @@ -2800,9 +2821,28 @@ void Item_func_json_search::fix_length_and_dec() int Item_func_json_search::compare_json_value_wild(json_engine_t *je, const String *cmp_str) { - return my_wildcmp(collation.collation, - (const char *) je->value, (const char *) (je->value + je->value_len), - cmp_str->ptr(), cmp_str->end(), escape, wild_one, wild_many) ? 0 : 1; + if (je->value_type != JSON_VALUE_STRING || !je->value_escaped) + return my_wildcmp(collation.collation, + (const char *) je->value, (const char *) (je->value + je->value_len), + cmp_str->ptr(), cmp_str->end(), escape, wild_one, wild_many) ? 0 : 1; + + { + int esc_len; + if (esc_value.alloced_length() < (uint) je->value_len && + esc_value.alloc((je->value_len / 1024 + 1) * 1024)) + return 0; + + esc_len= json_unescape(je->s.cs, je->value, je->value + je->value_len, + je->s.cs, (uchar *) esc_value.ptr(), + (uchar *) (esc_value.ptr() + + esc_value.alloced_length())); + if (esc_len <= 0) + return 0; + + return my_wildcmp(collation.collation, + esc_value.ptr(), esc_value.ptr() + esc_len, + cmp_str->ptr(), cmp_str->end(), escape, wild_one, wild_many) ? 0 : 1; + } } diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h index 535f1bf73a527..394ed5f189a15 100644 --- a/sql/item_jsonfunc.h +++ b/sql/item_jsonfunc.h @@ -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 @@ class Item_func_json_keys: public Item_str_func 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; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index f04f4e922f1aa..77f3e50777c82 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -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; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index bef95d6e21bd1..b1c797c4ee3d5 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1290,41 +1290,35 @@ void Item_sum_sum::clear() } +void Item_sum_sum::fix_length_and_dec_double() +{ + set_handler(&type_handler_double); // Change FLOAT to DOUBLE + decimals= args[0]->decimals; + sum= 0.0; +} + + +void Item_sum_sum::fix_length_and_dec_decimal() +{ + set_handler(&type_handler_newdecimal); // Change temporal to new DECIMAL + decimals= args[0]->decimals; + /* SUM result can't be longer than length(arg) + length(MAX_ROWS) */ + int precision= args[0]->decimal_precision() + DECIMAL_LONGLONG_DIGITS; + max_length= my_decimal_precision_to_length_no_truncation(precision, + decimals, + unsigned_flag); + curr_dec_buff= 0; + my_decimal_set_zero(dec_buffs); +} + + void Item_sum_sum::fix_length_and_dec() { DBUG_ENTER("Item_sum_sum::fix_length_and_dec"); maybe_null=null_value=1; - decimals= args[0]->decimals; - switch (args[0]->cast_to_int_type_handler()->cmp_type()) { - case REAL_RESULT: - case STRING_RESULT: - set_handler_by_field_type(MYSQL_TYPE_DOUBLE); - sum= 0.0; - break; - case INT_RESULT: - case TIME_RESULT: - case DECIMAL_RESULT: - { - /* SUM result can't be longer than length(arg) + length(MAX_ROWS) */ - int precision= args[0]->decimal_precision() + DECIMAL_LONGLONG_DIGITS; - max_length= my_decimal_precision_to_length_no_truncation(precision, - decimals, - unsigned_flag); - curr_dec_buff= 0; - set_handler_by_field_type(MYSQL_TYPE_NEWDECIMAL); - my_decimal_set_zero(dec_buffs); - break; - } - case ROW_RESULT: - DBUG_ASSERT(0); - } - DBUG_PRINT("info", ("Type: %s (%d, %d)", - (result_type() == REAL_RESULT ? "REAL_RESULT" : - result_type() == DECIMAL_RESULT ? "DECIMAL_RESULT" : - result_type() == INT_RESULT ? "INT_RESULT" : - "--ILLEGAL!!!--"), - max_length, - (int)decimals)); + args[0]->cast_to_int_type_handler()->Item_sum_sum_fix_length_and_dec(this); + DBUG_PRINT("info", ("Type: %s (%d, %d)", type_handler()->name().ptr(), + max_length, (int) decimals)); DBUG_VOID_RETURN; } @@ -1625,28 +1619,39 @@ void Item_sum_count::cleanup() /* Avgerage */ + +void Item_sum_avg::fix_length_and_dec_decimal() +{ + Item_sum_sum::fix_length_and_dec_decimal(); + int precision= args[0]->decimal_precision() + prec_increment; + decimals= MY_MIN(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE); + max_length= my_decimal_precision_to_length_no_truncation(precision, + decimals, + unsigned_flag); + f_precision= MY_MIN(precision+DECIMAL_LONGLONG_DIGITS, DECIMAL_MAX_PRECISION); + f_scale= args[0]->decimals; + dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale); +} + + +void Item_sum_avg::fix_length_and_dec_double() +{ + Item_sum_sum::fix_length_and_dec_double(); + decimals= MY_MIN(args[0]->decimals + prec_increment, + FLOATING_POINT_DECIMALS); + max_length= MY_MIN(args[0]->max_length + prec_increment, float_length(decimals)); +} + + void Item_sum_avg::fix_length_and_dec() { - Item_sum_sum::fix_length_and_dec(); - maybe_null=null_value=1; + DBUG_ENTER("Item_sum_avg::fix_length_and_dec"); prec_increment= current_thd->variables.div_precincrement; - if (Item_sum_avg::result_type() == DECIMAL_RESULT) - { - int precision= args[0]->decimal_precision() + prec_increment; - decimals= MY_MIN(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE); - max_length= my_decimal_precision_to_length_no_truncation(precision, - decimals, - unsigned_flag); - f_precision= MY_MIN(precision+DECIMAL_LONGLONG_DIGITS, DECIMAL_MAX_PRECISION); - f_scale= args[0]->decimals; - dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale); - } - else - { - decimals= MY_MIN(args[0]->decimals + prec_increment, - FLOATING_POINT_DECIMALS); - max_length= MY_MIN(args[0]->max_length + prec_increment, float_length(decimals)); - } + maybe_null=null_value=1; + args[0]->cast_to_int_type_handler()->Item_sum_avg_fix_length_and_dec(this); + DBUG_PRINT("info", ("Type: %s (%d, %d)", type_handler()->name().ptr(), + max_length, (int) decimals)); + DBUG_VOID_RETURN; } @@ -1845,6 +1850,25 @@ Item_sum_variance::Item_sum_variance(THD *thd, Item_sum_variance *item): } +void Item_sum_variance::fix_length_and_dec_double() +{ + DBUG_ASSERT(Item_sum_variance::type_handler() == &type_handler_double); + decimals= MY_MIN(args[0]->decimals + 4, FLOATING_POINT_DECIMALS); +} + + +void Item_sum_variance::fix_length_and_dec_decimal() +{ + DBUG_ASSERT(Item_sum_variance::type_handler() == &type_handler_double); + int precision= args[0]->decimal_precision() * 2 + prec_increment; + decimals= MY_MIN(args[0]->decimals + prec_increment, + FLOATING_POINT_DECIMALS - 1); + max_length= my_decimal_precision_to_length_no_truncation(precision, + decimals, + unsigned_flag); +} + + void Item_sum_variance::fix_length_and_dec() { DBUG_ENTER("Item_sum_variance::fix_length_and_dec"); @@ -1858,28 +1882,9 @@ void Item_sum_variance::fix_length_and_dec() type. */ - switch (args[0]->result_type()) { - case REAL_RESULT: - case STRING_RESULT: - decimals= MY_MIN(args[0]->decimals + 4, FLOATING_POINT_DECIMALS); - break; - case INT_RESULT: - case DECIMAL_RESULT: - { - int precision= args[0]->decimal_precision()*2 + prec_increment; - decimals= MY_MIN(args[0]->decimals + prec_increment, - FLOATING_POINT_DECIMALS-1); - max_length= my_decimal_precision_to_length_no_truncation(precision, - decimals, - unsigned_flag); - - break; - } - case ROW_RESULT: - case TIME_RESULT: - DBUG_ASSERT(0); - } - DBUG_PRINT("info", ("Type: REAL_RESULT (%d, %d)", max_length, (int)decimals)); + args[0]->type_handler()->Item_sum_variance_fix_length_and_dec(this); + DBUG_PRINT("info", ("Type: %s (%d, %d)", type_handler()->name().ptr(), + max_length, (int)decimals)); DBUG_VOID_RETURN; } @@ -2201,10 +2206,10 @@ bool Item_sum_bit::remove_as_window(ulonglong value) if (!bit_counters[i]) { // Don't attempt to remove values that were never added. - DBUG_ASSERT((value & (1 << i)) == 0); + DBUG_ASSERT((value & (1ULL << i)) == 0); continue; } - bit_counters[i]-= (value & (1 << i)) ? 1 : 0; + bit_counters[i]-= (value & (1ULL << i)) ? 1 : 0; } // Prevent overflow; @@ -2218,7 +2223,7 @@ bool Item_sum_bit::add_as_window(ulonglong value) DBUG_ASSERT(as_window_function); for (int i= 0; i < NUM_BIT_COUNTERS; i++) { - bit_counters[i]+= (value & (1 << i)) ? 1 : 0; + bit_counters[i]+= (value & (1ULL << i)) ? 1 : 0; } // Prevent overflow; num_values_added = std::max(num_values_added, num_values_added + 1); @@ -2289,7 +2294,7 @@ void Item_sum_and::set_bits_from_counters() { // We've only added values of 1 for this bit. if (bit_counters[i] == num_values_added) - value|= (1 << i); + value|= (1ULL << i); } bits= value & reset_bits; } @@ -3102,7 +3107,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), { Item_func_group_concat *item= (Item_func_group_concat *) item_arg; TABLE *table= item->table; - uint max_length= table->in_use->variables.group_concat_max_len; + uint max_length= (uint)table->in_use->variables.group_concat_max_len; String tmp((char *)table->record[1], table->s->reclength, default_charset_info); String tmp2; @@ -3473,9 +3478,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) result.set_charset(collation.collation); result_field= 0; null_value= 1; - max_length= thd->variables.group_concat_max_len + max_length= (uint32)(thd->variables.group_concat_max_len / collation.collation->mbminlen - * collation.collation->mbmaxlen; + * collation.collation->mbmaxlen); uint32 offset; if (separator->needs_conversion(separator->length(), separator->charset(), diff --git a/sql/item_sum.h b/sql/item_sum.h index 67e97b152bd1f..ee1c10f9fbe3f 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -456,7 +456,6 @@ class Item_sum :public Item_func_or_sum Updated value is then saved in the field. */ virtual void update_field()=0; - virtual bool keep_field_type(void) const { return 0; } virtual void fix_length_and_dec() { maybe_null=1; null_value=1; } virtual Item *result_item(THD *thd, Field *field); @@ -520,7 +519,7 @@ class Item_sum :public Item_func_or_sum st_select_lex *depended_from() { return (nest_level == aggr_level ? 0 : aggr_sel); } - Item *get_arg(uint i) { return args[i]; } + Item *get_arg(uint i) const { return args[i]; } Item *set_arg(uint i, THD *thd, Item *new_val); uint get_arg_count() const { return arg_count; } @@ -790,6 +789,8 @@ class Item_sum_sum :public Item_sum_num, { return Type_handler_hybrid_field_type::result_type(); } enum Item_result cmp_type () const { return Type_handler_hybrid_field_type::cmp_type(); } + void fix_length_and_dec_double(); + void fix_length_and_dec_decimal(); void reset_field(); void update_field(); void no_rows_in_result() {} @@ -889,6 +890,8 @@ class Item_sum_avg :public Item_sum_sum :Item_sum_sum(thd, item), count(item->count), prec_increment(item->prec_increment) {} + void fix_length_and_dec_double(); + void fix_length_and_dec_decimal(); void fix_length_and_dec(); enum Sumfunctype sum_func () const { @@ -963,6 +966,8 @@ class Item_sum_variance : public Item_sum_num {} Item_sum_variance(THD *thd, Item_sum_variance *item); enum Sumfunctype sum_func () const { return VARIANCE_FUNC; } + void fix_length_and_dec_double(); + void fix_length_and_dec_decimal(); void clear(); bool add(); double val_real(); @@ -1041,7 +1046,10 @@ class Item_sum_hybrid :public Item_sum, public Type_handler_hybrid_field_type my_decimal *val_decimal(my_decimal *); void reset_field(); String *val_str(String *); - bool keep_field_type(void) const { return 1; } + const Type_handler *real_type_handler() const + { + return get_arg(0)->real_type_handler(); + } const Type_handler *type_handler() const { return Type_handler_hybrid_field_type::type_handler(); } enum Item_result result_type () const diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index b4953c8a6ac27..193ac04b315b1 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -303,8 +303,6 @@ class Item_sum_hybrid_simple : public Item_sum, my_decimal *val_decimal(my_decimal *); void reset_field(); String *val_str(String *); - /* TODO(cvicentiu) copied from Item_sum_hybrid, what does it do? */ - bool keep_field_type(void) const { return 1; } enum Item_result result_type() const { return Type_handler_hybrid_field_type::result_type(); } enum Item_result cmp_type() const diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc index c23a20ebac991..58f19c427aabd 100644 --- a/sql/mysql_install_db.cc +++ b/sql/mysql_install_db.cc @@ -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(); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ce3b69ae08f59..f8fedbd103220 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2221,6 +2221,7 @@ void clean_up(bool print_message) #endif wsrep_thr_deinit(); my_uuid_end(); + delete type_handler_data; delete binlog_filter; delete global_rpl_filter; end_ssl(); @@ -4126,6 +4127,13 @@ static int init_common_variables() sf_malloc_dbug_id= mariadb_dbug_id; #endif + if (!(type_handler_data= new Type_handler_data) || + type_handler_data->init()) + { + sql_perror("Could not allocate type_handler_data"); + return 1; + } + max_system_variables.pseudo_thread_id= ~(my_thread_id) 0; server_start_time= flush_status_time= my_time(0); my_disable_copystat_in_redel= 1; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 61fe64c393005..397ce6f7ecc80 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -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); } diff --git a/sql/protocol.cc b/sql/protocol.cc index 3cc7307131087..0c3ff2792c01f 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -1617,16 +1617,14 @@ bool Protocol_binary::send_out_parameters(List *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; } diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index fd04e233d353d..a141d238f782c 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -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 { diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 5c637702d04b7..60a758590502a 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -522,7 +522,7 @@ class Relay_log_info : public Slave_reporting_capability } 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: diff --git a/sql/set_var.cc b/sql/set_var.cc index 004af2a56900a..07395e3e7080d 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -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: diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index e984a6d14d834..8f63af78b43ed 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7448,6 +7448,8 @@ ER_GEOJSON_NOT_CLOSED eng "Incorrect GeoJSON format - polygon not closed." ER_JSON_PATH_EMPTY eng "Path expression '$' is not allowed in argument %d to function '%s'." +ER_SLAVE_SAME_ID + eng "A slave with the same server_uuid/server_id as this slave has connected to the master" ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION eng "Illegal parameter data types %s and %s for operation '%s'" ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index dc90fcae57656..efcc9a3f0b252 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -201,6 +201,9 @@ extern "C" sig_handler handle_fatal_signal(int sig) case ABORT_QUERY_HARD: kreason= "ABORT_QUERY"; break; + case KILL_SLAVE_SAME_ID: + kreason= "KILL_SLAVE_SAME_ID"; + break; } my_safe_printf_stderr("%s", "\n" "Trying to get some variables.\n" diff --git a/sql/slave.cc b/sql/slave.cc index 05e967c4edbef..e031a424ea6ed 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -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 " diff --git a/sql/spatial.cc b/sql/spatial.cc index 0e3976ba57378..7c9d8bb771e55 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -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) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ab0ed527bc328..d18a5b4d503be 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -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)); diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index bc5b9bde8e874..95c2163f04388 100644 --- a/sql/sql_admin.cc +++ b/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 it(*lex->column_list); - - bitmap_clear_all(tab->read_set); - while ((column_name= it++)) + else { - if (tab->s->fieldnames.type_names == 0 || - (pos= find_type(&tab->s->fieldnames, column_name->str, - column_name->length, 1)) <= 0) + int pos; + LEX_STRING *column_name; + List_iterator_fast it(*lex->column_list); + + bitmap_clear_all(tab->read_set); + while ((column_name= it++)) { - compl_result_code= result_code= HA_ADMIN_INVALID; - break; + 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); } - 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(); } - 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); } - 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); + else + compl_result_code= HA_ADMIN_FAILED; + if (compl_result_code) result_code= HA_ADMIN_FAILED; else diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 4f87d4983007d..65cfe99649e68 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1060,7 +1060,7 @@ TABLE_LIST* find_dup_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list, { /* 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")); diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 6b13dba876e3c..0bf83915ba860 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -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; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 19846da8e8c5f..fef16acbd20e6 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1987,6 +1987,8 @@ int killed_errno(killed_state killed) case KILL_SERVER: case KILL_SERVER_HARD: DBUG_RETURN(ER_SERVER_SHUTDOWN); + case KILL_SLAVE_SAME_ID: + DBUG_RETURN(ER_SLAVE_SAME_ID); } DBUG_RETURN(0); // Keep compiler happy } diff --git a/sql/sql_class.h b/sql/sql_class.h index d96adc892f05d..681f3ecc6f860 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -477,17 +477,23 @@ enum killed_state ABORT_QUERY_HARD= 7, KILL_TIMEOUT= 8, KILL_TIMEOUT_HARD= 9, + /* + When binlog reading thread connects to the server it kills + all the binlog threads with the same ID. + */ + KILL_SLAVE_SAME_ID= 10, /* All of the following killed states will kill the connection KILL_CONNECTION must be the first of these and it must start with an even number (becasue of HARD bit)! */ - KILL_CONNECTION= 10, - KILL_CONNECTION_HARD= 11, - KILL_SYSTEM_THREAD= 12, - KILL_SYSTEM_THREAD_HARD= 13, - KILL_SERVER= 14, - KILL_SERVER_HARD= 15 + KILL_CONNECTION= 12, + KILL_CONNECTION_HARD= 13, + KILL_SYSTEM_THREAD= 14, + KILL_SYSTEM_THREAD_HARD= 15, + KILL_SERVER= 16, + KILL_SERVER_HARD= 17, + }; extern int killed_errno(killed_state killed); diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 5cb4cd872967b..157e59c2446f0 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -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; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 0df25e5ec27f2..bf5b8fc1ecb74 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -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 diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 438834284e6ec..a21fa33395232 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -3303,14 +3303,14 @@ uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type) { switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) { case PLUGIN_VAR_BOOL: - thd->sys_var_tmp.my_bool_value= option.def_value; + thd->sys_var_tmp.my_bool_value= (my_bool)option.def_value; return (uchar*) &thd->sys_var_tmp.my_bool_value; case PLUGIN_VAR_INT: - thd->sys_var_tmp.int_value= option.def_value; + thd->sys_var_tmp.int_value= (int)option.def_value; return (uchar*) &thd->sys_var_tmp.int_value; case PLUGIN_VAR_LONG: case PLUGIN_VAR_ENUM: - thd->sys_var_tmp.long_value= option.def_value; + thd->sys_var_tmp.long_value= (long)option.def_value; return (uchar*) &thd->sys_var_tmp.long_value; case PLUGIN_VAR_LONGLONG: case PLUGIN_VAR_SET: diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index e99cf15f44761..6ab777f7eacc6 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -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 fields(lex->select_lex.item_list); diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 2a22810b8c2f8..0180671977c27 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -2910,6 +2910,13 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, THD_STAGE_INFO(thd, stage_waiting_to_finalize_termination); RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags)); + if (info->thd->killed == KILL_SLAVE_SAME_ID) + { + info->errmsg= "A slave with the same server_uuid/server_id as this slave " + "has connected to the master"; + info->error= ER_SLAVE_SAME_ID; + } + const bool binlog_open = my_b_inited(&log); if (file >= 0) { @@ -2921,7 +2928,8 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, thd->variables.max_allowed_packet= old_max_allowed_packet; delete info->fdev; - if (info->error == ER_MASTER_FATAL_ERROR_READING_BINLOG && binlog_open) + if ((info->error == ER_MASTER_FATAL_ERROR_READING_BINLOG || + info->error == ER_SLAVE_SAME_ID) && binlog_open) { /* detailing the fatal error message with coordinates @@ -3392,7 +3400,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id) it will be slow because it will iterate through the list again. We just to do kill the thread ourselves. */ - tmp->awake(KILL_QUERY); + tmp->awake(KILL_SLAVE_SAME_ID); mysql_mutex_unlock(&tmp->LOCK_thd_data); } } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0bd787de1cda1..3c2984826cf15 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -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; } diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 4d4694d8638b2..67ecd2af45ed7 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -25,7 +25,6 @@ static Type_handler_short type_handler_short; static Type_handler_long type_handler_long; static Type_handler_int24 type_handler_int24; static Type_handler_year type_handler_year; -static Type_handler_float type_handler_float; static Type_handler_time type_handler_time; static Type_handler_time2 type_handler_time2; static Type_handler_date type_handler_date; @@ -39,65 +38,59 @@ static Type_handler_tiny_blob type_handler_tiny_blob; static Type_handler_medium_blob type_handler_medium_blob; static Type_handler_long_blob type_handler_long_blob; static Type_handler_blob type_handler_blob; -static Type_handler_enum type_handler_enum; -static Type_handler_set type_handler_set; Type_handler_null type_handler_null; Type_handler_row type_handler_row; Type_handler_varchar type_handler_varchar; Type_handler_longlong type_handler_longlong; +Type_handler_float type_handler_float; Type_handler_double type_handler_double; Type_handler_newdecimal type_handler_newdecimal; Type_handler_datetime type_handler_datetime; Type_handler_bit type_handler_bit; +Type_handler_enum type_handler_enum; +Type_handler_set type_handler_set; #ifdef HAVE_SPATIAL Type_handler_geometry type_handler_geometry; #endif -Type_aggregator type_aggregator_for_result; -Type_aggregator type_aggregator_for_comparison; - - -class Static_data_initializer +bool Type_handler_data::init() { -public: - static Static_data_initializer m_singleton; - Static_data_initializer() - { #ifdef HAVE_SPATIAL - type_aggregator_for_result.add(&type_handler_geometry, - &type_handler_null, - &type_handler_geometry); - type_aggregator_for_result.add(&type_handler_geometry, - &type_handler_geometry, - &type_handler_geometry); - type_aggregator_for_result.add(&type_handler_geometry, - &type_handler_blob, - &type_handler_long_blob); - type_aggregator_for_result.add(&type_handler_geometry, - &type_handler_varchar, - &type_handler_long_blob); - type_aggregator_for_result.add(&type_handler_geometry, - &type_handler_string, - &type_handler_long_blob); - - type_aggregator_for_comparison.add(&type_handler_geometry, - &type_handler_geometry, - &type_handler_geometry); - type_aggregator_for_comparison.add(&type_handler_geometry, - &type_handler_null, - &type_handler_geometry); - type_aggregator_for_comparison.add(&type_handler_geometry, - &type_handler_long_blob, - &type_handler_long_blob); + return + m_type_aggregator_for_result.add(&type_handler_geometry, + &type_handler_null, + &type_handler_geometry) || + m_type_aggregator_for_result.add(&type_handler_geometry, + &type_handler_geometry, + &type_handler_geometry) || + m_type_aggregator_for_result.add(&type_handler_geometry, + &type_handler_blob, + &type_handler_long_blob) || + m_type_aggregator_for_result.add(&type_handler_geometry, + &type_handler_varchar, + &type_handler_long_blob) || + m_type_aggregator_for_result.add(&type_handler_geometry, + &type_handler_string, + &type_handler_long_blob) || + m_type_aggregator_for_comparison.add(&type_handler_geometry, + &type_handler_geometry, + &type_handler_geometry) || + m_type_aggregator_for_comparison.add(&type_handler_geometry, + &type_handler_null, + &type_handler_geometry) || + m_type_aggregator_for_comparison.add(&type_handler_geometry, + &type_handler_long_blob, + &type_handler_long_blob); #endif - } -}; + return false; +} + -Static_data_initializer Static_data_initializer::m_singleton; +Type_handler_data *type_handler_data= NULL; void Type_std_attributes::set(const Field *field) @@ -293,7 +286,8 @@ Type_handler_hybrid_field_type::aggregate_for_result(const Type_handler *other) Type_handler::aggregate_for_result_traditional(m_type_handler, other); return false; } - other= type_aggregator_for_result.find_handler(m_type_handler, other); + other= type_handler_data-> + m_type_aggregator_for_result.find_handler(m_type_handler, other); if (!other) return true; m_type_handler= other; @@ -407,7 +401,8 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h) if (!m_type_handler->is_traditional_type() || !h->is_traditional_type()) { - h= type_aggregator_for_comparison.find_handler(m_type_handler, h); + h= type_handler_data-> + m_type_aggregator_for_comparison.find_handler(m_type_handler, h); if (!h) return true; m_type_handler= h; @@ -1398,6 +1393,166 @@ bool Type_handler_temporal_result:: return false; } + +/*************************************************************************/ + +bool Type_handler_int_result:: + Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_decimal_result:: + Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_temporal_result:: + Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_real_result:: + Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +bool Type_handler_string_result:: + Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +#ifdef HAVE_SPATIAL +bool Type_handler_geometry:: + Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const +{ + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0), + type_handler_geometry.name().ptr(), "sum"); + return false; +} +#endif + + +/*************************************************************************/ + +bool Type_handler_int_result:: + Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_decimal_result:: + Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_temporal_result:: + Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_real_result:: + Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +bool Type_handler_string_result:: + Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +#ifdef HAVE_SPATIAL +bool Type_handler_geometry:: + Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const +{ + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0), + type_handler_geometry.name().ptr(), "avg"); + return false; +} +#endif + + +/*************************************************************************/ + +bool Type_handler_int_result:: + Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_decimal_result:: + Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_temporal_result:: + Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const +{ + item->fix_length_and_dec_decimal(); + return false; +} + + +bool Type_handler_real_result:: + Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +bool Type_handler_string_result:: + Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const +{ + item->fix_length_and_dec_double(); + return false; +} + + +#ifdef HAVE_SPATIAL +bool Type_handler_geometry:: + Item_sum_variance_fix_length_and_dec(Item_sum_variance *item) const +{ + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0), + type_handler_geometry.name().ptr(), item->func_name()); + return false; +} +#endif + + /*************************************************************************/ String * diff --git a/sql/sql_type.h b/sql/sql_type.h index 74ab47f637e64..189b1b0dc276c 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -28,6 +28,9 @@ class Field; class Item; class Item_cache; class Item_sum_hybrid; +class Item_sum_sum; +class Item_sum_avg; +class Item_sum_variance; class Item_func_hex; class Item_hybrid_func; class Item_func_min_max; @@ -403,6 +406,11 @@ class Type_handler Item **items, uint nitems) const= 0; virtual bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const= 0; + virtual bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const= 0; + virtual bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const= 0; + virtual + bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const= 0; + virtual String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const= 0; @@ -540,6 +548,21 @@ class Type_handler_row: public Type_handler DBUG_ASSERT(0); return true; } + bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const + { + DBUG_ASSERT(0); + return true; + } + bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const + { + DBUG_ASSERT(0); + return true; + } + bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const + { + DBUG_ASSERT(0); + return true; + } String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const { DBUG_ASSERT(0); @@ -662,6 +685,9 @@ class Type_handler_real_result: public Type_handler_numeric bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func, Item **items, uint nitems) const; bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const; + bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const; + bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const; + bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const; String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const; String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, String *) const; @@ -709,6 +735,9 @@ class Type_handler_decimal_result: public Type_handler_numeric bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func, Item **items, uint nitems) const; bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const; + bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const; + bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const; + bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const; String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const; String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, String *) const; @@ -754,6 +783,9 @@ class Type_handler_int_result: public Type_handler_numeric bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func, Item **items, uint nitems) const; bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const; + bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const; + bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const; + bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const; String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const; String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, String *) const; @@ -799,6 +831,9 @@ class Type_handler_temporal_result: public Type_handler Item_cache *Item_get_cache(THD *thd, const Item *item) const; bool set_comparator_func(Arg_comparator *cmp) const; bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const; + bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const; + bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const; + bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const; String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const; String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, String *) const; @@ -860,6 +895,9 @@ class Type_handler_string_result: public Type_handler bool Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func, Item **items, uint nitems) const; bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const; + bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const; + bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const; + bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const; String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const; String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *, String *) const; @@ -1307,6 +1345,9 @@ class Type_handler_geometry: public Type_handler_string_result bool Item_func_int_val_fix_length_and_dec(Item_func_int_val *) const; bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const; bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const; + bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const; + bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const; + bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const; }; extern Type_handler_geometry type_handler_geometry; @@ -1409,29 +1450,19 @@ class Type_handler_hybrid_field_type }; -/** - This class is used for Item_type_holder, which preserves real_type. -*/ -class Type_handler_hybrid_real_field_type: - public Type_handler_hybrid_field_type -{ -public: - Type_handler_hybrid_real_field_type(enum_field_types type) - :Type_handler_hybrid_field_type(Type_handler:: - get_handler_by_real_type(type)) - { } -}; - - extern Type_handler_row type_handler_row; extern Type_handler_null type_handler_null; extern Type_handler_varchar type_handler_varchar; extern Type_handler_longlong type_handler_longlong; +extern Type_handler_float type_handler_float; extern Type_handler_double type_handler_double; extern Type_handler_newdecimal type_handler_newdecimal; extern Type_handler_datetime type_handler_datetime; extern Type_handler_longlong type_handler_longlong; extern Type_handler_bit type_handler_bit; +extern Type_handler_enum type_handler_enum; +extern Type_handler_set type_handler_set; + class Type_aggregator { @@ -1481,7 +1512,16 @@ class Type_aggregator } }; -extern Type_aggregator type_aggregator_for_result; -extern Type_aggregator type_aggregator_for_comparison; + +class Type_handler_data +{ +public: + Type_aggregator m_type_aggregator_for_result; + Type_aggregator m_type_aggregator_for_comparison; + bool init(); +}; + + +extern Type_handler_data *type_handler_data; #endif /* SQL_TYPE_H_INCLUDED */ diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 7a69481b2af0f..90d5c76b1bbc4 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5227,7 +5227,7 @@ int default_regex_flags_pcre(const THD *thd) int i, res; for (i= res= 0; default_regex_flags_to_pcre[i]; i++) { - if (src & (1 << i)) + if (src & (1ULL << i)) res|= default_regex_flags_to_pcre[i]; } return res; diff --git a/sql/unireg.cc b/sql/unireg.cc index 959f8341a90bd..0bb8a4e77c6fb 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -58,7 +58,7 @@ static bool make_empty_rec(THD *, uchar *, uint, List &, uint, static uchar *extra2_write_len(uchar *pos, size_t len) { if (len <= 255) - *pos++= len; + *pos++= (uchar)len; else { /* diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 9d6d100c1b8df..810c0fd9c4d6f 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -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++) diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 64daf36ffd672..80d84819f0839 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -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 diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 49ac63cff6dfe..e1446b409d1d3 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.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 @@ btr_validate_level( /**************************************************************//** 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( /*====================*/ diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 06b5b66c2aaf2..7d93c495aa08a 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -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" diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 741f16e0df425..445aa3504b7b3 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -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( /*=============================*/ diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc index e2670521cf3fd..c30227ef08517 100644 --- a/storage/innobase/btr/btr0scrub.cc +++ b/storage/innobase/btr/btr0scrub.cc @@ -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; diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 86827fabdd4fd..f7a430591ac18 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -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)) { diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc index 1d6083a5f7779..d75fc41376d56 100644 --- a/storage/innobase/buf/buf0buddy.cc +++ b/storage/innobase/buf/buf0buddy.cc @@ -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" diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index a1827e7b3b5d1..93e0bebfe4e8c 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -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 diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 4f83921a553d0..c4f2280a1f270 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -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" diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index ed975702fa346..ae33334ca175f 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -30,11 +30,6 @@ Created 11/11/1995 Heikki Tuuri #include #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( /*============================*/ diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index ef8c2177b2cb2..d6d5db3dfa94c 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -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 @@ buf_flush_or_remove_pages( 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( /*===================*/ diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc index c897564c1d4c0..8b1900face75c 100644 --- a/storage/innobase/data/data0data.cc +++ b/storage/innobase/data/data0data.cc @@ -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 */ diff --git a/storage/innobase/data/data0type.cc b/storage/innobase/data/data0type.cc index 7da473f0a3e3d..315b12e135ccc 100644 --- a/storage/innobase/data/data0type.cc +++ b/storage/innobase/data/data0type.cc @@ -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 */ diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc index 5c4e2049723bc..8d5bde4e0e24d 100644 --- a/storage/innobase/dict/dict0boot.cc +++ b/storage/innobase/dict/dict0boot.cc @@ -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" diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 084d39fc4a164..90dba680f25d3 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -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; } diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc index 3f3eefc6acf58..016b774217ff6 100644 --- a/storage/innobase/dict/dict0defrag_bg.cc +++ b/storage/innobase/dict/dict0defrag_bg.cc @@ -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 static ib_mutex_t defrag_pool_mutex; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 32c1a12ec1efe..dc64163bee315 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -37,11 +37,6 @@ Created 1/8/1996 Heikki Tuuri #include "fil0fil.h" #include -#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 @@ dict_create_foreign_constraints_low( 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. diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index 203185d55a581..da72126793fa5 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -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 @@ dict_load_column_low( /** 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 @@ dict_load_virtual_low( 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 @@ dict_load_indexes( 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( /*====================*/ diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index f4dbbf026aa84..13db213259ca8 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -29,11 +29,6 @@ Created 1/8/1996 Heikki Tuuri #include #include "dict0mem.h" - -#ifdef UNIV_NONINL -#include "dict0mem.ic" -#endif - #include "rem0rec.h" #include "data0type.h" #include "mach0data.h" diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index 87502ef130ce8..9eb033a7eb9f1 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -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); diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc index 974ec9b5c4197..1c998eb6ff4eb 100644 --- a/storage/innobase/dict/dict0stats_bg.cc +++ b/storage/innobase/dict/dict0stats_bg.cc @@ -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 /** Minimum time interval between stats recalc for a given table */ diff --git a/storage/innobase/eval/eval0eval.cc b/storage/innobase/eval/eval0eval.cc index a525cb604ea79..fa0b265b3db34 100644 --- a/storage/innobase/eval/eval0eval.cc +++ b/storage/innobase/eval/eval0eval.cc @@ -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" diff --git a/storage/innobase/eval/eval0proc.cc b/storage/innobase/eval/eval0proc.cc index cdd6fdc2a0a2c..c73bc6784a636 100644 --- a/storage/innobase/eval/eval0proc.cc +++ b/storage/innobase/eval/eval0proc.cc @@ -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 */ diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 5a7a33f67e350..9413a2b3cba6f 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -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 diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 80a2aa211db84..d37e334882025 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -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. */ diff --git a/storage/innobase/fts/fts0ast.cc b/storage/innobase/fts/fts0ast.cc index 8c542aab2899f..82c4438196bec 100644 --- a/storage/innobase/fts/fts0ast.cc +++ b/storage/innobase/fts/fts0ast.cc @@ -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) { diff --git a/storage/innobase/fts/fts0config.cc b/storage/innobase/fts/fts0config.cc index 740ee87fe0123..cca3d5fcd8759 100644 --- a/storage/innobase/fts/fts0config.cc +++ b/storage/innobase/fts/fts0config.cc @@ -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(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); -} - diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index f05ad4421f616..58924724ef11f 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -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(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(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 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(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(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( - 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( - 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(row); - ibool* found = static_cast(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( - 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( /*=======================*/ diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index 45c71f6f1cdf4..f1e717c353aec 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -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() diff --git a/storage/innobase/fts/fts0plugin.cc b/storage/innobase/fts/fts0plugin.cc index eaa32379a7c80..e78dcdacfb9e2 100644 --- a/storage/innobase/fts/fts0plugin.cc +++ b/storage/innobase/fts/fts0plugin.cc @@ -108,6 +108,7 @@ Refer to 'st_mysql_ftparser_param' for more detail. 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( /*==========================*/ diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc index dee7c59a58bee..beef71aa17836 100644 --- a/storage/innobase/fts/fts0que.cc +++ b/storage/innobase/fts/fts0que.cc @@ -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 #include @@ -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(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"; diff --git a/storage/innobase/fts/fts0sql.cc b/storage/innobase/fts/fts0sql.cc index 4900ff3be1a46..ae2186c2d3007 100644 --- a/storage/innobase/fts/fts0sql.cc +++ b/storage/innobase/fts/fts0sql.cc @@ -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. */ diff --git a/storage/innobase/fut/fut0fut.cc b/storage/innobase/fut/fut0fut.cc deleted file mode 100644 index 9bb1c512182d0..0000000000000 --- a/storage/innobase/fut/fut0fut.cc +++ /dev/null @@ -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 - diff --git a/storage/innobase/fut/fut0lst.cc b/storage/innobase/fut/fut0lst.cc index 2300d1894072a..9f79ac8df2b20 100644 --- a/storage/innobase/fut/fut0lst.cc +++ b/storage/innobase/fut/fut0lst.cc @@ -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; -} diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index 559ac2a6aa55b..a558ce3f54d5f 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -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( /*=========================*/ diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index f23065ae3c7dc..97163cae410a6 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -39,6 +39,15 @@ Created 2014/01/16 Jimmy Yang #include "srv0mon.h" #include "gis0geo.h" +/** Restore the stored position of a persistent cursor bufferfixing the page */ +static +bool +rtr_cur_restore_position( + ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ + btr_cur_t* cursor, /*!< in: detached persistent cursor */ + ulint level, /*!< in: index level */ + mtr_t* mtr); /*!< in: mtr */ + /*************************************************************//** Pop out used parent path entry, until we find the parent with matching page number */ @@ -678,47 +687,18 @@ rtr_page_get_father( mem_heap_free(heap); } -/************************************************************//** -Returns the father block to a page. It is assumed that mtr holds -an X or SX latch on the tree. -@return rec_get_offsets() of the node pointer record */ -ulint* -rtr_page_get_father_block( -/*======================*/ - ulint* offsets,/*!< in: work area for the return value */ - mem_heap_t* heap, /*!< in: memory heap to use */ - dict_index_t* index, /*!< in: b-tree index */ - buf_block_t* block, /*!< in: child page in the index */ - mtr_t* mtr, /*!< in: mtr */ - btr_cur_t* sea_cur,/*!< in: search cursor, contains information - about parent nodes in search */ - btr_cur_t* cursor) /*!< out: cursor on node pointer record, - its page x-latched */ -{ - - rec_t* rec = page_rec_get_next( - page_get_infimum_rec(buf_block_get_frame(block))); - btr_cur_position(index, rec, block, cursor); - - return(rtr_page_get_father_node_ptr(offsets, heap, sea_cur, - cursor, mtr)); -} - -/************************************************************//** -Returns the upper level node pointer to a R-Tree page. It is assumed -that mtr holds an x-latch on the tree. +/** Returns the upper level node pointer to a R-Tree page. It is assumed +that mtr holds an SX-latch or X-latch on the tree. @return rec_get_offsets() of the node pointer record */ +static ulint* -rtr_page_get_father_node_ptr_func( -/*==============================*/ +rtr_page_get_father_node_ptr( ulint* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ btr_cur_t* sea_cur,/*!< in: search cursor */ btr_cur_t* cursor, /*!< in: cursor pointing to user record, out: cursor on node pointer record, its page x-latched */ - const char* file, /*!< in: file name */ - unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { dtuple_t* tuple; @@ -800,6 +780,31 @@ rtr_page_get_father_node_ptr_func( return(offsets); } +/************************************************************//** +Returns the father block to a page. It is assumed that mtr holds +an X or SX latch on the tree. +@return rec_get_offsets() of the node pointer record */ +ulint* +rtr_page_get_father_block( +/*======================*/ + ulint* offsets,/*!< in: work area for the return value */ + mem_heap_t* heap, /*!< in: memory heap to use */ + dict_index_t* index, /*!< in: b-tree index */ + buf_block_t* block, /*!< in: child page in the index */ + mtr_t* mtr, /*!< in: mtr */ + btr_cur_t* sea_cur,/*!< in: search cursor, contains information + about parent nodes in search */ + btr_cur_t* cursor) /*!< out: cursor on node pointer record, + its page x-latched */ +{ + rec_t* rec = page_rec_get_next( + page_get_infimum_rec(buf_block_get_frame(block))); + btr_cur_position(index, rec, block, cursor); + + return(rtr_page_get_father_node_ptr(offsets, heap, sea_cur, + cursor, mtr)); +} + /********************************************************************//** Returns the upper level node pointer to a R-Tree page. It is assumed that mtr holds an x-latch on the tree. */ @@ -1253,16 +1258,13 @@ rtr_check_discard_page( lock_mutex_exit(); } -/**************************************************************//** -Restores the stored position of a persistent cursor bufferfixing the page */ +/** Restore the stored position of a persistent cursor bufferfixing the page */ +static bool -rtr_cur_restore_position_func( -/*==========================*/ - ulint latch_mode, /*!< in: BTR_CONT_MODIFY_TREE, ... */ +rtr_cur_restore_position( + ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_cur_t* btr_cur, /*!< in: detached persistent cursor */ ulint level, /*!< in: index level */ - const char* file, /*!< in: file name */ - unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { dict_index_t* index; @@ -1291,8 +1293,9 @@ rtr_cur_restore_position_func( if (!buf_pool_is_obsolete(r_cursor->withdraw_clock) && buf_page_optimistic_get(RW_X_LATCH, - r_cursor->block_when_stored, - r_cursor->modify_clock, file, line, mtr)) { + r_cursor->block_when_stored, + r_cursor->modify_clock, + __FILE__, __LINE__, mtr)) { ut_ad(r_cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(r_cursor->rel_pos == BTR_PCUR_ON); diff --git a/storage/innobase/ha/ha0ha.cc b/storage/innobase/ha/ha0ha.cc index 1f90738c75f01..5822bd6755c05 100644 --- a/storage/innobase/ha/ha0ha.cc +++ b/storage/innobase/ha/ha0ha.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 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 @@ -24,9 +24,6 @@ Created 8/22/1994 Heikki Tuuri *************************************************************************/ #include "ha0ha.h" -#ifdef UNIV_NONINL -#include "ha0ha.ic" -#endif #ifdef UNIV_DEBUG # include "buf0buf.h" diff --git a/storage/innobase/ha/ha0storage.cc b/storage/innobase/ha/ha0storage.cc index a36fd573a4f92..cde4cc04cb7d5 100644 --- a/storage/innobase/ha/ha0storage.cc +++ b/storage/innobase/ha/ha0storage.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2007, 2015, 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 @@ -31,10 +31,6 @@ Created September 22, 2007 Vasil Dimov #include "mem0mem.h" #include "ut0rnd.h" -#ifdef UNIV_NONINL -#include "ha0storage.ic" -#endif - /*******************************************************************//** Retrieves a data from a storage. If it is present, a pointer to the stored copy of data is returned, otherwise NULL is returned. */ diff --git a/storage/innobase/ha/hash0hash.cc b/storage/innobase/ha/hash0hash.cc index ef1339ff47b12..a91bc78abe9d9 100644 --- a/storage/innobase/ha/hash0hash.cc +++ b/storage/innobase/ha/hash0hash.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2015, 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 @@ -24,168 +24,9 @@ Created 5/20/1997 Heikki Tuuri *******************************************************/ #include "hash0hash.h" - -#ifdef UNIV_NONINL -#include "hash0hash.ic" -#endif /* UNIV_NOINL */ - #include "mem0mem.h" #include "sync0sync.h" -/************************************************************//** -Reserves the mutex for a fold value in a hash table. */ -void -hash_mutex_enter( -/*=============*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold) /*!< in: fold */ -{ - ut_ad(table->type == HASH_TABLE_SYNC_MUTEX); - mutex_enter(hash_get_mutex(table, fold)); -} - -/************************************************************//** -Releases the mutex for a fold value in a hash table. */ -void -hash_mutex_exit( -/*============*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold) /*!< in: fold */ -{ - ut_ad(table->type == HASH_TABLE_SYNC_MUTEX); - mutex_exit(hash_get_mutex(table, fold)); -} - -/************************************************************//** -Reserves all the mutexes of a hash table, in an ascending order. */ -void -hash_mutex_enter_all( -/*=================*/ - hash_table_t* table) /*!< in: hash table */ -{ - ut_ad(table->type == HASH_TABLE_SYNC_MUTEX); - - for (ulint i = 0; i < table->n_sync_obj; i++) { - - mutex_enter(table->sync_obj.mutexes + i); - } -} - -/************************************************************//** -Releases all the mutexes of a hash table. */ -void -hash_mutex_exit_all( -/*================*/ - hash_table_t* table) /*!< in: hash table */ -{ - ut_ad(table->type == HASH_TABLE_SYNC_MUTEX); - - for (ulint i = 0; i < table->n_sync_obj; i++) { - - mutex_exit(table->sync_obj.mutexes + i); - } -} - -/************************************************************//** -Releases all but the passed in mutex of a hash table. */ -void -hash_mutex_exit_all_but( -/*====================*/ - hash_table_t* table, /*!< in: hash table */ - ib_mutex_t* keep_mutex) /*!< in: mutex to keep */ -{ - ulint i; - - ut_ad(table->type == HASH_TABLE_SYNC_MUTEX); - for (i = 0; i < table->n_sync_obj; i++) { - - ib_mutex_t* mutex = table->sync_obj.mutexes + i; - if (keep_mutex != mutex) { - mutex_exit(mutex); - } - } - - ut_ad(mutex_own(keep_mutex)); -} - -/************************************************************//** -s-lock a lock for a fold value in a hash table. */ -void -hash_lock_s( -/*========*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold) /*!< in: fold */ -{ - - rw_lock_t* lock = hash_get_lock(table, fold); - - ut_ad(table->type == HASH_TABLE_SYNC_RW_LOCK); - ut_ad(lock); - - ut_ad(!rw_lock_own(lock, RW_LOCK_S)); - ut_ad(!rw_lock_own(lock, RW_LOCK_X)); - - rw_lock_s_lock(lock); -} - -/************************************************************//** -x-lock a lock for a fold value in a hash table. */ -void -hash_lock_x( -/*========*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold) /*!< in: fold */ -{ - - rw_lock_t* lock = hash_get_lock(table, fold); - - ut_ad(table->type == HASH_TABLE_SYNC_RW_LOCK); - ut_ad(lock); - - ut_ad(!rw_lock_own(lock, RW_LOCK_S)); - ut_ad(!rw_lock_own(lock, RW_LOCK_X)); - - rw_lock_x_lock(lock); -} - -/************************************************************//** -unlock an s-lock for a fold value in a hash table. */ -void -hash_unlock_s( -/*==========*/ - - hash_table_t* table, /*!< in: hash table */ - ulint fold) /*!< in: fold */ -{ - - rw_lock_t* lock = hash_get_lock(table, fold); - - ut_ad(table->type == HASH_TABLE_SYNC_RW_LOCK); - ut_ad(lock); - - ut_ad(rw_lock_own(lock, RW_LOCK_S)); - - rw_lock_s_unlock(lock); -} - -/************************************************************//** -unlock x-lock for a fold value in a hash table. */ -void -hash_unlock_x( -/*==========*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold) /*!< in: fold */ -{ - rw_lock_t* lock = hash_get_lock(table, fold); - - ut_ad(table->type == HASH_TABLE_SYNC_RW_LOCK); - ut_ad(lock); - - ut_ad(rw_lock_own(lock, RW_LOCK_X)); - - rw_lock_x_unlock(lock); -} - /************************************************************//** Reserves all the locks of a hash table, in an ascending order. */ void diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7385de8a0d77c..e9349fec95e0f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -472,6 +472,31 @@ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = { "all" /* IBUF_USE_ALL */ }; +/** Retrieve the FTS Relevance Ranking result for doc with doc_id +of m_prebuilt->fts_doc_id +@param[in,out] fts_hdl FTS handler +@return the relevance ranking value */ +static +float +innobase_fts_retrieve_ranking( + FT_INFO* fts_hdl); +/** Free the memory for the FTS handler +@param[in,out] fts_hdl FTS handler */ +static +void +innobase_fts_close_ranking( + FT_INFO* fts_hdl); +/** Find and Retrieve the FTS Relevance Ranking result for doc with doc_id +of m_prebuilt->fts_doc_id +@param[in,out] fts_hdl FTS handler +@return the relevance ranking value */ +static +float +innobase_fts_find_ranking( + FT_INFO* fts_hdl, + uchar*, + uint); + /* Call back function array defined by MySQL and used to retrieve FTS results. */ const struct _ft_vft ft_vft_result = {NULL, @@ -480,6 +505,50 @@ const struct _ft_vft ft_vft_result = {NULL, innobase_fts_retrieve_ranking, NULL}; +/** @return version of the extended FTS API */ +static +uint +innobase_fts_get_version() +{ + /* Currently this doesn't make much sense as returning + HA_CAN_FULLTEXT_EXT automatically mean this version is supported. + This supposed to ease future extensions. */ + return(2); +} + +/** @return Which part of the extended FTS API is supported */ +static +ulonglong +innobase_fts_flags() +{ + return(FTS_ORDERED_RESULT | FTS_DOCID_IN_RESULT); +} + +/** Find and Retrieve the FTS doc_id for the current result row +@param[in,out] fts_hdl FTS handler +@return the document ID */ +static +ulonglong +innobase_fts_retrieve_docid( + FT_INFO_EXT* fts_hdl); + +/** Find and retrieve the size of the current result +@param[in,out] fts_hdl FTS handler +@return number of matching rows */ +static +ulonglong +innobase_fts_count_matches( + FT_INFO_EXT* fts_hdl) /*!< in: FTS handler */ +{ + NEW_FT_INFO* handle = reinterpret_cast(fts_hdl); + + if (handle->ft_result->rankings_by_id != NULL) { + return(rbt_size(handle->ft_result->rankings_by_id)); + } else { + return(0); + } +} + const struct _ft_vft_ext ft_vft_ext_result = {innobase_fts_get_version, innobase_fts_flags, innobase_fts_retrieve_docid, @@ -1718,22 +1787,6 @@ thd_trx_priority(THD* thd) } #endif -#ifdef UNIV_DEBUG -/** -Returns true if transaction should be flagged as DD attachable transaction -@param[in] thd Thread handle -@return true if the thd is marked as read-only */ -bool -thd_trx_is_dd_trx(THD* thd) -{ - /* JAN: TODO: MySQL 5.7 - ha_table_flags() & HA_ATTACHABLE_TRX_COMPATIBLE - return(thd != NULL && thd_tx_is_dd_trx(thd)); - */ - return false; -} -#endif /* UNIV_DEBUG */ - /******************************************************************//** Check if the transaction is an auto-commit transaction. TRUE also implies that it is a SELECT (read-only) transaction. @@ -2358,6 +2411,7 @@ innobase_strcasecmp( Compares NUL-terminated UTF-8 strings case insensitively. The second string contains wildcards. @return 0 if a match is found, 1 if not */ +static int innobase_wildcasecmp( /*=================*/ @@ -2619,6 +2673,7 @@ innobase_mysql_tmpfile( /*********************************************************************//** Wrapper around MySQL's copy_and_convert function. @return number of bytes copied to 'to' */ +static ulint innobase_convert_string( /*====================*/ @@ -3035,6 +3090,7 @@ Copy table flags from MySQL's HA_CREATE_INFO into an InnoDB table object. Those flags are stored in .frm file and end up in the MySQL table object, but are frequently used inside InnoDB so we keep their copies into the InnoDB table object. */ +static void innobase_copy_frm_flags_from_create_info( /*=====================================*/ @@ -3445,6 +3501,7 @@ and quote it. @param[in] idlen length of id, in bytes @param[in] thd MySQL connection thread, or NULL @return pointer to the end of buf */ +static char* innobase_convert_identifier( char* buf, @@ -12067,6 +12124,7 @@ create_clustered_index_when_no_primary( /** Return a display name for the row format @param[in] row_format Row Format @return row format name */ +static const char* get_row_format_name( enum row_type row_format) @@ -16544,11 +16602,6 @@ ha_innobase::external_lock( TrxInInnoDB::begin_stmt(trx); -#ifdef UNIV_DEBUG - if (thd_trx_is_dd_trx(thd)) { - trx->is_dd_trx = true; - } -#endif /* UNIV_DEBUG */ DBUG_RETURN(0); } else { @@ -16578,11 +16631,6 @@ ha_innobase::external_lock( if (trx_is_started(trx)) { innobase_commit(ht, thd, TRUE); - } else { - /* Since the trx state is TRX_NOT_STARTED, - trx_commit() will not be called. Reset - trx->is_dd_trx here */ - ut_d(trx->is_dd_trx = false); } } else if (trx->isolation_level <= TRX_ISO_READ_COMMITTED @@ -17458,13 +17506,6 @@ ha_innobase::store_lock( ++trx->will_lock; } -#ifdef UNIV_DEBUG - if (trx->is_dd_trx) { - ut_ad(trx->will_lock == 0 - && m_prebuilt->select_lock_type == LOCK_NONE); - } -#endif /* UNIV_DEBUG */ - return(to); } @@ -18773,8 +18814,8 @@ innodb_change_buffer_max_size_update( } #ifdef UNIV_DEBUG -ulong srv_fil_make_page_dirty_debug = 0; -ulong srv_saved_page_number_debug = 0; +static ulong srv_fil_make_page_dirty_debug = 0; +static ulong srv_saved_page_number_debug = 0; /****************************************************************//** Save an InnoDB page number. */ @@ -19709,14 +19750,14 @@ innobase_index_name_is_reserved( return(false); } -/*********************************************************************** -Retrieve the FTS Relevance Ranking result for doc with doc_id +/** Retrieve the FTS Relevance Ranking result for doc with doc_id of m_prebuilt->fts_doc_id +@param[in,out] fts_hdl FTS handler @return the relevance ranking value */ +static float innobase_fts_retrieve_ranking( -/*============================*/ - FT_INFO * fts_hdl) /*!< in: FTS handler */ + FT_INFO* fts_hdl) { fts_result_t* result; row_prebuilt_t* ft_prebuilt; @@ -19731,12 +19772,12 @@ innobase_fts_retrieve_ranking( return(ranking->rank); } -/*********************************************************************** -Free the memory for the FTS handler */ +/** Free the memory for the FTS handler +@param[in,out] fts_hdl FTS handler */ +static void innobase_fts_close_ranking( -/*=======================*/ - FT_INFO * fts_hdl) + FT_INFO* fts_hdl) { fts_result_t* result; @@ -19745,20 +19786,15 @@ innobase_fts_close_ranking( fts_query_free_result(result); my_free((uchar*) fts_hdl); - - return; } -/*********************************************************************** -Find and Retrieve the FTS Relevance Ranking result for doc with doc_id +/** Find and Retrieve the FTS Relevance Ranking result for doc with doc_id of m_prebuilt->fts_doc_id +@param[in,out] fts_hdl FTS handler @return the relevance ranking value */ +static float -innobase_fts_find_ranking( -/*======================*/ - FT_INFO* fts_hdl, /*!< in: FTS handler */ - uchar* record, /*!< in: Unused */ - uint len) /*!< in: Unused */ +innobase_fts_find_ranking(FT_INFO* fts_hdl, uchar*, uint) { fts_result_t* result; row_prebuilt_t* ft_prebuilt; @@ -19922,35 +19958,13 @@ innodb_merge_threshold_set_all_debug_update( } #endif /* UNIV_DEBUG */ -/*********************************************************************** -@return version of the extended FTS API */ -uint -innobase_fts_get_version() -/*======================*/ -{ - /* Currently this doesn't make much sense as returning - HA_CAN_FULLTEXT_EXT automatically mean this version is supported. - This supposed to ease future extensions. */ - return(2); -} - -/*********************************************************************** -@return Which part of the extended FTS API is supported */ -ulonglong -innobase_fts_flags() -/*================*/ -{ - return(FTS_ORDERED_RESULT | FTS_DOCID_IN_RESULT); -} - - -/*********************************************************************** -Find and Retrieve the FTS doc_id for the current result row +/** Find and Retrieve the FTS doc_id for the current result row +@param[in,out] fts_hdl FTS handler @return the document ID */ +static ulonglong innobase_fts_retrieve_docid( -/*========================*/ - FT_INFO_EXT* fts_hdl) /*!< in: FTS handler */ + FT_INFO_EXT* fts_hdl) { fts_result_t* result; row_prebuilt_t* ft_prebuilt; @@ -19969,23 +19983,6 @@ innobase_fts_retrieve_docid( return(ft_prebuilt->fts_doc_id); } -/*********************************************************************** -Find and retrieve the size of the current result -@return number of matching rows */ -ulonglong -innobase_fts_count_matches( -/*=======================*/ - FT_INFO_EXT* fts_hdl) /*!< in: FTS handler */ -{ - NEW_FT_INFO* handle = reinterpret_cast(fts_hdl); - - if (handle->ft_result->rankings_by_id != 0) { - return rbt_size(handle->ft_result->rankings_by_id); - } else { - return(0); - } -} - /* These variables are never read by InnoDB or changed. They are a kind of dummies that are needed by the MySQL infrastructure to call buffer_pool_dump_now(), buffer_pool_load_now() and buffer_pool_load_abort() diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index d11d5913f3411..49eb150036b65 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -829,30 +829,6 @@ class create_table_info_t ulint m_flags2; }; -/** -Retrieve the FTS Relevance Ranking result for doc with doc_id -of prebuilt->fts_doc_id -@return the relevance ranking value */ -float -innobase_fts_retrieve_ranking( - FT_INFO* fts_hdl); /*!< in: FTS handler */ - -/** -Find and Retrieve the FTS Relevance Ranking result for doc with doc_id -of prebuilt->fts_doc_id -@return the relevance ranking value */ -float -innobase_fts_find_ranking( - FT_INFO* fts_hdl, /*!< in: FTS handler */ - uchar* record, /*!< in: Unused */ - uint len); /*!< in: Unused */ - -/** -Free the memory for the FTS handler */ -void -innobase_fts_close_ranking( - FT_INFO* fts_hdl); /*!< in: FTS handler */ - /** Initialize the table FTS stopword list @return TRUE if success */ @@ -895,42 +871,6 @@ innobase_fts_check_doc_id_index_in_def( const KEY* key_info) /*!< in: Key definitions */ MY_ATTRIBUTE((warn_unused_result)); -/** -@return version of the extended FTS API */ -uint -innobase_fts_get_version(); - -/** -@return Which part of the extended FTS API is supported */ -ulonglong -innobase_fts_flags(); - -/** -Find and Retrieve the FTS doc_id for the current result row -@return the document ID */ -ulonglong -innobase_fts_retrieve_docid( -/*========================*/ - FT_INFO_EXT* fts_hdl); /*!< in: FTS handler */ - -/** -Find and retrieve the size of the current result -@return number of matching rows */ -ulonglong -innobase_fts_count_matches( -/*=======================*/ - FT_INFO_EXT* fts_hdl); /*!< in: FTS handler */ - -/** -Copy table flags from MySQL's HA_CREATE_INFO into an InnoDB table object. -Those flags are stored in .frm file and end up in the MySQL table object, -but are frequently used inside InnoDB so we keep their copies into the -InnoDB table object. */ -void -innobase_copy_frm_flags_from_create_info( - dict_table_t* innodb_table, /*!< in/out: InnoDB table */ - const HA_CREATE_INFO* create_info); /*!< in: create info */ - /** Copy table flags from MySQL's TABLE_SHARE into an InnoDB table object. Those flags are stored in .frm file and end up in the MySQL table object, diff --git a/storage/innobase/handler/ha_innopart.cc b/storage/innobase/handler/ha_innopart.cc index 806a40793263b..7abc1f29b605b 100644 --- a/storage/innobase/handler/ha_innopart.cc +++ b/storage/innobase/handler/ha_innopart.cc @@ -58,11 +58,11 @@ Created Nov 22, 2013 Mattias Jonsson */ /* To be backwards compatible we also fold partition separator on windows. */ #ifdef _WIN32 -const char* part_sep = "#p#"; -const char* sub_sep = "#sp#"; +static const char* part_sep = "#p#"; +static const char* sub_sep = "#sp#"; #else -const char* part_sep = "#P#"; -const char* sub_sep = "#SP#"; +static const char* part_sep = "#P#"; +static const char* sub_sep = "#SP#"; #endif /* _WIN32 */ /* Partition separator for *nix platforms */ diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 3bc56c2d73743..7dee46dc4a9eb 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -42,10 +42,6 @@ my_bool srv_ibuf_disable_background_merge; /** The start address for an insert buffer bitmap page bitmap */ #define IBUF_BITMAP PAGE_DATA -#ifdef UNIV_NONINL -#include "ibuf0ibuf.ic" -#endif - #include "buf0buf.h" #include "buf0rea.h" #include "fsp0fsp.h" diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 4a80b5e491362..a5409c3ad4cce 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -71,16 +71,53 @@ enum btr_latch_mode { /** Start searching the entire B-tree. */ BTR_SEARCH_TREE = 37, /** Continue searching the entire B-tree. */ - BTR_CONT_SEARCH_TREE = 38 + BTR_CONT_SEARCH_TREE = 38, + + /* BTR_INSERT, BTR_DELETE and BTR_DELETE_MARK are mutually + exclusive. */ + /** The search tuple will be inserted to the secondary index + at the searched position. When the leaf page is not in the + buffer pool, try to use the change buffer. */ + BTR_INSERT = 512, + + /** Try to delete mark a secondary index leaf page record at + the searched position using the change buffer when the page is + not in the buffer pool. */ + BTR_DELETE_MARK = 4096, + + /** Try to purge the record using the change buffer when the + secondary index leaf page is not in the buffer pool. */ + BTR_DELETE = 8192, + + /** The caller is already holding dict_index_t::lock S-latch. */ + BTR_ALREADY_S_LATCHED = 16384, + /** Search and S-latch a leaf page, assuming that the + dict_index_t::lock S-latch is being held. */ + BTR_SEARCH_LEAF_ALREADY_S_LATCHED = BTR_SEARCH_LEAF + | BTR_ALREADY_S_LATCHED, + /** Search the entire index tree, assuming that the + dict_index_t::lock S-latch is being held. */ + BTR_SEARCH_TREE_ALREADY_S_LATCHED = BTR_SEARCH_TREE + | BTR_ALREADY_S_LATCHED, + /** Search and X-latch a leaf page, assuming that the + dict_index_t::lock S-latch is being held. */ + BTR_MODIFY_LEAF_ALREADY_S_LATCHED = BTR_MODIFY_LEAF + | BTR_ALREADY_S_LATCHED, + + /** Attempt to delete-mark a secondary index record. */ + BTR_DELETE_MARK_LEAF = BTR_MODIFY_LEAF | BTR_DELETE_MARK, + /** Attempt to delete-mark a secondary index record + while holding the dict_index_t::lock S-latch. */ + BTR_DELETE_MARK_LEAF_ALREADY_S_LATCHED = BTR_DELETE_MARK_LEAF + | BTR_ALREADY_S_LATCHED, + /** Attempt to purge a secondary index record. */ + BTR_PURGE_LEAF = BTR_MODIFY_LEAF | BTR_DELETE, + /** Attempt to purge a secondary index record + while holding the dict_index_t::lock S-latch. */ + BTR_PURGE_LEAF_ALREADY_S_LATCHED = BTR_PURGE_LEAF + | BTR_ALREADY_S_LATCHED }; -/* BTR_INSERT, BTR_DELETE and BTR_DELETE_MARK are mutually exclusive. */ - -/** If this is ORed to btr_latch_mode, it means that the search tuple -will be inserted to the index, at the searched position. -When the record is not in the buffer pool, try to use the insert buffer. */ -#define BTR_INSERT 512U - /** This flag ORed to btr_latch_mode says that we do the search in query optimization */ #define BTR_ESTIMATE 1024U @@ -90,18 +127,6 @@ UNIQUE definition on secondary indexes when we decide if we can use the insert buffer to speed up inserts */ #define BTR_IGNORE_SEC_UNIQUE 2048U -/** Try to delete mark the record at the searched position using the -insert/delete buffer when the record is not in the buffer pool. */ -#define BTR_DELETE_MARK 4096U - -/** Try to purge the record at the searched position using the insert/delete -buffer when the record is not in the buffer pool. */ -#define BTR_DELETE 8192U - -/** In the case of BTR_SEARCH_LEAF or BTR_MODIFY_LEAF, the caller is -already holding an S latch on the index tree */ -#define BTR_ALREADY_S_LATCHED 16384U - /** In the case of BTR_MODIFY_TREE, the caller specifies the intention to insert record only. It is used to optimize block->lock range.*/ #define BTR_LATCH_FOR_INSERT 32768U @@ -798,9 +823,7 @@ btr_lift_page_up( #define BTR_N_LEAF_PAGES 1 #define BTR_TOTAL_SIZE 2 -#ifndef UNIV_NONINL #include "btr0btr.ic" -#endif /**************************************************************** Global variable controlling if scrubbing should be performed */ diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 19109e30b1336..fee7f375cb462 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -997,8 +997,6 @@ extern ulint btr_cur_n_sea_old; extern uint btr_cur_limit_optimistic_insert_debug; #endif /* UNIV_DEBUG */ -#ifndef UNIV_NONINL #include "btr0cur.ic" -#endif #endif diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h index 28636715c2bb7..e00af1304795b 100644 --- a/storage/innobase/include/btr0pcur.h +++ b/storage/innobase/include/btr0pcur.h @@ -347,22 +347,6 @@ btr_pcur_move_to_next_page( btr_pcur_t* cursor, /*!< in: persistent cursor; must be on the last record of the current page */ mtr_t* mtr); /*!< in: mtr */ -/*********************************************************//** -Moves the persistent cursor backward if it is on the first record -of the page. Releases the latch on the current page, and bufferunfixes -it. Note that to prevent a possible deadlock, the operation first -stores the position of the cursor, releases the leaf latch, acquires -necessary latches and restores the cursor position again before returning. -The 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 while the cursor had no latches. */ -void -btr_pcur_move_backward_from_page( -/*=============================*/ - btr_pcur_t* cursor, /*!< in: persistent cursor, must be on the - first record of the current page */ - mtr_t* mtr); /*!< in: mtr */ #ifdef UNIV_DEBUG /*********************************************************//** Returns the btr cursor component of a persistent cursor. @@ -548,8 +532,6 @@ struct btr_pcur_t{ dict_index_t* index() const { return(btr_cur.index); } }; -#ifndef UNIV_NONINL #include "btr0pcur.ic" -#endif #endif diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index 8ff411cffd0bf..8887a3f81adfa 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -373,8 +373,6 @@ again set this much timeout. This is to reduce contention. */ #define BTR_SEA_TIMEOUT 10000 #endif /* BTR_CUR_HASH_ADAPT */ -#ifndef UNIV_NONINL #include "btr0sea.ic" -#endif #endif diff --git a/storage/innobase/include/buf0buddy.h b/storage/innobase/include/buf0buddy.h index c2c100e83e61d..f56ac2e5e70c5 100644 --- a/storage/innobase/include/buf0buddy.h +++ b/storage/innobase/include/buf0buddy.h @@ -88,8 +88,6 @@ void buf_buddy_condense_free( buf_pool_t* buf_pool); -#ifndef UNIV_NONINL -# include "buf0buddy.ic" -#endif +#include "buf0buddy.ic" #endif /* buf0buddy_h */ diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index ea0dd48cdbd1f..d9243c6627c58 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -382,11 +382,6 @@ buf_frame_will_withdrawn( buf_pool_t* buf_pool, const byte* ptr); -/** Resize the buffer pool based on srv_buf_pool_size from -srv_buf_pool_old_size. */ -void -buf_pool_resize(); - /** This is the thread for resizing buffer pool. It waits for an event and when waked up either performs a resizing and sleeps again. @return this function does not return, calls os_thread_exit() @@ -921,30 +916,18 @@ buf_stats_get_pool_info( ulint pool_id, /*!< in: buffer pool ID */ buf_pool_info_t* all_pool_info); /*!< in/out: buffer pool info to fill */ -/*********************************************************************//** -Returns the ratio in percents of modified pages in the buffer pool / +/** Return the ratio in percents of modified pages in the buffer pool / database pages in the buffer pool. @return modified page percentage ratio */ double buf_get_modified_ratio_pct(void); -/*============================*/ -/**********************************************************************//** -Refreshes the statistics used to print per-second averages. */ -void -buf_refresh_io_stats( -/*=================*/ - buf_pool_t* buf_pool); /*!< buffer pool instance */ -/**********************************************************************//** -Refreshes the statistics used to print per-second averages. */ +/** Refresh the statistics used to print per-second averages. */ void buf_refresh_io_stats_all(void); -/*=================*/ -/*********************************************************************//** -Asserts that all file pages in the buffer are in a replaceable state. +/** Assert that all file pages in the buffer are in a replaceable state. @return TRUE */ ibool buf_all_freed(void); -/*===============*/ /*********************************************************************//** Checks that there currently are no pending i/o-operations for the buffer pool. @@ -1404,18 +1387,6 @@ buf_pool_watch_is_sentinel( const buf_page_t* bpage) /*!< in: block */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -/** Add watch for the given page to be read in. Caller must have -appropriate hash_lock for the bpage. This function may release the -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 */ -buf_page_t* -buf_pool_watch_set( - const page_id_t& page_id, - rw_lock_t** hash_lock) -MY_ATTRIBUTE((warn_unused_result)); - /** Stop watching if the page has been read in. buf_pool_watch_set(space,offset) must have returned NULL before. @param[in] page_id page id */ @@ -2508,9 +2479,8 @@ struct CheckUnzipLRUAndLRUList { }; #endif /* UNIV_DEBUG || defined UNIV_BUF_DEBUG */ -#ifndef UNIV_NONINL #include "buf0buf.ic" -#endif + #endif /* !UNIV_INNOCHECKSUM */ #endif diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h index fd124e8f94e17..337a5417c1254 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -252,26 +252,13 @@ DECLARE_THREAD(buf_flush_page_cleaner_worker)( /*==========================================*/ void* arg); /*!< in: a dummy parameter required by os_thread_create */ -/******************************************************************//** -Initialize page_cleaner. */ +/** Initialize page_cleaner. */ void buf_flush_page_cleaner_init(void); -/*=============================*/ -/*********************************************************************//** -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); -/*=====================*/ -/*********************************************************************//** -Wait for any possible LRU flushes that are in progress to end. */ + +/** Wait for any possible LRU flushes that are in progress to end. */ void buf_flush_wait_LRU_batch_end(void); -/*==============================*/ #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG /******************************************************************//** @@ -333,14 +320,6 @@ buf_pool_get_dirty_pages_count( buf_pool_t* buf_pool, /*!< in: buffer pool */ ulint id, /*!< in: space id to check */ FlushObserver* observer); /*!< in: flush observer to check */ -/******************************************************************//** -Check if there are any dirty pages that belong to a space id in the flush list. -@return count of dirty pages present in all the buffer pools */ -ulint -buf_flush_get_dirty_pages_count( -/*============================*/ - ulint id, /*!< in: space id to check */ - FlushObserver* observer); /*!< in: flush observer to check */ /*******************************************************************//** Synchronously flush dirty blocks from the end of the flush list of all buffer @@ -485,8 +464,6 @@ buf_flush_batch( counts */ -#ifndef UNIV_NONINL #include "buf0flu.ic" -#endif #endif diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h index 2ad1211a5487a..3cc01473da1ec 100644 --- a/storage/innobase/include/buf0lru.h +++ b/storage/innobase/include/buf0lru.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -177,12 +178,6 @@ void buf_LRU_make_block_young( /*=====================*/ buf_page_t* bpage); /*!< in: control block */ -/******************************************************************//** -Moves a block to the end of the LRU list. */ -void -buf_LRU_make_block_old( -/*===================*/ - buf_page_t* bpage); /*!< in: control block */ /**********************************************************************//** Updates buf_pool->LRU_old_ratio. @return updated old_pct */ @@ -287,8 +282,4 @@ Increments the I/O counter in buf_LRU_stat_cur. */ Increments the page_zip_decompress() counter in buf_LRU_stat_cur. */ #define buf_LRU_stat_inc_unzip() buf_LRU_stat_cur.unzip++ -#ifndef UNIV_NONINL -#include "buf0lru.ic" -#endif - #endif diff --git a/storage/innobase/include/buf0lru.ic b/storage/innobase/include/buf0lru.ic deleted file mode 100644 index 6e0da7a25886a..0000000000000 --- a/storage/innobase/include/buf0lru.ic +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2009, 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 include/buf0lru.ic -The database buffer replacement algorithm - -Created 11/5/1995 Heikki Tuuri -*******************************************************/ - diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h index 8385fe3d0d3a6..87a2228ff2d89 100644 --- a/storage/innobase/include/data0data.h +++ b/storage/innobase/include/data0data.h @@ -472,14 +472,6 @@ dtuple_check_typed( /*===============*/ const dtuple_t* tuple) /*!< in: tuple */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -/**********************************************************//** -Checks that a data tuple is typed. -@return TRUE if ok */ -ibool -dtuple_check_typed_no_assert( -/*=========================*/ - const dtuple_t* tuple) /*!< in: tuple */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifdef UNIV_DEBUG /**********************************************************//** Validates the consistency of a tuple which must be complete, i.e, @@ -684,8 +676,6 @@ struct big_rec_t { ulint n_fld); }; -#ifndef UNIV_NONINL #include "data0data.ic" -#endif #endif diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index 958f5a4d0de17..3fa8320b5aa65 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.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) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -534,12 +534,13 @@ ibool dtype_validate( /*===========*/ const dtype_t* type); /*!< in: type struct to validate */ -/*********************************************************************//** -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 */ + const dtype_t* type); +#endif /* UNIV_DEBUG */ /* Structure for an SQL data type. If you add fields to this structure, be sure to initialize them everywhere. @@ -576,8 +577,6 @@ struct dtype_t{ mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */ }; -#ifndef UNIV_NONINL #include "data0type.ic" -#endif #endif diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h index 5884ba4bcc234..d6de7dcf71b77 100644 --- a/storage/innobase/include/dict0boot.h +++ b/storage/innobase/include/dict0boot.h @@ -353,8 +353,6 @@ two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is updated */ #define DICT_HDR_ROW_ID_WRITE_MARGIN 256 -#ifndef UNIV_NONINL #include "dict0boot.ic" -#endif #endif diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h index 9065f7ebf3d06..f53ea74717dce 100644 --- a/storage/innobase/include/dict0crea.h +++ b/storage/innobase/include/dict0crea.h @@ -383,8 +383,6 @@ dict_get_v_col_pos( #define INDEX_CREATE_INDEX_TREE 3 #define INDEX_ADD_TO_CACHE 4 -#ifndef UNIV_NONINL #include "dict0crea.ic" -#endif #endif diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 92f00549dc9e8..185783887231d 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -498,16 +498,6 @@ dict_foreign_replace_index( to use table->col_names */ const dict_index_t* index) /*!< in: index to be replaced */ MY_ATTRIBUTE((nonnull(1,3), warn_unused_result)); -/**********************************************************************//** -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 */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); /** 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. @@ -2063,8 +2053,6 @@ bool dict_table_have_virtual_index( dict_table_t* table); -#ifndef UNIV_NONINL #include "dict0dict.ic" -#endif #endif diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h index 0a862bb17a947..fb443caf77062 100644 --- a/storage/innobase/include/dict0load.h +++ b/storage/innobase/include/dict0load.h @@ -93,98 +93,6 @@ dict_get_first_table_name_in_db( /*============================*/ const char* name); /*!< in: database name which ends to '/' */ -/********************************************************************//** -Loads a table column definition from a SYS_COLUMNS record to -dict_table_t. -@return error message, or NULL on success */ -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 */ - -/** Loads 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, or NULL on success */ -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); -/********************************************************************//** -Loads 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 */ -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 */ -/********************************************************************//** -Loads an index field definition from a SYS_FIELDS record to -dict_index_t. -@return error message, or NULL on success */ -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 */ -/********************************************************************//** -Using the table->heap, copy the null-terminated filepath into -table->data_dir_path and put a null byte before the extension. -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. */ -void -dict_save_data_dir_path( -/*====================*/ - dict_table_t* table, /*!< in/out: table */ - char* filepath); /*!< in: filepath of tablespace */ - /** Get the first filepath from SYS_DATAFILES for a given space_id. @param[in] space_id Tablespace ID @return First filepath (caller must invoke ut_free() on it) @@ -430,8 +338,4 @@ dict_replace_tablespace_and_filepath( const char* filepath, ulint fsp_flags); -#ifndef UNIV_NONINL -#include "dict0load.ic" -#endif - #endif diff --git a/storage/innobase/include/dict0load.ic b/storage/innobase/include/dict0load.ic deleted file mode 100644 index 2c0f1ff38a5c7..0000000000000 --- a/storage/innobase/include/dict0load.ic +++ /dev/null @@ -1,26 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2009, 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 include/dict0load.ic -Loads to the memory cache database object definitions -from dictionary tables - -Created 4/24/1996 Heikki Tuuri -*******************************************************/ - diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index ff28add8ca4ad..0630137bb4fdc 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1532,15 +1532,6 @@ struct dict_table_t { /*!< set of foreign key constraints which refer to this table */ dict_foreign_set referenced_set; -#ifdef UNIV_DEBUG - /** This field is used to specify in simulations tables which are so - big that disk should be accessed. Disk access is simulated by putting - the thread to sleep for a while. NOTE that this flag is not stored to - the data dictionary on disk, and the database will forget about value - TRUE if it has to reload the table definition from disk. */ - ibool does_not_fit_in_memory; -#endif /* UNIV_DEBUG */ - /** TRUE if the maximum length of a single row exceeds BIG_ROW_SIZE. Initialized in dict_table_add_to_cache(). */ unsigned big_rows:1; @@ -1879,8 +1870,6 @@ dict_col_get_spatial_status( return(spatial_status); } -#ifndef UNIV_NONINL #include "dict0mem.ic" -#endif #endif /* dict0mem_h */ diff --git a/storage/innobase/include/dict0pagecompress.h b/storage/innobase/include/dict0pagecompress.h index 6641f6ba85f95..98f3486cdb9e3 100644 --- a/storage/innobase/include/dict0pagecompress.h +++ b/storage/innobase/include/dict0pagecompress.h @@ -56,8 +56,6 @@ dict_table_page_compression_level( const dict_table_t* table) /*!< in: table */ __attribute__((const)); -#ifndef UNIV_NONINL #include "dict0pagecompress.ic" -#endif #endif diff --git a/storage/innobase/include/dict0priv.h b/storage/innobase/include/dict0priv.h index 35548faeb93f3..593c27125a20b 100644 --- a/storage/innobase/include/dict0priv.h +++ b/storage/innobase/include/dict0priv.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2010, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2010, 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 @@ -59,8 +59,6 @@ dict_table_open_on_id_low( when loading the table */ ibool open_only_if_in_cache); -#ifndef UNIV_NONINL #include "dict0priv.ic" -#endif #endif /* dict0priv.h */ diff --git a/storage/innobase/include/dict0stats.h b/storage/innobase/include/dict0stats.h index cb16a4dee9c4d..f02b8eb8eed7c 100644 --- a/storage/innobase/include/dict0stats.h +++ b/storage/innobase/include/dict0stats.h @@ -54,17 +54,6 @@ enum dict_stats_upd_option_t { otherwise do nothing */ }; -/*********************************************************************//** -Calculates new estimates for table and index statistics. This function -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. */ -void -dict_stats_update_transient( -/*========================*/ - dict_table_t* table); /*!< in/out: table */ - /*********************************************************************//** Set the persistent statistics flag for a given table. This is set only in the in-memory table object and is not saved on disk. It will be read @@ -263,9 +252,7 @@ dict_stats_save_index_stat( const char* stat_description, trx_t* trx); -#ifndef UNIV_NONINL #include "dict0stats.ic" -#endif #ifdef UNIV_ENABLE_UNIT_TEST_DICT_STATS void test_dict_stats_all(); diff --git a/storage/innobase/include/dict0stats_bg.h b/storage/innobase/include/dict0stats_bg.h index e09716e3842d2..b7bf1b0c170b1 100644 --- a/storage/innobase/include/dict0stats_bg.h +++ b/storage/innobase/include/dict0stats_bg.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -83,7 +83,17 @@ bool dict_stats_stop_bg( /*===============*/ dict_table_t* table) /*!< in/out: table */ - MY_ATTRIBUTE((warn_unused_result)); +{ + ut_ad(!srv_read_only_mode); + ut_ad(mutex_own(&dict_sys->mutex)); + + if (!(table->stats_bg_flag & BG_STAT_IN_PROGRESS)) { + return(true); + } + + table->stats_bg_flag |= BG_STAT_SHOULD_QUIT; + return(false); +} /*****************************************************************//** Wait until background stats thread has stopped using the specified table. @@ -145,8 +155,4 @@ DECLARE_THREAD(dict_stats_thread)( void dict_stats_shutdown(); -# ifndef UNIV_NONINL -# include "dict0stats_bg.ic" -# endif - #endif /* dict0stats_bg_h */ diff --git a/storage/innobase/include/dict0stats_bg.ic b/storage/innobase/include/dict0stats_bg.ic deleted file mode 100644 index 87e3225de5895..0000000000000 --- a/storage/innobase/include/dict0stats_bg.ic +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2012, 2013, 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 include/dict0stats_bg.ic -Code used for background table and index stats gathering. - -Created Feb 8, 2013 Marko Makela -*******************************************************/ - -/*****************************************************************//** -Request the background collection of statistics to stop for a table. -@retval true when no background process is active -@retval false when it is not safe to modify the table definition */ -UNIV_INLINE -bool -dict_stats_stop_bg( -/*===============*/ - dict_table_t* table) /*!< in/out: table */ -{ - ut_ad(!srv_read_only_mode); - ut_ad(mutex_own(&dict_sys->mutex)); - - if (!(table->stats_bg_flag & BG_STAT_IN_PROGRESS)) { - return(true); - } - - table->stats_bg_flag |= BG_STAT_SHOULD_QUIT; - return(false); -} diff --git a/storage/innobase/include/eval0eval.h b/storage/innobase/include/eval0eval.h index f0e5b4006b6de..2e20c634c3bef 100644 --- a/storage/innobase/include/eval0eval.h +++ b/storage/innobase/include/eval0eval.h @@ -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 @@ -105,8 +105,6 @@ eval_cmp( func_node_t* cmp_node); /*!< in: comparison node */ -#ifndef UNIV_NONINL #include "eval0eval.ic" -#endif #endif diff --git a/storage/innobase/include/eval0proc.h b/storage/innobase/include/eval0proc.h index 6705c2c7b64da..b359bf06ce08d 100644 --- a/storage/innobase/include/eval0proc.h +++ b/storage/innobase/include/eval0proc.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 @@ -90,9 +90,6 @@ return_step( /*========*/ que_thr_t* thr); /*!< in: query thread */ - -#ifndef UNIV_NONINL #include "eval0proc.ic" -#endif #endif diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h index 7211d295c2775..d6a6ecb15386e 100644 --- a/storage/innobase/include/fil0crypt.h +++ b/storage/innobase/include/fil0crypt.h @@ -533,8 +533,6 @@ fil_crypt_calculate_checksum( byte* dst_frame) /*!< in: page where to calculate */ __attribute__((warn_unused_result)); -#ifndef UNIV_NONINL #include "fil0crypt.ic" -#endif #endif /* fil0crypt_h */ diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 587ad902c2ac5..66d79bd24b511 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1591,12 +1591,7 @@ fil_decr_pending_ops( /*=================*/ ulint id); /*!< in: space id */ -#endif /* UNIV_INNOCHECKSUM */ - -#ifndef UNIV_INNOCHECKSUM -#ifndef UNIV_NONINL #include "fil0fil.ic" -#endif -#endif +#endif /* UNIV_INNOCHECKSUM */ #endif /* fil0fil_h */ diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 621498b9a4ccc..f6fee72300cfd 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -669,16 +669,6 @@ fsp_parse_init_file_page( byte* ptr, /*!< in: buffer */ byte* end_ptr, /*!< in: buffer end */ buf_block_t* block); /*!< in: block or NULL */ -#ifdef UNIV_DEBUG -/*******************************************************************//** -Validates a segment. -@return TRUE if ok */ -ibool -fseg_validate( -/*==========*/ - fseg_header_t* header, /*!< in: segment header */ - mtr_t* mtr); /*!< in/out: mini-transaction */ -#endif /* UNIV_DEBUG */ #ifdef UNIV_BTR_PRINT /*******************************************************************//** Writes info of a segment. */ @@ -869,8 +859,6 @@ fsp_page_is_free_func( #endif /* UNIV_INNOCHECKSUM */ -#ifndef UNIV_NONINL #include "fsp0fsp.ic" -#endif #endif diff --git a/storage/innobase/include/fsp0pagecompress.h b/storage/innobase/include/fsp0pagecompress.h index b45a4b8789043..a5c76737b3aaa 100644 --- a/storage/innobase/include/fsp0pagecompress.h +++ b/storage/innobase/include/fsp0pagecompress.h @@ -59,8 +59,6 @@ fsp_flags_get_page_compression_level( /*=================================*/ ulint flags); /*!< in: tablespace flags */ -#ifndef UNIV_NONINL #include "fsp0pagecompress.ic" -#endif #endif diff --git a/storage/innobase/include/fts0ast.h b/storage/innobase/include/fts0ast.h index 87b7cf709c855..b5187ce2a4120 100644 --- a/storage/innobase/include/fts0ast.h +++ b/storage/innobase/include/fts0ast.h @@ -180,14 +180,6 @@ fts_ast_node_print( /*===============*/ fts_ast_node_t* node); /*!< in: ast node to print */ /******************************************************************** -For tracking node allocations, in case there is an during parsing.*/ -extern -void -fts_ast_state_add_node( -/*===================*/ - fts_ast_state_t*state, /*!< in: ast state instance */ - fts_ast_node_t* node); /*!< in: node to add to state */ -/******************************************************************** Free node and expr allocations.*/ extern void @@ -217,18 +209,6 @@ fts_ast_visit( operator, currently we only ignore FTS_IGNORE operator */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -/*****************************************************************//** -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. -@return DB_SUCCESS if all went well */ -dberr_t -fts_ast_visit_sub_exp( -/*==================*/ - fts_ast_node_t* node, /*!< in: instance to traverse*/ - fts_ast_callback visitor, /*!< in: callback */ - void* arg) /*!< in: callback arg */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************** Create a lex instance.*/ fts_lexer_t* @@ -275,13 +255,6 @@ fts_ast_string_to_ul( const fts_ast_string_t* ast_str, int base); -/** -Print the ast string -@param[in] str string to print */ -void -fts_ast_string_print( - const fts_ast_string_t* ast_str); - /* String of length len. We always store the string of length len with a terminating '\0', regardless of there is any 0x00 in the string itself */ @@ -367,8 +340,6 @@ fts_ast_create_node_phrase_list( #ifdef UNIV_DEBUG const char* -fts_ast_oper_name_get(fts_ast_oper_t oper); -const char* fts_ast_node_type_get(fts_ast_type_t type); #endif /* UNIV_DEBUG */ diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index c6b39bce286da..21354b1b605c1 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -663,6 +663,7 @@ void fts_startup(void); /*==============*/ +#if 0 // TODO: Enable this in WL#6608 /******************************************************************//** Signal FTS threads to initiate shutdown. */ void @@ -682,6 +683,7 @@ fts_shutdown( indexes */ fts_t* fts); /*!< in: fts instance to shutdown */ +#endif /******************************************************************//** Create an instance of fts_t. @@ -714,13 +716,6 @@ void fts_optimize_init(void); /*====================*/ -/**********************************************************************//** -Check whether the work queue is initialized. -@return TRUE if optimze queue is initialized. */ -ibool -fts_optimize_is_init(void); -/*======================*/ - /****************************************************************//** Drops index ancillary tables for a FTS index @return DB_SUCCESS or error code */ @@ -773,13 +768,6 @@ fts_savepoint_release( trx_t* trx, /*!< in: transaction */ const char* name); /*!< in: savepoint name */ -/**********************************************************************//** -Free the FTS cache. */ -void -fts_cache_destroy( -/*==============*/ - fts_cache_t* cache); /*!< in: cache*/ - /** Clear cache. @param[in,out] cache fts cache */ void @@ -815,17 +803,6 @@ void fts_drop_orphaned_tables(void); /*==========================*/ -/******************************************************************//** -Since we do a horizontal split on the index table, we need to drop -all the split tables. -@return DB_SUCCESS or error code */ -dberr_t -fts_drop_index_split_tables( -/*========================*/ - trx_t* trx, /*!< in: transaction */ - dict_index_t* index) /*!< in: fts instance */ - MY_ATTRIBUTE((warn_unused_result)); - /** Run SYNC on the table, i.e., write out data from the cache to the FTS auxiliary INDEX table and clear the cache at the end. @param[in,out] table fts table @@ -975,14 +952,6 @@ fts_load_stopword( ibool reload); /*!< in: Whether it is during reload of FTS table */ -/****************************************************************//** -Create the vector of fts_get_doc_t instances. -@return vector of fts_get_doc_t instances */ -ib_vector_t* -fts_get_docs_create( -/*================*/ - fts_cache_t* cache); /*!< in: fts cache */ - /****************************************************************//** Read the rows from the FTS index @return DB_SUCCESS if OK */ diff --git a/storage/innobase/include/fts0priv.h b/storage/innobase/include/fts0priv.h index 1fd33c2b103d3..80ebcf09d6d8a 100644 --- a/storage/innobase/include/fts0priv.h +++ b/storage/innobase/include/fts0priv.h @@ -232,30 +232,6 @@ fts_check_token( bool is_ngram, const CHARSET_INFO* cs); -/*******************************************************************//** -Tokenize a document. */ -void -fts_tokenize_document( -/*==================*/ - fts_doc_t* doc, /*!< in/out: document to - tokenize */ - fts_doc_t* result, /*!< out: if provided, save - result tokens here */ - st_mysql_ftparser* parser);/* in: plugin fts parser */ - -/*******************************************************************//** -Continue to tokenize a document. */ -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 - result tokens here */ - st_mysql_ftparser* parser);/* in: plugin fts parser */ - /******************************************************************//** Initialize a document. */ void @@ -302,16 +278,6 @@ fts_index_fetch_nodes( word, /*!< in: the word to fetch */ fts_fetch_t* fetch); /*!< in: fetch callback.*/ -/******************************************************************//** -Create a fts_optimizer_word_t instance. -@return new instance */ -fts_word_t* -fts_word_init( -/*==========*/ - fts_word_t* word, /*!< in: word to initialize */ - byte* utf8, /*!< in: UTF-8 string */ - ulint len); /*!< in: length of string in bytes */ - /******************************************************************//** Compare two fts_trx_table_t instances, we actually compare the table id's here. @@ -429,31 +395,7 @@ fts_config_set_index_value( config table */ MY_ATTRIBUTE((warn_unused_result)); -/******************************************************************//** -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 */ - MY_ATTRIBUTE((warn_unused_result)); - -/******************************************************************//** -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* name, /*!< in: increment config value - for this parameter name */ - ulint delta); /*!< in: increment by this much */ - +#ifdef FTS_OPTIMIZE_DEBUG /******************************************************************//** Get an ulint value from the config table. @return DB_SUCCESS or error code */ @@ -465,6 +407,7 @@ fts_config_get_index_ulint( const char* name, /*!< in: param name */ ulint* int_value) /*!< out: value */ MY_ATTRIBUTE((warn_unused_result)); +#endif /* FTS_OPTIMIZE_DEBUG */ /******************************************************************//** Set an ulint value int the config table. @@ -501,17 +444,6 @@ fts_cache_find_word( text) /*!< in: word to search for */ MY_ATTRIBUTE((warn_unused_result)); -/******************************************************************//** -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 */ - MY_ATTRIBUTE((warn_unused_result)); - /******************************************************************//** Append deleted doc ids to vector and sort the vector. */ void @@ -533,18 +465,6 @@ fts_wait_for_background_thread_to_start( ulint max_wait); /*!< in: time in microseconds, if set to 0 then it disables timeout checking */ -#ifdef FTS_DOC_STATS_DEBUG -/******************************************************************//** -Get the total number of words in the FTS for a particular FTS index. -@return DB_SUCCESS or 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 */ - MY_ATTRIBUTE((warn_unused_result)); -#endif /******************************************************************//** Search the index specific cache for a particular FTS index. @return the index specific cache else NULL */ @@ -602,13 +522,6 @@ fts_optimize_add_table( /*===================*/ dict_table_t* table); /*!< in: table to add */ -/******************************************************************//** -Optimize a table. */ -void -fts_optimize_do_table( -/*==================*/ - dict_table_t* table); /*!< in: table to optimize */ - /******************************************************************//** Construct the prefix name of an FTS table. @return own: table name, must be freed with ut_free() */ @@ -639,8 +552,6 @@ fts_config_create_index_param_name( const dict_index_t* index) /*!< in: index for config */ MY_ATTRIBUTE((warn_unused_result)); -#ifndef UNIV_NONINL #include "fts0priv.ic" -#endif #endif /* INNOBASE_FTS0PRIV_H */ diff --git a/storage/innobase/include/fts0types.h b/storage/innobase/include/fts0types.h index 5c6cd3ee56dea..c1db160602f57 100644 --- a/storage/innobase/include/fts0types.h +++ b/storage/innobase/include/fts0types.h @@ -399,9 +399,7 @@ fts_select_index( const byte* str, ulint len); -#ifndef UNIV_NONINL #include "fts0types.ic" #include "fts0vlc.ic" -#endif #endif /* INNOBASE_FTS0TYPES_H */ diff --git a/storage/innobase/include/fut0fut.h b/storage/innobase/include/fut0fut.h index 0b8b8b0e43b54..8288244429169 100644 --- a/storage/innobase/include/fut0fut.h +++ b/storage/innobase/include/fut0fut.h @@ -52,8 +52,6 @@ fut_get_ptr( buf_block_t** ptr_block = NULL) MY_ATTRIBUTE((warn_unused_result)); -#ifndef UNIV_NONINL #include "fut0fut.ic" -#endif #endif /* fut0fut_h */ diff --git a/storage/innobase/include/fut0lst.h b/storage/innobase/include/fut0lst.h index 450def962271c..bff4a92f3814b 100644 --- a/storage/innobase/include/fut0lst.h +++ b/storage/innobase/include/fut0lst.h @@ -74,24 +74,6 @@ flst_add_first( flst_node_t* node, /*!< in: node to add */ mtr_t* mtr); /*!< in: mini-transaction handle */ /********************************************************************//** -Inserts a node after another in a list. */ -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. */ -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 */ -/********************************************************************//** Removes a node. */ void flst_remove( @@ -168,18 +150,8 @@ flst_validate( /*==========*/ const flst_base_node_t* base, /*!< in: pointer to base node of list */ mtr_t* mtr1); /*!< in: mtr */ -/********************************************************************//** -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 */ - -#ifndef UNIV_NONINL #include "fut0lst.ic" -#endif #endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h index 950e2f2e9f57e..65a53ec1d3931 100644 --- a/storage/innobase/include/gis0rtree.h +++ b/storage/innobase/include/gis0rtree.h @@ -143,20 +143,6 @@ rtr_pcur_move_to_next( /*!< in: current level */ mtr_t* mtr); /*!< in: mtr */ -/**************************************************************//** -Restores the stored position of a persistent cursor bufferfixing the page */ -bool -rtr_cur_restore_position_func( -/*==========================*/ - ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ - btr_cur_t* cursor, /*!< in: detached persistent cursor */ - ulint level, /*!< in: index level */ - const char* file, /*!< in: file name */ - unsigned line, /*!< in: line where called */ - mtr_t* mtr); /*!< in: mtr */ -#define rtr_cur_restore_position(l,cur,level,mtr) \ - rtr_cur_restore_position_func(l,cur,level,__FILE__,__LINE__,mtr) - /****************************************************************//** Searches the right position in rtree for a page cursor. */ bool @@ -318,9 +304,6 @@ rtr_get_mbr_from_tuple( const dtuple_t* dtuple, /*!< in: data tuple */ rtr_mbr* mbr); /*!< out: mbr to fill */ -#define rtr_page_get_father_node_ptr(of,heap,sea,cur,mtr) \ - rtr_page_get_father_node_ptr_func(of,heap,sea,cur,__FILE__,__LINE__,mtr) - /* Get the rtree page father. @param[in] offsets work area for the return value @param[in] index rtree index @@ -338,24 +321,6 @@ rtr_page_get_father( btr_cur_t* sea_cur, btr_cur_t* cursor); -/************************************************************//** -Returns the upper level node pointer to a R-Tree page. It is assumed -that mtr holds an x-latch on the tree. -@return rec_get_offsets() of the node pointer record */ -ulint* -rtr_page_get_father_node_ptr_func( -/*==============================*/ - ulint* offsets,/*!< in: work area for the return value */ - mem_heap_t* heap, /*!< in: memory heap to use */ - btr_cur_t* sea_cur,/*!< in: search cursor */ - btr_cur_t* cursor, /*!< in: cursor pointing to user record, - out: cursor on node pointer record, - its page x-latched */ - const char* file, /*!< in: file name */ - unsigned line, /*!< in: line where called */ - mtr_t* mtr); /*!< in: mtr */ - - /************************************************************//** Returns the father block to a page. It is assumed that mtr holds an X or SX latch on the tree. @@ -584,7 +549,5 @@ rtr_estimate_n_rows_in_range( const dtuple_t* tuple, page_cur_mode_t mode); -#ifndef UNIV_NONINL #include "gis0rtree.ic" -#endif #endif /*!< gis0rtree.h */ diff --git a/storage/innobase/include/ha0ha.h b/storage/innobase/include/ha0ha.h index 7ddcaf82aa88c..db53b6c6580a8 100644 --- a/storage/innobase/include/ha0ha.h +++ b/storage/innobase/include/ha0ha.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 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 @@ -244,9 +244,6 @@ hash_assert_can_search( #define hash_assert_can_search(t, f) #endif /* UNIV_DEBUG */ - -#ifndef UNIV_NONINL #include "ha0ha.ic" -#endif #endif diff --git a/storage/innobase/include/ha0storage.h b/storage/innobase/include/ha0storage.h index 7dd6d26bad0ad..ccca2206897da 100644 --- a/storage/innobase/include/ha0storage.h +++ b/storage/innobase/include/ha0storage.h @@ -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 @@ -132,8 +132,6 @@ ha_storage_get_size( /*================*/ const ha_storage_t* storage); /*!< in: hash storage */ -#ifndef UNIV_NONINL #include "ha0storage.ic" -#endif #endif /* ha0storage_h */ diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index 2bb2c0fe773c1..97d51d9e6485f 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -36,9 +36,6 @@ simple headers. /* Forward declarations */ class THD; -class Field; -struct fts_string_t; -//typedef struct charset_info_st CHARSET_INFO; // JAN: TODO missing features: #undef MYSQL_57_SELECT_COUNT_OPTIMIZATION @@ -50,23 +47,6 @@ struct fts_string_t; #undef MYSQL_SPATIAL_INDEX #undef MYSQL_STORE_FTS_DOC_ID -/*********************************************************************//** -Wrapper around MySQL's copy_and_convert function. -@return number of bytes copied to 'to' */ -ulint -innobase_convert_string( -/*====================*/ - void* to, /*!< out: converted string */ - ulint to_length, /*!< in: number of bytes reserved - for the converted string */ - CHARSET_INFO* to_cs, /*!< in: character set to convert to */ - const void* from, /*!< in: string to convert */ - ulint from_length, /*!< in: number of bytes to convert */ - CHARSET_INFO* from_cs, /*!< in: character set to convert - from */ - uint* errors); /*!< out: number of errors encountered - during the conversion */ - /*******************************************************************//** Formats the raw data in "data" (in InnoDB on-disk format) that is of type DATA_(CHAR|VARCHAR|MYSQL|VARMYSQL) using "charset_coll" and writes @@ -208,16 +188,6 @@ innobase_strcasecmp( const char* a, /*!< in: first string to compare */ const char* b); /*!< in: second string to compare */ -/******************************************************************//** -Compares NUL-terminated UTF-8 strings case insensitively. The -second string contains wildcards. -@return 0 if a match is found, 1 if not */ -int -innobase_wildcasecmp( -/*=================*/ - const char* a, /*!< in: string to compare */ - const char* b); /*!< in: wildcard string to compare */ - /** Strip dir name from a full path name and return only the file name @param[in] path_name full path name @return file name or "null" if no file name */ diff --git a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h index 738fa813ddd10..3d099cd2f3ad3 100644 --- a/storage/innobase/include/hash0hash.h +++ b/storage/innobase/include/hash0hash.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2015, 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 @@ -448,68 +448,6 @@ hash_lock_x_confirm( ulint fold); /************************************************************//** -Reserves the mutex for a fold value in a hash table. */ -void -hash_mutex_enter( -/*=============*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold); /*!< in: fold */ -/************************************************************//** -Releases the mutex for a fold value in a hash table. */ -void -hash_mutex_exit( -/*============*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold); /*!< in: fold */ -/************************************************************//** -Reserves all the mutexes of a hash table, in an ascending order. */ -void -hash_mutex_enter_all( -/*=================*/ - hash_table_t* table); /*!< in: hash table */ -/************************************************************//** -Releases all the mutexes of a hash table. */ -void -hash_mutex_exit_all( -/*================*/ - hash_table_t* table); /*!< in: hash table */ -/************************************************************//** -Releases all but the passed in mutex of a hash table. */ -void -hash_mutex_exit_all_but( -/*====================*/ - hash_table_t* table, /*!< in: hash table */ - ib_mutex_t* keep_mutex); /*!< in: mutex to keep */ -/************************************************************//** -s-lock a lock for a fold value in a hash table. */ -void -hash_lock_s( -/*========*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold); /*!< in: fold */ -/************************************************************//** -x-lock a lock for a fold value in a hash table. */ -void -hash_lock_x( -/*========*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold); /*!< in: fold */ -/************************************************************//** -unlock an s-lock for a fold value in a hash table. */ -void -hash_unlock_s( -/*==========*/ - - hash_table_t* table, /*!< in: hash table */ - ulint fold); /*!< in: fold */ -/************************************************************//** -unlock x-lock for a fold value in a hash table. */ -void -hash_unlock_x( -/*==========*/ - hash_table_t* table, /*!< in: hash table */ - ulint fold); /*!< in: fold */ -/************************************************************//** Reserves all the locks of a hash table, in an ascending order. */ void hash_lock_x_all( @@ -572,8 +510,6 @@ struct hash_table_t { #endif /* UNIV_DEBUG */ }; -#ifndef UNIV_NONINL #include "hash0hash.ic" -#endif #endif diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h index ee8272d724cd0..6cff26635bd3b 100644 --- a/storage/innobase/include/ibuf0ibuf.h +++ b/storage/innobase/include/ibuf0ibuf.h @@ -450,8 +450,6 @@ for the file segment from which the pages for the ibuf tree are allocated */ /* The insert buffer tree itself is always located in space 0. */ #define IBUF_SPACE_ID static_cast(0) -#ifndef UNIV_NONINL #include "ibuf0ibuf.ic" -#endif #endif diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index f3f1f39d1a669..e9ec01f6eb2e7 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -299,55 +299,6 @@ lock_rec_insert_check_and_lock( record */ MY_ATTRIBUTE((warn_unused_result)); -/*************************************************************//** -Removes a record lock request, waiting or granted, from the queue and -grants locks to other transactions in the queue if they now are entitled -to a lock. NOTE: all record locks contained in in_lock are removed. */ -void -lock_rec_dequeue_from_page( -/*=======================*/ - lock_t* in_lock); /*!< in: record lock object: all - record locks which are contained in - this lock object are removed; - transactions waiting behind will - get their lock requests granted, - if they are now qualified to it */ - -/*************************************************************//** -Moves the locks of a record to another record and resets the lock bits of -the donating record. */ -UNIV_INLINE -void -lock_rec_move( -/*==========*/ - const buf_block_t* receiver, /*!< in: buffer block containing - the receiving record */ - const buf_block_t* donator, /*!< in: buffer block containing - the donating record */ - ulint receiver_heap_no,/*!< in: heap_no of the record - which gets the locks; there - must be no lock requests - on it! */ - ulint donator_heap_no);/*!< in: heap_no of the record - which gives the locks */ - -/*************************************************************//** -Moves the locks of a record to another record and resets the lock bits of -the donating record. */ -void -lock_rec_move_low( -/*==============*/ - hash_table_t* lock_hash, /*!< in: hash table to use */ - const buf_block_t* receiver, /*!< in: buffer block containing - the receiving record */ - const buf_block_t* donator, /*!< in: buffer block containing - the donating record */ - ulint receiver_heap_no,/*!< in: heap_no of the record - which gets the locks; there - must be no lock requests - on it! */ - ulint donator_heap_no);/*!< in: heap_no of the record - which gives the locks */ /*********************************************************************//** Checks if locks of other transactions prevent an immediate modify (update, delete mark, or delete unmark) of a clustered index record. If they do, @@ -657,20 +608,6 @@ lock_report_trx_id_insanity( const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */ trx_id_t max_trx_id); /*!< in: trx_sys_get_max_trx_id() */ /*********************************************************************//** -Prints info of a table lock. */ -void -lock_table_print( -/*=============*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock); /*!< in: table type lock */ -/*********************************************************************//** -Prints info of a record lock. */ -void -lock_rec_print( -/*===========*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock); /*!< in: record type lock */ -/*********************************************************************//** Prints info of locks for all transactions. @return FALSE if not able to obtain lock mutex and exits without printing info */ @@ -1146,8 +1083,6 @@ lock_update_split_and_merge( #endif /* WITH_WSREP */ -#ifndef UNIV_NONINL #include "lock0lock.ic" -#endif #endif diff --git a/storage/innobase/include/lock0lock.ic b/storage/innobase/include/lock0lock.ic index 6c28300467dd1..b73843e7a1f3c 100644 --- a/storage/innobase/include/lock0lock.ic +++ b/storage/innobase/include/lock0lock.ic @@ -91,28 +91,6 @@ lock_get_min_heap_no( } } -/*************************************************************//** -Moves the locks of a record to another record and resets the lock bits of -the donating record. */ -UNIV_INLINE -void -lock_rec_move( -/*==========*/ - const buf_block_t* receiver, /*!< in: buffer block containing - the receiving record */ - const buf_block_t* donator, /*!< in: buffer block containing - the donating record */ - ulint receiver_heap_no,/*!< in: heap_no of the record - which gets the locks; there - must be no lock requests - on it! */ - ulint donator_heap_no)/*!< in: heap_no of the record - which gives the locks */ -{ - lock_rec_move_low(lock_sys->rec_hash, receiver, donator, - receiver_heap_no, donator_heap_no); -} - /*************************************************************//** Get the lock hash table */ UNIV_INLINE diff --git a/storage/innobase/include/lock0prdt.h b/storage/innobase/include/lock0prdt.h index 6c61f07a4e848..878d575ddc7c1 100644 --- a/storage/innobase/include/lock0prdt.h +++ b/storage/innobase/include/lock0prdt.h @@ -65,16 +65,6 @@ lock_place_prdt_page_lock( dict_index_t* index, /*!< in: secondary index */ que_thr_t* thr); /*!< in: query thread */ -/*********************************************************************//** -Checks two predicate locks are compatible with each other -@return true if conflicts */ -bool -lock_prdt_consistent( -/*=================*/ - lock_prdt_t* prdt1, /*!< in: Predicate for the lock */ - lock_prdt_t* prdt2, /*!< in: Predicate for the lock */ - ulint op); /*!< in: Predicate comparison operator */ - /*********************************************************************//** Initiate a Predicate lock from a MBR */ void diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h index 0b2ab1bfcfec9..6bb75817ad694 100644 --- a/storage/innobase/include/lock0priv.h +++ b/storage/innobase/include/lock0priv.h @@ -1170,8 +1170,6 @@ lock_table_has( const dict_table_t* table, /*!< in: table */ enum lock_mode mode); /*!< in: lock mode */ -#ifndef UNIV_NONINL #include "lock0priv.ic" -#endif #endif /* lock0priv_h */ diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index de72e5291efea..35a9451363263 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -52,22 +52,6 @@ typedef ulint (*log_checksum_func_t)(const byte* log_block); log_sys->mutex. */ extern log_checksum_func_t log_checksum_algorithm_ptr; -/*******************************************************************//** -Calculates where in log files we find a specified lsn. -@return log file number */ -ulint -log_calc_where_lsn_is( -/*==================*/ - int64_t* log_file_offset, /*!< out: offset in that file - (including the header) */ - ib_uint64_t first_header_lsn, /*!< in: first log file start - lsn */ - ib_uint64_t lsn, /*!< in: lsn whose position to - determine */ - ulint n_log_files, /*!< in: total number of log - files */ - int64_t log_file_size); /*!< in: log file size - (including the header) */ /** Append a string to the log. @param[in] str string @param[in] len string length @@ -281,14 +265,6 @@ log_group_set_fields( log_group_t* group, /*!< in/out: group */ lsn_t lsn); /*!< in: lsn for which the values should be set */ -/******************************************************//** -Calculates the data capacity of a log group, when the log file headers are not -included. -@return capacity in bytes */ -lsn_t -log_group_get_capacity( -/*===================*/ - const log_group_t* group); /*!< in: log group */ /************************************************************//** Gets a log block flush bit. @return TRUE if this block was the first to be written in a log flush */ @@ -814,8 +790,6 @@ extern os_event_t log_scrub_event; /** Whether log_scrub_thread is active */ extern bool log_scrub_thread_active; -#ifndef UNIV_NONINL #include "log0log.ic" -#endif #endif diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h index d3e3a53c6559c..5a5574b2537f3 100644 --- a/storage/innobase/include/mach0data.h +++ b/storage/innobase/include/mach0data.h @@ -375,8 +375,6 @@ mach_read_ulint( #endif /* !UNIV_INNOCHECKSUM */ -#ifndef UNIV_NONINL #include "mach0data.ic" -#endif #endif diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h index c44b6d38b7833..e44f3f730afe4 100644 --- a/storage/innobase/include/mem0mem.h +++ b/storage/innobase/include/mem0mem.h @@ -411,9 +411,7 @@ struct mem_block_info_t { #define MEM_BLOCK_HEADER_SIZE ut_calc_align(sizeof(mem_block_info_t),\ UNIV_MEM_ALIGNMENT) -#ifndef UNIV_NONINL #include "mem0mem.ic" -#endif /** A C++ wrapper class to the mem_heap_t routines, so that it can be used as an STL allocator */ diff --git a/storage/innobase/include/mtr0log.h b/storage/innobase/include/mtr0log.h index b5c94ff7d4615..d6b32374c4249 100644 --- a/storage/innobase/include/mtr0log.h +++ b/storage/innobase/include/mtr0log.h @@ -243,8 +243,6 @@ mlog_parse_index( extra mlog buffer size for variable size data */ #define MLOG_BUF_MARGIN 256 -#ifndef UNIV_NONINL #include "mtr0log.ic" -#endif /* UNIV_NOINL */ #endif /* mtr0log_h */ diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 972209c1bf65b..a02333109ccad 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -239,7 +239,10 @@ struct mtr_t { /** Start a mini-transaction. @param sync true if it is a synchronous mini-transaction @param read_only true if read only mini-transaction */ - void start(bool sync = true, bool read_only = false); + void start(bool sync = true, bool read_only = false) + { + start(NULL, sync, read_only); + } /** Start a mini-transaction. @param sync true if it is a synchronous mini-transaction @@ -609,8 +612,6 @@ struct mtr_t { bool m_sync; }; -#ifndef UNIV_NONINL #include "mtr0mtr.ic" -#endif /* UNIV_NOINL */ #endif /* mtr0mtr_h */ diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 3c4a9d9479cf0..7028625df871e 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -424,15 +424,12 @@ class IORequest { } } - /** Punch a hole in the file if it was a write + /** Free storage space associated with a section of the file. @param[in] fh Open file handle - @param[in] len Compressed buffer length for write + @param[in] off Starting offset (SEEK_SET) + @param[in] len Size of the hole @return DB_SUCCESS or error code */ - - dberr_t punch_hole( - os_file_t fh, - os_offset_t offset, - os_offset_t len); + dberr_t punch_hole(os_file_t fh, os_offset_t off, ulint len); private: /** Page to be written on write operation. */ @@ -1607,8 +1604,6 @@ os_file_get_block_size( os_file_t file, /*!< in: handle to a file */ const char* name); /*!< in: file name */ -#ifndef UNIV_NONINL #include "os0file.ic" -#endif /* UNIV_NONINL */ #endif /* os0file_h */ diff --git a/storage/innobase/include/os0proc.h b/storage/innobase/include/os0proc.h index af57b5d6a7a43..a73ba5a9e8419 100644 --- a/storage/innobase/include/os0proc.h +++ b/storage/innobase/include/os0proc.h @@ -1,6 +1,7 @@ /***************************************************************************** -Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -67,8 +68,4 @@ os_mem_free_large( void *ptr, ulint size); -#ifndef UNIV_NONINL -#include "os0proc.ic" -#endif - #endif diff --git a/storage/innobase/include/os0proc.ic b/storage/innobase/include/os0proc.ic deleted file mode 100644 index 506f4f8ce0c1d..0000000000000 --- a/storage/innobase/include/os0proc.ic +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2009, 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 include/os0proc.ic -The interface to the operating system -process control primitives - -Created 9/30/1995 Heikki Tuuri -*******************************************************/ - - diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h index 9ba35b6f35982..7aea976a37eb9 100644 --- a/storage/innobase/include/os0thread.h +++ b/storage/innobase/include/os0thread.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -159,8 +160,4 @@ bool os_thread_active(); /*==============*/ -#ifndef UNIV_NONINL -#include "os0thread.ic" -#endif - #endif diff --git a/storage/innobase/include/os0thread.ic b/storage/innobase/include/os0thread.ic deleted file mode 100644 index 0622d22f2dcf8..0000000000000 --- a/storage/innobase/include/os0thread.ic +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2009, 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 include/os0thread.ic -The interface to the operating system -process and thread control primitives - -Created 9/8/1995 Heikki Tuuri -*******************************************************/ diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h index 731817e740a33..f3890c43b73d4 100644 --- a/storage/innobase/include/page0cur.h +++ b/storage/innobase/include/page0cur.h @@ -387,8 +387,6 @@ struct page_cur_t{ buf_block_t* block; /*!< pointer to the block containing rec */ }; -#ifndef UNIV_NONINL #include "page0cur.ic" -#endif #endif diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index e61e7d2ae16df..a8c5f11c17bc7 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -1193,9 +1193,7 @@ page_warn_strict_checksum( #endif /* !UNIV_INNOCHECKSUM */ -#ifndef UNIV_NONINL #include "page0page.ic" -#endif #endif diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h index f4da2b5538545..e1062c00a6f87 100644 --- a/storage/innobase/include/page0zip.h +++ b/storage/innobase/include/page0zip.h @@ -564,9 +564,7 @@ page_zip_reset_stat_per_index(); # define UNIV_INLINE UNIV_INLINE_ORIGINAL #endif -#ifndef UNIV_NONINL -# include "page0zip.ic" -#endif +#include "page0zip.ic" #endif /* !UNIV_INNOCHECKSUM */ #endif /* page0zip_h */ diff --git a/storage/innobase/include/pars0grm.h b/storage/innobase/include/pars0grm.h index 8e725fe95454e..788090a2e74fb 100644 --- a/storage/innobase/include/pars0grm.h +++ b/storage/innobase/include/pars0grm.h @@ -1,14 +1,13 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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; either version 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +15,7 @@ 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, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -33,229 +30,135 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* Tokens. */ +#ifndef YY_YY_PARS0GRM_TAB_H_INCLUDED +# define YY_YY_PARS0GRM_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - PARS_INT_LIT = 258, - PARS_FLOAT_LIT = 259, - PARS_STR_LIT = 260, - PARS_FIXBINARY_LIT = 261, - PARS_BLOB_LIT = 262, - PARS_NULL_LIT = 263, - PARS_ID_TOKEN = 264, - PARS_AND_TOKEN = 265, - PARS_OR_TOKEN = 266, - PARS_NOT_TOKEN = 267, - PARS_GE_TOKEN = 268, - PARS_LE_TOKEN = 269, - PARS_NE_TOKEN = 270, - PARS_PROCEDURE_TOKEN = 271, - PARS_IN_TOKEN = 272, - PARS_OUT_TOKEN = 273, - PARS_BINARY_TOKEN = 274, - PARS_BLOB_TOKEN = 275, - PARS_INT_TOKEN = 276, - PARS_INTEGER_TOKEN = 277, - PARS_FLOAT_TOKEN = 278, - PARS_CHAR_TOKEN = 279, - PARS_IS_TOKEN = 280, - PARS_BEGIN_TOKEN = 281, - PARS_END_TOKEN = 282, - PARS_IF_TOKEN = 283, - PARS_THEN_TOKEN = 284, - PARS_ELSE_TOKEN = 285, - PARS_ELSIF_TOKEN = 286, - PARS_LOOP_TOKEN = 287, - PARS_WHILE_TOKEN = 288, - PARS_RETURN_TOKEN = 289, - PARS_SELECT_TOKEN = 290, - PARS_SUM_TOKEN = 291, - PARS_COUNT_TOKEN = 292, - PARS_DISTINCT_TOKEN = 293, - PARS_FROM_TOKEN = 294, - PARS_WHERE_TOKEN = 295, - PARS_FOR_TOKEN = 296, - PARS_DDOT_TOKEN = 297, - PARS_READ_TOKEN = 298, - PARS_ORDER_TOKEN = 299, - PARS_BY_TOKEN = 300, - PARS_ASC_TOKEN = 301, - PARS_DESC_TOKEN = 302, - PARS_INSERT_TOKEN = 303, - PARS_INTO_TOKEN = 304, - PARS_VALUES_TOKEN = 305, - PARS_UPDATE_TOKEN = 306, - PARS_SET_TOKEN = 307, - PARS_DELETE_TOKEN = 308, - PARS_CURRENT_TOKEN = 309, - PARS_OF_TOKEN = 310, - PARS_CREATE_TOKEN = 311, - PARS_TABLE_TOKEN = 312, - PARS_INDEX_TOKEN = 313, - PARS_UNIQUE_TOKEN = 314, - PARS_CLUSTERED_TOKEN = 315, - PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 316, - PARS_ON_TOKEN = 317, - PARS_ASSIGN_TOKEN = 318, - PARS_DECLARE_TOKEN = 319, - PARS_CURSOR_TOKEN = 320, - PARS_SQL_TOKEN = 321, - PARS_OPEN_TOKEN = 322, - PARS_FETCH_TOKEN = 323, - PARS_CLOSE_TOKEN = 324, - PARS_NOTFOUND_TOKEN = 325, - PARS_TO_CHAR_TOKEN = 326, - PARS_TO_NUMBER_TOKEN = 327, - PARS_TO_BINARY_TOKEN = 328, - PARS_BINARY_TO_NUMBER_TOKEN = 329, - PARS_SUBSTR_TOKEN = 330, - PARS_REPLSTR_TOKEN = 331, - PARS_CONCAT_TOKEN = 332, - PARS_INSTR_TOKEN = 333, - PARS_LENGTH_TOKEN = 334, - PARS_SYSDATE_TOKEN = 335, - PARS_PRINTF_TOKEN = 336, - PARS_ASSERT_TOKEN = 337, - PARS_RND_TOKEN = 338, - PARS_RND_STR_TOKEN = 339, - PARS_ROW_PRINTF_TOKEN = 340, - PARS_COMMIT_TOKEN = 341, - PARS_ROLLBACK_TOKEN = 342, - PARS_WORK_TOKEN = 343, - PARS_UNSIGNED_TOKEN = 344, - PARS_EXIT_TOKEN = 345, - PARS_FUNCTION_TOKEN = 346, - PARS_LOCK_TOKEN = 347, - PARS_SHARE_TOKEN = 348, - PARS_MODE_TOKEN = 349, - PARS_LIKE_TOKEN = 350, - PARS_LIKE_TOKEN_EXACT = 351, - PARS_LIKE_TOKEN_PREFIX = 352, - PARS_LIKE_TOKEN_SUFFIX = 353, - PARS_LIKE_TOKEN_SUBSTR = 354, - PARS_TABLE_NAME_TOKEN = 355, - PARS_COMPACT_TOKEN = 356, - PARS_BLOCK_SIZE_TOKEN = 357, - PARS_BIGINT_TOKEN = 358, - NEG = 359 - }; + enum yytokentype + { + PARS_INT_LIT = 258, + PARS_FLOAT_LIT = 259, + PARS_STR_LIT = 260, + PARS_FIXBINARY_LIT = 261, + PARS_BLOB_LIT = 262, + PARS_NULL_LIT = 263, + PARS_ID_TOKEN = 264, + PARS_AND_TOKEN = 265, + PARS_OR_TOKEN = 266, + PARS_NOT_TOKEN = 267, + PARS_GE_TOKEN = 268, + PARS_LE_TOKEN = 269, + PARS_NE_TOKEN = 270, + PARS_PROCEDURE_TOKEN = 271, + PARS_IN_TOKEN = 272, + PARS_OUT_TOKEN = 273, + PARS_BINARY_TOKEN = 274, + PARS_BLOB_TOKEN = 275, + PARS_INT_TOKEN = 276, + PARS_INTEGER_TOKEN = 277, + PARS_FLOAT_TOKEN = 278, + PARS_CHAR_TOKEN = 279, + PARS_IS_TOKEN = 280, + PARS_BEGIN_TOKEN = 281, + PARS_END_TOKEN = 282, + PARS_IF_TOKEN = 283, + PARS_THEN_TOKEN = 284, + PARS_ELSE_TOKEN = 285, + PARS_ELSIF_TOKEN = 286, + PARS_LOOP_TOKEN = 287, + PARS_WHILE_TOKEN = 288, + PARS_RETURN_TOKEN = 289, + PARS_SELECT_TOKEN = 290, + PARS_SUM_TOKEN = 291, + PARS_COUNT_TOKEN = 292, + PARS_DISTINCT_TOKEN = 293, + PARS_FROM_TOKEN = 294, + PARS_WHERE_TOKEN = 295, + PARS_FOR_TOKEN = 296, + PARS_DDOT_TOKEN = 297, + PARS_READ_TOKEN = 298, + PARS_ORDER_TOKEN = 299, + PARS_BY_TOKEN = 300, + PARS_ASC_TOKEN = 301, + PARS_DESC_TOKEN = 302, + PARS_INSERT_TOKEN = 303, + PARS_INTO_TOKEN = 304, + PARS_VALUES_TOKEN = 305, + PARS_UPDATE_TOKEN = 306, + PARS_SET_TOKEN = 307, + PARS_DELETE_TOKEN = 308, + PARS_CURRENT_TOKEN = 309, + PARS_OF_TOKEN = 310, + PARS_CREATE_TOKEN = 311, + PARS_TABLE_TOKEN = 312, + PARS_INDEX_TOKEN = 313, + PARS_UNIQUE_TOKEN = 314, + PARS_CLUSTERED_TOKEN = 315, + PARS_ON_TOKEN = 316, + PARS_ASSIGN_TOKEN = 317, + PARS_DECLARE_TOKEN = 318, + PARS_CURSOR_TOKEN = 319, + PARS_SQL_TOKEN = 320, + PARS_OPEN_TOKEN = 321, + PARS_FETCH_TOKEN = 322, + PARS_CLOSE_TOKEN = 323, + PARS_NOTFOUND_TOKEN = 324, + PARS_TO_CHAR_TOKEN = 325, + PARS_TO_NUMBER_TOKEN = 326, + PARS_TO_BINARY_TOKEN = 327, + PARS_BINARY_TO_NUMBER_TOKEN = 328, + PARS_SUBSTR_TOKEN = 329, + PARS_REPLSTR_TOKEN = 330, + PARS_CONCAT_TOKEN = 331, + PARS_INSTR_TOKEN = 332, + PARS_LENGTH_TOKEN = 333, + PARS_SYSDATE_TOKEN = 334, + PARS_PRINTF_TOKEN = 335, + PARS_ASSERT_TOKEN = 336, + PARS_RND_TOKEN = 337, + PARS_RND_STR_TOKEN = 338, + PARS_ROW_PRINTF_TOKEN = 339, + PARS_COMMIT_TOKEN = 340, + PARS_ROLLBACK_TOKEN = 341, + PARS_WORK_TOKEN = 342, + PARS_UNSIGNED_TOKEN = 343, + PARS_EXIT_TOKEN = 344, + PARS_FUNCTION_TOKEN = 345, + PARS_LOCK_TOKEN = 346, + PARS_SHARE_TOKEN = 347, + PARS_MODE_TOKEN = 348, + PARS_LIKE_TOKEN = 349, + PARS_LIKE_TOKEN_EXACT = 350, + PARS_LIKE_TOKEN_PREFIX = 351, + PARS_LIKE_TOKEN_SUFFIX = 352, + PARS_LIKE_TOKEN_SUBSTR = 353, + PARS_TABLE_NAME_TOKEN = 354, + PARS_COMPACT_TOKEN = 355, + PARS_BLOCK_SIZE_TOKEN = 356, + PARS_BIGINT_TOKEN = 357, + NEG = 358 + }; #endif -/* Tokens. */ -#define PARS_INT_LIT 258 -#define PARS_FLOAT_LIT 259 -#define PARS_STR_LIT 260 -#define PARS_FIXBINARY_LIT 261 -#define PARS_BLOB_LIT 262 -#define PARS_NULL_LIT 263 -#define PARS_ID_TOKEN 264 -#define PARS_AND_TOKEN 265 -#define PARS_OR_TOKEN 266 -#define PARS_NOT_TOKEN 267 -#define PARS_GE_TOKEN 268 -#define PARS_LE_TOKEN 269 -#define PARS_NE_TOKEN 270 -#define PARS_PROCEDURE_TOKEN 271 -#define PARS_IN_TOKEN 272 -#define PARS_OUT_TOKEN 273 -#define PARS_BINARY_TOKEN 274 -#define PARS_BLOB_TOKEN 275 -#define PARS_INT_TOKEN 276 -#define PARS_INTEGER_TOKEN 277 -#define PARS_FLOAT_TOKEN 278 -#define PARS_CHAR_TOKEN 279 -#define PARS_IS_TOKEN 280 -#define PARS_BEGIN_TOKEN 281 -#define PARS_END_TOKEN 282 -#define PARS_IF_TOKEN 283 -#define PARS_THEN_TOKEN 284 -#define PARS_ELSE_TOKEN 285 -#define PARS_ELSIF_TOKEN 286 -#define PARS_LOOP_TOKEN 287 -#define PARS_WHILE_TOKEN 288 -#define PARS_RETURN_TOKEN 289 -#define PARS_SELECT_TOKEN 290 -#define PARS_SUM_TOKEN 291 -#define PARS_COUNT_TOKEN 292 -#define PARS_DISTINCT_TOKEN 293 -#define PARS_FROM_TOKEN 294 -#define PARS_WHERE_TOKEN 295 -#define PARS_FOR_TOKEN 296 -#define PARS_DDOT_TOKEN 297 -#define PARS_READ_TOKEN 298 -#define PARS_ORDER_TOKEN 299 -#define PARS_BY_TOKEN 300 -#define PARS_ASC_TOKEN 301 -#define PARS_DESC_TOKEN 302 -#define PARS_INSERT_TOKEN 303 -#define PARS_INTO_TOKEN 304 -#define PARS_VALUES_TOKEN 305 -#define PARS_UPDATE_TOKEN 306 -#define PARS_SET_TOKEN 307 -#define PARS_DELETE_TOKEN 308 -#define PARS_CURRENT_TOKEN 309 -#define PARS_OF_TOKEN 310 -#define PARS_CREATE_TOKEN 311 -#define PARS_TABLE_TOKEN 312 -#define PARS_INDEX_TOKEN 313 -#define PARS_UNIQUE_TOKEN 314 -#define PARS_CLUSTERED_TOKEN 315 -#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 316 -#define PARS_ON_TOKEN 317 -#define PARS_ASSIGN_TOKEN 318 -#define PARS_DECLARE_TOKEN 319 -#define PARS_CURSOR_TOKEN 320 -#define PARS_SQL_TOKEN 321 -#define PARS_OPEN_TOKEN 322 -#define PARS_FETCH_TOKEN 323 -#define PARS_CLOSE_TOKEN 324 -#define PARS_NOTFOUND_TOKEN 325 -#define PARS_TO_CHAR_TOKEN 326 -#define PARS_TO_NUMBER_TOKEN 327 -#define PARS_TO_BINARY_TOKEN 328 -#define PARS_BINARY_TO_NUMBER_TOKEN 329 -#define PARS_SUBSTR_TOKEN 330 -#define PARS_REPLSTR_TOKEN 331 -#define PARS_CONCAT_TOKEN 332 -#define PARS_INSTR_TOKEN 333 -#define PARS_LENGTH_TOKEN 334 -#define PARS_SYSDATE_TOKEN 335 -#define PARS_PRINTF_TOKEN 336 -#define PARS_ASSERT_TOKEN 337 -#define PARS_RND_TOKEN 338 -#define PARS_RND_STR_TOKEN 339 -#define PARS_ROW_PRINTF_TOKEN 340 -#define PARS_COMMIT_TOKEN 341 -#define PARS_ROLLBACK_TOKEN 342 -#define PARS_WORK_TOKEN 343 -#define PARS_UNSIGNED_TOKEN 344 -#define PARS_EXIT_TOKEN 345 -#define PARS_FUNCTION_TOKEN 346 -#define PARS_LOCK_TOKEN 347 -#define PARS_SHARE_TOKEN 348 -#define PARS_MODE_TOKEN 349 -#define PARS_LIKE_TOKEN 350 -#define PARS_LIKE_TOKEN_EXACT 351 -#define PARS_LIKE_TOKEN_PREFIX 352 -#define PARS_LIKE_TOKEN_SUFFIX 353 -#define PARS_LIKE_TOKEN_SUBSTR 354 -#define PARS_TABLE_NAME_TOKEN 355 -#define PARS_COMPACT_TOKEN 356 -#define PARS_BLOCK_SIZE_TOKEN 357 -#define PARS_BIGINT_TOKEN 358 -#define NEG 359 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 #endif + extern YYSTYPE yylval; +int yyparse (void); + +#endif /* !YY_YY_PARS0GRM_TAB_H_INCLUDED */ diff --git a/storage/innobase/include/pars0opt.h b/storage/innobase/include/pars0opt.h index cb1ce60ac2282..13ea38cc38502 100644 --- a/storage/innobase/include/pars0opt.h +++ b/storage/innobase/include/pars0opt.h @@ -1,6 +1,7 @@ /***************************************************************************** -Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -67,8 +68,4 @@ opt_print_query_plan( sel_node_t* sel_node); /*!< in: select node */ #endif /* UNIV_SQL_DEBUG */ -#ifndef UNIV_NONINL -#include "pars0opt.ic" -#endif - #endif diff --git a/storage/innobase/include/pars0opt.ic b/storage/innobase/include/pars0opt.ic deleted file mode 100644 index 786d911ca3d33..0000000000000 --- a/storage/innobase/include/pars0opt.ic +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2009, 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 include/pars0opt.ic -Simple SQL optimizer - -Created 12/21/1997 Heikki Tuuri -*******************************************************/ diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h index 7e153d0c19bc7..dad7953424c81 100644 --- a/storage/innobase/include/pars0pars.h +++ b/storage/innobase/include/pars0pars.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -373,18 +374,7 @@ pars_create_table( table */ sym_node_t* column_defs, /*!< in: list of column names */ sym_node_t* compact, /* in: non-NULL if COMPACT table. */ - sym_node_t* block_size, /* in: block size (can be NULL) */ - void* not_fit_in_memory); - /*!< in: a non-NULL pointer means that - this is a table which in simulations - should be simulated as not fitting - in memory; thread is put to sleep - to simulate disk accesses; NOTE that - this flag is not stored to the data - dictionary on disk, and the database - will forget about non-NULL value if - it has to reload the table definition - from disk */ + sym_node_t* block_size); /* in: block size (can be NULL) */ /*********************************************************************//** Parses an index creation operation. @return index create subgraph */ @@ -764,8 +754,4 @@ struct col_assign_node_t{ e.g., := */ /* @} */ -#ifndef UNIV_NONINL -#include "pars0pars.ic" -#endif - #endif diff --git a/storage/innobase/include/pars0pars.ic b/storage/innobase/include/pars0pars.ic deleted file mode 100644 index 4c88337a265d4..0000000000000 --- a/storage/innobase/include/pars0pars.ic +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2009, 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 include/pars0pars.ic -SQL parser - -Created 11/19/1996 Heikki Tuuri -*******************************************************/ diff --git a/storage/innobase/include/pars0sym.h b/storage/innobase/include/pars0sym.h index abd0c5cd4c8a2..4e5117196395a 100644 --- a/storage/innobase/include/pars0sym.h +++ b/storage/innobase/include/pars0sym.h @@ -1,6 +1,7 @@ /***************************************************************************** -Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -242,8 +243,4 @@ struct sym_tab_t{ allocate space */ }; -#ifndef UNIV_NONINL -#include "pars0sym.ic" -#endif - #endif diff --git a/storage/innobase/include/pars0sym.ic b/storage/innobase/include/pars0sym.ic deleted file mode 100644 index 266c1a6310df2..0000000000000 --- a/storage/innobase/include/pars0sym.ic +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2009, 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 include/pars0sym.ic -SQL parser symbol table - -Created 12/15/1997 Heikki Tuuri -*******************************************************/ diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index 574b7e6acee41..763b16820d8a6 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.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) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -499,8 +499,6 @@ struct que_fork_t{ #define QUE_NODE_CALL 31 #define QUE_NODE_EXIT 32 -#ifndef UNIV_NONINL #include "que0que.ic" -#endif #endif diff --git a/storage/innobase/include/rem0cmp.h b/storage/innobase/include/rem0cmp.h index a59479849a87e..245fefae9447b 100644 --- a/storage/innobase/include/rem0cmp.h +++ b/storage/innobase/include/rem0cmp.h @@ -250,8 +250,6 @@ cmp_dfield_dfield_like_prefix( const dfield_t* dfield1, const dfield_t* dfield2); -#ifndef UNIV_NONINL #include "rem0cmp.ic" -#endif #endif diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index 4b82a6b05b92c..916222d5fdb5d 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -941,16 +941,6 @@ rec_print_old( const rec_t* rec) /*!< in: physical record */ MY_ATTRIBUTE((nonnull)); /***************************************************************//** -Prints a physical record in ROW_FORMAT=COMPACT. Ignores the -record header. */ -void -rec_print_comp( -/*===========*/ - FILE* file, /*!< in: file where to print */ - const rec_t* rec, /*!< in: physical record */ - const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - MY_ATTRIBUTE((nonnull)); -/***************************************************************//** Prints a spatial index record. */ void rec_print_mbr_rec( @@ -1120,8 +1110,6 @@ int wsrep_rec_get_foreign_key( ibool new_protocol); /* in: protocol > 1 */ #endif /* WITH_WSREP */ -#ifndef UNIV_NONINL #include "rem0rec.ic" -#endif #endif /* rem0rec_h */ diff --git a/storage/innobase/include/row0ext.h b/storage/innobase/include/row0ext.h index 1d788a4c2176e..050bc37850b22 100644 --- a/storage/innobase/include/row0ext.h +++ b/storage/innobase/include/row0ext.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 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 @@ -98,8 +98,6 @@ struct row_ext_t{ ulint len[1]; /*!< prefix lengths; 0 if not cached */ }; -#ifndef UNIV_NONINL #include "row0ext.ic" -#endif #endif diff --git a/storage/innobase/include/row0ftsort.h b/storage/innobase/include/row0ftsort.h index 7e39fe33d9fb0..207fd783cacf8 100644 --- a/storage/innobase/include/row0ftsort.h +++ b/storage/innobase/include/row0ftsort.h @@ -223,45 +223,18 @@ row_fts_free_pll_merge_buf( fts_psort_t* psort_info); /*!< in: parallel sort info */ /*********************************************************************//** -Function performs parallel tokenization of the incoming doc strings. -@return OS_THREAD_DUMMY_RETURN */ -os_thread_ret_t -fts_parallel_tokenization( -/*======================*/ - void* arg); /*!< in: psort_info for the thread */ -/*********************************************************************//** Start the parallel tokenization and parallel merge sort */ void row_fts_start_psort( /*================*/ fts_psort_t* psort_info); /*!< in: parallel sort info */ /*********************************************************************//** -Function performs the merge and insertion of the sorted records. -@return OS_THREAD_DUMMY_RETURN */ -os_thread_ret_t -fts_parallel_merge( -/*===============*/ - void* arg); /*!< in: parallel merge info */ -/*********************************************************************//** Kick off the parallel merge and insert thread */ void row_fts_start_parallel_merge( /*=========================*/ fts_psort_t* merge_info); /*!< in: parallel sort info */ /********************************************************************//** -Read sorted FTS data files and insert data tuples to auxillary tables. -@return DB_SUCCESS or error number */ -void -row_fts_insert_tuple( -/*=================*/ - fts_psort_insert_t* - ins_ctx, /*!< in: insert context */ - fts_tokenizer_word_t* word, /*!< in: last processed - tokenized word */ - ib_vector_t* positions, /*!< in: word position */ - doc_id_t* in_doc_id, /*!< in: last item doc id */ - dtuple_t* dtuple); /*!< in: entry to insert */ -/********************************************************************//** Propagate a newly added record up one level in the selection tree @return parent where this value propagated to */ int diff --git a/storage/innobase/include/row0import.h b/storage/innobase/include/row0import.h index 137c28ac1faa8..c6dfca9d7e8d9 100644 --- a/storage/innobase/include/row0import.h +++ b/storage/innobase/include/row0import.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -80,8 +81,5 @@ row_import_update_index_root( caller already owns the dict_sys_t:: mutex. */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -#ifndef UNIV_NONINL -#include "row0import.ic" -#endif #endif /* row0import_h */ diff --git a/storage/innobase/include/row0import.ic b/storage/innobase/include/row0import.ic deleted file mode 100644 index c5bbab49f6fbb..0000000000000 --- a/storage/innobase/include/row0import.ic +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2012, 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 include/row0import.ic - -Import tablespace inline functions. - -Created 2012-02-08 Sunny Bains -*******************************************************/ diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h index 00a32942de237..8cb3a2f16cdc2 100644 --- a/storage/innobase/include/row0ins.h +++ b/storage/innobase/include/row0ins.h @@ -138,31 +138,6 @@ row_ins_index_entry_set_vals( dtuple_t* entry, const dtuple_t* row); -/***************************************************************//** -Tries to insert the externally stored fields (off-page columns) -of a clustered index entry. -@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ -dberr_t -row_ins_index_entry_big_rec_func( -/*=============================*/ - const dtuple_t* entry, /*!< in/out: index entry to insert */ - const big_rec_t* big_rec,/*!< in: externally stored fields */ - ulint* offsets,/*!< in/out: rec offsets */ - mem_heap_t** heap, /*!< in/out: memory heap */ - dict_index_t* index, /*!< in: index */ - const char* file, /*!< in: file name of caller */ -#ifndef DBUG_OFF - const void* thd, /*!< in: connection, or NULL */ -#endif /* DBUG_OFF */ - unsigned line) /*!< in: line number of caller */ - MY_ATTRIBUTE((nonnull(1,2,3,4,5,6), warn_unused_result)); -#ifdef DBUG_OFF -# define row_ins_index_entry_big_rec(e,big,ofs,heap,index,thd,file,line) \ - row_ins_index_entry_big_rec_func(e,big,ofs,heap,index,file,line) -#else /* DBUG_OFF */ -# define row_ins_index_entry_big_rec(e,big,ofs,heap,index,thd,file,line) \ - row_ins_index_entry_big_rec_func(e,big,ofs,heap,index,file,thd,line) -#endif /* DBUG_OFF */ /***************************************************************//** Inserts an entry into a clustered index. Tries first optimistic, then pessimistic descent down the tree. If the entry matches enough @@ -253,8 +228,4 @@ struct ins_node_t{ #define INS_NODE_INSERT_ENTRIES 3 /* index entries should be built and inserted */ -#ifndef UNIV_NONINL -#include "row0ins.ic" -#endif - #endif diff --git a/storage/innobase/include/row0ins.ic b/storage/innobase/include/row0ins.ic deleted file mode 100644 index 9c191d869a232..0000000000000 --- a/storage/innobase/include/row0ins.ic +++ /dev/null @@ -1,26 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2009, 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 include/row0ins.ic -Insert into a table - -Created 4/20/1996 Heikki Tuuri -*******************************************************/ - - diff --git a/storage/innobase/include/row0log.h b/storage/innobase/include/row0log.h index c8db44f23b3a3..980facee427ef 100644 --- a/storage/innobase/include/row0log.h +++ b/storage/innobase/include/row0log.h @@ -259,8 +259,6 @@ row_log_estimate_work( const dict_index_t* index); #endif /* HAVE_PSI_STAGE_INTERFACE */ -#ifndef UNIV_NONINL #include "row0log.ic" -#endif #endif /* row0log.h */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 0e4ebafc9903c..59bd786d25cc9 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -119,18 +119,6 @@ row_mysql_store_geometry( is SQL NULL this should be 0; remember also to set the NULL bit in the MySQL record header! */ -/*******************************************************************//** -Reads a reference to a geometry data in the MySQL format. -@return pointer to geometry data */ -const byte* -row_mysql_read_geometry( -/*====================*/ - ulint* len, /*!< out: geometry data length */ - const byte* ref, /*!< in: reference in the - MySQL format */ - ulint col_len) /*!< in: BLOB reference length - (not BLOB length) */ - MY_ATTRIBUTE((nonnull(1,2), warn_unused_result)); /**************************************************************//** Pad a column with spaces. */ void @@ -570,17 +558,6 @@ void row_mysql_close(void); /*=================*/ -/*********************************************************************//** -Reassigns the table identifier of a table. -@return error code or DB_SUCCESS */ -dberr_t -row_mysql_table_id_reassign( -/*========================*/ - dict_table_t* table, /*!< in/out: table */ - trx_t* trx, /*!< in/out: transaction */ - table_id_t* new_id) /*!< out: new table id */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); - /* A struct describing a place for an individual column in the MySQL row format which is presented to the table handler in ha_innobase. This template struct is used to speed up row transformations between @@ -961,10 +938,6 @@ innobase_rename_vc_templ( #define ROW_READ_TRY_SEMI_CONSISTENT 1 #define ROW_READ_DID_SEMI_CONSISTENT 2 -#ifndef UNIV_NONINL -#include "row0mysql.ic" -#endif - #ifdef UNIV_DEBUG /** Wait for the background drop list to become empty. */ void diff --git a/storage/innobase/include/row0mysql.ic b/storage/innobase/include/row0mysql.ic deleted file mode 100644 index 2eb60898c462e..0000000000000 --- a/storage/innobase/include/row0mysql.ic +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2001, 2009, 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 include/row0mysql.ic -MySQL interface for Innobase - -Created 1/23/2001 Heikki Tuuri -*******************************************************/ diff --git a/storage/innobase/include/row0purge.h b/storage/innobase/include/row0purge.h index 32a989833bc23..3cf4a7b982a46 100644 --- a/storage/innobase/include/row0purge.h +++ b/storage/innobase/include/row0purge.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -128,8 +129,4 @@ struct purge_node_t{ #endif }; -#ifndef UNIV_NONINL -#include "row0purge.ic" -#endif - #endif diff --git a/storage/innobase/include/row0purge.ic b/storage/innobase/include/row0purge.ic deleted file mode 100644 index 700106d1048cf..0000000000000 --- a/storage/innobase/include/row0purge.ic +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2009, 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 include/row0purge.ic -Purge obsolete records - -Created 3/14/1997 Heikki Tuuri -*******************************************************/ diff --git a/storage/innobase/include/row0quiesce.h b/storage/innobase/include/row0quiesce.h index ae14b3c63c143..4519e2487ce56 100644 --- a/storage/innobase/include/row0quiesce.h +++ b/storage/innobase/include/row0quiesce.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -64,8 +65,4 @@ row_quiesce_table_complete( trx_t* trx) /*!< in/out: transaction/session */ MY_ATTRIBUTE((nonnull)); -#ifndef UNIV_NONINL -#include "row0quiesce.ic" -#endif - #endif /* row0quiesce_h */ diff --git a/storage/innobase/include/row0quiesce.ic b/storage/innobase/include/row0quiesce.ic deleted file mode 100644 index f570a6aed05a3..0000000000000 --- a/storage/innobase/include/row0quiesce.ic +++ /dev/null @@ -1,26 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2012, 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 include/row0quiesce.ic - -Quiesce a tablespace. - -Created 2012-02-08 Sunny Bains -*******************************************************/ - diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h index 9ae1387810aa8..60f256fb200d5 100644 --- a/storage/innobase/include/row0row.h +++ b/storage/innobase/include/row0row.h @@ -387,8 +387,6 @@ row_raw_format( in bytes */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -#ifndef UNIV_NONINL #include "row0row.ic" -#endif #endif diff --git a/storage/innobase/include/row0sel.h b/storage/innobase/include/row0sel.h index 3f87d78e25ae2..d4d55601bc2d6 100644 --- a/storage/innobase/include/row0sel.h +++ b/storage/innobase/include/row0sel.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -91,14 +92,6 @@ que_thr_t* fetch_step( /*=======*/ que_thr_t* thr); /*!< in: query thread */ -/****************************************************************//** -Sample callback function for fetch that prints each row. -@return always returns non-NULL */ -void* -row_fetch_print( -/*============*/ - void* row, /*!< in: sel_node_t* */ - void* user_arg); /*!< in: not used */ /***********************************************************//** Prints a row in a select result. @return query thread to run next or NULL */ @@ -223,8 +216,8 @@ row_count_rtree_recs( /*******************************************************************//** Checks if MySQL at the moment is allowed for this table to retrieve a consistent read result, or store it to the query cache. -@return TRUE if storing or retrieving from the query cache is permitted */ -ibool +@return whether storing or retrieving from the query cache is permitted */ +bool row_search_check_if_query_cache_permitted( /*======================================*/ trx_t* trx, /*!< in: transaction object */ @@ -406,9 +399,7 @@ struct fetch_node_t{ further rows and the cursor is modified so (cursor % NOTFOUND) is true. If it returns not-NULL, - continue normally. See - row_fetch_print() for an example - (and a useful debugging tool). */ + continue normally. */ }; /** Open or close cursor operation type */ @@ -487,8 +478,6 @@ row_sel_field_store_in_mysql_format_func( const byte* data, /*!< in: data to store */ ulint len); /*!< in: length of the data */ -#ifndef UNIV_NONINL #include "row0sel.ic" -#endif #endif diff --git a/storage/innobase/include/row0uins.h b/storage/innobase/include/row0uins.h index 95a714d2338ff..15e6c33e55e3e 100644 --- a/storage/innobase/include/row0uins.h +++ b/storage/innobase/include/row0uins.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -47,8 +48,5 @@ row_undo_ins( undo_node_t* node, /*!< in: row undo node */ que_thr_t* thr) /*!< in: query thread */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -#ifndef UNIV_NONINL -#include "row0uins.ic" -#endif #endif diff --git a/storage/innobase/include/row0uins.ic b/storage/innobase/include/row0uins.ic deleted file mode 100644 index 54da2e4987400..0000000000000 --- a/storage/innobase/include/row0uins.ic +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2009, 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 include/row0uins.ic -Fresh insert undo - -Created 2/25/1997 Heikki Tuuri -*******************************************************/ - diff --git a/storage/innobase/include/row0umod.h b/storage/innobase/include/row0umod.h index a1bb42035a96e..ef2dd491efd25 100644 --- a/storage/innobase/include/row0umod.h +++ b/storage/innobase/include/row0umod.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -44,8 +45,4 @@ row_undo_mod( que_thr_t* thr) /*!< in: query thread */ MY_ATTRIBUTE((warn_unused_result)); -#ifndef UNIV_NONINL -#include "row0umod.ic" -#endif - #endif diff --git a/storage/innobase/include/row0umod.ic b/storage/innobase/include/row0umod.ic deleted file mode 100644 index 00a8cd86e01bf..0000000000000 --- a/storage/innobase/include/row0umod.ic +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2009, 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 include/row0umod.ic -Undo modify of a row - -Created 2/27/1997 Heikki Tuuri -*******************************************************/ diff --git a/storage/innobase/include/row0undo.h b/storage/innobase/include/row0undo.h index 3d5b3574afa78..730e7f559c6e2 100644 --- a/storage/innobase/include/row0undo.h +++ b/storage/innobase/include/row0undo.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -125,9 +126,4 @@ struct undo_node_t{ on a row */ }; - -#ifndef UNIV_NONINL -#include "row0undo.ic" -#endif - #endif diff --git a/storage/innobase/include/row0undo.ic b/storage/innobase/include/row0undo.ic deleted file mode 100644 index b97ffca590e1b..0000000000000 --- a/storage/innobase/include/row0undo.ic +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2009, 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 include/row0undo.ic -Row undo - -Created 1/8/1997 Heikki Tuuri -*******************************************************/ diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index 86b282553d80b..359d243a0cd9a 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -652,8 +652,6 @@ struct upd_node_t{ changed in the update */ -#ifndef UNIV_NONINL #include "row0upd.ic" -#endif #endif diff --git a/storage/innobase/include/row0vers.h b/storage/innobase/include/row0vers.h index 489db305fac67..b28533578e177 100644 --- a/storage/innobase/include/row0vers.h +++ b/storage/innobase/include/row0vers.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2015, 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 @@ -146,9 +146,4 @@ row_vers_build_for_semi_consistent_read( const dtuple_t**vrow); /*!< out: holds virtual column info if any is updated in the view */ - -#ifndef UNIV_NONINL -#include "row0vers.ic" -#endif - #endif diff --git a/storage/innobase/include/row0vers.ic b/storage/innobase/include/row0vers.ic deleted file mode 100644 index ef43a55bf7020..0000000000000 --- a/storage/innobase/include/row0vers.ic +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2009, 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 include/row0vers.ic -Row versions - -Created 2/6/1997 Heikki Tuuri -*******************************************************/ - -#include "row0row.h" -#include "dict0dict.h" -#include "read0read.h" -#include "page0page.h" -#include "log0recv.h" diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index 3697604425cce..1b1597d0fba05 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -889,8 +889,6 @@ void srv_mon_default_on(void); /*====================*/ -#ifndef UNIV_NONINL #include "srv0mon.ic" -#endif #endif diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 357ce658a808e..fac4718a2a671 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -643,39 +643,34 @@ extern PSI_stage_info srv_stage_alter_table_read_pk_internal_sort; extern PSI_stage_info srv_stage_buffer_pool_load; #endif /* HAVE_PSI_STAGE_INTERFACE */ -#ifndef _WIN32 + /** Alternatives for the file flush option in Unix; see the InnoDB manual about what these mean */ -enum srv_unix_flush_t { - SRV_UNIX_FSYNC = 1, /*!< fsync, the default */ - SRV_UNIX_O_DSYNC, /*!< open log files in O_SYNC mode */ - SRV_UNIX_LITTLESYNC, /*!< do not call os_file_flush() +enum srv_flush_t { + SRV_FSYNC = 1, /*!< fsync, the default */ + SRV_O_DSYNC, /*!< open log files in O_SYNC mode */ + SRV_LITTLESYNC, /*!< do not call os_file_flush() when writing data files, but do flush after writing to log files */ - SRV_UNIX_NOSYNC, /*!< do not flush after writing */ - SRV_UNIX_O_DIRECT, /*!< invoke os_file_set_nocache() on + SRV_NOSYNC, /*!< do not flush after writing */ + SRV_O_DIRECT, /*!< invoke os_file_set_nocache() on data files. This implies using non-buffered IO but still using fsync, the reason for which is that some FS do not flush meta-data when unbuffered IO happens */ - SRV_UNIX_O_DIRECT_NO_FSYNC + SRV_O_DIRECT_NO_FSYNC, /*!< do not use fsync() when using direct IO i.e.: it can be set to avoid the fsync() call that we make when using SRV_UNIX_O_DIRECT. However, in this case user/DBA should be sure about the integrity of the meta-data */ + SRV_ALL_O_DIRECT_FSYNC + /*!< Traditional Windows appoach to open + all files without caching, and do FileFlushBuffers()*/ }; -extern enum srv_unix_flush_t srv_unix_file_flush_method; -#else -/** Alternatives for file i/o in Windows */ -enum srv_win_flush_t { - SRV_WIN_IO_NORMAL = 1, /*!< buffered I/O */ - SRV_WIN_IO_UNBUFFERED /*!< unbuffered I/O; this is the default */ -}; -extern enum srv_win_flush_t srv_win_file_flush_method; -#endif /* _WIN32 */ +extern enum srv_flush_t srv_file_flush_method; /** Alternatives for srv_force_recovery. Non-zero values are intended to help the user get a damaged database up so that he can dump intact diff --git a/storage/innobase/include/srv0srv.ic b/storage/innobase/include/srv0srv.ic deleted file mode 100644 index 53405c06f9739..0000000000000 --- a/storage/innobase/include/srv0srv.ic +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1995, 2009, 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 include/srv0srv.ic -Server main program - -Created 10/4/1995 Heikki Tuuri -*******************************************************/ diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 8de9e3457fc98..d7a5922c954d6 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -76,13 +76,6 @@ Shuts down background threads that can generate undo pages. */ void srv_shutdown_bg_undo_sources(void); -/******************************************************************** -Signal all per-table background threads to shutdown, and wait for them to do -so. */ -void -srv_shutdown_table_bg_threads(void); -/*=============================*/ - /*************************************************************//** Copy the file path component of the physical file to parameter. It will copy up to and including the terminating path separator. diff --git a/storage/innobase/include/sync0arr.h b/storage/innobase/include/sync0arr.h index 23b9b746d2027..4104e594cf907 100644 --- a/storage/innobase/include/sync0arr.h +++ b/storage/innobase/include/sync0arr.h @@ -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. Copyright (c) 2015, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -93,13 +93,6 @@ sync_array_print_long_waits( os_thread_id_t* waiter, /*!< out: longest waiting thread */ const void** sema); /*!< out: longest-waited-for semaphore */ -/********************************************************************//** -Validates the integrity of the wait array. Checks -that the number of reserved cells equals the count variable. */ -void -sync_array_validate( - sync_array_t* arr); /*!< in: sync wait array */ - /**********************************************************************//** Prints info of the wait array. */ void @@ -138,8 +131,6 @@ sync_array_get_nth_cell( sync_array_t* arr, /*!< in: sync array */ ulint n); /*!< in: index */ -#ifndef UNIV_NONINL #include "sync0arr.ic" -#endif /* UNIV_NOINL */ #endif /* sync0arr_h */ diff --git a/storage/innobase/include/sync0debug.h b/storage/innobase/include/sync0debug.h index 6b80c0b25a119..ba697b70e1390 100644 --- a/storage/innobase/include/sync0debug.h +++ b/storage/innobase/include/sync0debug.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, MariaDB Corporation. All Rights Reserved. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -39,7 +40,7 @@ Created 2012-08-21 Sunny Bains void sync_check_init(); -/** Frees the resources in synchronization data structures. */ +/** Free the InnoDB synchronization data structures. */ void sync_check_close(); diff --git a/storage/innobase/include/sync0policy.h b/storage/innobase/include/sync0policy.h index 1a430328f0e4f..410e46f9c68b9 100644 --- a/storage/innobase/include/sync0policy.h +++ b/storage/innobase/include/sync0policy.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2013, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2013, 2016, 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 @@ -544,8 +544,6 @@ class BlockMutexPolicy latch_id_t m_id; }; -#ifndef UNIV_NONINL #include "sync0policy.ic" -#endif /* UNIV_NOINL */ #endif /* sync0policy_h */ diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h index cf4a646cdccf9..888a32007ce97 100644 --- a/storage/innobase/include/sync0rw.h +++ b/storage/innobase/include/sync0rw.h @@ -537,24 +537,11 @@ rw_lock_is_locked( RW_LOCK_X or RW_LOCK_SX */ #ifdef UNIV_DEBUG /***************************************************************//** -Prints debug info of an rw-lock. */ -void -rw_lock_print( -/*==========*/ - rw_lock_t* lock); /*!< in: rw-lock */ -/***************************************************************//** Prints debug info of currently locked rw-locks. */ void rw_lock_list_print_info( /*====================*/ FILE* file); /*!< in: file where to print */ -/***************************************************************//** -Returns the number of currently locked rw-locks. -Works only in the debug version. -@return number of locked rw-locks */ -ulint -rw_lock_n_locked(void); -/*==================*/ /*#####################################################################*/ @@ -884,8 +871,6 @@ pfs_rw_lock_free_func( rw_lock_t* lock); /*!< in: rw-lock */ #endif /* UNIV_PFS_RWLOCK */ -#ifndef UNIV_NONINL #include "sync0rw.ic" -#endif /* !UNIV_NONINL */ #endif /* sync0rw.h */ diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index 44eaa9d4f1e04..c9f5edb1432ca 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.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) 2017, MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under @@ -37,9 +37,6 @@ Created 3/26/1996 Heikki Tuuri #include "fil0fil.h" #include "read0types.h" -/** The global data structure coordinating a purge */ -extern trx_purge_t* purge_sys; - /** A dummy undo record used as a return value when we have a whole undo log which needs no purge */ extern trx_undo_rec_t trx_purge_dummy_rec; @@ -54,19 +51,6 @@ trx_purge_get_log_from_hist( /*========================*/ fil_addr_t node_addr); /*!< in: file address of the history list node of the log */ -/********************************************************************//** -Creates the global purge system control structure and inits the history -mutex. */ -void -trx_purge_sys_create( -/*=================*/ - ulint n_purge_threads,/*!< in: number of purge threads */ - purge_pq_t* purge_queue); /*!< in/own: UNDO log min binary heap*/ -/********************************************************************//** -Frees the global purge system control structure. */ -void -trx_purge_sys_close(void); -/*======================*/ /************************************************************************ Adds the update undo log as the first log in the history list. Removes the update undo log segment from the rseg slot if it is too big for reuse. */ @@ -74,13 +58,8 @@ void trx_purge_add_update_undo_to_history( /*=================================*/ trx_t* trx, /*!< in: transaction */ - trx_undo_ptr_t* undo_ptr, /*!< in: update undo log. */ page_t* undo_page, /*!< in: update undo log header page, x-latched */ - bool update_rseg_history_len, - /*!< in: if true: update rseg history - len else skip updating it. */ - ulint n_added_logs, /*!< in: number of logs added */ mtr_t* mtr); /*!< in: mtr */ /*******************************************************************//** This function runs a purge batch. @@ -120,8 +99,129 @@ purge_state_t trx_purge_state(void); /*=================*/ -// Forward declaration -struct TrxUndoRsegsIterator; +/** Rollback segements from a given transaction with trx-no +scheduled for purge. */ +class TrxUndoRsegs { +private: + typedef std::vector > + trx_rsegs_t; +public: + typedef trx_rsegs_t::iterator iterator; + + /** Default constructor */ + TrxUndoRsegs() : m_trx_no() { } + + explicit TrxUndoRsegs(trx_id_t trx_no) + : + m_trx_no(trx_no) + { + // Do nothing + } + + /** Get transaction number + @return trx_id_t - get transaction number. */ + trx_id_t get_trx_no() const + { + return(m_trx_no); + } + + /** Add rollback segment. + @param rseg rollback segment to add. */ + void push_back(trx_rseg_t* rseg) + { + m_rsegs.push_back(rseg); + } + + /** Erase the element pointed by given iterator. + @param[in] iterator iterator */ + void erase(iterator& it) + { + m_rsegs.erase(it); + } + + /** Number of registered rsegs. + @return size of rseg list. */ + ulint size() const + { + return(m_rsegs.size()); + } + + /** + @return an iterator to the first element */ + iterator begin() + { + return(m_rsegs.begin()); + } + + /** + @return an iterator to the end */ + iterator end() + { + return(m_rsegs.end()); + } + + /** Append rollback segments from referred instance to current + instance. */ + void append(const TrxUndoRsegs& append_from) + { + ut_ad(get_trx_no() == append_from.get_trx_no()); + + m_rsegs.insert(m_rsegs.end(), + append_from.m_rsegs.begin(), + append_from.m_rsegs.end()); + } + + /** Compare two TrxUndoRsegs based on trx_no. + @param elem1 first element to compare + @param elem2 second element to compare + @return true if elem1 > elem2 else false.*/ + bool operator()(const TrxUndoRsegs& lhs, const TrxUndoRsegs& rhs) + { + return(lhs.m_trx_no > rhs.m_trx_no); + } + + /** Compiler defined copy-constructor/assignment operator + should be fine given that there is no reference to a memory + object outside scope of class object.*/ + +private: + /** The rollback segments transaction number. */ + trx_id_t m_trx_no; + + /** Rollback segments of a transaction, scheduled for purge. */ + trx_rsegs_t m_rsegs; +}; + +typedef std::priority_queue< + TrxUndoRsegs, + std::vector >, + TrxUndoRsegs> purge_pq_t; + +/** +Chooses the rollback segment with the smallest trx_no. */ +struct TrxUndoRsegsIterator { + + /** Constructor */ + TrxUndoRsegsIterator(); + + /** Sets the next rseg to purge in purge_sys. + @return whether anything is to be purged */ + bool set_next(); + +private: + // Disable copying + TrxUndoRsegsIterator(const TrxUndoRsegsIterator&); + TrxUndoRsegsIterator& operator=(const TrxUndoRsegsIterator&); + + /** The current element to process */ + TrxUndoRsegs m_trx_undo_rsegs; + + /** Track the current element in m_trx_undo_rseg */ + TrxUndoRsegs::iterator m_iter; + + /** Sentinel value */ + static const TrxUndoRsegs NullElement; +}; /** This is the purge pointer/iterator. We need both the undo no and the transaction no up to which purge has parsed and applied the records. */ @@ -386,13 +486,16 @@ namespace undo { }; /* namespace undo */ /** The control structure used in the purge operation */ -struct trx_purge_t{ +class purge_sys_t +{ +public: + /** Construct the purge system. */ + purge_sys_t(); + /** Destruct the purge system. */ + ~purge_sys_t(); + sess_t* sess; /*!< System session running the purge query */ - trx_t* trx; /*!< System transaction running the - purge query: this trx is not in the - trx list of the trx system and it - never ends */ rw_lock_t latch; /*!< The latch protecting the purge view. A purge operation must acquire an x-latch here for the instant at which @@ -402,7 +505,7 @@ struct trx_purge_t{ protects state and running */ os_event_t event; /*!< State signal event; os_event_set() and os_event_reset() - are protected by trx_purge_t::latch + are protected by purge_sys_t::latch X-lock */ ulint n_stop; /*!< Counter to track number stops */ volatile bool running; /*!< true, if purge is active, @@ -414,7 +517,6 @@ struct trx_purge_t{ parallelized purge operation */ ReadView view; /*!< The purge will not remove undo logs which are >= this view (purge view) */ - bool view_active; /*!< true if view is active */ volatile ulint n_submitted; /*!< Count of total tasks submitted to the task queue */ volatile ulint n_completed; /*!< Count of total tasks completed */ @@ -437,11 +539,8 @@ struct trx_purge_t{ purged already accurately. */ #endif /* UNIV_DEBUG */ /*-----------------------------*/ - ibool next_stored; /*!< TRUE if the info of the next record - to purge is stored below: if yes, then - the transaction number and the undo - number of the record are stored in - purge_trx_no and purge_undo_no above */ + bool next_stored; /*!< whether rseg holds the next record + to purge */ trx_rseg_t* rseg; /*!< Rollback segment for the next undo record to purge */ ulint page_no; /*!< Page number for the next undo @@ -455,11 +554,11 @@ struct trx_purge_t{ ulint hdr_offset; /*!< Header byte offset on the page */ - TrxUndoRsegsIterator* + TrxUndoRsegsIterator rseg_iter; /*!< Iterator to get the next rseg to process */ - purge_pq_t* purge_queue; /*!< Binary min-heap, ordered on + purge_pq_t purge_queue; /*!< Binary min-heap, ordered on TrxUndoRsegs::trx_no. It is protected by the pq_mutex */ PQMutex pq_mutex; /*!< Mutex protecting purge_queue */ @@ -468,46 +567,15 @@ struct trx_purge_t{ for truncate. */ }; +/** The global data structure coordinating a purge */ +extern purge_sys_t* purge_sys; + /** Info required to purge a record */ struct trx_purge_rec_t { trx_undo_rec_t* undo_rec; /*!< Record to purge */ roll_ptr_t roll_ptr; /*!< File pointr to UNDO record */ }; -/** -Chooses the rollback segment with the smallest trx_no. */ -struct TrxUndoRsegsIterator { - - /** Constructor */ - TrxUndoRsegsIterator(trx_purge_t* purge_sys); - - /** Sets the next rseg to purge in m_purge_sys. - @return page size of the table for which the log is. - NOTE: if rseg is NULL when this function returns this means that - there are no rollback segments to purge and then the returned page - size object should not be used. */ - const page_size_t set_next(); - -private: - // Disable copying - TrxUndoRsegsIterator(const TrxUndoRsegsIterator&); - TrxUndoRsegsIterator& operator=(const TrxUndoRsegsIterator&); - - /** The purge system pointer */ - trx_purge_t* m_purge_sys; - - /** The current element to process */ - TrxUndoRsegs m_trx_undo_rsegs; - - /** Track the current element in m_trx_undo_rseg */ - TrxUndoRsegs::iterator m_iter; - - /** Sentinel value */ - static const TrxUndoRsegs NullElement; -}; - -#ifndef UNIV_NONINL #include "trx0purge.ic" -#endif /* UNIV_NOINL */ #endif /* trx0purge_h */ diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index fc3d90b478d9a..50304ce363148 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -117,15 +117,6 @@ trx_undo_rec_get_row_ref( dtuple_t** ref, /*!< out, own: row reference */ mem_heap_t* heap); /*!< in: memory heap from which the memory needed is allocated */ -/*******************************************************************//** -Skips a row reference from an undo log record. -@return pointer to remaining part of undo record */ -byte* -trx_undo_rec_skip_row_ref( -/*======================*/ - byte* ptr, /*!< in: remaining part in update undo log - record, at the start of the row reference */ - dict_index_t* index); /*!< in: clustered index */ /**********************************************************************//** Reads from an undo log update record the system field values of the old version. @@ -219,17 +210,6 @@ trx_undo_report_row_operation( 0 if BTR_NO_UNDO_LOG flag was specified */ MY_ATTRIBUTE((nonnull(3,4,10), warn_unused_result)); -/******************************************************************//** -Copies an undo record to heap. This function can be called if we know that -the undo log record exists. -@return own: copy of the record */ -trx_undo_rec_t* -trx_undo_get_undo_rec_low( -/*======================*/ - roll_ptr_t roll_ptr, /*!< in: roll pointer to record */ - mem_heap_t* heap, /*!< in: memory heap where copied */ - bool is_redo_rseg) /*!< in: true if redo rseg. */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); /** status bit used for trx_undo_prev_version_build() */ @@ -365,8 +345,6 @@ record */ #define TRX_UNDO_INSERT_OP 1U #define TRX_UNDO_MODIFY_OP 2U -#ifndef UNIV_NONINL #include "trx0rec.ic" -#endif #endif /* trx0rec_h */ diff --git a/storage/innobase/include/trx0roll.h b/storage/innobase/include/trx0roll.h index ec4c7d57e5dd1..8908376bff133 100644 --- a/storage/innobase/include/trx0roll.h +++ b/storage/innobase/include/trx0roll.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2015, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -50,32 +51,16 @@ trx_savept_t trx_savept_take( /*============*/ trx_t* trx); /*!< in: transaction */ -/********************************************************************//** -Pops the topmost record when the two undo logs of a transaction are seen -as a single stack of records ordered by their undo numbers. -@return undo log record copied to heap, NULL if none left, or if the -undo number of the top record would be less than the limit */ -trx_undo_rec_t* -trx_roll_pop_top_rec_of_trx_low( -/*============================*/ - trx_t* trx, /*!< in/out: transaction */ - trx_undo_ptr_t* undo_ptr, /*!< in: rollback segment to look - for next undo log record. */ - undo_no_t limit, /*!< in: least undo number we need */ - roll_ptr_t* roll_ptr, /*!< out: roll pointer to undo record */ - mem_heap_t* heap); /*!< in/out: memory heap where copied */ - -/********************************************************************//** -Get next undo log record from redo and noredo rollback segments. -@return undo log record copied to heap, NULL if none left, or if the -undo number of the top record would be less than the limit */ + +/** Get the last undo log record of a transaction (for rollback). +@param[in,out] trx transaction +@param[out] roll_ptr DB_ROLL_PTR to the undo record +@param[in,out] heap memory heap for allocation +@return undo log record copied to heap +@retval NULL if none left or the roll_limit (savepoint) was reached */ trx_undo_rec_t* -trx_roll_pop_top_rec_of_trx( -/*========================*/ - trx_t* trx, /*!< in: transaction */ - undo_no_t limit, /*!< in: least undo number we need */ - roll_ptr_t* roll_ptr, /*!< out: roll pointer to undo record */ - mem_heap_t* heap); /*!< in: memory heap where copied */ +trx_roll_pop_top_rec_of_trx(trx_t* trx, roll_ptr_t* roll_ptr, mem_heap_t* heap) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Rollback or clean up any incomplete transactions which were @@ -235,8 +220,6 @@ struct trx_named_savept_t{ transaction */ }; -#ifndef UNIV_NONINL #include "trx0roll.ic" -#endif #endif diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index b9cbd387a6278..e17d11b383e75 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -1,6 +1,7 @@ /***************************************************************************** -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) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -26,7 +27,6 @@ Created 3/26/1996 Heikki Tuuri #ifndef trx0rseg_h #define trx0rseg_h -#include "univ.i" #include "trx0types.h" #include "trx0sys.h" #include "fut0lst.h" @@ -35,7 +35,6 @@ Created 3/26/1996 Heikki Tuuri /** Gets a rollback segment header. @param[in] space space where placed @param[in] page_no page number of the header -@param[in] page_size page size @param[in,out] mtr mini-transaction @return rollback segment header, page x-latched */ UNIV_INLINE @@ -43,13 +42,11 @@ trx_rsegf_t* trx_rsegf_get( ulint space, ulint page_no, - const page_size_t& page_size, mtr_t* mtr); /** Gets a newly created rollback segment header. @param[in] space space where placed @param[in] page_no page number of the header -@param[in] page_size page size @param[in,out] mtr mini-transaction @return rollback segment header, page x-latched */ UNIV_INLINE @@ -57,7 +54,6 @@ trx_rsegf_t* trx_rsegf_get_new( ulint space, ulint page_no, - const page_size_t& page_size, mtr_t* mtr); /***************************************************************//** @@ -89,21 +85,21 @@ trx_rsegf_undo_find_free( /*=====================*/ trx_rsegf_t* rsegf, /*!< in: rollback segment header */ mtr_t* mtr); /*!< in: mtr */ -/******************************************************************//** -Looks for a rollback segment, based on the rollback segment id. +/** Get a rollback segment. +@param[in] id rollback segment id @return rollback segment */ UNIV_INLINE trx_rseg_t* -trx_rseg_get_on_id( -/*===============*/ - ulint id, /*!< in: rollback segment id */ - bool is_redo_rseg); /*!< in: true if redo rseg else false. */ +trx_rseg_get_on_id(ulint id) +{ + ut_a(id < TRX_SYS_N_RSEGS); + return(trx_sys->rseg_array[id]); +} /** Creates a rollback segment header. This function is called only when a new rollback segment is created in the database. @param[in] space space id -@param[in] page_size page size @param[in] max_size max size in pages @param[in] rseg_slot_no rseg id == slot number in trx sys @param[in,out] mtr mini-transaction @@ -111,27 +107,18 @@ the database. ulint trx_rseg_header_create( ulint space, - const page_size_t& page_size, ulint max_size, ulint rseg_slot_no, mtr_t* mtr); -/*********************************************************************//** -Creates the memory copies for rollback segments and initializes the -rseg array in trx_sys at a database startup. */ +/** Initialize the rollback segments in memory at database startup. */ void -trx_rseg_array_init( -/*================*/ - purge_pq_t* purge_queue); /*!< in: rseg queue */ +trx_rseg_array_init(); -/*************************************************************************** -Free's an instance of the rollback segment in memory. */ +/** Free a rollback segment in memory. */ void -trx_rseg_mem_free( -/*==============*/ - trx_rseg_t* rseg, /*!< in, own: instance to free */ - trx_rseg_t** rseg_array); /*!< out: add rseg reference to this - central array. */ +trx_rseg_mem_free(trx_rseg_t* rseg); + /********************************************************************* Creates a rollback segment. */ trx_rseg_t* @@ -175,9 +162,6 @@ struct trx_rseg_t { /** page number of the rollback segment header */ ulint page_no; - /** page size of the relevant tablespace */ - page_size_t page_size; - /** maximum allowed size in pages */ ulint max_size; @@ -249,8 +233,6 @@ struct trx_rseg_t { /* Undo log segment slots */ /*-------------------------------------------------------------*/ -#ifndef UNIV_NONINL #include "trx0rseg.ic" -#endif #endif diff --git a/storage/innobase/include/trx0rseg.ic b/storage/innobase/include/trx0rseg.ic index 9574be67ff86c..0a33c74766802 100644 --- a/storage/innobase/include/trx0rseg.ic +++ b/storage/innobase/include/trx0rseg.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2013, 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 the terms of the GNU General Public License as published by the Free Software @@ -25,12 +26,10 @@ Created 3/26/1996 Heikki Tuuri #include "srv0srv.h" #include "mtr0log.h" -#include "trx0sys.h" /** Gets a rollback segment header. @param[in] space space where placed @param[in] page_no page number of the header -@param[in] page_size page size @param[in,out] mtr mini-transaction @return rollback segment header, page x-latched */ UNIV_INLINE @@ -38,14 +37,15 @@ trx_rsegf_t* trx_rsegf_get( ulint space, ulint page_no, - const page_size_t& page_size, mtr_t* mtr) { buf_block_t* block; trx_rsegf_t* header; + ut_ad(space <= srv_undo_tablespaces || space == SRV_TMP_SPACE_ID); + block = buf_page_get( - page_id_t(space, page_no), page_size, RW_X_LATCH, mtr); + page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr); buf_block_dbg_add_level(block, SYNC_RSEG_HEADER); @@ -57,7 +57,6 @@ trx_rsegf_get( /** Gets a newly created rollback segment header. @param[in] space space where placed @param[in] page_no page number of the header -@param[in] page_size page size @param[in,out] mtr mini-transaction @return rollback segment header, page x-latched */ UNIV_INLINE @@ -65,14 +64,15 @@ trx_rsegf_t* trx_rsegf_get_new( ulint space, ulint page_no, - const page_size_t& page_size, mtr_t* mtr) { buf_block_t* block; trx_rsegf_t* header; + ut_ad(space <= srv_undo_tablespaces || space == SRV_TMP_SPACE_ID); + block = buf_page_get( - page_id_t(space, page_no), page_size, RW_X_LATCH, mtr); + page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr); buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW); @@ -146,28 +146,3 @@ trx_rsegf_undo_find_free( return(ULINT_UNDEFINED); } - -/******************************************************************//** -Looks for a rollback segment, based on the rollback segment id. -@return rollback segment */ -UNIV_INLINE -trx_rseg_t* -trx_rseg_get_on_id( -/*===============*/ - ulint id, /*!< in: rollback segment id */ - bool is_redo_rseg) /*!< in: true if redo rseg else false. */ -{ - ut_a(id < TRX_SYS_N_RSEGS); - - /* If redo rseg is being requested and id falls in range of - non-redo rseg that is from slot-1....slot-srv_tmp_undo_logs then - server is being upgraded from pre-5.7.2. In such case return - rseg from pending_purge_rseg_array array. */ - if (is_redo_rseg && trx_sys_is_noredo_rseg_slot(id)) { - ut_ad(trx_sys->pending_purge_rseg_array[id] != NULL); - return(trx_sys->pending_purge_rseg_array[id]); - } - - return(trx_sys->rseg_array[id]); -} - diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index ae46d2abae9b4..8ebb74e3d86f8 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -61,13 +62,9 @@ bool trx_sys_hdr_page( const page_id_t& page_id); -/*****************************************************************//** -Creates and initializes the central memory structures for the transaction -system. This is called when the database is started. -@return min binary heap of rsegs to purge */ -purge_pq_t* -trx_sys_init_at_db_start(void); -/*==========================*/ +/** Initialize the transaction system main-memory data structures. */ +void trx_sys_init_at_db_start(); + /*****************************************************************//** Creates the trx_sys instance and initializes purge_queue and mutex. */ void @@ -89,16 +86,6 @@ trx_sysf_rseg_find_free( for temp-tablespace as free slots. */ ulint nth_free_slots); /*!< in: allocate nth free slot. 0 means next free slot. */ -/***************************************************************//** -Gets the pointer in the nth slot of the rseg array. -@return pointer to rseg object, NULL if slot not in use */ -UNIV_INLINE -trx_rseg_t* -trx_sys_get_nth_rseg( -/*=================*/ - trx_sys_t* sys, /*!< in: trx system */ - ulint n, /*!< in: index of slot */ - bool is_redo_rseg); /*!< in: true if redo rseg. */ /**********************************************************************//** Gets a pointer to the transaction system file copy and x-locks its page. @return pointer to system file copy, page x-locked */ @@ -243,16 +230,6 @@ trx_rw_is_active( that will be set if corrupt */ bool do_ref_count); /*!< in: if true then increment the trx_t::n_ref_count */ -#ifdef UNIV_DEBUG -/****************************************************************//** -Checks whether a trx is in on of rw_trx_list -@return TRUE if is in */ -bool -trx_in_rw_trx_list( -/*============*/ - const trx_t* in_trx) /*!< in: transaction */ - MY_ATTRIBUTE((warn_unused_result)); -#endif /* UNIV_DEBUG */ #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG /***********************************************************//** Assert that a transaction has been recovered. @@ -619,14 +596,6 @@ struct trx_sys_t { transactions), protected by rseg->mutex */ - trx_rseg_t* const pending_purge_rseg_array[TRX_SYS_N_RSEGS]; - /*!< Pointer array to rollback segments - between slot-1..slot-srv_tmp_undo_logs - that are now replaced by non-redo - rollback segments. We need them for - scheduling purge if any of the rollback - segment has pending records to purge. */ - TrxIdSet rw_trx_set; /*!< Mapping from transaction id to transaction instance */ @@ -661,8 +630,6 @@ page is updated */ trx_sys->mutex.exit(); \ } while (0) -#ifndef UNIV_NONINL #include "trx0sys.ic" -#endif #endif diff --git a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0sys.ic index b07f487984cbf..f03535c53b311 100644 --- a/storage/innobase/include/trx0sys.ic +++ b/storage/innobase/include/trx0sys.ic @@ -62,31 +62,6 @@ trx_sys_hdr_page( && page_id.page_no() == TRX_SYS_PAGE_NO); } -/***************************************************************//** -Gets the pointer in the nth slot of the rseg array. -@return pointer to rseg object, NULL if slot not in use */ -UNIV_INLINE -trx_rseg_t* -trx_sys_get_nth_rseg( -/*=================*/ - trx_sys_t* sys, /*!< in: trx system */ - ulint n, /*!< in: index of slot */ - bool is_redo_rseg) /*!< in: true if redo rseg. */ -{ - ut_ad(n < TRX_SYS_N_RSEGS); - - /* If redo rseg is being requested and id falls in range of - non-redo rseg that is from slot-1....slot-srv_tmp_undo_logs then - server is being upgraded from pre-5.7.2. In such case return - rseg from pending_purge_rseg_array array. */ - if (is_redo_rseg && trx_sys_is_noredo_rseg_slot(n)) { - ut_ad(trx_sys->pending_purge_rseg_array[n] != NULL); - return(trx_sys->pending_purge_rseg_array[n]); - } - - return(sys->rseg_array[n]); -} - /**********************************************************************//** Gets a pointer to the transaction system header and x-latches its page. @return pointer to system header, page x-latched. */ diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index efae0556469b9..7d9db25ddce73 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -143,15 +143,9 @@ trx_disconnect_plain(trx_t* trx); void trx_disconnect_prepared(trx_t* trx); -/****************************************************************//** -Creates trx objects for transactions and initializes the trx list of -trx_sys at database start. Rollback segment and undo log lists must -already exist when this function is called, because the lists of -transactions to be rolled back or cleaned up are built based on the -undo log lists. */ +/** Initialize (resurrect) transactions at startup. */ void -trx_lists_init_at_db_start(void); -/*============================*/ +trx_lists_init_at_db_start(); /*************************************************************//** Starts the transaction if it is not yet started. */ @@ -862,6 +856,14 @@ struct trx_undo_ptr_t { NULL if no update performed yet */ }; +/** An instance of temporary rollback segment. */ +struct trx_temp_undo_t { + /** temporary rollback segment, or NULL if not assigned yet */ + trx_rseg_t* rseg; + /** pointer to the undo log, or NULL if nothing logged yet */ + trx_undo_t* undo; +}; + /** Rollback segments assigned to a transaction for undo logging. */ struct trx_rsegs_t { /** undo log ptr holding reference to a rollback segment that resides in @@ -869,10 +871,9 @@ struct trx_rsegs_t { to be recovered on crash. */ trx_undo_ptr_t m_redo; - /** undo log ptr holding reference to a rollback segment that resides in - temp tablespace used for undo logging of tables that doesn't need - to be recovered on crash. */ - trx_undo_ptr_t m_noredo; + /** undo log for temporary tables; discarded immediately after + transaction commit/rollback */ + trx_temp_undo_t m_noredo; }; enum trx_rseg_type_t { @@ -1270,12 +1271,6 @@ struct trx_t { error, or empty. */ FlushObserver* flush_observer; /*!< flush observer */ -#ifdef UNIV_DEBUG - bool is_dd_trx; /*!< True if the transaction is used for - doing Non-locking Read-only Read - Committed on DD tables */ -#endif /* UNIV_DEBUG */ - /* Lock wait statistics */ ulint n_rec_lock_waits; /*!< Number of record lock waits, @@ -1604,8 +1599,6 @@ class TrxInInnoDB { trx_t* m_trx; }; -#ifndef UNIV_NONINL #include "trx0trx.ic" -#endif #endif diff --git a/storage/innobase/include/trx0trx.ic b/storage/innobase/include/trx0trx.ic index 14d519351e4a5..e5fdcec919a24 100644 --- a/storage/innobase/include/trx0trx.ic +++ b/storage/innobase/include/trx0trx.ic @@ -225,18 +225,6 @@ trx_is_redo_rseg_updated( || trx->rsegs.m_redo.update_undo != 0); } -/********************************************************************//** -Check if noredo rseg is modified for insert/update. */ -UNIV_INLINE -bool -trx_is_noredo_rseg_updated( -/*=======================*/ - const trx_t* trx) /*!< in: transaction */ -{ - return(trx->rsegs.m_noredo.insert_undo != 0 - || trx->rsegs.m_noredo.update_undo != 0); -} - /********************************************************************//** Check if redo/noredo rseg is modified for insert/update. */ UNIV_INLINE @@ -245,20 +233,7 @@ trx_is_rseg_updated( /*================*/ const trx_t* trx) /*!< in: transaction */ { - return(trx_is_redo_rseg_updated(trx) - || trx_is_noredo_rseg_updated(trx)); -} - -/********************************************************************//** -Check if redo/nonredo rseg is valid. */ -UNIV_INLINE -bool -trx_is_rseg_assigned( -/*=================*/ - const trx_t* trx) /*!< in: transaction */ -{ - return(trx->rsegs.m_redo.rseg != NULL - || trx->rsegs.m_noredo.rseg != NULL); + return(trx_is_redo_rseg_updated(trx) || trx->rsegs.m_noredo.undo); } /** diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h index 6fd5b1ab678c8..8092246c7fa43 100644 --- a/storage/innobase/include/trx0types.h +++ b/storage/innobase/include/trx0types.h @@ -123,8 +123,6 @@ struct trx_sig_t; struct trx_rseg_t; /** Transaction undo log */ struct trx_undo_t; -/** The control structure used in the purge operation */ -struct trx_purge_t; /** Rollback command node in a query graph */ struct roll_node_t; /** Commit command node in a query graph */ @@ -174,104 +172,6 @@ typedef ib_mutex_t UndoMutex; typedef ib_mutex_t PQMutex; typedef ib_mutex_t TrxSysMutex; -/** Rollback segements from a given transaction with trx-no -scheduled for purge. */ -class TrxUndoRsegs { -private: - typedef std::vector > - trx_rsegs_t; -public: - typedef trx_rsegs_t::iterator iterator; - - /** Default constructor */ - TrxUndoRsegs() : m_trx_no() { } - - explicit TrxUndoRsegs(trx_id_t trx_no) - : - m_trx_no(trx_no) - { - // Do nothing - } - - /** Get transaction number - @return trx_id_t - get transaction number. */ - trx_id_t get_trx_no() const - { - return(m_trx_no); - } - - /** Add rollback segment. - @param rseg rollback segment to add. */ - void push_back(trx_rseg_t* rseg) - { - m_rsegs.push_back(rseg); - } - - /** Erase the element pointed by given iterator. - @param[in] iterator iterator */ - void erase(iterator& it) - { - m_rsegs.erase(it); - } - - /** Number of registered rsegs. - @return size of rseg list. */ - ulint size() const - { - return(m_rsegs.size()); - } - - /** - @return an iterator to the first element */ - iterator begin() - { - return(m_rsegs.begin()); - } - - /** - @return an iterator to the end */ - iterator end() - { - return(m_rsegs.end()); - } - - /** Append rollback segments from referred instance to current - instance. */ - void append(const TrxUndoRsegs& append_from) - { - ut_ad(get_trx_no() == append_from.get_trx_no()); - - m_rsegs.insert(m_rsegs.end(), - append_from.m_rsegs.begin(), - append_from.m_rsegs.end()); - } - - /** Compare two TrxUndoRsegs based on trx_no. - @param elem1 first element to compare - @param elem2 second element to compare - @return true if elem1 > elem2 else false.*/ - bool operator()(const TrxUndoRsegs& lhs, const TrxUndoRsegs& rhs) - { - return(lhs.m_trx_no > rhs.m_trx_no); - } - - /** Compiler defined copy-constructor/assignment operator - should be fine given that there is no reference to a memory - object outside scope of class object.*/ - -private: - /** The rollback segments transaction number. */ - trx_id_t m_trx_no; - - /** Rollback segments of a transaction, scheduled for purge. */ - trx_rsegs_t m_rsegs; -}; - -typedef std::priority_queue< - TrxUndoRsegs, - std::vector >, - TrxUndoRsegs> purge_pq_t; - typedef std::vector > trx_ids_t; /** Mapping read-write transactions from id to transaction instance, for diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index 1acb5b7c1ada0..cdf97b6a9cf76 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -34,6 +35,15 @@ Created 3/26/1996 Heikki Tuuri #include "page0types.h" #include "trx0xa.h" +/** The LSB of the "is insert" flag in DB_ROLL_PTR */ +#define ROLL_PTR_INSERT_FLAG_POS 55 +/** The LSB of the 7-bit trx_rseg_t::id in DB_ROLL_PTR */ +#define ROLL_PTR_RSEG_ID_POS 48 +/** The LSB of the 32-bit undo log page number in DB_ROLL_PTR */ +#define ROLL_PTR_PAGE_POS 16 +/** The LSB of the 16-bit byte offset within an undo log page in DB_ROLL_PTR */ +#define ROLL_PTR_BYTE_POS 0 + /***********************************************************************//** Builds a roll pointer. @return roll pointer */ @@ -98,27 +108,19 @@ trx_read_roll_ptr( /** Gets an undo log page and x-latches it. @param[in] page_id page id -@param[in] page_size page size @param[in,out] mtr mini-transaction @return pointer to page x-latched */ UNIV_INLINE page_t* -trx_undo_page_get( - const page_id_t& page_id, - const page_size_t& page_size, - mtr_t* mtr); +trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr); /** Gets an undo log page and s-latches it. @param[in] page_id page id -@param[in] page_size page size @param[in,out] mtr mini-transaction @return pointer to page s-latched */ UNIV_INLINE page_t* -trx_undo_page_get_s_latched( - const page_id_t& page_id, - const page_size_t& page_size, - mtr_t* mtr); +trx_undo_page_get_s_latched(const page_id_t& page_id, mtr_t* mtr); /******************************************************************//** Returns the previous undo record on the page in the specified log, or @@ -188,7 +190,6 @@ trx_undo_get_next_rec( /** Gets the first record in an undo log. @param[in] space undo log header space -@param[in] page_size page size @param[in] page_no undo log header page number @param[in] offset undo log header offset on page @param[in] mode latching mode: RW_S_LATCH or RW_X_LATCH @@ -197,63 +198,36 @@ trx_undo_get_next_rec( trx_undo_rec_t* trx_undo_get_first_rec( ulint space, - const page_size_t& page_size, ulint page_no, ulint offset, ulint mode, mtr_t* mtr); -/********************************************************************//** -Tries to add a page to the undo log segment where the undo log is placed. -@return X-latched block if success, else NULL */ +/** Allocate an undo log page. +@param[in,out] trx transaction +@param[in,out] undo undo log +@param[in,out] mtr mini-transaction that does not hold any page latch +@return X-latched block if success +@retval NULL on failure */ buf_block_t* -trx_undo_add_page( -/*==============*/ - trx_t* trx, /*!< in: transaction */ - trx_undo_t* undo, /*!< in: undo log memory object */ - trx_undo_ptr_t* undo_ptr, /*!< in: assign undo log from - referred rollback segment. */ - mtr_t* mtr) /*!< in: mtr which does not have - a latch to any undo log page; - the caller must have reserved - the rollback segment mutex */ +trx_undo_add_page(trx_t* trx, trx_undo_t* undo, mtr_t* mtr) MY_ATTRIBUTE((nonnull, warn_unused_result)); -/********************************************************************//** -Frees the last undo log page. -The caller must hold the rollback segment mutex. */ + +/** Free the last undo log page. The caller must hold the rseg mutex. +@param[in,out] undo undo log +@param[in,out] mtr mini-transaction that does not hold any undo log page + or that has allocated the undo log page */ void -trx_undo_free_last_page_func( -/*==========================*/ -#ifdef UNIV_DEBUG - const trx_t* trx, /*!< in: transaction */ -#endif /* UNIV_DEBUG */ - trx_undo_t* undo, /*!< in/out: undo log memory copy */ - mtr_t* mtr) /*!< in/out: mini-transaction which does not - have a latch to any undo log page or which - has allocated the undo log page */ +trx_undo_free_last_page(trx_undo_t* undo, mtr_t* mtr) MY_ATTRIBUTE((nonnull)); -#ifdef UNIV_DEBUG -# define trx_undo_free_last_page(trx,undo,mtr) \ - trx_undo_free_last_page_func(trx,undo,mtr) -#else /* UNIV_DEBUG */ -# define trx_undo_free_last_page(trx,undo,mtr) \ - trx_undo_free_last_page_func(undo,mtr) -#endif /* UNIV_DEBUG */ -/***********************************************************************//** -Truncates an undo log from the end. This function is used during a rollback -to free space from an undo log. */ +/** Truncate the tail of an undo log during rollback. +@param[in,out] undo undo log +@param[in] limit all undo logs after this limit will be discarded +@param[in] is_temp whether this is temporary undo log */ void -trx_undo_truncate_end_func( -/*=======================*/ - trx_t* trx, /*!< in: transaction whose undo log it is */ - trx_undo_t* undo, /*!< in/out: undo log */ - undo_no_t limit) /*!< in: all undo records with undo number - >= this value should be truncated */ - MY_ATTRIBUTE((nonnull(1,2))); - -#define trx_undo_truncate_end(trx, undo, limit) \ - trx_undo_truncate_end_func(trx, undo, limit) +trx_undo_truncate_end(trx_undo_t* undo, undo_no_t limit, bool is_temp) + MY_ATTRIBUTE((nonnull)); /** Truncate the head of an undo log. NOTE that only whole pages are freed; the header page is not @@ -278,20 +252,23 @@ ulint trx_undo_lists_init( /*================*/ trx_rseg_t* rseg); /*!< in: rollback segment memory object */ -/**********************************************************************//** -Assigns an undo log for a transaction. A new undo log is created or a cached -undo log reused. -@return DB_SUCCESS if undo log assign successful, possible error codes -are: DB_TOO_MANY_CONCURRENT_TRXS DB_OUT_OF_FILE_SPACE DB_READ_ONLY -DB_OUT_OF_MEMORY */ +/** Assign an undo log for a transaction. +A new undo log is created or a cached undo log reused. +@param[in,out] trx transaction +@param[in] rseg rollback segment +@param[out] undo the undo log +@param[in] type TRX_UNDO_INSERT or TRX_UNDO_UPDATE +@retval DB_SUCCESS on success +@retval DB_TOO_MANY_CONCURRENT_TRXS +@retval DB_OUT_OF_FILE_SPACE +@retval DB_READ_ONLY +@retval DB_OUT_OF_MEMORY */ dberr_t trx_undo_assign_undo( -/*=================*/ - trx_t* trx, /*!< in: transaction */ - trx_undo_ptr_t* undo_ptr, /*!< in: assign undo log from - referred rollback segment. */ - ulint type) /*!< in: TRX_UNDO_INSERT or - TRX_UNDO_UPDATE */ + trx_t* trx, + trx_rseg_t* rseg, + trx_undo_t** undo, + ulint type) MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Sets the state of the undo log segment at a transaction finish. @@ -324,24 +301,17 @@ trx_undo_update_cleanup( /*====================*/ trx_t* trx, /*!< in: trx owning the update undo log */ - trx_undo_ptr_t* undo_ptr, /*!< in: update undo log. */ page_t* undo_page, /*!< in: update undo log header page, x-latched */ - bool update_rseg_history_len, - /*!< in: if true: update rseg history - len else skip updating it. */ - ulint n_added_logs, /*!< in: number of logs added */ mtr_t* mtr); /*!< in: mtr */ -/** Frees an insert undo log after a transaction commit or rollback. -Knowledge of inserts is not needed after a commit or rollback, therefore +/** Free an insert or temporary undo log after commit or rollback. +The information is not needed after a commit or rollback, therefore the data can be discarded. -@param[in,out] undo_ptr undo log to clean up -@param[in] noredo whether the undo tablespace is redo logged */ +@param[in,out] undo undo log +@param[in] is_temp whether this is temporary undo log */ void -trx_undo_insert_cleanup( - trx_undo_ptr_t* undo_ptr, - bool noredo); +trx_undo_commit_cleanup(trx_undo_t* undo, bool is_temp); /********************************************************************//** At shutdown, frees the undo logs of a PREPARED transaction. */ @@ -455,7 +425,6 @@ struct trx_undo_t { /*-----------------------------*/ ulint space; /*!< space id where the undo log placed */ - page_size_t page_size; ulint hdr_page_no; /*!< page number of the header page in the undo log */ ulint hdr_offset; /*!< header offset of the undo log on @@ -613,9 +582,7 @@ quite a large overhead. */ with the XA XID */ /* @} */ -#ifndef UNIV_NONINL #include "trx0undo.ic" -#endif #endif /* !UNIV_INNOCHECKSUM */ #endif diff --git a/storage/innobase/include/trx0undo.ic b/storage/innobase/include/trx0undo.ic index 62d9e64b13fb6..0285c212bddf9 100644 --- a/storage/innobase/include/trx0undo.ic +++ b/storage/innobase/include/trx0undo.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2013, 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 the terms of the GNU General Public License as published by the Free Software @@ -46,9 +47,9 @@ trx_undo_build_roll_ptr( ut_ad(rseg_id < TRX_SYS_N_RSEGS); ut_ad(offset < 65536); - roll_ptr = (roll_ptr_t) is_insert << 55 - | (roll_ptr_t) rseg_id << 48 - | (roll_ptr_t) page_no << 16 + roll_ptr = (roll_ptr_t) is_insert << ROLL_PTR_INSERT_FLAG_POS + | (roll_ptr_t) rseg_id << ROLL_PTR_RSEG_ID_POS + | (roll_ptr_t) page_no << ROLL_PTR_PAGE_POS | offset; return(roll_ptr); } @@ -153,17 +154,13 @@ trx_read_roll_ptr( /** Gets an undo log page and x-latches it. @param[in] page_id page id -@param[in] page_size page size @param[in,out] mtr mini-transaction @return pointer to page x-latched */ UNIV_INLINE page_t* -trx_undo_page_get( - const page_id_t& page_id, - const page_size_t& page_size, - mtr_t* mtr) +trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr) { - buf_block_t* block = buf_page_get(page_id, page_size, + buf_block_t* block = buf_page_get(page_id, univ_page_size, RW_X_LATCH, mtr); buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); @@ -173,17 +170,13 @@ trx_undo_page_get( /** Gets an undo log page and s-latches it. @param[in] page_id page id -@param[in] page_size page size @param[in,out] mtr mini-transaction @return pointer to page s-latched */ UNIV_INLINE page_t* -trx_undo_page_get_s_latched( - const page_id_t& page_id, - const page_size_t& page_size, - mtr_t* mtr) +trx_undo_page_get_s_latched(const page_id_t& page_id, mtr_t* mtr) { - buf_block_t* block = buf_page_get(page_id, page_size, + buf_block_t* block = buf_page_get(page_id, univ_page_size, RW_S_LATCH, mtr); buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index edb018c46e287..cb2674ebddf99 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -187,6 +187,13 @@ command. */ #if defined HAVE_valgrind && defined HAVE_VALGRIND # define UNIV_DEBUG_VALGRIND #endif /* HAVE_VALGRIND */ + +#ifdef DBUG_OFF +# undef UNIV_DEBUG +#elif !defined UNIV_DEBUG +# define UNIV_DEBUG +#endif + #if 0 #define UNIV_DEBUG_VALGRIND /* Enable extra Valgrind instrumentation */ @@ -198,8 +205,6 @@ command. */ debugging without UNIV_DEBUG */ #define UNIV_BLOB_LIGHT_DEBUG /* Enable off-page column debugging without UNIV_DEBUG */ -#define UNIV_DEBUG /* Enable ut_ad() assertions - and disable UNIV_INLINE */ #define UNIV_DEBUG_LOCK_VALIDATE /* Enable ut_ad(lock_rec_validate_page()) assertions. */ @@ -275,20 +280,8 @@ rarely invoked function for size instead for speed. */ # define UNIV_COLD /* empty */ #endif -#ifndef UNIV_MUST_NOT_INLINE -/* Definition for inline version */ - #define UNIV_INLINE static inline -#else /* !UNIV_MUST_NOT_INLINE */ -/* If we want to compile a noninlined version we use the following macro -definitions: */ - -#define UNIV_NONINL -#define UNIV_INLINE - -#endif /* !UNIV_MUST_NOT_INLINE */ - #ifdef _WIN32 # ifdef _WIN64 # define UNIV_WORD_SIZE 8 diff --git a/storage/innobase/include/usr0sess.h b/storage/innobase/include/usr0sess.h index 21c3298625926..8e9497a85c590 100644 --- a/storage/innobase/include/usr0sess.h +++ b/storage/innobase/include/usr0sess.h @@ -1,6 +1,7 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -65,8 +66,4 @@ struct sess_t{ #define SESS_ERROR 2 /* session contains an error message which has not yet been communicated to the client */ -#ifndef UNIV_NONINL -#include "usr0sess.ic" -#endif - #endif diff --git a/storage/innobase/include/usr0sess.ic b/storage/innobase/include/usr0sess.ic deleted file mode 100644 index 284e59537fee6..0000000000000 --- a/storage/innobase/include/usr0sess.ic +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2009, 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 include/usr0sess.ic -Sessions - -Created 6/25/1996 Heikki Tuuri -*******************************************************/ diff --git a/storage/innobase/include/ut0byte.h b/storage/innobase/include/ut0byte.h index bcf1b8e4a2d69..59a813a259078 100644 --- a/storage/innobase/include/ut0byte.h +++ b/storage/innobase/include/ut0byte.h @@ -112,8 +112,6 @@ ut_bit_set_nth( ulint n, /*!< in: nth bit requested */ ibool val); /*!< in: value for the bit to set */ -#ifndef UNIV_NONINL #include "ut0byte.ic" -#endif #endif diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h index 7d212dfcff48d..706579a3b9fa5 100644 --- a/storage/innobase/include/ut0dbg.h +++ b/storage/innobase/include/ut0dbg.h @@ -60,14 +60,12 @@ ut_dbg_assertion_failed( #define ut_error \ ut_dbg_assertion_failed(0, __FILE__, __LINE__) +/** Debug assertion */ +#define ut_ad DBUG_ASSERT #ifdef UNIV_DEBUG -/** Debug assertion. Does nothing unless UNIV_DEBUG is defined. */ -#define ut_ad(EXPR) ut_a(EXPR) /** Debug statement. Does nothing unless UNIV_DEBUG is defined. */ #define ut_d(EXPR) EXPR #else -/** Debug assertion. Does nothing unless UNIV_DEBUG is defined. */ -#define ut_ad(EXPR) /** Debug statement. Does nothing unless UNIV_DEBUG is defined. */ #define ut_d(EXPR) #endif diff --git a/storage/innobase/include/ut0list.h b/storage/innobase/include/ut0list.h index 3b91384bbff45..bb6e6730e1533 100644 --- a/storage/innobase/include/ut0list.h +++ b/storage/innobase/include/ut0list.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 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 @@ -59,16 +59,6 @@ ib_list_t* ib_list_create(void); /*=================*/ - -/****************************************************************//** -Create a new list using the given heap. ib_list_free MUST NOT BE CALLED for -lists created with this function. -@return list */ -ib_list_t* -ib_list_create_heap( -/*================*/ - mem_heap_t* heap); /*!< in: memory heap to use */ - /****************************************************************//** Free a list. */ void @@ -76,16 +66,6 @@ ib_list_free( /*=========*/ ib_list_t* list); /*!< in: list */ -/****************************************************************//** -Add the data to the start of the list. -@return new list node */ -ib_list_node_t* -ib_list_add_first( -/*==============*/ - ib_list_t* list, /*!< in: list */ - void* data, /*!< in: data */ - mem_heap_t* heap); /*!< in: memory heap to use */ - /****************************************************************//** Add the data to the end of the list. @return new list node */ @@ -96,18 +76,6 @@ ib_list_add_last( void* data, /*!< in: data */ mem_heap_t* heap); /*!< in: memory heap to use */ -/****************************************************************//** -Add the data after the indicated node. -@return new list node */ -ib_list_node_t* -ib_list_add_after( -/*==============*/ - ib_list_t* list, /*!< in: list */ - ib_list_node_t* prev_node, /*!< in: node preceding new node (can - be NULL) */ - void* data, /*!< in: data */ - mem_heap_t* heap); /*!< in: memory heap to use */ - /****************************************************************//** Remove the node from the list. */ void @@ -156,8 +124,6 @@ ib_list_len( struct ib_list_t { ib_list_node_t* first; /*!< first node */ ib_list_node_t* last; /*!< last node */ - ibool is_heap_list; /*!< TRUE if this list was - allocated through a heap */ }; /* A list node. */ @@ -175,8 +141,6 @@ struct ib_list_helper_t { void* data; /*!< user data */ }; -#ifndef UNIV_NONINL #include "ut0list.ic" -#endif #endif diff --git a/storage/innobase/include/ut0mem.h b/storage/innobase/include/ut0mem.h index f20273daca661..9e94216f47b1f 100644 --- a/storage/innobase/include/ut0mem.h +++ b/storage/innobase/include/ut0mem.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 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 @@ -107,27 +107,6 @@ ut_strlcpy_rev( const char* src, /*!< in: source buffer */ ulint size); /*!< in: size of destination buffer */ -/**********************************************************************//** -Return the number of times s2 occurs in s1. Overlapping instances of s2 -are only counted once. -@return the number of times s2 occurs in s1 */ -ulint -ut_strcount( -/*========*/ - const char* s1, /*!< in: string to search in */ - const char* s2); /*!< in: string to search for */ - -/**********************************************************************//** -Replace every occurrence of s1 in str with s2. Overlapping instances of s1 -are only replaced once. -@return own: modified string, must be freed with ut_free() */ -char* -ut_strreplace( -/*==========*/ - const char* str, /*!< in: string to operate on */ - const char* s1, /*!< in: string to replace */ - const char* s2); /*!< in: string to replace s1 with */ - /******************************************************************** Concatenate 3 strings.*/ char* @@ -170,8 +149,6 @@ ut_str_sql_format( ulint buf_size); /*!< in: output buffer size in bytes */ -#ifndef UNIV_NONINL #include "ut0mem.ic" -#endif #endif diff --git a/storage/innobase/include/ut0rbt.h b/storage/innobase/include/ut0rbt.h index 9555fe6137c7f..2fea7187a6553 100644 --- a/storage/innobase/include/ut0rbt.h +++ b/storage/innobase/include/ut0rbt.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2007, 2015, 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 @@ -156,15 +156,6 @@ rbt_remove_node( because the caller has access only to const nodes.*/ /**********************************************************************//** -Return a node from the red black tree, identified by -key, NULL if not found -@return node if found else return NULL */ -const ib_rbt_node_t* -rbt_lookup( -/*=======*/ - const ib_rbt_t* tree, /*!< in: rb tree to search */ - const void* key); /*!< in: key to lookup */ -/**********************************************************************//** Add data to the red black tree, identified by key (no dups yet!) @return inserted node */ const ib_rbt_node_t* @@ -217,22 +208,6 @@ rbt_prev( const ib_rbt_node_t* /* in: current node */ current); /**********************************************************************//** -Find the node that has the lowest key that is >= key. -@return node that satisfies the lower bound constraint or NULL */ -const ib_rbt_node_t* -rbt_lower_bound( -/*============*/ - const ib_rbt_t* tree, /*!< in: rb tree */ - const void* key); /*!< in: key to search */ -/**********************************************************************//** -Find the node that has the greatest key that is <= key. -@return node that satisifies the upper bound constraint or NULL */ -const ib_rbt_node_t* -rbt_upper_bound( -/*============*/ - const ib_rbt_t* tree, /*!< in: rb tree */ - const void* key); /*!< in: key to search */ -/**********************************************************************//** Search for the key, a node will be retuned in parent.last, whether it was found or not. If not found then parent.last will contain the parent node for the possibly new key otherwise the matching node. @@ -259,12 +234,6 @@ rbt_search_cmp( arg_compare); /*!< in: fn to compare items with argument */ /**********************************************************************//** -Clear the tree, deletes (and free's) all the nodes. */ -void -rbt_clear( -/*======*/ - ib_rbt_t* tree); /*!< in: rb tree */ -/**********************************************************************//** Merge the node from dst into src. Return the number of nodes merged. @return no. of recs merged */ ulint @@ -272,18 +241,7 @@ rbt_merge_uniq( /*===========*/ ib_rbt_t* dst, /*!< in: dst rb tree */ const ib_rbt_t* src); /*!< in: src rb tree */ -/**********************************************************************//** -Merge the node from dst into src. Return the number of nodes merged. -Delete the nodes from src after copying node to dst. As a side effect -the duplicates will be left untouched in the src, since we don't support -duplicates (yet). NOTE: src and dst must be similar, the function doesn't -check for this condition (yet). -@return no. of recs merged */ -ulint -rbt_merge_uniq_destructive( -/*=======================*/ - ib_rbt_t* dst, /*!< in: dst rb tree */ - ib_rbt_t* src); /*!< in: src rb tree */ +#if defined UNIV_DEBUG || defined IB_RBT_TESTING /**********************************************************************//** Verify the integrity of the RB tree. For debugging. 0 failure else height of tree (in count of black nodes). @@ -292,12 +250,6 @@ ibool rbt_validate( /*=========*/ const ib_rbt_t* tree); /*!< in: tree to validate */ -/**********************************************************************//** -Iterate over the tree in depth first order. */ -void -rbt_print( -/*======*/ - const ib_rbt_t* tree, /*!< in: tree to traverse */ - ib_rbt_print_node print); /*!< in: print function */ +#endif /* UNIV_DEBUG || IB_RBT_TESTING */ #endif /* INNOBASE_UT0RBT_H */ diff --git a/storage/innobase/include/ut0rnd.h b/storage/innobase/include/ut0rnd.h index aa5b4b6745dc7..49ae3c8135639 100644 --- a/storage/innobase/include/ut0rnd.h +++ b/storage/innobase/include/ut0rnd.h @@ -133,9 +133,6 @@ ut_fold_binary( ulint len) /*!< in: length */ MY_ATTRIBUTE((pure)); - -#ifndef UNIV_NONINL #include "ut0rnd.ic" -#endif #endif diff --git a/storage/innobase/include/ut0stage.h b/storage/innobase/include/ut0stage.h index 1cccb0b8f84c1..baad5cd77b4ee 100644 --- a/storage/innobase/include/ut0stage.h +++ b/storage/innobase/include/ut0stage.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 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 the terms of the GNU General Public License as published by the Free Software diff --git a/storage/innobase/include/ut0timer.h b/storage/innobase/include/ut0timer.h index f361ae79bf525..ea4dddec683c8 100644 --- a/storage/innobase/include/ut0timer.h +++ b/storage/innobase/include/ut0timer.h @@ -97,8 +97,6 @@ ut_microseconds_to_timer( /*=====================*/ ulonglong when); /*!< in: time where to calculate */ -#ifndef UNIV_NONINL #include "ut0timer.ic" -#endif #endif diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index fb8b66ddd3978..bf1275170515b 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -610,9 +610,7 @@ class fatal_or_error : public logger { } // namespace ib -#ifndef UNIV_NONINL #include "ut0ut.ic" -#endif #endif diff --git a/storage/innobase/include/ut0vec.h b/storage/innobase/include/ut0vec.h index b5c0beddc1585..13b561a3a4f01 100644 --- a/storage/innobase/include/ut0vec.h +++ b/storage/innobase/include/ut0vec.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 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 @@ -281,8 +281,6 @@ struct ib_vector_t { ulint sizeof_value; }; -#ifndef UNIV_NONINL #include "ut0vec.ic" -#endif #endif /* IB_VECTOR_H */ diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 7e70e9a846bf9..744041acf0666 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -34,12 +34,6 @@ Created 5/7/1996 Heikki Tuuri #include "lock0lock.h" #include "lock0priv.h" - -#ifdef UNIV_NONINL -#include "lock0lock.ic" -#include "lock0priv.ic" -#endif - #include "dict0mem.h" #include "usr0sess.h" #include "trx0purge.h" @@ -99,6 +93,19 @@ extern "C" int thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other extern "C" int thd_deadlock_victim_preference(const MYSQL_THD thd1, const MYSQL_THD thd2); +/** Print info of a table lock. +@param[in,out] file output stream +@param[in] lock table lock */ +static +void +lock_table_print(FILE* file, const lock_t* lock); + +/** Print info of a record lock. +@param[in,out] file output stream +@param[in] lock record lock */ +static +void +lock_rec_print(FILE* file, const lock_t* lock); /** Deadlock checker. */ class DeadlockChecker { @@ -330,7 +337,7 @@ lock_sys_t* lock_sys = NULL; /** We store info on the latest deadlock error to this buffer. InnoDB Monitor will then fetch it and print */ -bool lock_deadlock_found = false; +static bool lock_deadlock_found = false; /** Only created if !srv_read_only_mode */ static FILE* lock_latest_err_file; @@ -3088,6 +3095,7 @@ lock_grant_and_move_on_page( Removes a record lock request, waiting or granted, from the queue and grants locks to other transactions in the queue if they now are entitled to a lock. NOTE: all record locks contained in in_lock are removed. */ +static void lock_rec_dequeue_from_page( /*=======================*/ @@ -3392,6 +3400,7 @@ lock_rec_inherit_to_gap_if_gap_lock( /*************************************************************//** Moves the locks of a record to another record and resets the lock bits of the donating record. */ +static void lock_rec_move_low( /*==============*/ @@ -3475,6 +3484,28 @@ lock_move_granted_locks_to_front( } } +/*************************************************************//** +Moves the locks of a record to another record and resets the lock bits of +the donating record. */ +UNIV_INLINE +void +lock_rec_move( +/*==========*/ + const buf_block_t* receiver, /*!< in: buffer block containing + the receiving record */ + const buf_block_t* donator, /*!< in: buffer block containing + the donating record */ + ulint receiver_heap_no,/*!< in: heap_no of the record + which gets the locks; there + must be no lock requests + on it! */ + ulint donator_heap_no)/*!< in: heap_no of the record + which gives the locks */ +{ + lock_rec_move_low(lock_sys->rec_hash, receiver, donator, + receiver_heap_no, donator_heap_no); +} + /*************************************************************//** Updates the lock table when we have reorganized a page. NOTE: we copy also the locks set on the infimum of the page; the infimum may carry @@ -5198,7 +5229,6 @@ lock_release( ut_ad(lock_mutex_own()); ut_ad(!trx_mutex_own(trx)); - ut_ad(!trx->is_dd_trx); for (lock = UT_LIST_GET_LAST(trx->lock.trx_locks); lock != NULL; @@ -5493,13 +5523,12 @@ lock_remove_all_on_table( /*===================== VALIDATION AND DEBUGGING ====================*/ -/*********************************************************************//** -Prints info of a table lock. */ +/** Print info of a table lock. +@param[in,out] file output stream +@param[in] lock table lock */ +static void -lock_table_print( -/*=============*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock) /*!< in: table type lock */ +lock_table_print(FILE* file, const lock_t* lock) { ut_ad(lock_mutex_own()); ut_a(lock_get_type_low(lock) == LOCK_TABLE); @@ -5533,13 +5562,12 @@ lock_table_print( putc('\n', file); } -/*********************************************************************//** -Prints info of a record lock. */ +/** Print info of a record lock. +@param[in,out] file output stream +@param[in] lock record lock */ +static void -lock_rec_print( -/*===========*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock) /*!< in: record type lock */ +lock_rec_print(FILE* file, const lock_t* lock) { ulint space; ulint page_no; diff --git a/storage/innobase/lock/lock0prdt.cc b/storage/innobase/lock/lock0prdt.cc index d26ae0f91e4d5..88573b8a71a8e 100644 --- a/storage/innobase/lock/lock0prdt.cc +++ b/storage/innobase/lock/lock0prdt.cc @@ -28,13 +28,6 @@ Created 9/7/2013 Jimmy Yang #include "lock0lock.h" #include "lock0priv.h" #include "lock0prdt.h" - -#ifdef UNIV_NONINL -#include "lock0lock.ic" -#include "lock0priv.ic" -#include "lock0prdt.ic" -#endif - #include "ha_prototypes.h" #include "usr0sess.h" #include "trx0purge.h" @@ -108,6 +101,58 @@ lock_prdt_set_prdt( memcpy(&(((byte*) &lock[1])[UNIV_WORD_SIZE]), prdt, sizeof *prdt); } + +/** Check whether two predicate locks are compatible with each other +@param[in] prdt1 first predicate lock +@param[in] prdt2 second predicate lock +@param[in] op predicate comparison operator +@return true if consistent */ +static +bool +lock_prdt_consistent( + lock_prdt_t* prdt1, + lock_prdt_t* prdt2, + ulint op) +{ + bool ret = false; + rtr_mbr_t* mbr1 = prdt_get_mbr_from_prdt(prdt1); + rtr_mbr_t* mbr2 = prdt_get_mbr_from_prdt(prdt2); + ulint action; + + if (op) { + action = op; + } else { + if (prdt2->op != 0 && (prdt1->op != prdt2->op)) { + return(false); + } + + action = prdt1->op; + } + + switch (action) { + case PAGE_CUR_CONTAIN: + ret = MBR_CONTAIN_CMP(mbr1, mbr2); + break; + case PAGE_CUR_DISJOINT: + ret = MBR_DISJOINT_CMP(mbr1, mbr2); + break; + case PAGE_CUR_MBR_EQUAL: + ret = MBR_EQUAL_CMP(mbr1, mbr2); + break; + case PAGE_CUR_INTERSECT: + ret = MBR_INTERSECT_CMP(mbr1, mbr2); + break; + case PAGE_CUR_WITHIN: + ret = MBR_WITHIN_CMP(mbr1, mbr2); + break; + default: + ib::error() << "invalid operator " << action; + ut_error; + } + + return(ret); +} + /*********************************************************************//** Checks if a predicate lock request for a new lock has to wait for another lock. @@ -739,55 +784,6 @@ lock_init_prdt_from_mbr( prdt->op = static_cast(mode); } -/*********************************************************************//** -Checks two predicate locks are compatible with each other -@return true if consistent */ -bool -lock_prdt_consistent( -/*=================*/ - lock_prdt_t* prdt1, /*!< in: Predicate for the lock */ - lock_prdt_t* prdt2, /*!< in: Predicate for the lock */ - ulint op) /*!< in: Predicate comparison operator */ -{ - bool ret = false; - rtr_mbr_t* mbr1 = prdt_get_mbr_from_prdt(prdt1); - rtr_mbr_t* mbr2 = prdt_get_mbr_from_prdt(prdt2); - ulint action; - - if (op) { - action = op; - } else { - if (prdt2->op != 0 && (prdt1->op != prdt2->op)) { - return(false); - } - - action = prdt1->op; - } - - switch (action) { - case PAGE_CUR_CONTAIN: - ret = MBR_CONTAIN_CMP(mbr1, mbr2); - break; - case PAGE_CUR_DISJOINT: - ret = MBR_DISJOINT_CMP(mbr1, mbr2); - break; - case PAGE_CUR_MBR_EQUAL: - ret = MBR_EQUAL_CMP(mbr1, mbr2); - break; - case PAGE_CUR_INTERSECT: - ret = MBR_INTERSECT_CMP(mbr1, mbr2); - break; - case PAGE_CUR_WITHIN: - ret = MBR_WITHIN_CMP(mbr1, mbr2); - break; - default: - ib::error() << "invalid operator " << action; - ut_error; - } - - return(ret); -} - /*********************************************************************//** Acquire a predicate lock on a block @return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 57796acf1afe3..d26886e45f95a 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Google Inc. -Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2014, 2017, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -35,11 +35,6 @@ Created 12/9/1995 Heikki Tuuri #include #include "log0log.h" - -#ifdef UNIV_NONINL -#include "log0log.ic" -#endif - #include "log0crypt.h" #include "mem0mem.h" #include "buf0buf.h" @@ -98,11 +93,11 @@ static ulint next_lbn_to_pad = 0; /* These control how often we print warnings if the last checkpoint is too old */ -bool log_has_printed_chkp_warning = false; -time_t log_last_warning_time; +static bool log_has_printed_chkp_warning = false; +static time_t log_last_warning_time; -bool log_has_printed_chkp_margine_warning = false; -time_t log_last_margine_warning_time; +static bool log_has_printed_chkp_margine_warning = false; +static time_t log_last_margine_warning_time; /* A margin for free space in the log buffer before a log entry is catenated */ #define LOG_BUF_WRITE_MARGIN (4 * OS_FILE_LOG_BLOCK_SIZE) @@ -562,6 +557,7 @@ log_close(void) Calculates the data capacity of a log group, when the log file headers are not included. @return capacity in bytes */ +static lsn_t log_group_get_capacity( /*===================*/ @@ -660,45 +656,6 @@ log_group_calc_lsn_offset( return(log_group_calc_real_offset(offset, group)); } -/*******************************************************************//** -Calculates where in log files we find a specified lsn. -@return log file number */ -ulint -log_calc_where_lsn_is( -/*==================*/ - int64_t* log_file_offset, /*!< out: offset in that file - (including the header) */ - ib_uint64_t first_header_lsn, /*!< in: first log file start - lsn */ - ib_uint64_t lsn, /*!< in: lsn whose position to - determine */ - ulint n_log_files, /*!< in: total number of log - files */ - int64_t log_file_size) /*!< in: log file size - (including the header) */ -{ - int64_t capacity = log_file_size - LOG_FILE_HDR_SIZE; - ulint file_no; - int64_t add_this_many; - - if (lsn < first_header_lsn) { - add_this_many = 1 + (first_header_lsn - lsn) - / (capacity * static_cast(n_log_files)); - lsn += add_this_many - * capacity * static_cast(n_log_files); - } - - ut_a(lsn >= first_header_lsn); - - file_no = ((ulint)((lsn - first_header_lsn) / capacity)) - % n_log_files; - *log_file_offset = (lsn - first_header_lsn) % capacity; - - *log_file_offset = *log_file_offset + LOG_FILE_HDR_SIZE; - - return(file_no); -} - /********************************************************//** Sets the field values in group to correspond to a given lsn. For this function @@ -942,20 +899,18 @@ log_io_complete( /* It was a checkpoint write */ group = (log_group_t*)((ulint) group - 1); -#ifdef _WIN32 - fil_flush(group->space_id); -#else - switch (srv_unix_file_flush_method) { - case SRV_UNIX_O_DSYNC: - case SRV_UNIX_NOSYNC: + switch (srv_file_flush_method) { + case SRV_O_DSYNC: + case SRV_NOSYNC: break; - case SRV_UNIX_FSYNC: - case SRV_UNIX_LITTLESYNC: - case SRV_UNIX_O_DIRECT: - case SRV_UNIX_O_DIRECT_NO_FSYNC: + case SRV_FSYNC: + case SRV_LITTLESYNC: + case SRV_O_DIRECT: + case SRV_O_DIRECT_NO_FSYNC: + case SRV_ALL_O_DIRECT_FSYNC: fil_flush(group->space_id); } -#endif /* _WIN32 */ + DBUG_PRINT("ib_log", ("checkpoint info written to group %u", unsigned(group->id))); @@ -1176,11 +1131,8 @@ log_write_flush_to_disk_low() calling os_event_set()! */ ut_a(log_sys->n_pending_flushes == 1); /* No other threads here */ -#ifndef _WIN32 - bool do_flush = srv_unix_file_flush_method != SRV_UNIX_O_DSYNC; -#else - bool do_flush = true; -#endif + bool do_flush = srv_file_flush_method != SRV_O_DSYNC; + if (do_flush) { fil_flush(SRV_LOG_SPACE_FIRST_ID); } @@ -1285,16 +1237,6 @@ log_write_up_to( return; } -#ifdef _WIN32 - /* write requests during fil_flush() might not be good for Windows */ - if (log_sys->n_pending_flushes > 0 - || !os_event_is_set(log_sys->flush_event)) { - log_write_mutex_exit(); - os_event_wait(log_sys->flush_event); - goto loop; - } -#endif /* _WIN32 */ - /* If it is a write call we should just go ahead and do it as we checked that write_lsn is not where we'd like it to be. If we have to flush as well then we check if there is a @@ -1413,13 +1355,12 @@ log_write_up_to( srv_stats.log_padded.add(pad_size); log_sys->write_lsn = write_lsn; -#ifndef _WIN32 - if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) { + + if (srv_file_flush_method == SRV_O_DSYNC) { /* O_SYNC means the OS did not buffer the log file at all: so we have also flushed to disk what we have written */ log_sys->flushed_to_disk_lsn = log_sys->write_lsn; } -#endif /* !_WIN32 */ log_write_mutex_exit(); @@ -1771,18 +1712,17 @@ log_checkpoint( recv_apply_hashed_log_recs(true); } -#ifndef _WIN32 - switch (srv_unix_file_flush_method) { - case SRV_UNIX_NOSYNC: + switch (srv_file_flush_method) { + case SRV_NOSYNC: break; - case SRV_UNIX_O_DSYNC: - case SRV_UNIX_FSYNC: - case SRV_UNIX_LITTLESYNC: - case SRV_UNIX_O_DIRECT: - case SRV_UNIX_O_DIRECT_NO_FSYNC: + case SRV_O_DSYNC: + case SRV_FSYNC: + case SRV_LITTLESYNC: + case SRV_O_DIRECT: + case SRV_O_DIRECT_NO_FSYNC: + case SRV_ALL_O_DIRECT_FSYNC: fil_flush_file_spaces(FIL_TYPE_TABLESPACE); } -#endif /* !_WIN32 */ log_mutex_enter(); @@ -2015,28 +1955,26 @@ logs_empty_and_mark_files_at_shutdown(void) { lsn_t lsn; ulint count = 0; - ulint pending_io; ib::info() << "Starting shutdown..."; - while (srv_fast_shutdown == 0 && trx_rollback_or_clean_is_active) { - /* we should wait until rollback after recovery end - for slow shutdown */ - os_thread_sleep(100000); - } - /* Wait until the master thread and all other operations are idle: our algorithm only works if the server is idle at shutdown */ srv_shutdown_state = SRV_SHUTDOWN_CLEANUP; loop: + ut_ad(lock_sys || !srv_was_started); + ut_ad(log_sys || !srv_was_started); + ut_ad(fil_system || !srv_was_started); os_event_set(srv_buf_resize_event); if (!srv_read_only_mode) { os_event_set(srv_error_event); os_event_set(srv_monitor_event); os_event_set(srv_buf_dump_event); - os_event_set(lock_sys->timeout_event); + if (lock_sys) { + os_event_set(lock_sys->timeout_event); + } if (dict_stats_event) { os_event_set(dict_stats_event); } else { @@ -2077,10 +2015,12 @@ logs_empty_and_mark_files_at_shutdown(void) thread_name = "buf_resize_thread"; } else if (srv_dict_stats_thread_active) { thread_name = "dict_stats_thread"; - } else if (lock_sys->timeout_thread_active) { + } else if (lock_sys && lock_sys->timeout_thread_active) { thread_name = "lock_wait_timeout_thread"; } else if (srv_buf_dump_thread_active) { thread_name = "buf_dump_thread"; + } else if (srv_fast_shutdown != 2 && trx_rollback_or_clean_is_active) { + thread_name = "rollback of recovered transactions"; } else { thread_name = NULL; } @@ -2137,25 +2077,29 @@ logs_empty_and_mark_files_at_shutdown(void) os_event_set(log_scrub_event); } - log_mutex_enter(); - const ulint n_write = log_sys->n_pending_checkpoint_writes; - const ulint n_flush = log_sys->n_pending_flushes; - log_mutex_exit(); + if (log_sys) { + log_mutex_enter(); + const ulint n_write = log_sys->n_pending_checkpoint_writes; + const ulint n_flush = log_sys->n_pending_flushes; + log_mutex_exit(); - if (log_scrub_thread_active || n_write || n_flush) { - if (srv_print_verbose_log && count > 600) { - ib::info() << "Pending checkpoint_writes: " << n_write - << ". Pending log flush writes: " << n_flush; - count = 0; + if (log_scrub_thread_active || n_write || n_flush) { + if (srv_print_verbose_log && count > 600) { + ib::info() << "Pending checkpoint_writes: " + << n_write + << ". Pending log flush writes: " + << n_flush; + count = 0; + } + goto loop; } - goto loop; } ut_ad(!log_scrub_thread_active); - pending_io = buf_pool_check_no_pending_io(); - - if (pending_io) { + if (!buf_pool_ptr) { + ut_ad(!srv_was_started); + } else if (ulint pending_io = buf_pool_check_no_pending_io()) { if (srv_print_verbose_log && count > 600) { ib::info() << "Waiting for " << pending_io << " buffer" " page I/Os to complete"; @@ -2187,7 +2131,9 @@ logs_empty_and_mark_files_at_shutdown(void) srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE; - fil_close_all_files(); + if (fil_system) { + fil_close_all_files(); + } return; } diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 1ab1341bbdc49..e6d6f4b0af229 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -117,7 +117,7 @@ ulint recv_n_pool_free_frames; /** The maximum lsn we see for a page during the recovery process. If this is bigger than the lsn we are able to scan up to, that is an indication that the recovery failed and the database may be corrupt. */ -lsn_t recv_max_page_lsn; +static lsn_t recv_max_page_lsn; #ifdef UNIV_PFS_THREAD mysql_pfs_key_t trx_rollback_clean_thread_key; @@ -2726,18 +2726,16 @@ recv_scan_log_recs( stored to the hash table; this is reset if just debug checking is needed, or when the available_memory runs out */ - const byte* buf, /*!< in: buffer containing a log - segment or garbage */ - ulint len, /*!< in: buffer length */ + const byte* log_block, /*!< in: log segment */ lsn_t checkpoint_lsn, /*!< in: latest checkpoint LSN */ - lsn_t start_lsn, /*!< in: buffer start lsn */ + lsn_t start_lsn, /*!< in: buffer start LSN */ + lsn_t end_lsn, /*!< in: buffer end LSN */ lsn_t* contiguous_lsn, /*!< in/out: it is known that all log groups contain contiguous log data up to this lsn */ lsn_t* group_scanned_lsn)/*!< out: scanning succeeded up to this lsn */ { - const byte* log_block = buf; lsn_t scanned_lsn = start_lsn; bool finished = false; ulint data_len; @@ -2745,8 +2743,11 @@ recv_scan_log_recs( bool apply = recv_sys->mlog_checkpoint_lsn != 0; ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0); - ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0); - ut_ad(len >= OS_FILE_LOG_BLOCK_SIZE); + ut_ad(end_lsn % OS_FILE_LOG_BLOCK_SIZE == 0); + ut_ad(end_lsn >= start_lsn + OS_FILE_LOG_BLOCK_SIZE); + + const byte* const log_end = log_block + + ulint(end_lsn - start_lsn); do { ut_ad(!finished); @@ -2842,7 +2843,7 @@ recv_scan_log_recs( } else { log_block += OS_FILE_LOG_BLOCK_SIZE; } - } while (log_block < buf + len); + } while (log_block < log_end); *group_scanned_lsn = scanned_lsn; @@ -2938,9 +2939,9 @@ recv_group_scan_log_recs( } while (end_lsn != start_lsn && !recv_scan_log_recs( available_mem, &store_to_hash, log_sys->buf, - end_lsn - start_lsn, checkpoint_lsn, - start_lsn, contiguous_lsn, &group->scanned_lsn)); + start_lsn, end_lsn, + contiguous_lsn, &group->scanned_lsn)); if (recv_sys->found_corrupt_log || recv_sys->found_corrupt_fs) { DBUG_RETURN(false); diff --git a/storage/innobase/mach/mach0data.cc b/storage/innobase/mach/mach0data.cc index 2d3e6730f7588..b22da00c0f160 100644 --- a/storage/innobase/mach/mach0data.cc +++ b/storage/innobase/mach/mach0data.cc @@ -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 @@ -26,10 +26,6 @@ Created 11/28/1995 Heikki Tuuri #include "mach0data.h" -#ifdef UNIV_NONINL -#include "mach0data.ic" -#endif - /** Read a 32-bit integer in a compressed form. @param[in,out] ptr pointer to memory where to read; advanced by the number of bytes consumed, or set NULL if out of space diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc index d067bbaa803cc..a5b5c9e0f8468 100644 --- a/storage/innobase/mem/mem0mem.cc +++ b/storage/innobase/mem/mem0mem.cc @@ -27,10 +27,6 @@ Created 6/9/1994 Heikki Tuuri #include "ha_prototypes.h" #include "mem0mem.h" -#ifdef UNIV_NONINL -#include "mem0mem.ic" -#endif - #include "buf0buf.h" #include "srv0srv.h" #include diff --git a/storage/innobase/mtr/mtr0log.cc b/storage/innobase/mtr/mtr0log.cc index 783fdcd05acdc..7d97aaa3f42f0 100644 --- a/storage/innobase/mtr/mtr0log.cc +++ b/storage/innobase/mtr/mtr0log.cc @@ -24,11 +24,6 @@ Created 12/7/1995 Heikki Tuuri *******************************************************/ #include "mtr0log.h" - -#ifdef UNIV_NONINL -#include "mtr0log.ic" -#endif /* UNIV_NOINL */ - #include "buf0buf.h" #include "dict0dict.h" #include "log0recv.h" diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index c19d2131d1ef8..c626937b0d8a7 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -36,10 +36,6 @@ Created 11/26/1995 Heikki Tuuri #include "log0recv.h" -#ifdef UNIV_NONINL -#include "mtr0mtr.ic" -#endif /* UNIV_NONINL */ - /** Iterate over a memo block in reverse. */ template struct Iterate { @@ -491,15 +487,6 @@ mtr_write_log( log_close(); } -/** Start a mini-transaction. -@param sync true if it is a synchronous mini-transaction -@param read_only true if read only mini-transaction */ -void -mtr_t::start(bool sync, bool read_only) -{ - start(NULL, sync, read_only); -} - /** Start a mini-transaction. @param sync true if it is a synchronous mini-transaction @param read_only true if read only mini-transaction */ diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 905edfb09e0f6..792f4c206c972 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -40,10 +40,6 @@ Created 10/21/1995 Heikki Tuuri #include "os0file.h" -#ifdef UNIV_NONINL -#include "os0file.ic" -#endif - #ifdef UNIV_LINUX #include #include @@ -685,18 +681,18 @@ wait until a batch of new read requests have been posted */ static bool os_aio_recommend_sleep_for_read_threads = false; ulint os_n_file_reads = 0; -ulint os_bytes_read_since_printout = 0; +static ulint os_bytes_read_since_printout = 0; ulint os_n_file_writes = 0; ulint os_n_fsyncs = 0; -ulint os_n_file_reads_old = 0; -ulint os_n_file_writes_old = 0; -ulint os_n_fsyncs_old = 0; +static ulint os_n_file_reads_old = 0; +static ulint os_n_file_writes_old = 0; +static ulint os_n_fsyncs_old = 0; /** Number of pending write operations */ ulint os_n_pending_writes = 0; /** Number of pending read operations */ ulint os_n_pending_reads = 0; -time_t os_last_printout; +static time_t os_last_printout; bool os_has_said_disk_full = false; /** Default Zip compression level */ @@ -1047,6 +1043,7 @@ AIO::pending_io_count() const #ifdef UNIV_DEBUG /** Validates the consistency the aio system some of the time. @return true if ok or the check was skipped */ +static bool os_aio_validate_skip() { @@ -1920,8 +1917,7 @@ LinuxAIOHandler::collect() slot->err = slot->type.punch_hole( slot->file, - slot->offset, - static_cast(slot->len)); + slot->offset, slot->len); } else { slot->err = DB_SUCCESS; } @@ -2497,6 +2493,7 @@ os_file_fsync_posix( @param[out] exists true if the file exists @param[out] type Type of the file, if it exists @return true if call succeeded */ +static bool os_file_status_posix( const char* path, @@ -2683,8 +2680,8 @@ os_file_create_simple_func( we open the same file in the same mode, see man page of open(2). */ if (!srv_read_only_mode && *success - && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT - || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) { + && (srv_file_flush_method == SRV_O_DIRECT + || srv_file_flush_method == SRV_O_DIRECT_NO_FSYNC)) { os_file_set_nocache(file, name, mode_str); } @@ -2955,7 +2952,7 @@ os_file_create_func( if (!read_only && type == OS_LOG_FILE - && srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) { + && srv_file_flush_method == SRV_O_DSYNC) { create_flag |= O_SYNC; } @@ -2992,8 +2989,8 @@ os_file_create_func( if (!read_only && *success && (type != OS_LOG_FILE && type != OS_DATA_TEMP_FILE) - && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT - || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) { + && (srv_file_flush_method == SRV_O_DIRECT + || srv_file_flush_method == SRV_O_DIRECT_NO_FSYNC)) { os_file_set_nocache(file, name, mode_str); } @@ -3602,6 +3599,7 @@ os_file_punch_hole_win32( @param[out] exists true if the file exists @param[out] type Type of the file, if it exists @return true if call succeeded */ +static bool os_file_status_win32( const char* path, @@ -4212,20 +4210,55 @@ os_file_create_func( return(OS_FILE_CLOSED); } -#ifdef UNIV_NON_BUFFERED_IO + if (type == OS_LOG_FILE) { + /* There is not reason to use buffered write to logs.*/ + attributes |= FILE_FLAG_NO_BUFFERING; + } + + switch (srv_file_flush_method) + { + case SRV_O_DSYNC: + if (type == OS_LOG_FILE) { + /* Map O_SYNC to FILE_WRITE_THROUGH */ + attributes |= FILE_FLAG_WRITE_THROUGH; + } + break; + + case SRV_O_DIRECT_NO_FSYNC: + case SRV_O_DIRECT: + if (type == OS_DATA_FILE) { + attributes |= FILE_FLAG_NO_BUFFERING; + } + break; + + case SRV_ALL_O_DIRECT_FSYNC: + /*Traditional Windows behavior, no buffering for any files.*/ + attributes |= FILE_FLAG_NO_BUFFERING; + break; + + case SRV_FSYNC: + case SRV_LITTLESYNC: + break; + + case SRV_NOSYNC: + /* Let Windows cache manager handle all writes.*/ + attributes &= ~(FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING); + break; + + default: + ut_a(false); /* unknown flush mode.*/ + } + + // TODO: Create a bug, this looks wrong. The flush log // parameter is dynamic. if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) { - /* Do not use unbuffered i/o for the log files because value 2 denotes that we do not flush the log at every commit, but only once per second */ - - } else if (srv_win_file_flush_method == SRV_WIN_IO_UNBUFFERED) { - - attributes |= FILE_FLAG_NO_BUFFERING; + attributes &= ~(FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING); } -#endif /* UNIV_NON_BUFFERED_IO */ + DWORD access = GENERIC_READ; @@ -4846,9 +4879,7 @@ os_file_io( && !type.is_log() && type.is_write() && type.punch_hole()) { - *err = type.punch_hole(file, - offset, - static_cast(n)); + *err = type.punch_hole(file, offset, n); } else { *err = DB_SUCCESS; @@ -5506,10 +5537,7 @@ os_file_punch_hole( @param[in] len Size of the hole @return DB_SUCCESS or error code */ dberr_t -IORequest::punch_hole( - os_file_t fh, - os_offset_t off, - os_offset_t len) +IORequest::punch_hole(os_file_t fh, os_offset_t off, ulint len) { /* In this debugging mode, we act as if punch hole is supported, and then skip any calls to actually punch a hole here. @@ -5518,7 +5546,7 @@ IORequest::punch_hole( return(DB_SUCCESS); ); - os_offset_t trim_len = static_cast(get_trim_length(len)); + ulint trim_len = get_trim_length(len); if (trim_len == 0) { return(DB_SUCCESS); @@ -6036,7 +6064,11 @@ os_aio_free() { AIO::shutdown(); - if (!srv_use_native_aio) { + ut_ad(!os_aio_segment_wait_events || !srv_use_native_aio); + ut_ad(srv_use_native_aio || os_aio_segment_wait_events + || !srv_was_started); + + if (!srv_use_native_aio && os_aio_segment_wait_events) { for (ulint i = 0; i < os_aio_n_segments; i++) { os_event_destroy(os_aio_segment_wait_events[i]); } diff --git a/storage/innobase/os/os0proc.cc b/storage/innobase/os/os0proc.cc index 801e4e8b9d9ad..9309c1f2c972e 100644 --- a/storage/innobase/os/os0proc.cc +++ b/storage/innobase/os/os0proc.cc @@ -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 @@ -27,10 +27,6 @@ Created 9/30/1995 Heikki Tuuri #include "ha_prototypes.h" #include "os0proc.h" -#ifdef UNIV_NONINL -#include "os0proc.ic" -#endif - #include "srv0srv.h" #include "ut0mem.h" #include "ut0byte.h" diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc index 8039c2e4f4689..4012c281f8dbe 100644 --- a/storage/innobase/os/os0thread.cc +++ b/storage/innobase/os/os0thread.cc @@ -27,11 +27,6 @@ Created 9/8/1995 Heikki Tuuri #include "os0thread.h" #include "ut0new.h" - -#ifdef UNIV_NONINL -#include "os0thread.ic" -#endif - #include "srv0srv.h" #include "os0event.h" #include diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index 16bdf602e812b..f2ba1c6422956 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. This program is free software; you can redistribute it and/or modify it under @@ -27,10 +27,6 @@ Created 10/4/1994 Heikki Tuuri #include "ha_prototypes.h" #include "page0cur.h" -#ifdef UNIV_NONINL -#include "page0cur.ic" -#endif - #include "page0zip.h" #include "btr0btr.h" #include "mtr0log.h" diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index d38b426b0d437..437b6c01a41ad 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -26,10 +26,6 @@ Created 2/2/1994 Heikki Tuuri *******************************************************/ #include "page0page.h" -#ifdef UNIV_NONINL -#include "page0page.ic" -#endif - #include "page0cur.h" #include "page0zip.h" #include "buf0buf.h" diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index c0746bd9d5fa4..11b8838ce2dfb 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -27,9 +27,6 @@ Created June 2005 by Marko Makela #include "page0size.h" #include "page0zip.h" -#ifdef UNIV_NONINL -# include "page0zip.ic" -#endif /** A BLOB field reference full of zero, for use in assertions and tests. Initially, BLOB field references are set to zero, in @@ -812,12 +809,12 @@ page_zip_set_alloc( #ifdef PAGE_ZIP_COMPRESS_DBG /** Set this variable in a debugger to enable excessive logging in page_zip_compress(). */ -ibool page_zip_compress_dbg; +static ibool page_zip_compress_dbg; /** Set this variable in a debugger to enable binary logging of the data passed to deflate(). When this variable is nonzero, it will act as a log file name generator. */ -unsigned page_zip_compress_log; +static unsigned page_zip_compress_log; /**********************************************************************//** Wrapper for deflate(). Log the operation if page_zip_compress_dbg is set. diff --git a/storage/innobase/pars/lexyy.cc b/storage/innobase/pars/lexyy.cc index b97afd7c76b34..4d1b021fa2bdd 100644 --- a/storage/innobase/pars/lexyy.cc +++ b/storage/innobase/pars/lexyy.cc @@ -9,8 +9,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -35,7 +35,7 @@ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. + * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 @@ -52,7 +52,7 @@ typedef uint32_t flex_uint32_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; @@ -89,25 +89,13 @@ typedef unsigned int flex_uint32_t; #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ @@ -168,23 +156,24 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t yyleng; -extern FILE *yyin, *yyout; + + #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -#define YY_LESS_LINENO(n) - + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ @@ -206,12 +195,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -232,8 +221,8 @@ struct yy_buffer_state */ int yy_at_bol; - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. @@ -262,7 +251,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -281,11 +270,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ @@ -294,13 +283,13 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart (FILE *input_file ); +static void yyrestart (FILE *input_file ); MY_ATTRIBUTE((unused)) static void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); static YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); +static void yy_delete_buffer (YY_BUFFER_STATE b ); +static void yy_flush_buffer (YY_BUFFER_STATE b ); +MY_ATTRIBUTE((unused)) static void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +MY_ATTRIBUTE((unused)) static void yypop_buffer_state (void ); static void yyensure_buffer_stack (void ); static void yy_load_buffer_state (void ); @@ -310,20 +299,20 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); +static void *yyalloc (yy_size_t ); +static void *yyrealloc (void *,yy_size_t ); +static void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } @@ -331,9 +320,9 @@ void yyfree (void * ); #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } @@ -342,39 +331,42 @@ void yyfree (void * ); /* Begin user sect3 */ -#define yywrap() 1 +#define yywrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +static FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int yylineno; -int yylineno = 1; -extern char *yytext; +static int yylineno = 1; + + +#ifdef yytext_ptr +#undef yytext_ptr +#endif #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static void yynoreturn yy_fatal_error (yyconst char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 124 -#define YY_END_OF_BUFFER 125 +#define YY_NUM_RULES 123 +#define YY_END_OF_BUFFER 124 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -382,58 +374,56 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[425] = +static yyconst flex_int16_t yy_accept[404] = { 0, - 0, 0, 119, 119, 0, 0, 0, 0, 125, 123, - 122, 122, 8, 123, 114, 5, 103, 109, 112, 110, - 107, 111, 123, 113, 1, 123, 108, 106, 104, 105, - 117, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 115, 116, 119, 120, 6, 7, 9, 10, 122, 4, - 98, 118, 2, 1, 3, 99, 100, 102, 101, 0, - 96, 0, 96, 96, 96, 96, 96, 44, 96, 96, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96, 28, 17, 25, 96, 96, 96, - - 96, 96, 96, 54, 63, 96, 14, 96, 96, 96, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96, 96, 119, 120, 120, 121, 6, - 7, 9, 10, 2, 0, 97, 13, 45, 96, 96, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96, 96, 96, 96, 27, 96, 96, - 96, 41, 96, 96, 96, 96, 21, 96, 96, 96, - 96, 96, 15, 96, 96, 96, 18, 96, 96, 96, - 96, 96, 82, 96, 96, 96, 51, 96, 12, 96, - 36, 96, 96, 96, 96, 96, 96, 96, 96, 96, - - 96, 96, 0, 97, 96, 96, 96, 96, 20, 96, - 24, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 46, 96, 96, 30, 96, 89, 96, 96, - 39, 96, 96, 96, 96, 96, 48, 96, 94, 91, - 32, 93, 96, 11, 66, 96, 96, 96, 42, 96, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 29, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 87, - 0, 96, 26, 96, 96, 96, 68, 96, 96, 96, - 96, 37, 96, 96, 96, 96, 96, 96, 96, 31, - 67, 23, 96, 59, 96, 77, 96, 96, 96, 43, - - 96, 96, 96, 96, 96, 96, 96, 96, 92, 96, - 96, 56, 96, 96, 96, 96, 96, 96, 96, 40, - 33, 0, 81, 95, 19, 96, 96, 85, 96, 76, - 55, 96, 65, 96, 52, 96, 96, 96, 47, 96, - 78, 96, 80, 96, 96, 34, 96, 96, 96, 35, - 74, 96, 96, 96, 96, 60, 96, 50, 49, 96, - 96, 96, 57, 53, 64, 96, 96, 96, 22, 96, - 96, 75, 83, 96, 96, 79, 96, 70, 96, 96, - 96, 96, 96, 38, 96, 90, 69, 96, 86, 96, - 96, 96, 88, 96, 96, 61, 96, 16, 96, 72, - - 71, 96, 58, 96, 84, 96, 96, 96, 96, 96, - 96, 96, 96, 96, 96, 73, 96, 96, 96, 96, - 96, 96, 62, 0 + 0, 0, 118, 118, 0, 0, 0, 0, 124, 122, + 121, 121, 8, 122, 113, 5, 102, 108, 111, 109, + 106, 110, 122, 112, 1, 122, 107, 105, 103, 104, + 116, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 114, 115, 118, 119, 6, 7, 9, 10, 121, 4, + 97, 117, 2, 1, 3, 98, 99, 101, 100, 0, + 95, 0, 95, 95, 95, 95, 95, 44, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 28, 17, 25, 95, 95, 95, 95, + + 95, 95, 54, 62, 95, 14, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 118, 119, 119, 120, 6, 7, + 9, 10, 2, 0, 96, 13, 45, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 27, 95, 95, 95, 41, + 95, 95, 95, 95, 21, 95, 95, 95, 95, 95, + 15, 95, 95, 95, 18, 95, 95, 95, 95, 95, + 81, 95, 95, 95, 51, 95, 12, 95, 36, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + + 0, 96, 95, 95, 95, 95, 20, 95, 24, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 46, 95, 30, 95, 88, 95, 95, 39, 95, 95, + 95, 95, 95, 48, 95, 93, 90, 32, 92, 95, + 11, 65, 95, 95, 95, 42, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 29, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 86, 0, 95, 26, + 95, 95, 95, 67, 95, 95, 95, 95, 37, 95, + 95, 95, 95, 95, 95, 31, 66, 23, 95, 59, + 95, 76, 95, 95, 95, 43, 95, 95, 95, 95, + + 95, 95, 95, 95, 91, 95, 95, 56, 95, 95, + 95, 95, 95, 95, 95, 40, 33, 0, 80, 94, + 19, 95, 95, 84, 95, 75, 55, 95, 64, 95, + 52, 95, 95, 47, 95, 77, 95, 79, 95, 95, + 34, 95, 95, 95, 35, 73, 95, 95, 95, 95, + 60, 95, 50, 49, 95, 95, 95, 57, 53, 63, + 95, 95, 22, 95, 95, 74, 82, 95, 95, 78, + 95, 69, 95, 95, 95, 95, 95, 38, 89, 68, + 95, 85, 95, 95, 95, 87, 95, 95, 61, 16, + 95, 71, 70, 95, 58, 83, 95, 95, 95, 95, + + 95, 72, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -465,7 +455,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[57] = +static yyconst YY_CHAR yy_meta[57] = { 0, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 5, 1, 1, 1, 1, 6, 7, 1, 1, 1, @@ -475,111 +465,107 @@ static yyconst flex_int32_t yy_meta[57] = 9, 9, 9, 9, 1, 1 } ; -static yyconst flex_int16_t yy_base[438] = +static yyconst flex_uint16_t yy_base[417] = { 0, - 0, 0, 293, 287, 284, 281, 272, 256, 254, 1357, - 55, 57, 1357, 0, 1357, 1357, 1357, 1357, 1357, 1357, - 1357, 1357, 238, 227, 46, 205, 1357, 43, 1357, 203, - 1357, 46, 50, 56, 52, 66, 64, 51, 81, 92, + 0, 0, 296, 281, 283, 280, 261, 252, 253, 1285, + 55, 57, 1285, 0, 1285, 1285, 1285, 1285, 1285, 1285, + 1285, 1285, 211, 213, 46, 202, 1285, 43, 1285, 199, + 1285, 46, 50, 56, 52, 66, 64, 51, 81, 92, 91, 94, 96, 111, 113, 116, 130, 134, 53, 143, - 1357, 1357, 0, 106, 0, 212, 0, 210, 141, 0, - 1357, 1357, 192, 56, 173, 1357, 1357, 1357, 1357, 168, - 140, 150, 152, 154, 155, 161, 167, 171, 177, 172, - 184, 174, 188, 189, 191, 194, 203, 212, 215, 217, - 219, 221, 226, 228, 231, 240, 233, 235, 246, 251, - - 258, 253, 255, 256, 269, 271, 278, 272, 285, 283, - 287, 289, 296, 305, 298, 315, 319, 321, 322, 326, - 332, 333, 342, 339, 343, 0, 112, 173, 1357, 0, - 155, 0, 156, 132, 93, 0, 355, 357, 358, 360, - 364, 367, 374, 370, 379, 380, 389, 383, 390, 392, - 395, 408, 411, 409, 415, 418, 425, 427, 429, 436, - 431, 441, 446, 448, 450, 452, 453, 462, 471, 464, - 473, 474, 478, 485, 488, 490, 491, 494, 500, 501, - 504, 506, 507, 517, 518, 519, 520, 521, 522, 523, - 533, 536, 538, 543, 549, 554, 555, 561, 556, 566, - - 567, 576, 60, 0, 573, 578, 580, 582, 583, 593, - 589, 596, 598, 603, 605, 607, 610, 617, 619, 621, - 622, 628, 633, 634, 635, 639, 640, 649, 650, 652, - 653, 655, 659, 664, 668, 669, 665, 671, 674, 678, - 681, 685, 687, 688, 692, 697, 698, 701, 703, 704, - 707, 708, 717, 713, 728, 730, 724, 740, 734, 745, - 746, 750, 751, 756, 757, 760, 761, 762, 771, 773, - 42, 778, 782, 783, 787, 789, 792, 794, 793, 804, - 805, 808, 809, 810, 819, 823, 826, 828, 829, 830, - 835, 840, 844, 846, 847, 856, 857, 858, 859, 860, - - 863, 872, 873, 878, 879, 882, 885, 889, 894, 895, - 896, 898, 905, 910, 908, 912, 914, 915, 926, 930, - 931, 73, 932, 933, 935, 937, 942, 944, 946, 947, - 948, 949, 951, 958, 961, 965, 967, 972, 978, 979, - 981, 984, 983, 985, 994, 988, 999, 1000, 1001, 1004, - 1013, 1015, 1022, 1016, 1019, 1026, 1032, 1033, 1035, 1036, - 1038, 1039, 1048, 1049, 1050, 1051, 1053, 1054, 1060, 1063, - 1065, 1066, 1069, 1070, 1072, 1082, 1084, 1085, 1087, 1096, - 1097, 1098, 1099, 1101, 1113, 1114, 1115, 1116, 1117, 1118, - 1119, 1128, 1130, 1131, 1134, 1133, 1135, 1137, 1150, 1151, - - 1153, 1155, 1157, 1162, 1160, 1167, 1172, 1173, 1174, 1176, - 1185, 1190, 1183, 1187, 1189, 1199, 1204, 1206, 1208, 1210, - 1215, 1220, 1222, 1357, 1269, 1278, 1287, 1290, 1293, 1297, - 1306, 1315, 1324, 1333, 1340, 1344, 1347 + 1285, 1285, 0, 106, 0, 206, 0, 205, 141, 0, + 1285, 1285, 177, 56, 152, 1285, 1285, 1285, 1285, 161, + 140, 147, 152, 154, 155, 161, 167, 171, 177, 172, + 184, 174, 188, 189, 191, 194, 203, 212, 217, 219, + 222, 223, 228, 224, 226, 233, 235, 239, 244, 251, + + 256, 260, 261, 262, 265, 271, 266, 281, 277, 287, + 282, 288, 303, 306, 307, 292, 310, 321, 322, 323, + 324, 325, 335, 338, 0, 112, 173, 1285, 0, 152, + 0, 145, 130, 59, 0, 339, 341, 353, 351, 354, + 365, 367, 355, 372, 376, 383, 379, 386, 388, 385, + 398, 392, 402, 401, 414, 415, 416, 417, 426, 430, + 432, 437, 433, 439, 442, 443, 449, 456, 460, 461, + 463, 470, 472, 473, 479, 483, 485, 489, 492, 495, + 498, 499, 502, 508, 509, 514, 515, 518, 520, 527, + 530, 534, 536, 541, 543, 553, 555, 557, 559, 568, + + 41, 0, 564, 569, 570, 573, 574, 585, 580, 589, + 586, 595, 598, 600, 605, 610, 611, 617, 620, 615, + 622, 627, 626, 631, 641, 642, 646, 647, 648, 651, + 652, 653, 657, 662, 663, 667, 669, 673, 680, 682, + 684, 685, 686, 687, 689, 696, 698, 700, 701, 703, + 699, 710, 714, 716, 729, 732, 731, 733, 735, 734, + 746, 747, 748, 752, 753, 759, 749, 39, 769, 770, + 771, 773, 774, 780, 783, 784, 787, 785, 786, 802, + 800, 803, 816, 817, 818, 819, 820, 823, 833, 835, + 836, 837, 838, 839, 848, 849, 852, 853, 854, 859, + + 863, 870, 868, 872, 875, 884, 885, 887, 889, 890, + 888, 904, 906, 907, 908, 918, 919, 73, 921, 922, + 923, 924, 933, 934, 936, 937, 938, 939, 940, 949, + 952, 955, 953, 965, 969, 970, 971, 972, 974, 975, + 981, 984, 986, 988, 990, 991, 1000, 1006, 1004, 1009, + 1016, 1018, 1020, 1021, 1025, 1027, 1032, 1034, 1038, 1039, + 1041, 1043, 1048, 1050, 1052, 1055, 1059, 1064, 1066, 1068, + 1071, 1073, 1077, 1084, 1086, 1087, 1091, 1093, 1098, 1100, + 1102, 1104, 1105, 1111, 1114, 1116, 1117, 1118, 1120, 1127, + 1129, 1130, 1134, 1139, 1141, 1145, 1146, 1148, 1150, 1151, + + 1155, 1157, 1285, 1197, 1206, 1215, 1218, 1221, 1225, 1234, + 1243, 1252, 1261, 1268, 1272, 1275 } ; -static yyconst flex_int16_t yy_def[438] = +static yyconst flex_int16_t yy_def[417] = { 0, - 424, 1, 425, 425, 426, 426, 427, 427, 424, 424, - 424, 424, 424, 428, 424, 424, 424, 424, 424, 424, - 424, 424, 424, 424, 424, 429, 424, 424, 424, 424, - 424, 430, 430, 430, 430, 430, 34, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 424, 424, 431, 432, 433, 424, 434, 424, 424, 428, - 424, 424, 424, 424, 429, 424, 424, 424, 424, 435, - 430, 436, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 431, 432, 432, 424, 433, - 424, 434, 424, 424, 424, 437, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - - 430, 430, 424, 437, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 424, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 424, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 430, 0, 424, 424, 424, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424 + 403, 1, 404, 404, 405, 405, 406, 406, 403, 403, + 403, 403, 403, 407, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 408, 403, 403, 403, 403, + 403, 409, 409, 409, 409, 409, 34, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 403, 403, 410, 411, 412, 403, 413, 403, 403, 407, + 403, 403, 403, 403, 408, 403, 403, 403, 403, 414, + 409, 415, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 410, 411, 411, 403, 412, 403, + 413, 403, 403, 403, 416, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + + 403, 416, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 403, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 403, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + + 409, 409, 0, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403 } ; -static yyconst flex_int16_t yy_nxt[1414] = +static yyconst flex_uint16_t yy_nxt[1342] = { 0, 10, 11, 12, 13, 10, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, @@ -588,158 +574,150 @@ static yyconst flex_int16_t yy_nxt[1414] = 38, 45, 46, 47, 48, 49, 50, 38, 38, 38, 38, 38, 38, 38, 51, 52, 59, 59, 59, 59, 63, 70, 64, 67, 68, 70, 70, 70, 70, 72, - 63, 70, 64, 72, 72, 72, 72, 123, 75, 72, - 84, 70, 76, 73, 85, 77, 136, 79, 74, 72, - 86, 80, 90, 322, 81, 71, 70, 82, 78, 91, - - 83, 87, 92, 88, 72, 93, 70, 70, 94, 70, - 95, 70, 271, 89, 72, 72, 128, 72, 96, 72, - 98, 129, 424, 97, 99, 104, 70, 424, 70, 101, - 100, 70, 102, 105, 72, 106, 72, 107, 103, 72, - 108, 110, 59, 59, 113, 70, 203, 114, 134, 70, - 111, 112, 109, 72, 118, 70, 115, 72, 70, 133, - 116, 119, 131, 72, 117, 70, 72, 70, 120, 70, - 70, 121, 135, 122, 124, 72, 70, 72, 72, 137, - 138, 125, 70, 128, 72, 140, 70, 70, 129, 70, - 72, 141, 70, 424, 72, 72, 139, 72, 142, 70, - - 72, 144, 150, 70, 70, 143, 70, 72, 134, 70, - 145, 72, 72, 133, 72, 152, 146, 72, 70, 131, - 147, 148, 156, 69, 153, 66, 72, 70, 149, 151, - 70, 154, 70, 155, 70, 72, 70, 62, 72, 158, - 72, 70, 72, 70, 72, 157, 70, 159, 70, 72, - 70, 72, 61, 424, 72, 70, 72, 161, 72, 58, - 160, 70, 162, 72, 163, 164, 70, 165, 70, 72, - 70, 70, 168, 70, 72, 58, 72, 170, 72, 72, - 169, 72, 166, 167, 70, 172, 70, 70, 56, 171, - 174, 56, 72, 70, 72, 72, 173, 54, 70, 175, - - 70, 72, 70, 54, 70, 176, 72, 180, 72, 424, - 72, 70, 72, 70, 183, 177, 424, 178, 424, 72, - 70, 72, 181, 179, 184, 424, 182, 424, 72, 188, - 70, 186, 424, 189, 70, 185, 70, 70, 72, 187, - 190, 70, 72, 424, 72, 72, 193, 70, 70, 72, - 194, 191, 424, 424, 70, 72, 72, 70, 70, 424, - 198, 192, 72, 424, 196, 72, 72, 200, 424, 424, - 70, 201, 70, 70, 197, 70, 195, 199, 72, 70, - 72, 72, 70, 72, 202, 70, 205, 72, 424, 70, - 72, 208, 206, 72, 70, 70, 207, 72, 70, 209, - - 210, 424, 72, 72, 70, 70, 72, 70, 424, 216, - 70, 211, 72, 72, 424, 72, 218, 424, 72, 424, - 424, 212, 213, 70, 70, 214, 70, 217, 215, 424, - 70, 72, 72, 70, 72, 223, 219, 220, 72, 222, - 70, 72, 70, 221, 70, 424, 70, 424, 72, 424, - 72, 70, 72, 226, 72, 230, 70, 227, 224, 72, - 225, 70, 229, 70, 72, 70, 424, 70, 70, 72, - 424, 72, 228, 72, 232, 72, 72, 70, 233, 70, - 234, 236, 231, 424, 424, 72, 70, 72, 70, 70, - 424, 237, 238, 70, 72, 235, 72, 72, 240, 239, - - 70, 72, 242, 70, 424, 70, 70, 243, 72, 70, - 424, 72, 241, 72, 72, 70, 70, 72, 246, 70, - 244, 70, 70, 72, 72, 245, 248, 72, 249, 72, - 72, 247, 70, 70, 70, 70, 70, 70, 70, 250, - 72, 72, 72, 72, 72, 72, 72, 255, 70, 424, - 251, 70, 253, 70, 424, 424, 72, 252, 70, 72, - 424, 72, 256, 258, 70, 257, 72, 424, 254, 70, - 70, 70, 72, 259, 261, 262, 70, 72, 72, 72, - 260, 70, 70, 424, 72, 266, 263, 265, 70, 72, - 72, 70, 424, 70, 264, 70, 72, 70, 70, 72, - - 267, 72, 269, 72, 70, 72, 72, 268, 70, 424, - 270, 70, 72, 70, 272, 273, 72, 274, 70, 72, - 70, 72, 70, 275, 277, 70, 72, 276, 72, 280, - 72, 281, 70, 72, 70, 279, 70, 70, 424, 424, - 72, 278, 72, 70, 72, 72, 286, 284, 70, 70, - 70, 72, 424, 282, 70, 70, 72, 72, 72, 285, - 283, 424, 72, 72, 70, 70, 288, 70, 70, 290, - 70, 287, 72, 72, 70, 72, 72, 424, 72, 70, - 70, 291, 72, 70, 70, 289, 70, 72, 72, 70, - 424, 72, 72, 70, 72, 292, 70, 72, 293, 297, - - 70, 72, 70, 70, 72, 295, 294, 70, 72, 296, - 72, 72, 70, 70, 298, 72, 70, 424, 70, 70, - 72, 72, 70, 70, 72, 299, 72, 72, 70, 302, - 72, 72, 70, 424, 424, 424, 72, 424, 300, 70, - 72, 301, 306, 70, 424, 70, 303, 72, 304, 70, - 305, 72, 307, 72, 308, 70, 424, 72, 309, 424, - 70, 70, 312, 72, 311, 70, 70, 310, 72, 72, - 424, 70, 70, 72, 72, 70, 70, 70, 313, 72, - 72, 314, 424, 72, 72, 72, 70, 317, 70, 319, - 320, 424, 424, 70, 72, 315, 72, 70, 70, 321, - - 316, 72, 70, 318, 70, 72, 72, 70, 70, 70, - 72, 424, 72, 424, 424, 72, 72, 72, 424, 70, - 70, 323, 327, 70, 70, 70, 324, 72, 72, 424, - 329, 72, 72, 72, 70, 325, 328, 331, 70, 326, - 424, 70, 72, 70, 70, 70, 72, 332, 330, 72, - 70, 72, 72, 72, 335, 70, 424, 424, 72, 70, - 333, 70, 70, 72, 334, 336, 337, 72, 424, 72, - 72, 70, 70, 70, 70, 70, 338, 424, 70, 72, - 72, 72, 72, 72, 424, 340, 72, 70, 70, 341, - 339, 424, 343, 70, 70, 72, 72, 70, 424, 344, - - 70, 72, 72, 342, 70, 72, 348, 424, 72, 70, - 70, 70, 72, 70, 424, 346, 345, 72, 72, 72, - 70, 72, 347, 70, 424, 70, 349, 70, 72, 70, - 70, 72, 350, 72, 354, 72, 351, 72, 72, 352, - 356, 70, 353, 358, 355, 70, 70, 70, 70, 72, - 70, 357, 70, 72, 72, 72, 72, 70, 72, 70, - 72, 70, 70, 70, 70, 72, 70, 72, 359, 72, - 72, 72, 72, 70, 72, 424, 70, 424, 424, 361, - 70, 72, 70, 362, 72, 360, 365, 70, 72, 363, - 72, 366, 364, 70, 70, 72, 70, 424, 70, 70, - - 70, 72, 72, 70, 72, 367, 72, 72, 72, 70, - 368, 72, 424, 424, 70, 70, 70, 72, 424, 70, - 369, 370, 72, 72, 72, 424, 374, 72, 70, 371, - 70, 70, 424, 375, 70, 372, 72, 70, 72, 72, - 373, 70, 72, 376, 379, 72, 377, 70, 70, 72, - 70, 70, 424, 70, 70, 72, 72, 378, 72, 72, - 380, 72, 72, 70, 70, 70, 70, 383, 70, 70, - 382, 72, 72, 72, 72, 70, 72, 72, 70, 381, - 70, 70, 424, 72, 70, 70, 72, 70, 72, 72, - 387, 386, 72, 72, 384, 72, 385, 70, 424, 70, - - 70, 424, 70, 424, 389, 72, 388, 72, 72, 390, - 72, 70, 70, 70, 70, 392, 70, 424, 424, 72, - 72, 72, 72, 393, 72, 391, 396, 424, 70, 70, - 70, 70, 70, 70, 70, 394, 72, 72, 72, 72, - 72, 72, 72, 70, 398, 70, 70, 395, 70, 70, - 70, 72, 70, 72, 72, 424, 72, 72, 72, 424, - 72, 399, 403, 397, 404, 70, 70, 400, 70, 401, - 70, 424, 70, 72, 72, 70, 72, 70, 72, 405, - 72, 402, 70, 72, 424, 72, 424, 70, 70, 70, - 72, 70, 406, 424, 407, 72, 72, 72, 70, 72, - - 70, 412, 70, 424, 70, 70, 72, 424, 72, 410, - 72, 408, 72, 72, 70, 409, 424, 413, 414, 70, - 415, 70, 72, 70, 411, 70, 424, 72, 416, 72, - 70, 72, 424, 72, 419, 70, 424, 70, 72, 417, - 418, 424, 424, 72, 420, 72, 424, 424, 421, 424, - 424, 424, 424, 424, 424, 424, 422, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 423, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 60, 424, 60, 65, - - 65, 65, 71, 71, 424, 71, 126, 126, 126, 126, - 424, 126, 126, 126, 126, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 130, 130, 130, 424, 130, 130, - 130, 130, 130, 132, 424, 132, 132, 132, 132, 132, - 132, 132, 136, 424, 424, 424, 424, 424, 136, 72, - 72, 424, 72, 204, 424, 204, 9, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - 424, 424, 424 + 63, 70, 64, 72, 72, 72, 72, 122, 75, 72, + 84, 70, 76, 73, 85, 77, 135, 79, 74, 72, + 318, 80, 89, 268, 81, 71, 70, 82, 78, 90, + + 83, 86, 91, 87, 72, 92, 70, 70, 93, 70, + 94, 70, 201, 88, 72, 72, 127, 72, 95, 72, + 97, 128, 403, 96, 98, 103, 70, 403, 70, 100, + 99, 70, 101, 104, 72, 105, 72, 106, 102, 72, + 107, 109, 59, 59, 112, 70, 133, 113, 132, 70, + 110, 111, 108, 72, 117, 70, 114, 72, 70, 130, + 115, 118, 70, 72, 116, 134, 72, 70, 119, 70, + 70, 120, 403, 121, 123, 72, 70, 72, 72, 136, + 137, 124, 70, 127, 72, 139, 70, 70, 128, 70, + 72, 140, 70, 133, 72, 72, 138, 72, 141, 70, + + 72, 143, 149, 70, 70, 142, 70, 72, 132, 70, + 144, 72, 72, 130, 72, 151, 145, 72, 70, 69, + 146, 147, 66, 62, 152, 61, 72, 70, 148, 150, + 156, 153, 70, 154, 70, 72, 155, 70, 70, 70, + 72, 70, 72, 70, 157, 72, 72, 72, 70, 72, + 70, 72, 403, 163, 70, 58, 72, 159, 72, 70, + 158, 161, 72, 160, 58, 162, 70, 72, 164, 165, + 168, 70, 166, 167, 72, 70, 70, 70, 170, 72, + 70, 70, 169, 72, 72, 72, 70, 56, 72, 72, + 56, 54, 70, 173, 72, 172, 70, 70, 174, 171, + + 72, 178, 70, 70, 72, 72, 54, 70, 403, 175, + 72, 72, 403, 176, 181, 72, 179, 182, 70, 177, + 180, 70, 70, 184, 403, 70, 72, 186, 183, 72, + 72, 185, 188, 72, 190, 191, 70, 70, 70, 70, + 70, 187, 403, 189, 72, 72, 72, 72, 72, 192, + 70, 196, 403, 70, 70, 194, 70, 403, 72, 403, + 197, 72, 72, 198, 72, 195, 70, 199, 70, 70, + 70, 403, 193, 403, 72, 403, 72, 72, 72, 200, + 70, 203, 70, 204, 403, 403, 205, 70, 72, 206, + 72, 70, 207, 208, 70, 72, 209, 403, 70, 72, + + 70, 70, 72, 70, 403, 214, 72, 70, 72, 72, + 403, 72, 216, 70, 210, 72, 70, 70, 211, 212, + 220, 72, 213, 215, 72, 72, 217, 218, 221, 70, + 70, 70, 70, 219, 403, 403, 403, 72, 72, 72, + 72, 70, 223, 226, 222, 70, 224, 70, 70, 72, + 227, 403, 70, 72, 70, 72, 72, 70, 70, 225, + 72, 230, 72, 229, 70, 72, 72, 231, 228, 403, + 233, 70, 72, 235, 403, 70, 70, 236, 70, 72, + 234, 403, 232, 72, 72, 70, 72, 70, 70, 239, + 237, 403, 240, 72, 70, 72, 72, 403, 70, 238, + + 70, 243, 72, 403, 70, 241, 72, 70, 72, 242, + 70, 245, 72, 70, 70, 72, 246, 70, 72, 403, + 244, 72, 72, 70, 70, 72, 403, 247, 403, 70, + 70, 72, 72, 70, 250, 70, 252, 72, 72, 248, + 403, 72, 70, 72, 403, 70, 403, 403, 249, 70, + 72, 70, 251, 72, 255, 253, 70, 72, 70, 72, + 254, 258, 259, 403, 72, 256, 72, 403, 70, 403, + 70, 257, 70, 260, 70, 262, 72, 263, 72, 70, + 72, 261, 72, 70, 70, 70, 403, 72, 70, 70, + 403, 72, 72, 72, 266, 70, 72, 72, 265, 264, + + 70, 70, 267, 72, 70, 269, 270, 271, 72, 72, + 70, 403, 72, 70, 272, 70, 403, 274, 72, 273, + 70, 72, 277, 72, 278, 70, 70, 276, 72, 275, + 70, 403, 70, 72, 72, 70, 403, 70, 72, 281, + 72, 70, 70, 72, 283, 72, 70, 403, 279, 72, + 72, 403, 403, 280, 72, 282, 70, 70, 284, 285, + 286, 70, 70, 70, 72, 72, 70, 70, 70, 72, + 72, 72, 70, 287, 72, 72, 72, 70, 70, 403, + 72, 403, 70, 403, 70, 72, 72, 293, 70, 288, + 72, 289, 72, 291, 292, 70, 72, 70, 290, 70, + + 70, 70, 70, 72, 70, 72, 294, 72, 72, 72, + 72, 70, 72, 70, 70, 70, 70, 298, 70, 72, + 295, 72, 72, 72, 72, 70, 72, 296, 302, 70, + 297, 70, 403, 72, 403, 403, 304, 72, 303, 72, + 299, 300, 305, 301, 70, 403, 70, 70, 70, 70, + 70, 403, 72, 307, 72, 72, 72, 72, 72, 306, + 308, 70, 70, 70, 70, 309, 310, 70, 70, 72, + 72, 72, 72, 403, 70, 72, 72, 313, 311, 403, + 315, 316, 72, 403, 70, 70, 70, 317, 70, 70, + 312, 314, 72, 72, 72, 70, 72, 72, 70, 70, + + 70, 70, 70, 72, 403, 403, 72, 72, 72, 72, + 72, 323, 319, 325, 320, 70, 403, 70, 70, 403, + 403, 321, 403, 72, 322, 72, 72, 324, 326, 403, + 327, 70, 70, 70, 70, 70, 403, 328, 70, 72, + 72, 72, 72, 72, 329, 331, 72, 403, 70, 403, + 70, 70, 70, 70, 70, 332, 72, 330, 72, 72, + 72, 72, 72, 70, 70, 333, 335, 70, 70, 70, + 336, 72, 72, 403, 70, 72, 72, 72, 70, 334, + 339, 338, 72, 70, 403, 70, 72, 70, 403, 403, + 70, 72, 337, 72, 343, 72, 341, 340, 72, 70, + + 70, 403, 70, 70, 70, 70, 342, 72, 72, 344, + 72, 72, 72, 72, 349, 345, 403, 403, 403, 70, + 403, 70, 70, 70, 350, 346, 348, 72, 347, 72, + 72, 72, 351, 70, 70, 353, 70, 70, 70, 70, + 403, 72, 72, 352, 72, 72, 72, 72, 70, 70, + 354, 70, 70, 70, 70, 70, 72, 72, 403, 72, + 72, 72, 72, 72, 70, 403, 356, 70, 70, 403, + 70, 403, 72, 355, 357, 72, 72, 360, 72, 358, + 70, 361, 359, 403, 70, 70, 70, 70, 72, 70, + 70, 362, 72, 72, 72, 72, 70, 72, 72, 70, + + 403, 70, 403, 70, 72, 70, 70, 72, 364, 72, + 363, 72, 368, 72, 72, 70, 366, 403, 365, 70, + 369, 70, 403, 72, 70, 367, 403, 72, 370, 72, + 371, 70, 72, 70, 373, 70, 70, 403, 403, 72, + 70, 72, 70, 72, 72, 372, 374, 70, 72, 70, + 72, 403, 403, 70, 70, 72, 70, 72, 70, 376, + 377, 72, 72, 70, 72, 70, 72, 70, 375, 403, + 70, 72, 403, 72, 70, 72, 403, 380, 72, 70, + 379, 70, 72, 70, 378, 403, 70, 72, 70, 72, + 403, 72, 70, 381, 72, 403, 72, 403, 382, 70, + + 72, 70, 70, 383, 403, 385, 70, 72, 70, 72, + 72, 386, 384, 70, 72, 70, 72, 70, 389, 70, + 70, 72, 403, 72, 387, 72, 70, 72, 72, 70, + 390, 70, 70, 70, 72, 70, 388, 72, 403, 72, + 72, 72, 70, 72, 70, 70, 395, 403, 391, 70, + 72, 403, 72, 72, 70, 393, 70, 72, 396, 392, + 70, 70, 72, 70, 72, 70, 70, 394, 72, 72, + 70, 72, 70, 72, 72, 400, 397, 403, 72, 401, + 72, 403, 403, 403, 399, 403, 403, 403, 403, 403, + 398, 403, 403, 403, 403, 403, 402, 53, 53, 53, + + 53, 53, 53, 53, 53, 53, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 60, 403, 60, 65, 65, 65, + 71, 71, 403, 71, 125, 125, 125, 125, 403, 125, + 125, 125, 125, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 129, 129, 129, 403, 129, 129, 129, 129, + 129, 131, 403, 131, 131, 131, 131, 131, 131, 131, + 135, 403, 403, 403, 403, 403, 135, 72, 72, 403, + 72, 202, 403, 202, 9, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 403 } ; -static yyconst flex_int16_t yy_chk[1414] = +static yyconst flex_int16_t yy_chk[1342] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -749,161 +727,153 @@ static yyconst flex_int16_t yy_chk[1414] = 1, 1, 1, 1, 1, 1, 11, 11, 12, 12, 25, 32, 25, 28, 28, 33, 38, 35, 49, 32, 64, 34, 64, 33, 38, 35, 49, 49, 33, 34, - 35, 36, 33, 32, 35, 33, 322, 34, 32, 36, - 35, 34, 37, 271, 34, 37, 39, 34, 33, 37, + 35, 36, 33, 32, 35, 33, 318, 34, 32, 36, + 268, 34, 37, 201, 34, 37, 39, 34, 33, 37, 34, 36, 37, 36, 39, 37, 41, 40, 37, 42, - 39, 43, 203, 36, 41, 40, 54, 42, 39, 43, - 40, 54, 127, 39, 40, 43, 44, 127, 45, 41, + 39, 43, 134, 36, 41, 40, 54, 42, 39, 43, + 40, 54, 126, 39, 40, 43, 44, 126, 45, 41, 40, 46, 42, 43, 44, 43, 45, 43, 42, 46, - 43, 45, 59, 59, 46, 47, 135, 46, 134, 48, - 45, 45, 44, 47, 47, 71, 46, 48, 50, 133, - 46, 47, 131, 71, 46, 72, 50, 73, 47, 74, - 75, 48, 70, 48, 50, 73, 76, 74, 75, 73, - 74, 50, 77, 128, 76, 75, 78, 80, 128, 82, - 77, 76, 79, 65, 78, 80, 74, 82, 76, 81, - - 79, 79, 82, 83, 84, 77, 85, 81, 63, 86, - 80, 83, 84, 58, 85, 84, 80, 86, 87, 56, - 81, 81, 86, 30, 84, 26, 87, 88, 81, 83, - 89, 84, 90, 85, 91, 88, 92, 24, 89, 88, - 90, 93, 91, 94, 92, 87, 95, 89, 97, 93, - 98, 94, 23, 9, 95, 96, 97, 91, 98, 8, - 90, 99, 92, 96, 93, 94, 100, 96, 102, 99, - 103, 104, 98, 101, 100, 7, 102, 100, 103, 104, - 99, 101, 96, 96, 105, 101, 106, 108, 6, 100, - 103, 5, 105, 107, 106, 108, 102, 4, 110, 106, - - 109, 107, 111, 3, 112, 107, 110, 110, 109, 0, - 111, 113, 112, 115, 111, 108, 0, 109, 0, 113, - 114, 115, 110, 109, 112, 0, 110, 0, 114, 114, - 116, 113, 0, 115, 117, 112, 118, 119, 116, 113, - 116, 120, 117, 0, 118, 119, 118, 121, 122, 120, - 119, 116, 0, 0, 124, 121, 122, 123, 125, 0, - 122, 117, 124, 0, 121, 123, 125, 124, 0, 0, - 137, 124, 138, 139, 121, 140, 120, 123, 137, 141, - 138, 139, 142, 140, 125, 144, 139, 141, 0, 143, - 142, 142, 140, 144, 145, 146, 141, 143, 148, 143, - - 143, 0, 145, 146, 147, 149, 148, 150, 0, 148, - 151, 144, 147, 149, 0, 150, 150, 0, 151, 0, - 0, 145, 146, 152, 154, 147, 153, 149, 147, 0, - 155, 152, 154, 156, 153, 154, 151, 151, 155, 153, - 157, 156, 158, 152, 159, 0, 161, 0, 157, 0, - 158, 160, 159, 157, 161, 161, 162, 157, 155, 160, - 156, 163, 160, 164, 162, 165, 0, 166, 167, 163, - 0, 164, 159, 165, 164, 166, 167, 168, 165, 170, - 166, 167, 163, 0, 0, 168, 169, 170, 171, 172, - 0, 167, 168, 173, 169, 166, 171, 172, 170, 169, - - 174, 173, 172, 175, 0, 176, 177, 173, 174, 178, - 0, 175, 171, 176, 177, 179, 180, 178, 176, 181, - 174, 182, 183, 179, 180, 175, 179, 181, 180, 182, - 183, 178, 184, 185, 186, 187, 188, 189, 190, 181, - 184, 185, 186, 187, 188, 189, 190, 186, 191, 0, - 182, 192, 184, 193, 0, 0, 191, 183, 194, 192, - 0, 193, 188, 192, 195, 190, 194, 0, 185, 196, - 197, 199, 195, 193, 195, 195, 198, 196, 197, 199, - 194, 200, 201, 0, 198, 198, 195, 197, 205, 200, - 201, 202, 0, 206, 196, 207, 205, 208, 209, 202, - - 199, 206, 201, 207, 211, 208, 209, 200, 210, 0, - 202, 212, 211, 213, 205, 206, 210, 207, 214, 212, - 215, 213, 216, 208, 212, 217, 214, 210, 215, 215, - 216, 216, 218, 217, 219, 214, 220, 221, 0, 0, - 218, 213, 219, 222, 220, 221, 221, 219, 223, 224, - 225, 222, 0, 217, 226, 227, 223, 224, 225, 220, - 218, 0, 226, 227, 228, 229, 224, 230, 231, 227, - 232, 222, 228, 229, 233, 230, 231, 0, 232, 234, - 237, 229, 233, 235, 236, 225, 238, 234, 237, 239, - 0, 235, 236, 240, 238, 230, 241, 239, 232, 236, - - 242, 240, 243, 244, 241, 234, 233, 245, 242, 235, - 243, 244, 246, 247, 238, 245, 248, 0, 249, 250, - 246, 247, 251, 252, 248, 243, 249, 250, 254, 248, - 251, 252, 253, 0, 0, 0, 254, 0, 246, 257, - 253, 247, 253, 255, 0, 256, 250, 257, 251, 259, - 252, 255, 254, 256, 255, 258, 0, 259, 256, 0, - 260, 261, 259, 258, 258, 262, 263, 257, 260, 261, - 0, 264, 265, 262, 263, 266, 267, 268, 261, 264, - 265, 262, 0, 266, 267, 268, 269, 265, 270, 267, - 268, 0, 0, 272, 269, 263, 270, 273, 274, 269, - - 264, 272, 275, 266, 276, 273, 274, 277, 279, 278, - 275, 0, 276, 0, 0, 277, 279, 278, 0, 280, - 281, 272, 278, 282, 283, 284, 274, 280, 281, 0, - 280, 282, 283, 284, 285, 275, 279, 283, 286, 276, - 0, 287, 285, 288, 289, 290, 286, 284, 281, 287, - 291, 288, 289, 290, 287, 292, 0, 0, 291, 293, - 285, 294, 295, 292, 286, 288, 289, 293, 0, 294, - 295, 296, 297, 298, 299, 300, 293, 0, 301, 296, - 297, 298, 299, 300, 0, 297, 301, 302, 303, 298, - 295, 0, 301, 304, 305, 302, 303, 306, 0, 302, - - 307, 304, 305, 299, 308, 306, 306, 0, 307, 309, - 310, 311, 308, 312, 0, 304, 303, 309, 310, 311, - 313, 312, 305, 315, 0, 314, 307, 316, 313, 317, - 318, 315, 308, 314, 314, 316, 310, 317, 318, 311, - 316, 319, 313, 318, 315, 320, 321, 323, 324, 319, - 325, 317, 326, 320, 321, 323, 324, 327, 325, 328, - 326, 329, 330, 331, 332, 327, 333, 328, 319, 329, - 330, 331, 332, 334, 333, 0, 335, 0, 0, 326, - 336, 334, 337, 327, 335, 325, 334, 338, 336, 329, - 337, 336, 332, 339, 340, 338, 341, 0, 343, 342, - - 344, 339, 340, 346, 341, 337, 343, 342, 344, 345, - 338, 346, 0, 0, 347, 348, 349, 345, 0, 350, - 340, 342, 347, 348, 349, 0, 348, 350, 351, 344, - 352, 354, 0, 349, 355, 345, 351, 353, 352, 354, - 347, 356, 355, 352, 355, 353, 353, 357, 358, 356, - 359, 360, 0, 361, 362, 357, 358, 354, 359, 360, - 357, 361, 362, 363, 364, 365, 366, 362, 367, 368, - 361, 363, 364, 365, 366, 369, 367, 368, 370, 360, - 371, 372, 0, 369, 373, 374, 370, 375, 371, 372, - 370, 368, 373, 374, 366, 375, 367, 376, 0, 377, - - 378, 0, 379, 0, 374, 376, 371, 377, 378, 375, - 379, 380, 381, 382, 383, 379, 384, 0, 0, 380, - 381, 382, 383, 380, 384, 377, 383, 0, 385, 386, - 387, 388, 389, 390, 391, 381, 385, 386, 387, 388, - 389, 390, 391, 392, 388, 393, 394, 382, 396, 395, - 397, 392, 398, 393, 394, 0, 396, 395, 397, 0, - 398, 390, 395, 385, 397, 399, 400, 391, 401, 392, - 402, 0, 403, 399, 400, 405, 401, 404, 402, 399, - 403, 394, 406, 405, 0, 404, 0, 407, 408, 409, - 406, 410, 402, 0, 404, 407, 408, 409, 413, 410, - - 411, 410, 414, 0, 415, 412, 413, 0, 411, 408, - 414, 406, 415, 412, 416, 407, 0, 411, 412, 417, - 413, 418, 416, 419, 409, 420, 0, 417, 414, 418, - 421, 419, 0, 420, 418, 422, 0, 423, 421, 415, - 417, 0, 0, 422, 419, 423, 0, 0, 420, 0, - 0, 0, 0, 0, 0, 0, 421, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 422, 425, - 425, 425, 425, 425, 425, 425, 425, 425, 426, 426, - 426, 426, 426, 426, 426, 426, 426, 427, 427, 427, - 427, 427, 427, 427, 427, 427, 428, 0, 428, 429, - - 429, 429, 430, 430, 0, 430, 431, 431, 431, 431, - 0, 431, 431, 431, 431, 432, 432, 432, 432, 432, - 432, 432, 432, 432, 433, 433, 433, 0, 433, 433, - 433, 433, 433, 434, 0, 434, 434, 434, 434, 434, - 434, 434, 435, 0, 0, 0, 0, 0, 435, 436, - 436, 0, 436, 437, 0, 437, 424, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - 424, 424, 424 + 43, 45, 59, 59, 46, 47, 133, 46, 132, 48, + 45, 45, 44, 47, 47, 71, 46, 48, 50, 130, + 46, 47, 72, 71, 46, 70, 50, 73, 47, 74, + 75, 48, 65, 48, 50, 73, 76, 74, 75, 73, + 74, 50, 77, 127, 76, 75, 78, 80, 127, 82, + 77, 76, 79, 63, 78, 80, 74, 82, 76, 81, + + 79, 79, 82, 83, 84, 77, 85, 81, 58, 86, + 80, 83, 84, 56, 85, 84, 80, 86, 87, 30, + 81, 81, 26, 24, 84, 23, 87, 88, 81, 83, + 87, 84, 89, 85, 90, 88, 86, 91, 92, 94, + 89, 95, 90, 93, 88, 91, 92, 94, 96, 95, + 97, 93, 9, 95, 98, 8, 96, 90, 97, 99, + 89, 92, 98, 91, 7, 93, 100, 99, 95, 95, + 99, 101, 97, 98, 100, 102, 103, 104, 100, 101, + 105, 107, 99, 102, 103, 104, 106, 6, 105, 107, + 5, 4, 109, 105, 106, 102, 108, 111, 106, 101, + + 109, 109, 110, 112, 108, 111, 3, 116, 0, 107, + 110, 112, 0, 108, 110, 116, 109, 111, 113, 108, + 109, 114, 115, 112, 0, 117, 113, 113, 111, 114, + 115, 112, 115, 117, 116, 117, 118, 119, 120, 121, + 122, 114, 0, 115, 118, 119, 120, 121, 122, 118, + 123, 121, 0, 124, 136, 120, 137, 0, 123, 0, + 122, 124, 136, 123, 137, 120, 139, 123, 138, 140, + 143, 0, 119, 0, 139, 0, 138, 140, 143, 124, + 141, 138, 142, 139, 0, 0, 140, 144, 141, 141, + 142, 145, 142, 142, 147, 144, 143, 0, 146, 145, + + 150, 148, 147, 149, 0, 147, 146, 152, 150, 148, + 0, 149, 149, 151, 144, 152, 154, 153, 145, 146, + 152, 151, 146, 148, 154, 153, 150, 150, 153, 155, + 156, 157, 158, 151, 0, 0, 0, 155, 156, 157, + 158, 159, 155, 158, 154, 160, 155, 161, 163, 159, + 159, 0, 162, 160, 164, 161, 163, 165, 166, 157, + 162, 163, 164, 162, 167, 165, 166, 164, 161, 0, + 165, 168, 167, 166, 0, 169, 170, 167, 171, 168, + 165, 0, 164, 169, 170, 172, 171, 173, 174, 170, + 168, 0, 171, 172, 175, 173, 174, 0, 176, 169, + + 177, 174, 175, 0, 178, 172, 176, 179, 177, 173, + 180, 177, 178, 181, 182, 179, 178, 183, 180, 0, + 176, 181, 182, 184, 185, 183, 0, 179, 0, 186, + 187, 184, 185, 188, 182, 189, 184, 186, 187, 180, + 0, 188, 190, 189, 0, 191, 0, 0, 181, 192, + 190, 193, 183, 191, 190, 186, 194, 192, 195, 193, + 188, 193, 193, 0, 194, 191, 195, 0, 196, 0, + 197, 192, 198, 193, 199, 195, 196, 196, 197, 203, + 198, 194, 199, 200, 204, 205, 0, 203, 206, 207, + 0, 200, 204, 205, 199, 209, 206, 207, 198, 197, + + 208, 211, 200, 209, 210, 203, 204, 205, 208, 211, + 212, 0, 210, 213, 206, 214, 0, 210, 212, 208, + 215, 213, 213, 214, 214, 216, 217, 212, 215, 211, + 220, 0, 218, 216, 217, 219, 0, 221, 220, 217, + 218, 223, 222, 219, 219, 221, 224, 0, 215, 223, + 222, 0, 0, 216, 224, 218, 225, 226, 220, 222, + 224, 227, 228, 229, 225, 226, 230, 231, 232, 227, + 228, 229, 233, 226, 230, 231, 232, 234, 235, 0, + 233, 0, 236, 0, 237, 234, 235, 233, 238, 227, + 236, 229, 237, 231, 232, 239, 238, 240, 230, 241, + + 242, 243, 244, 239, 245, 240, 235, 241, 242, 243, + 244, 246, 245, 247, 251, 248, 249, 245, 250, 246, + 240, 247, 251, 248, 249, 252, 250, 243, 250, 253, + 244, 254, 0, 252, 0, 0, 252, 253, 251, 254, + 247, 248, 253, 249, 255, 0, 257, 256, 258, 260, + 259, 0, 255, 255, 257, 256, 258, 260, 259, 254, + 256, 261, 262, 263, 267, 258, 259, 264, 265, 261, + 262, 263, 267, 0, 266, 264, 265, 262, 260, 0, + 264, 265, 266, 0, 269, 270, 271, 266, 272, 273, + 261, 263, 269, 270, 271, 274, 272, 273, 275, 276, + + 278, 279, 277, 274, 0, 0, 275, 276, 278, 279, + 277, 275, 269, 277, 271, 281, 0, 280, 282, 0, + 0, 272, 0, 281, 273, 280, 282, 276, 278, 0, + 280, 283, 284, 285, 286, 287, 0, 281, 288, 283, + 284, 285, 286, 287, 282, 284, 288, 0, 289, 0, + 290, 291, 292, 293, 294, 285, 289, 283, 290, 291, + 292, 293, 294, 295, 296, 289, 293, 297, 298, 299, + 294, 295, 296, 0, 300, 297, 298, 299, 301, 291, + 298, 297, 300, 303, 0, 302, 301, 304, 0, 0, + 305, 303, 295, 302, 302, 304, 300, 299, 305, 306, + + 307, 0, 308, 311, 309, 310, 301, 306, 307, 303, + 308, 311, 309, 310, 310, 304, 0, 0, 0, 312, + 0, 313, 314, 315, 311, 306, 309, 312, 307, 313, + 314, 315, 312, 316, 317, 314, 319, 320, 321, 322, + 0, 316, 317, 313, 319, 320, 321, 322, 323, 324, + 315, 325, 326, 327, 328, 329, 323, 324, 0, 325, + 326, 327, 328, 329, 330, 0, 322, 331, 333, 0, + 332, 0, 330, 321, 323, 331, 333, 330, 332, 325, + 334, 332, 328, 0, 335, 336, 337, 338, 334, 339, + 340, 333, 335, 336, 337, 338, 341, 339, 340, 342, + + 0, 343, 0, 344, 341, 345, 346, 342, 337, 343, + 335, 344, 343, 345, 346, 347, 340, 0, 339, 349, + 344, 348, 0, 347, 350, 342, 0, 349, 347, 348, + 348, 351, 350, 352, 350, 353, 354, 0, 0, 351, + 355, 352, 356, 353, 354, 349, 352, 357, 355, 358, + 356, 0, 0, 359, 360, 357, 361, 358, 362, 356, + 357, 359, 360, 363, 361, 364, 362, 365, 355, 0, + 366, 363, 0, 364, 367, 365, 0, 364, 366, 368, + 362, 369, 367, 370, 361, 0, 371, 368, 372, 369, + 0, 370, 373, 365, 371, 0, 372, 0, 368, 374, + + 373, 375, 376, 369, 0, 373, 377, 374, 378, 375, + 376, 374, 371, 379, 377, 380, 378, 381, 377, 382, + 383, 379, 0, 380, 375, 381, 384, 382, 383, 385, + 381, 386, 387, 388, 384, 389, 376, 385, 0, 386, + 387, 388, 390, 389, 391, 392, 388, 0, 383, 393, + 390, 0, 391, 392, 394, 385, 395, 393, 391, 384, + 396, 397, 394, 398, 395, 399, 400, 387, 396, 397, + 401, 398, 402, 399, 400, 399, 394, 0, 401, 400, + 402, 0, 0, 0, 398, 0, 0, 0, 0, 0, + 397, 0, 0, 0, 0, 0, 401, 404, 404, 404, + + 404, 404, 404, 404, 404, 404, 405, 405, 405, 405, + 405, 405, 405, 405, 405, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 407, 0, 407, 408, 408, 408, + 409, 409, 0, 409, 410, 410, 410, 410, 0, 410, + 410, 410, 410, 411, 411, 411, 411, 411, 411, 411, + 411, 411, 412, 412, 412, 0, 412, 412, 412, 412, + 412, 413, 0, 413, 413, 413, 413, 413, 413, 413, + 414, 0, 0, 0, 0, 0, 414, 415, 415, 0, + 415, 416, 0, 416, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 403 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int yy_flex_debug; -int yy_flex_debug = 0; + +static int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -912,11 +882,12 @@ int yy_flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *yytext; +static char *yytext; #line 1 "pars0lex.l" /***************************************************************************** -Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -951,7 +922,7 @@ Created 12/14/1997 Heikki Tuuri *******************************************************/ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 -#line 53 "pars0lex.l" +#line 54 "pars0lex.l" #define YYSTYPE que_node_t* #include "univ.i" @@ -1003,7 +974,7 @@ string_append( -#line 1006 "lexyy.cc" +#line 977 "lexyy.cc" #define INITIAL 0 #define comment 1 @@ -1029,29 +1000,29 @@ static int yy_init_globals (void ); MY_ATTRIBUTE((unused)) static int yylex_destroy (void ); -int yyget_debug (void ); +MY_ATTRIBUTE((unused)) static int yyget_debug (void ); -void yyset_debug (int debug_flag ); +MY_ATTRIBUTE((unused)) static void yyset_debug (int debug_flag ); YY_EXTRA_TYPE yyget_extra (void ); -void yyset_extra (YY_EXTRA_TYPE user_defined ); -FILE *yyget_in (void ); -void yyset_in (FILE * in_str ); +MY_ATTRIBUTE((unused)) static FILE *yyget_in (void ); + +MY_ATTRIBUTE((unused)) static void yyset_in (FILE * _in_str ); -FILE *yyget_out (void ); +MY_ATTRIBUTE((unused)) static FILE *yyget_out (void ); -void yyset_out (FILE * out_str ); +MY_ATTRIBUTE((unused)) static void yyset_out (FILE * _out_str ); -yy_size_t yyget_leng (void ); + MY_ATTRIBUTE((unused)) static int yyget_leng (void ); -char *yyget_text (void ); +MY_ATTRIBUTE((unused)) static char *yyget_text (void ); -int yyget_lineno (void ); +MY_ATTRIBUTE((unused)) static int yyget_lineno (void ); -void yyset_lineno (int line_number ); +MY_ATTRIBUTE((unused)) static void yyset_lineno (int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1065,6 +1036,10 @@ extern int yywrap (void ); #endif #endif +#ifndef YY_NO_UNPUT + +#endif + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -1098,7 +1073,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1122,7 +1097,7 @@ static int input (void ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -1177,7 +1152,7 @@ extern int yylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -1187,15 +1162,10 @@ extern int yylex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 112 "pars0lex.l" - - -#line 1197 "lexyy.cc" - + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + if ( !(yy_init) ) { (yy_init) = 1; @@ -1222,7 +1192,13 @@ YY_DECL yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 113 "pars0lex.l" + + +#line 1199 "lexyy.cc" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -1238,7 +1214,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1247,13 +1223,13 @@ YY_DECL while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 425 ) + if ( yy_current_state >= 404 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; ++yy_cp; } - while ( yy_current_state != 424 ); + while ( yy_current_state != 403 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -1275,7 +1251,7 @@ YY_DECL case 1: YY_RULE_SETUP -#line 114 "pars0lex.l" +#line 115 "pars0lex.l" { yylval = sym_tab_add_int_lit(pars_sym_tab_global, atoi(yytext)); @@ -1284,7 +1260,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 120 "pars0lex.l" +#line 121 "pars0lex.l" { ut_error; /* not implemented */ @@ -1293,7 +1269,7 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 126 "pars0lex.l" +#line 127 "pars0lex.l" { ulint type; @@ -1305,7 +1281,7 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 135 "pars0lex.l" +#line 136 "pars0lex.l" { yylval = sym_tab_add_bound_id(pars_sym_tab_global, yytext + 1); @@ -1315,7 +1291,7 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 142 "pars0lex.l" +#line 143 "pars0lex.l" { /* Quoted character string literals are handled in an explicit start state 'quoted'. This state is entered and the buffer for @@ -1329,7 +1305,7 @@ In the state 'quoted', only two actions are possible (defined below). */ case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 151 "pars0lex.l" +#line 152 "pars0lex.l" { /* Got a sequence of characters other than "'": append to string buffer */ @@ -1338,7 +1314,7 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 156 "pars0lex.l" +#line 157 "pars0lex.l" { /* Got a sequence of "'" characters: append half of them to string buffer, @@ -1365,7 +1341,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 180 "pars0lex.l" +#line 181 "pars0lex.l" { /* Quoted identifiers are handled in an explicit start state 'id'. This state is entered and the buffer for the scanned string is emptied @@ -1379,7 +1355,7 @@ In the state 'id', only two actions are possible (defined below). */ case 9: /* rule 9 can match eol */ YY_RULE_SETUP -#line 189 "pars0lex.l" +#line 190 "pars0lex.l" { /* Got a sequence of characters other than '"': append to string buffer */ @@ -1388,7 +1364,7 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 194 "pars0lex.l" +#line 195 "pars0lex.l" { /* Got a sequence of '"' characters: append half of them to string buffer, @@ -1416,7 +1392,7 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 219 "pars0lex.l" +#line 220 "pars0lex.l" { yylval = sym_tab_add_null_lit(pars_sym_tab_global); @@ -1425,7 +1401,7 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 225 "pars0lex.l" +#line 226 "pars0lex.l" { /* Implicit cursor name */ yylval = sym_tab_add_str_lit(pars_sym_tab_global, @@ -1435,643 +1411,644 @@ YY_RULE_SETUP YY_BREAK case 13: YY_RULE_SETUP -#line 232 "pars0lex.l" +#line 233 "pars0lex.l" { return(PARS_AND_TOKEN); } YY_BREAK case 14: YY_RULE_SETUP -#line 236 "pars0lex.l" +#line 237 "pars0lex.l" { return(PARS_OR_TOKEN); } YY_BREAK case 15: YY_RULE_SETUP -#line 240 "pars0lex.l" +#line 241 "pars0lex.l" { return(PARS_NOT_TOKEN); } YY_BREAK case 16: YY_RULE_SETUP -#line 244 "pars0lex.l" +#line 245 "pars0lex.l" { return(PARS_PROCEDURE_TOKEN); } YY_BREAK case 17: YY_RULE_SETUP -#line 248 "pars0lex.l" +#line 249 "pars0lex.l" { return(PARS_IN_TOKEN); } YY_BREAK case 18: YY_RULE_SETUP -#line 252 "pars0lex.l" +#line 253 "pars0lex.l" { return(PARS_OUT_TOKEN); } YY_BREAK case 19: YY_RULE_SETUP -#line 256 "pars0lex.l" +#line 257 "pars0lex.l" { return(PARS_BINARY_TOKEN); } YY_BREAK case 20: YY_RULE_SETUP -#line 260 "pars0lex.l" +#line 261 "pars0lex.l" { return(PARS_BLOB_TOKEN); } YY_BREAK case 21: YY_RULE_SETUP -#line 264 "pars0lex.l" +#line 265 "pars0lex.l" { return(PARS_INT_TOKEN); } YY_BREAK case 22: YY_RULE_SETUP -#line 268 "pars0lex.l" +#line 269 "pars0lex.l" { return(PARS_INT_TOKEN); } YY_BREAK case 23: YY_RULE_SETUP -#line 272 "pars0lex.l" +#line 273 "pars0lex.l" { return(PARS_FLOAT_TOKEN); } YY_BREAK case 24: YY_RULE_SETUP -#line 276 "pars0lex.l" +#line 277 "pars0lex.l" { return(PARS_CHAR_TOKEN); } YY_BREAK case 25: YY_RULE_SETUP -#line 280 "pars0lex.l" +#line 281 "pars0lex.l" { return(PARS_IS_TOKEN); } YY_BREAK case 26: YY_RULE_SETUP -#line 284 "pars0lex.l" +#line 285 "pars0lex.l" { return(PARS_BEGIN_TOKEN); } YY_BREAK case 27: YY_RULE_SETUP -#line 288 "pars0lex.l" +#line 289 "pars0lex.l" { return(PARS_END_TOKEN); } YY_BREAK case 28: YY_RULE_SETUP -#line 292 "pars0lex.l" +#line 293 "pars0lex.l" { return(PARS_IF_TOKEN); } YY_BREAK case 29: YY_RULE_SETUP -#line 296 "pars0lex.l" +#line 297 "pars0lex.l" { return(PARS_THEN_TOKEN); } YY_BREAK case 30: YY_RULE_SETUP -#line 300 "pars0lex.l" +#line 301 "pars0lex.l" { return(PARS_ELSE_TOKEN); } YY_BREAK case 31: YY_RULE_SETUP -#line 304 "pars0lex.l" +#line 305 "pars0lex.l" { return(PARS_ELSIF_TOKEN); } YY_BREAK case 32: YY_RULE_SETUP -#line 308 "pars0lex.l" +#line 309 "pars0lex.l" { return(PARS_LOOP_TOKEN); } YY_BREAK case 33: YY_RULE_SETUP -#line 312 "pars0lex.l" +#line 313 "pars0lex.l" { return(PARS_WHILE_TOKEN); } YY_BREAK case 34: YY_RULE_SETUP -#line 316 "pars0lex.l" +#line 317 "pars0lex.l" { return(PARS_RETURN_TOKEN); } YY_BREAK case 35: YY_RULE_SETUP -#line 320 "pars0lex.l" +#line 321 "pars0lex.l" { return(PARS_SELECT_TOKEN); } YY_BREAK case 36: YY_RULE_SETUP -#line 324 "pars0lex.l" +#line 325 "pars0lex.l" { return(PARS_SUM_TOKEN); } YY_BREAK case 37: YY_RULE_SETUP -#line 328 "pars0lex.l" +#line 329 "pars0lex.l" { return(PARS_COUNT_TOKEN); } YY_BREAK case 38: YY_RULE_SETUP -#line 332 "pars0lex.l" +#line 333 "pars0lex.l" { return(PARS_DISTINCT_TOKEN); } YY_BREAK case 39: YY_RULE_SETUP -#line 336 "pars0lex.l" +#line 337 "pars0lex.l" { return(PARS_FROM_TOKEN); } YY_BREAK case 40: YY_RULE_SETUP -#line 340 "pars0lex.l" +#line 341 "pars0lex.l" { return(PARS_WHERE_TOKEN); } YY_BREAK case 41: YY_RULE_SETUP -#line 344 "pars0lex.l" +#line 345 "pars0lex.l" { return(PARS_FOR_TOKEN); } YY_BREAK case 42: YY_RULE_SETUP -#line 348 "pars0lex.l" +#line 349 "pars0lex.l" { return(PARS_READ_TOKEN); } YY_BREAK case 43: YY_RULE_SETUP -#line 352 "pars0lex.l" +#line 353 "pars0lex.l" { return(PARS_ORDER_TOKEN); } YY_BREAK case 44: YY_RULE_SETUP -#line 356 "pars0lex.l" +#line 357 "pars0lex.l" { return(PARS_BY_TOKEN); } YY_BREAK case 45: YY_RULE_SETUP -#line 360 "pars0lex.l" +#line 361 "pars0lex.l" { return(PARS_ASC_TOKEN); } YY_BREAK case 46: YY_RULE_SETUP -#line 364 "pars0lex.l" +#line 365 "pars0lex.l" { return(PARS_DESC_TOKEN); } YY_BREAK case 47: YY_RULE_SETUP -#line 368 "pars0lex.l" +#line 369 "pars0lex.l" { return(PARS_INSERT_TOKEN); } YY_BREAK case 48: YY_RULE_SETUP -#line 372 "pars0lex.l" +#line 373 "pars0lex.l" { return(PARS_INTO_TOKEN); } YY_BREAK case 49: YY_RULE_SETUP -#line 376 "pars0lex.l" +#line 377 "pars0lex.l" { return(PARS_VALUES_TOKEN); } YY_BREAK case 50: YY_RULE_SETUP -#line 380 "pars0lex.l" +#line 381 "pars0lex.l" { return(PARS_UPDATE_TOKEN); } YY_BREAK case 51: YY_RULE_SETUP -#line 384 "pars0lex.l" +#line 385 "pars0lex.l" { return(PARS_SET_TOKEN); } YY_BREAK case 52: YY_RULE_SETUP -#line 388 "pars0lex.l" +#line 389 "pars0lex.l" { return(PARS_DELETE_TOKEN); } YY_BREAK case 53: YY_RULE_SETUP -#line 392 "pars0lex.l" +#line 393 "pars0lex.l" { return(PARS_CURRENT_TOKEN); } YY_BREAK case 54: YY_RULE_SETUP -#line 396 "pars0lex.l" +#line 397 "pars0lex.l" { return(PARS_OF_TOKEN); } YY_BREAK case 55: YY_RULE_SETUP -#line 400 "pars0lex.l" +#line 401 "pars0lex.l" { return(PARS_CREATE_TOKEN); } YY_BREAK case 56: YY_RULE_SETUP -#line 404 "pars0lex.l" +#line 405 "pars0lex.l" { return(PARS_TABLE_TOKEN); } YY_BREAK case 57: YY_RULE_SETUP -#line 408 "pars0lex.l" +#line 409 "pars0lex.l" { return(PARS_COMPACT_TOKEN); } YY_BREAK case 58: YY_RULE_SETUP -#line 412 "pars0lex.l" +#line 413 "pars0lex.l" { return(PARS_BLOCK_SIZE_TOKEN); } YY_BREAK case 59: YY_RULE_SETUP -#line 416 "pars0lex.l" +#line 417 "pars0lex.l" { return(PARS_INDEX_TOKEN); } YY_BREAK case 60: YY_RULE_SETUP -#line 420 "pars0lex.l" +#line 421 "pars0lex.l" { return(PARS_UNIQUE_TOKEN); } YY_BREAK case 61: YY_RULE_SETUP -#line 424 "pars0lex.l" +#line 425 "pars0lex.l" { return(PARS_CLUSTERED_TOKEN); } YY_BREAK case 62: YY_RULE_SETUP -#line 428 "pars0lex.l" +#line 429 "pars0lex.l" { - return(PARS_DOES_NOT_FIT_IN_MEM_TOKEN); + return(PARS_ON_TOKEN); } YY_BREAK case 63: YY_RULE_SETUP -#line 432 "pars0lex.l" +#line 433 "pars0lex.l" { - return(PARS_ON_TOKEN); + return(PARS_DECLARE_TOKEN); } YY_BREAK case 64: YY_RULE_SETUP -#line 436 "pars0lex.l" +#line 437 "pars0lex.l" { - return(PARS_DECLARE_TOKEN); + return(PARS_CURSOR_TOKEN); } YY_BREAK case 65: YY_RULE_SETUP -#line 440 "pars0lex.l" +#line 441 "pars0lex.l" { - return(PARS_CURSOR_TOKEN); + return(PARS_OPEN_TOKEN); } YY_BREAK case 66: YY_RULE_SETUP -#line 444 "pars0lex.l" +#line 445 "pars0lex.l" { - return(PARS_OPEN_TOKEN); + return(PARS_FETCH_TOKEN); } YY_BREAK case 67: YY_RULE_SETUP -#line 448 "pars0lex.l" +#line 449 "pars0lex.l" { - return(PARS_FETCH_TOKEN); + return(PARS_CLOSE_TOKEN); } YY_BREAK case 68: YY_RULE_SETUP -#line 452 "pars0lex.l" +#line 453 "pars0lex.l" { - return(PARS_CLOSE_TOKEN); + return(PARS_NOTFOUND_TOKEN); } YY_BREAK case 69: YY_RULE_SETUP -#line 456 "pars0lex.l" +#line 457 "pars0lex.l" { - return(PARS_NOTFOUND_TOKEN); + return(PARS_TO_CHAR_TOKEN); } YY_BREAK case 70: YY_RULE_SETUP -#line 460 "pars0lex.l" +#line 461 "pars0lex.l" { - return(PARS_TO_CHAR_TOKEN); + return(PARS_TO_NUMBER_TOKEN); } YY_BREAK case 71: YY_RULE_SETUP -#line 464 "pars0lex.l" +#line 465 "pars0lex.l" { - return(PARS_TO_NUMBER_TOKEN); + return(PARS_TO_BINARY_TOKEN); } YY_BREAK case 72: YY_RULE_SETUP -#line 468 "pars0lex.l" +#line 469 "pars0lex.l" { - return(PARS_TO_BINARY_TOKEN); + return(PARS_BINARY_TO_NUMBER_TOKEN); } YY_BREAK case 73: YY_RULE_SETUP -#line 472 "pars0lex.l" +#line 473 "pars0lex.l" { - return(PARS_BINARY_TO_NUMBER_TOKEN); + return(PARS_SUBSTR_TOKEN); } YY_BREAK case 74: YY_RULE_SETUP -#line 476 "pars0lex.l" +#line 477 "pars0lex.l" { - return(PARS_SUBSTR_TOKEN); + return(PARS_REPLSTR_TOKEN); } YY_BREAK case 75: YY_RULE_SETUP -#line 480 "pars0lex.l" +#line 481 "pars0lex.l" { - return(PARS_REPLSTR_TOKEN); + return(PARS_CONCAT_TOKEN); } YY_BREAK case 76: YY_RULE_SETUP -#line 484 "pars0lex.l" +#line 485 "pars0lex.l" { - return(PARS_CONCAT_TOKEN); + return(PARS_INSTR_TOKEN); } YY_BREAK case 77: YY_RULE_SETUP -#line 488 "pars0lex.l" +#line 489 "pars0lex.l" { - return(PARS_INSTR_TOKEN); + return(PARS_LENGTH_TOKEN); } YY_BREAK case 78: YY_RULE_SETUP -#line 492 "pars0lex.l" +#line 493 "pars0lex.l" { - return(PARS_LENGTH_TOKEN); + return(PARS_SYSDATE_TOKEN); } YY_BREAK case 79: YY_RULE_SETUP -#line 496 "pars0lex.l" +#line 497 "pars0lex.l" { - return(PARS_SYSDATE_TOKEN); + return(PARS_PRINTF_TOKEN); } YY_BREAK case 80: YY_RULE_SETUP -#line 500 "pars0lex.l" +#line 501 "pars0lex.l" { - return(PARS_PRINTF_TOKEN); + return(PARS_ASSERT_TOKEN); } YY_BREAK case 81: YY_RULE_SETUP -#line 504 "pars0lex.l" +#line 505 "pars0lex.l" { - return(PARS_ASSERT_TOKEN); + return(PARS_RND_TOKEN); } YY_BREAK case 82: YY_RULE_SETUP -#line 508 "pars0lex.l" +#line 509 "pars0lex.l" { - return(PARS_RND_TOKEN); + return(PARS_RND_STR_TOKEN); } YY_BREAK case 83: YY_RULE_SETUP -#line 512 "pars0lex.l" +#line 513 "pars0lex.l" { - return(PARS_RND_STR_TOKEN); + return(PARS_ROW_PRINTF_TOKEN); } YY_BREAK case 84: YY_RULE_SETUP -#line 516 "pars0lex.l" +#line 517 "pars0lex.l" { - return(PARS_ROW_PRINTF_TOKEN); + return(PARS_COMMIT_TOKEN); } YY_BREAK case 85: YY_RULE_SETUP -#line 520 "pars0lex.l" +#line 521 "pars0lex.l" { - return(PARS_COMMIT_TOKEN); + return(PARS_ROLLBACK_TOKEN); } YY_BREAK case 86: YY_RULE_SETUP -#line 524 "pars0lex.l" +#line 525 "pars0lex.l" { - return(PARS_ROLLBACK_TOKEN); + return(PARS_WORK_TOKEN); } YY_BREAK case 87: YY_RULE_SETUP -#line 528 "pars0lex.l" +#line 529 "pars0lex.l" { - return(PARS_WORK_TOKEN); + return(PARS_UNSIGNED_TOKEN); } YY_BREAK case 88: YY_RULE_SETUP -#line 532 "pars0lex.l" +#line 533 "pars0lex.l" { - return(PARS_UNSIGNED_TOKEN); + return(PARS_EXIT_TOKEN); } YY_BREAK case 89: YY_RULE_SETUP -#line 536 "pars0lex.l" +#line 537 "pars0lex.l" { - return(PARS_EXIT_TOKEN); + return(PARS_FUNCTION_TOKEN); } YY_BREAK case 90: YY_RULE_SETUP -#line 540 "pars0lex.l" +#line 541 "pars0lex.l" { - return(PARS_FUNCTION_TOKEN); + return(PARS_LOCK_TOKEN); } YY_BREAK case 91: YY_RULE_SETUP -#line 544 "pars0lex.l" +#line 545 "pars0lex.l" { - return(PARS_LOCK_TOKEN); + return(PARS_SHARE_TOKEN); } YY_BREAK case 92: YY_RULE_SETUP -#line 548 "pars0lex.l" +#line 549 "pars0lex.l" { - return(PARS_SHARE_TOKEN); + return(PARS_MODE_TOKEN); } YY_BREAK case 93: YY_RULE_SETUP -#line 552 "pars0lex.l" +#line 553 "pars0lex.l" { - return(PARS_MODE_TOKEN); + return(PARS_LIKE_TOKEN); } YY_BREAK case 94: YY_RULE_SETUP -#line 556 "pars0lex.l" +#line 557 "pars0lex.l" { - return(PARS_LIKE_TOKEN); + return(PARS_BIGINT_TOKEN); } YY_BREAK case 95: YY_RULE_SETUP -#line 560 "pars0lex.l" +#line 561 "pars0lex.l" { - return(PARS_BIGINT_TOKEN); + yylval = sym_tab_add_id(pars_sym_tab_global, + (byte*) yytext, + ut_strlen(yytext)); + return(PARS_ID_TOKEN); } YY_BREAK case 96: YY_RULE_SETUP -#line 564 "pars0lex.l" +#line 568 "pars0lex.l" { yylval = sym_tab_add_id(pars_sym_tab_global, (byte*) yytext, ut_strlen(yytext)); - return(PARS_ID_TOKEN); + return(PARS_TABLE_NAME_TOKEN); } YY_BREAK case 97: YY_RULE_SETUP -#line 571 "pars0lex.l" +#line 575 "pars0lex.l" { - yylval = sym_tab_add_id(pars_sym_tab_global, - (byte*) yytext, - ut_strlen(yytext)); - return(PARS_TABLE_NAME_TOKEN); + return(PARS_DDOT_TOKEN); } YY_BREAK case 98: YY_RULE_SETUP -#line 578 "pars0lex.l" +#line 579 "pars0lex.l" { - return(PARS_DDOT_TOKEN); + return(PARS_ASSIGN_TOKEN); } YY_BREAK case 99: YY_RULE_SETUP -#line 582 "pars0lex.l" +#line 583 "pars0lex.l" { - return(PARS_ASSIGN_TOKEN); + return(PARS_LE_TOKEN); } YY_BREAK case 100: YY_RULE_SETUP -#line 586 "pars0lex.l" +#line 587 "pars0lex.l" { - return(PARS_LE_TOKEN); + return(PARS_GE_TOKEN); } YY_BREAK case 101: YY_RULE_SETUP -#line 590 "pars0lex.l" +#line 591 "pars0lex.l" { - return(PARS_GE_TOKEN); + return(PARS_NE_TOKEN); } YY_BREAK case 102: YY_RULE_SETUP -#line 594 "pars0lex.l" +#line 595 "pars0lex.l" { - return(PARS_NE_TOKEN); + + return((int)(*yytext)); } YY_BREAK case 103: YY_RULE_SETUP -#line 598 "pars0lex.l" +#line 600 "pars0lex.l" { return((int)(*yytext)); @@ -2079,7 +2056,7 @@ YY_RULE_SETUP YY_BREAK case 104: YY_RULE_SETUP -#line 603 "pars0lex.l" +#line 605 "pars0lex.l" { return((int)(*yytext)); @@ -2087,7 +2064,7 @@ YY_RULE_SETUP YY_BREAK case 105: YY_RULE_SETUP -#line 608 "pars0lex.l" +#line 610 "pars0lex.l" { return((int)(*yytext)); @@ -2095,7 +2072,7 @@ YY_RULE_SETUP YY_BREAK case 106: YY_RULE_SETUP -#line 613 "pars0lex.l" +#line 615 "pars0lex.l" { return((int)(*yytext)); @@ -2103,7 +2080,7 @@ YY_RULE_SETUP YY_BREAK case 107: YY_RULE_SETUP -#line 618 "pars0lex.l" +#line 620 "pars0lex.l" { return((int)(*yytext)); @@ -2111,7 +2088,7 @@ YY_RULE_SETUP YY_BREAK case 108: YY_RULE_SETUP -#line 623 "pars0lex.l" +#line 625 "pars0lex.l" { return((int)(*yytext)); @@ -2119,7 +2096,7 @@ YY_RULE_SETUP YY_BREAK case 109: YY_RULE_SETUP -#line 628 "pars0lex.l" +#line 630 "pars0lex.l" { return((int)(*yytext)); @@ -2127,7 +2104,7 @@ YY_RULE_SETUP YY_BREAK case 110: YY_RULE_SETUP -#line 633 "pars0lex.l" +#line 635 "pars0lex.l" { return((int)(*yytext)); @@ -2135,7 +2112,7 @@ YY_RULE_SETUP YY_BREAK case 111: YY_RULE_SETUP -#line 638 "pars0lex.l" +#line 640 "pars0lex.l" { return((int)(*yytext)); @@ -2143,7 +2120,7 @@ YY_RULE_SETUP YY_BREAK case 112: YY_RULE_SETUP -#line 643 "pars0lex.l" +#line 645 "pars0lex.l" { return((int)(*yytext)); @@ -2151,7 +2128,7 @@ YY_RULE_SETUP YY_BREAK case 113: YY_RULE_SETUP -#line 648 "pars0lex.l" +#line 650 "pars0lex.l" { return((int)(*yytext)); @@ -2159,7 +2136,7 @@ YY_RULE_SETUP YY_BREAK case 114: YY_RULE_SETUP -#line 653 "pars0lex.l" +#line 655 "pars0lex.l" { return((int)(*yytext)); @@ -2167,7 +2144,7 @@ YY_RULE_SETUP YY_BREAK case 115: YY_RULE_SETUP -#line 658 "pars0lex.l" +#line 660 "pars0lex.l" { return((int)(*yytext)); @@ -2175,7 +2152,7 @@ YY_RULE_SETUP YY_BREAK case 116: YY_RULE_SETUP -#line 663 "pars0lex.l" +#line 665 "pars0lex.l" { return((int)(*yytext)); @@ -2183,43 +2160,35 @@ YY_RULE_SETUP YY_BREAK case 117: YY_RULE_SETUP -#line 668 "pars0lex.l" -{ - - return((int)(*yytext)); -} +#line 670 "pars0lex.l" +BEGIN(comment); /* eat up comment */ YY_BREAK case 118: +/* rule 118 can match eol */ YY_RULE_SETUP -#line 673 "pars0lex.l" -BEGIN(comment); /* eat up comment */ +#line 672 "pars0lex.l" + YY_BREAK case 119: /* rule 119 can match eol */ YY_RULE_SETUP -#line 675 "pars0lex.l" +#line 673 "pars0lex.l" YY_BREAK case 120: -/* rule 120 can match eol */ YY_RULE_SETUP -#line 676 "pars0lex.l" - +#line 674 "pars0lex.l" +BEGIN(INITIAL); YY_BREAK case 121: +/* rule 121 can match eol */ YY_RULE_SETUP -#line 677 "pars0lex.l" -BEGIN(INITIAL); +#line 676 "pars0lex.l" +/* eat up whitespace */ YY_BREAK case 122: -/* rule 122 can match eol */ YY_RULE_SETUP #line 679 "pars0lex.l" -/* eat up whitespace */ - YY_BREAK -case 123: -YY_RULE_SETUP -#line 682 "pars0lex.l" { fprintf(stderr,"Unrecognized character: %02x\n", *yytext); @@ -2229,12 +2198,12 @@ YY_RULE_SETUP return(0); } YY_BREAK -case 124: +case 123: YY_RULE_SETUP -#line 691 "pars0lex.l" +#line 688 "pars0lex.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 2237 "lexyy.cc" +#line 2206 "lexyy.cc" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(comment): case YY_STATE_EOF(quoted): @@ -2369,6 +2338,7 @@ case YY_STATE_EOF(id): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -2380,9 +2350,9 @@ case YY_STATE_EOF(id): */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2411,7 +2381,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -2424,21 +2394,21 @@ static int yy_get_next_buffer (void) else { - int num_to_read = static_cast( - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1); + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - int new_size = static_cast(b->yy_buf_size * 2); + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2451,7 +2421,7 @@ static int yy_get_next_buffer (void) } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -2459,17 +2429,17 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = static_cast( - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1); - } + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); + (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } @@ -2493,9 +2463,9 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); @@ -2512,16 +2482,16 @@ static int yy_get_next_buffer (void) /* yy_get_previous_state - get the state just before the EOB char was reached */ -yy_state_type yy_get_previous_state (void) + static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; - + yy_state_type yy_current_state; + char *yy_cp; + yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2530,10 +2500,10 @@ yy_state_type yy_get_previous_state (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 425 ) + if ( yy_current_state >= 404 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; } return yy_current_state; @@ -2544,12 +2514,12 @@ yy_state_type yy_get_previous_state (void) * synopsis * next_state = yy_try_NUL_trans( current_state ); */ -static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2558,15 +2528,19 @@ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 425 ) + if ( yy_current_state >= 404 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 424); + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_is_jam = (yy_current_state == 403); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -2576,7 +2550,7 @@ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { int c; - + *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) @@ -2615,7 +2589,7 @@ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) - return EOF; + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -2643,16 +2617,16 @@ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) /** Immediately switch to a different input stream. * @param input_file A readable stream. - * + * * @note This function does not reset the start condition to @c INITIAL . */ -void yyrestart (FILE * input_file ) + static void yyrestart (FILE * input_file ) { - + if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); + yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); @@ -2661,16 +2635,16 @@ void yyrestart (FILE * input_file ) /** Switch to a different input buffer. * @param new_buffer The new input buffer. - * + * */ -MY_ATTRIBUTE((unused)) static void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) + MY_ATTRIBUTE((unused)) static void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - + /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); - */ + */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2696,7 +2670,7 @@ MY_ATTRIBUTE((unused)) static void yy_switch_to_buffer (YY_BUFFER_STATE new_bu static void yy_load_buffer_state (void) { - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); @@ -2705,18 +2679,18 @@ static void yy_load_buffer_state (void) /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * + * * @return the allocated buffer state. */ -static YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) + static YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. @@ -2734,11 +2708,11 @@ static YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() - * + * */ -void yy_delete_buffer (YY_BUFFER_STATE b ) + static void yy_delete_buffer (YY_BUFFER_STATE b ) { - + if ( ! b ) return; @@ -2755,37 +2729,37 @@ void yy_delete_buffer (YY_BUFFER_STATE b ) * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ -static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - + yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = 0; - + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * + * */ -void yy_flush_buffer (YY_BUFFER_STATE b ) + static void yy_flush_buffer (YY_BUFFER_STATE b ) { - if ( ! b ) + if ( ! b ) return; b->yy_n_chars = 0; @@ -2810,11 +2784,11 @@ void yy_flush_buffer (YY_BUFFER_STATE b ) * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. - * + * */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +MY_ATTRIBUTE((unused)) static void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) + if (new_buffer == NULL) return; yyensure_buffer_stack(); @@ -2840,11 +2814,11 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. - * + * */ -void yypop_buffer_state (void) +MY_ATTRIBUTE((unused)) static void yypop_buffer_state (void) { - if (!YY_CURRENT_BUFFER) + if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); @@ -2864,14 +2838,14 @@ void yypop_buffer_state (void) static void yyensure_buffer_stack (void) { int num_to_alloc; - + if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. - */ - num_to_alloc = 1; + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); @@ -2888,10 +2862,9 @@ static void yyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; - num_to_alloc = static_cast( - (yy_buffer_stack_max) + grow_size); + num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) @@ -2909,9 +2882,9 @@ static void yyensure_buffer_stack (void) #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2922,8 +2895,8 @@ static void yy_fatal_error (yyconst char* msg ) do \ { \ /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ @@ -2935,116 +2908,116 @@ static void yy_fatal_error (yyconst char* msg ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. - * + * */ -int yyget_lineno (void) +MY_ATTRIBUTE((unused)) static int yyget_lineno (void) { - - return yylineno; + + return yylineno; } /** Get the input stream. - * + * */ -FILE *yyget_in (void) +MY_ATTRIBUTE((unused)) static FILE *yyget_in (void) { - return yyin; + return yyin; } /** Get the output stream. - * + * */ -FILE *yyget_out (void) +MY_ATTRIBUTE((unused)) static FILE *yyget_out (void) { - return yyout; + return yyout; } /** Get the length of the current token. - * + * */ -yy_size_t yyget_leng (void) +MY_ATTRIBUTE((unused)) static int yyget_leng (void) { - return yyleng; + return yyleng; } /** Get the current token. - * + * */ -char *yyget_text (void) +MY_ATTRIBUTE((unused)) static char *yyget_text (void) { - return yytext; + return yytext; } /** Set the current line number. - * @param line_number - * + * @param _line_number line number + * */ -void yyset_lineno (int line_number ) +MY_ATTRIBUTE((unused)) static void yyset_lineno (int _line_number ) { - - yylineno = line_number; + + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. - * + * @param _in_str A readable stream. + * * @see yy_switch_to_buffer */ -void yyset_in (FILE * in_str ) +MY_ATTRIBUTE((unused)) static void yyset_in (FILE * _in_str ) { - yyin = in_str ; + yyin = _in_str ; } -void yyset_out (FILE * out_str ) +MY_ATTRIBUTE((unused)) static void yyset_out (FILE * _out_str ) { - yyout = out_str ; + yyout = _out_str ; } -int yyget_debug (void) +MY_ATTRIBUTE((unused)) static int yyget_debug (void) { - return yy_flex_debug; + return yy_flex_debug; } -void yyset_debug (int bdebug ) +MY_ATTRIBUTE((unused)) static void yyset_debug (int _bdebug ) { - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; + yyin = stdin; + yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ MY_ATTRIBUTE((unused)) static int yylex_destroy (void) { - - /* Pop the buffer stack, destroying each element. */ + + /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; @@ -3055,11 +3028,11 @@ MY_ATTRIBUTE((unused)) static int yylex_destroy (void) yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); - return 0; + return 0; } /* @@ -3069,7 +3042,8 @@ MY_ATTRIBUTE((unused)) static int yylex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -3078,7 +3052,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -3086,13 +3060,14 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *yyalloc (yy_size_t size ) +static void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } -void *yyrealloc (void * ptr, yy_size_t size ) +static void *yyrealloc (void * ptr, yy_size_t size ) { + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -3100,17 +3075,17 @@ void *yyrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } -void yyfree (void * ptr ) +static void yyfree (void * ptr ) { - free( (char*) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 691 "pars0lex.l" +#line 688 "pars0lex.l" diff --git a/storage/innobase/pars/make_flex.sh b/storage/innobase/pars/make_flex.sh index 2c49309746317..2ddb14606408c 100755 --- a/storage/innobase/pars/make_flex.sh +++ b/storage/innobase/pars/make_flex.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright (c) 1994, 2016, 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 # the terms of the GNU General Public License as published by the Free Software @@ -31,6 +32,7 @@ echo '#include "univ.i"' > $OUTFILE # a warning on Win64. Add the cast. Also define some symbols as static. sed -e ' s/'"$TMPFILE"'/'"$OUTFILE"'/; +s/^void yyset_extra *(YY_EXTRA_TYPE *user_defined *);// s/\(int offset = \)\((yy_c_buf_p) - (yytext_ptr)\);/\1(int)(\2);/; s/\(void yy\(restart\|_\(delete\|flush\)_buffer\)\)/static \1/; s/\(void yy_switch_to_buffer\)/MY_ATTRIBUTE((unused)) static \1/; @@ -38,10 +40,12 @@ s/\(void yy\(push\|pop\)_buffer_state\)/MY_ATTRIBUTE((unused)) static \1/; s/\(YY_BUFFER_STATE yy_create_buffer\)/static \1/; s/\(\(int\|void\) yy[gs]et_\)/MY_ATTRIBUTE((unused)) static \1/; s/\(void \*\?yy\(\(re\)\?alloc\|free\)\)/static \1/; -s/\(extern \)\?\(int yy\(leng\|lineno\|_flex_debug\)\)/static \2/; +s/extern int yy\(leng\|_flex_debug\|lineno\);//; +s/\(int yy\(leng\|lineno\|_flex_debug\)\)/static \1/; s/\(int yylex_destroy\)/MY_ATTRIBUTE((unused)) static \1/; s/^\(\(FILE\|char\) *\* *yyget\)/MY_ATTRIBUTE((unused)) static \1/; -s/^\(extern \)\?\(\(FILE\|char\) *\* *yy\)/static \2/; +s/^extern \(\(FILE\|char\) *\* *yy\).*//; +s/^\(FILE\|char\) *\* *yy/static &/; ' < $TMPFILE >> $OUTFILE rm $TMPFILE diff --git a/storage/innobase/pars/pars0grm.cc b/storage/innobase/pars/pars0grm.cc index 5fbb70c448125..ef732209978e8 100644 --- a/storage/innobase/pars/pars0grm.cc +++ b/storage/innobase/pars/pars0grm.cc @@ -1,14 +1,13 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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; either version 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +15,7 @@ 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, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -47,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,230 +52,17 @@ /* Pure parsers. */ #define YYPURE 0 -/* Using locations. */ -#define YYLSP_NEEDED 0 +/* Push parsers. */ +#define YYPUSH 0 - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - PARS_INT_LIT = 258, - PARS_FLOAT_LIT = 259, - PARS_STR_LIT = 260, - PARS_FIXBINARY_LIT = 261, - PARS_BLOB_LIT = 262, - PARS_NULL_LIT = 263, - PARS_ID_TOKEN = 264, - PARS_AND_TOKEN = 265, - PARS_OR_TOKEN = 266, - PARS_NOT_TOKEN = 267, - PARS_GE_TOKEN = 268, - PARS_LE_TOKEN = 269, - PARS_NE_TOKEN = 270, - PARS_PROCEDURE_TOKEN = 271, - PARS_IN_TOKEN = 272, - PARS_OUT_TOKEN = 273, - PARS_BINARY_TOKEN = 274, - PARS_BLOB_TOKEN = 275, - PARS_INT_TOKEN = 276, - PARS_INTEGER_TOKEN = 277, - PARS_FLOAT_TOKEN = 278, - PARS_CHAR_TOKEN = 279, - PARS_IS_TOKEN = 280, - PARS_BEGIN_TOKEN = 281, - PARS_END_TOKEN = 282, - PARS_IF_TOKEN = 283, - PARS_THEN_TOKEN = 284, - PARS_ELSE_TOKEN = 285, - PARS_ELSIF_TOKEN = 286, - PARS_LOOP_TOKEN = 287, - PARS_WHILE_TOKEN = 288, - PARS_RETURN_TOKEN = 289, - PARS_SELECT_TOKEN = 290, - PARS_SUM_TOKEN = 291, - PARS_COUNT_TOKEN = 292, - PARS_DISTINCT_TOKEN = 293, - PARS_FROM_TOKEN = 294, - PARS_WHERE_TOKEN = 295, - PARS_FOR_TOKEN = 296, - PARS_DDOT_TOKEN = 297, - PARS_READ_TOKEN = 298, - PARS_ORDER_TOKEN = 299, - PARS_BY_TOKEN = 300, - PARS_ASC_TOKEN = 301, - PARS_DESC_TOKEN = 302, - PARS_INSERT_TOKEN = 303, - PARS_INTO_TOKEN = 304, - PARS_VALUES_TOKEN = 305, - PARS_UPDATE_TOKEN = 306, - PARS_SET_TOKEN = 307, - PARS_DELETE_TOKEN = 308, - PARS_CURRENT_TOKEN = 309, - PARS_OF_TOKEN = 310, - PARS_CREATE_TOKEN = 311, - PARS_TABLE_TOKEN = 312, - PARS_INDEX_TOKEN = 313, - PARS_UNIQUE_TOKEN = 314, - PARS_CLUSTERED_TOKEN = 315, - PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 316, - PARS_ON_TOKEN = 317, - PARS_ASSIGN_TOKEN = 318, - PARS_DECLARE_TOKEN = 319, - PARS_CURSOR_TOKEN = 320, - PARS_SQL_TOKEN = 321, - PARS_OPEN_TOKEN = 322, - PARS_FETCH_TOKEN = 323, - PARS_CLOSE_TOKEN = 324, - PARS_NOTFOUND_TOKEN = 325, - PARS_TO_CHAR_TOKEN = 326, - PARS_TO_NUMBER_TOKEN = 327, - PARS_TO_BINARY_TOKEN = 328, - PARS_BINARY_TO_NUMBER_TOKEN = 329, - PARS_SUBSTR_TOKEN = 330, - PARS_REPLSTR_TOKEN = 331, - PARS_CONCAT_TOKEN = 332, - PARS_INSTR_TOKEN = 333, - PARS_LENGTH_TOKEN = 334, - PARS_SYSDATE_TOKEN = 335, - PARS_PRINTF_TOKEN = 336, - PARS_ASSERT_TOKEN = 337, - PARS_RND_TOKEN = 338, - PARS_RND_STR_TOKEN = 339, - PARS_ROW_PRINTF_TOKEN = 340, - PARS_COMMIT_TOKEN = 341, - PARS_ROLLBACK_TOKEN = 342, - PARS_WORK_TOKEN = 343, - PARS_UNSIGNED_TOKEN = 344, - PARS_EXIT_TOKEN = 345, - PARS_FUNCTION_TOKEN = 346, - PARS_LOCK_TOKEN = 347, - PARS_SHARE_TOKEN = 348, - PARS_MODE_TOKEN = 349, - PARS_LIKE_TOKEN = 350, - PARS_LIKE_TOKEN_EXACT = 351, - PARS_LIKE_TOKEN_PREFIX = 352, - PARS_LIKE_TOKEN_SUFFIX = 353, - PARS_LIKE_TOKEN_SUBSTR = 354, - PARS_TABLE_NAME_TOKEN = 355, - PARS_COMPACT_TOKEN = 356, - PARS_BLOCK_SIZE_TOKEN = 357, - PARS_BIGINT_TOKEN = 358, - NEG = 359 - }; -#endif -/* Tokens. */ -#define PARS_INT_LIT 258 -#define PARS_FLOAT_LIT 259 -#define PARS_STR_LIT 260 -#define PARS_FIXBINARY_LIT 261 -#define PARS_BLOB_LIT 262 -#define PARS_NULL_LIT 263 -#define PARS_ID_TOKEN 264 -#define PARS_AND_TOKEN 265 -#define PARS_OR_TOKEN 266 -#define PARS_NOT_TOKEN 267 -#define PARS_GE_TOKEN 268 -#define PARS_LE_TOKEN 269 -#define PARS_NE_TOKEN 270 -#define PARS_PROCEDURE_TOKEN 271 -#define PARS_IN_TOKEN 272 -#define PARS_OUT_TOKEN 273 -#define PARS_BINARY_TOKEN 274 -#define PARS_BLOB_TOKEN 275 -#define PARS_INT_TOKEN 276 -#define PARS_INTEGER_TOKEN 277 -#define PARS_FLOAT_TOKEN 278 -#define PARS_CHAR_TOKEN 279 -#define PARS_IS_TOKEN 280 -#define PARS_BEGIN_TOKEN 281 -#define PARS_END_TOKEN 282 -#define PARS_IF_TOKEN 283 -#define PARS_THEN_TOKEN 284 -#define PARS_ELSE_TOKEN 285 -#define PARS_ELSIF_TOKEN 286 -#define PARS_LOOP_TOKEN 287 -#define PARS_WHILE_TOKEN 288 -#define PARS_RETURN_TOKEN 289 -#define PARS_SELECT_TOKEN 290 -#define PARS_SUM_TOKEN 291 -#define PARS_COUNT_TOKEN 292 -#define PARS_DISTINCT_TOKEN 293 -#define PARS_FROM_TOKEN 294 -#define PARS_WHERE_TOKEN 295 -#define PARS_FOR_TOKEN 296 -#define PARS_DDOT_TOKEN 297 -#define PARS_READ_TOKEN 298 -#define PARS_ORDER_TOKEN 299 -#define PARS_BY_TOKEN 300 -#define PARS_ASC_TOKEN 301 -#define PARS_DESC_TOKEN 302 -#define PARS_INSERT_TOKEN 303 -#define PARS_INTO_TOKEN 304 -#define PARS_VALUES_TOKEN 305 -#define PARS_UPDATE_TOKEN 306 -#define PARS_SET_TOKEN 307 -#define PARS_DELETE_TOKEN 308 -#define PARS_CURRENT_TOKEN 309 -#define PARS_OF_TOKEN 310 -#define PARS_CREATE_TOKEN 311 -#define PARS_TABLE_TOKEN 312 -#define PARS_INDEX_TOKEN 313 -#define PARS_UNIQUE_TOKEN 314 -#define PARS_CLUSTERED_TOKEN 315 -#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 316 -#define PARS_ON_TOKEN 317 -#define PARS_ASSIGN_TOKEN 318 -#define PARS_DECLARE_TOKEN 319 -#define PARS_CURSOR_TOKEN 320 -#define PARS_SQL_TOKEN 321 -#define PARS_OPEN_TOKEN 322 -#define PARS_FETCH_TOKEN 323 -#define PARS_CLOSE_TOKEN 324 -#define PARS_NOTFOUND_TOKEN 325 -#define PARS_TO_CHAR_TOKEN 326 -#define PARS_TO_NUMBER_TOKEN 327 -#define PARS_TO_BINARY_TOKEN 328 -#define PARS_BINARY_TO_NUMBER_TOKEN 329 -#define PARS_SUBSTR_TOKEN 330 -#define PARS_REPLSTR_TOKEN 331 -#define PARS_CONCAT_TOKEN 332 -#define PARS_INSTR_TOKEN 333 -#define PARS_LENGTH_TOKEN 334 -#define PARS_SYSDATE_TOKEN 335 -#define PARS_PRINTF_TOKEN 336 -#define PARS_ASSERT_TOKEN 337 -#define PARS_RND_TOKEN 338 -#define PARS_RND_STR_TOKEN 339 -#define PARS_ROW_PRINTF_TOKEN 340 -#define PARS_COMMIT_TOKEN 341 -#define PARS_ROLLBACK_TOKEN 342 -#define PARS_WORK_TOKEN 343 -#define PARS_UNSIGNED_TOKEN 344 -#define PARS_EXIT_TOKEN 345 -#define PARS_FUNCTION_TOKEN 346 -#define PARS_LOCK_TOKEN 347 -#define PARS_SHARE_TOKEN 348 -#define PARS_MODE_TOKEN 349 -#define PARS_LIKE_TOKEN 350 -#define PARS_LIKE_TOKEN_EXACT 351 -#define PARS_LIKE_TOKEN_PREFIX 352 -#define PARS_LIKE_TOKEN_SUFFIX 353 -#define PARS_LIKE_TOKEN_SUBSTR 354 -#define PARS_TABLE_NAME_TOKEN 355 -#define PARS_COMPACT_TOKEN 356 -#define PARS_BLOCK_SIZE_TOKEN 357 -#define PARS_BIGINT_TOKEN 358 -#define NEG 359 +/* Pull parsers. */ +#define YYPULL 1 /* Copy the first part of user declarations. */ -#line 28 "pars0grm.y" +#line 29 "pars0grm.y" /* yacc.c:339 */ /* The value of the semantic attribute is a pointer to a query tree node que_node_t */ @@ -297,11 +81,15 @@ que_node_t */ int yylex(void); +#line 85 "pars0grm.cc" /* yacc.c:339 */ -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -311,25 +99,144 @@ yylex(void); # define YYERROR_VERBOSE 0 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "pars0grm.tab.h". */ +#ifndef YY_YY_PARS0GRM_TAB_H_INCLUDED +# define YY_YY_PARS0GRM_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + PARS_INT_LIT = 258, + PARS_FLOAT_LIT = 259, + PARS_STR_LIT = 260, + PARS_FIXBINARY_LIT = 261, + PARS_BLOB_LIT = 262, + PARS_NULL_LIT = 263, + PARS_ID_TOKEN = 264, + PARS_AND_TOKEN = 265, + PARS_OR_TOKEN = 266, + PARS_NOT_TOKEN = 267, + PARS_GE_TOKEN = 268, + PARS_LE_TOKEN = 269, + PARS_NE_TOKEN = 270, + PARS_PROCEDURE_TOKEN = 271, + PARS_IN_TOKEN = 272, + PARS_OUT_TOKEN = 273, + PARS_BINARY_TOKEN = 274, + PARS_BLOB_TOKEN = 275, + PARS_INT_TOKEN = 276, + PARS_INTEGER_TOKEN = 277, + PARS_FLOAT_TOKEN = 278, + PARS_CHAR_TOKEN = 279, + PARS_IS_TOKEN = 280, + PARS_BEGIN_TOKEN = 281, + PARS_END_TOKEN = 282, + PARS_IF_TOKEN = 283, + PARS_THEN_TOKEN = 284, + PARS_ELSE_TOKEN = 285, + PARS_ELSIF_TOKEN = 286, + PARS_LOOP_TOKEN = 287, + PARS_WHILE_TOKEN = 288, + PARS_RETURN_TOKEN = 289, + PARS_SELECT_TOKEN = 290, + PARS_SUM_TOKEN = 291, + PARS_COUNT_TOKEN = 292, + PARS_DISTINCT_TOKEN = 293, + PARS_FROM_TOKEN = 294, + PARS_WHERE_TOKEN = 295, + PARS_FOR_TOKEN = 296, + PARS_DDOT_TOKEN = 297, + PARS_READ_TOKEN = 298, + PARS_ORDER_TOKEN = 299, + PARS_BY_TOKEN = 300, + PARS_ASC_TOKEN = 301, + PARS_DESC_TOKEN = 302, + PARS_INSERT_TOKEN = 303, + PARS_INTO_TOKEN = 304, + PARS_VALUES_TOKEN = 305, + PARS_UPDATE_TOKEN = 306, + PARS_SET_TOKEN = 307, + PARS_DELETE_TOKEN = 308, + PARS_CURRENT_TOKEN = 309, + PARS_OF_TOKEN = 310, + PARS_CREATE_TOKEN = 311, + PARS_TABLE_TOKEN = 312, + PARS_INDEX_TOKEN = 313, + PARS_UNIQUE_TOKEN = 314, + PARS_CLUSTERED_TOKEN = 315, + PARS_ON_TOKEN = 316, + PARS_ASSIGN_TOKEN = 317, + PARS_DECLARE_TOKEN = 318, + PARS_CURSOR_TOKEN = 319, + PARS_SQL_TOKEN = 320, + PARS_OPEN_TOKEN = 321, + PARS_FETCH_TOKEN = 322, + PARS_CLOSE_TOKEN = 323, + PARS_NOTFOUND_TOKEN = 324, + PARS_TO_CHAR_TOKEN = 325, + PARS_TO_NUMBER_TOKEN = 326, + PARS_TO_BINARY_TOKEN = 327, + PARS_BINARY_TO_NUMBER_TOKEN = 328, + PARS_SUBSTR_TOKEN = 329, + PARS_REPLSTR_TOKEN = 330, + PARS_CONCAT_TOKEN = 331, + PARS_INSTR_TOKEN = 332, + PARS_LENGTH_TOKEN = 333, + PARS_SYSDATE_TOKEN = 334, + PARS_PRINTF_TOKEN = 335, + PARS_ASSERT_TOKEN = 336, + PARS_RND_TOKEN = 337, + PARS_RND_STR_TOKEN = 338, + PARS_ROW_PRINTF_TOKEN = 339, + PARS_COMMIT_TOKEN = 340, + PARS_ROLLBACK_TOKEN = 341, + PARS_WORK_TOKEN = 342, + PARS_UNSIGNED_TOKEN = 343, + PARS_EXIT_TOKEN = 344, + PARS_FUNCTION_TOKEN = 345, + PARS_LOCK_TOKEN = 346, + PARS_SHARE_TOKEN = 347, + PARS_MODE_TOKEN = 348, + PARS_LIKE_TOKEN = 349, + PARS_LIKE_TOKEN_EXACT = 350, + PARS_LIKE_TOKEN_PREFIX = 351, + PARS_LIKE_TOKEN_SUFFIX = 352, + PARS_LIKE_TOKEN_SUBSTR = 353, + PARS_TABLE_NAME_TOKEN = 354, + PARS_COMPACT_TOKEN = 355, + PARS_BLOCK_SIZE_TOKEN = 356, + PARS_BIGINT_TOKEN = 357, + NEG = 358 + }; #endif +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 #endif +extern YYSTYPE yylval; -/* Copy the second part of user declarations. */ +int yyparse (void); + +#endif /* !YY_YY_PARS0GRM_TAB_H_INCLUDED */ +/* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 334 "pars0grm.cc" +#line 240 "pars0grm.cc" /* yacc.c:358 */ #ifdef short # undef short @@ -343,11 +250,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -367,8 +271,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -382,38 +285,67 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return i; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + #if ! defined yyoverflow || YYERROR_VERBOSE @@ -425,16 +357,18 @@ YYID (i) # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -442,8 +376,8 @@ YYID (i) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -457,26 +391,24 @@ YYID (i) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void*); /* INFRINGES ON USER NAME SPACE */ +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif @@ -485,14 +417,14 @@ void free (void*); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -503,79 +435,85 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 816 +#define YYLAST 824 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 120 +#define YYNTOKENS 119 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 73 +#define YYNNTS 72 /* YYNRULES -- Number of rules. */ -#define YYNRULES 183 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 350 +#define YYNRULES 181 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 348 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 359 +#define YYMAXUTOK 358 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 112, 2, 2, - 114, 115, 109, 108, 117, 107, 2, 110, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 113, - 105, 104, 106, 116, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 111, 2, 2, + 113, 114, 108, 107, 116, 106, 2, 109, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 112, + 104, 103, 105, 115, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 118, 2, 119, 2, 2, 2, 2, + 2, 2, 2, 117, 2, 118, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -598,124 +536,36 @@ static const yytype_uint8 yytranslate[] = 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 111 + 95, 96, 97, 98, 99, 100, 101, 102, 110 }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 6, 8, 11, 14, 17, 20, 23, - 26, 29, 32, 35, 38, 41, 44, 47, 50, 53, - 56, 59, 62, 65, 68, 71, 73, 76, 78, 83, - 85, 87, 89, 91, 93, 95, 97, 101, 105, 109, - 113, 116, 120, 124, 128, 132, 136, 140, 144, 148, - 152, 156, 159, 163, 167, 169, 171, 173, 175, 177, - 179, 181, 183, 185, 187, 189, 190, 192, 196, 203, - 208, 210, 212, 214, 218, 220, 224, 225, 227, 231, - 232, 234, 238, 240, 245, 251, 256, 257, 259, 263, - 265, 269, 271, 272, 275, 276, 279, 280, 285, 286, - 288, 290, 291, 296, 305, 309, 315, 318, 322, 324, - 328, 333, 338, 341, 344, 348, 351, 354, 357, 361, - 366, 368, 371, 372, 375, 377, 385, 392, 403, 405, - 407, 410, 413, 418, 423, 429, 431, 435, 436, 440, - 441, 443, 444, 447, 448, 450, 451, 453, 454, 458, - 468, 470, 474, 475, 477, 478, 480, 491, 493, 495, - 498, 501, 503, 505, 507, 509, 511, 513, 517, 521, - 522, 524, 528, 532, 533, 535, 538, 545, 550, 552, - 554, 555, 557, 560 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 121, 0, -1, 192, 113, -1, 127, -1, 128, 113, - -1, 160, 113, -1, 161, 113, -1, 162, 113, -1, - 159, 113, -1, 163, 113, -1, 155, 113, -1, 142, - 113, -1, 144, 113, -1, 154, 113, -1, 152, 113, - -1, 153, 113, -1, 149, 113, -1, 150, 113, -1, - 164, 113, -1, 166, 113, -1, 165, 113, -1, 181, - 113, -1, 182, 113, -1, 175, 113, -1, 179, 113, - -1, 122, -1, 123, 122, -1, 9, -1, 125, 114, - 133, 115, -1, 3, -1, 4, -1, 5, -1, 6, - -1, 7, -1, 8, -1, 66, -1, 124, 108, 124, - -1, 124, 107, 124, -1, 124, 109, 124, -1, 124, - 110, 124, -1, 107, 124, -1, 114, 124, 115, -1, - 124, 104, 124, -1, 124, 95, 5, -1, 124, 105, - 124, -1, 124, 106, 124, -1, 124, 13, 124, -1, - 124, 14, 124, -1, 124, 15, 124, -1, 124, 10, - 124, -1, 124, 11, 124, -1, 12, 124, -1, 9, - 112, 70, -1, 66, 112, 70, -1, 71, -1, 72, - -1, 73, -1, 74, -1, 75, -1, 77, -1, 78, - -1, 79, -1, 80, -1, 83, -1, 84, -1, -1, - 116, -1, 126, 117, 116, -1, 118, 9, 114, 126, - 115, 119, -1, 129, 114, 133, 115, -1, 76, -1, - 81, -1, 82, -1, 9, 114, 115, -1, 180, -1, - 131, 117, 180, -1, -1, 9, -1, 132, 117, 9, - -1, -1, 124, -1, 133, 117, 124, -1, 124, -1, - 37, 114, 109, 115, -1, 37, 114, 38, 9, 115, - -1, 36, 114, 124, 115, -1, -1, 134, -1, 135, - 117, 134, -1, 109, -1, 135, 49, 132, -1, 135, - -1, -1, 40, 124, -1, -1, 41, 51, -1, -1, - 92, 17, 93, 94, -1, -1, 46, -1, 47, -1, - -1, 44, 45, 9, 140, -1, 35, 136, 39, 131, - 137, 138, 139, 141, -1, 48, 49, 180, -1, 143, - 50, 114, 133, 115, -1, 143, 142, -1, 9, 104, - 124, -1, 145, -1, 146, 117, 145, -1, 40, 54, - 55, 9, -1, 51, 180, 52, 146, -1, 148, 137, - -1, 148, 147, -1, 53, 39, 180, -1, 151, 137, - -1, 151, 147, -1, 85, 142, -1, 9, 63, 124, - -1, 31, 124, 29, 123, -1, 156, -1, 157, 156, - -1, -1, 30, 123, -1, 157, -1, 28, 124, 29, - 123, 158, 27, 28, -1, 33, 124, 32, 123, 27, - 32, -1, 41, 9, 17, 124, 42, 124, 32, 123, - 27, 32, -1, 90, -1, 34, -1, 67, 9, -1, - 69, 9, -1, 68, 9, 49, 132, -1, 68, 9, - 49, 130, -1, 9, 183, 169, 170, 171, -1, 167, - -1, 168, 117, 167, -1, -1, 114, 3, 115, -1, - -1, 89, -1, -1, 12, 8, -1, -1, 61, -1, - -1, 101, -1, -1, 102, 104, 3, -1, 56, 57, - 180, 114, 168, 115, 172, 173, 174, -1, 9, -1, - 176, 117, 9, -1, -1, 59, -1, -1, 60, -1, - 56, 177, 178, 58, 9, 62, 180, 114, 176, 115, - -1, 9, -1, 100, -1, 86, 88, -1, 87, 88, - -1, 21, -1, 22, -1, 103, -1, 24, -1, 19, - -1, 20, -1, 9, 17, 183, -1, 9, 18, 183, - -1, -1, 184, -1, 185, 117, 184, -1, 9, 183, - 113, -1, -1, 186, -1, 187, 186, -1, 64, 65, - 9, 25, 142, 113, -1, 64, 91, 9, 113, -1, - 188, -1, 189, -1, -1, 190, -1, 191, 190, -1, - 16, 9, 114, 185, 115, 25, 187, 191, 26, 123, - 27, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 162, 162, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 190, 191, 196, 197, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 225, 230, 231, 232, 233, 235, 236, - 237, 238, 239, 240, 241, 244, 246, 247, 251, 257, - 262, 263, 264, 268, 272, 273, 278, 279, 280, 285, - 286, 287, 291, 292, 297, 303, 310, 311, 312, 317, - 319, 322, 326, 327, 331, 332, 337, 338, 343, 344, - 345, 349, 350, 357, 372, 377, 380, 388, 394, 395, - 400, 406, 415, 423, 431, 438, 446, 454, 460, 467, - 473, 474, 479, 480, 482, 486, 493, 499, 509, 513, - 517, 524, 531, 535, 543, 552, 553, 558, 559, 564, - 565, 571, 572, 578, 579, 585, 586, 591, 592, 597, - 608, 609, 614, 615, 619, 620, 624, 638, 639, 643, - 648, 653, 654, 655, 656, 657, 658, 662, 667, 675, - 676, 677, 682, 688, 690, 691, 695, 703, 709, 710, - 713, 715, 716, 720 + 0, 163, 163, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 191, 192, 197, 198, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 226, 231, 232, 233, 234, 236, 237, + 238, 239, 240, 241, 242, 245, 247, 248, 252, 258, + 263, 264, 265, 269, 273, 274, 279, 280, 281, 286, + 287, 288, 292, 293, 298, 304, 311, 312, 313, 318, + 320, 323, 327, 328, 332, 333, 338, 339, 344, 345, + 346, 350, 351, 358, 373, 378, 381, 389, 395, 396, + 401, 407, 416, 424, 432, 439, 447, 455, 461, 468, + 474, 475, 480, 481, 483, 487, 494, 500, 510, 514, + 518, 525, 532, 536, 544, 553, 554, 559, 560, 565, + 566, 572, 573, 579, 580, 585, 586, 591, 602, 603, + 608, 609, 613, 614, 618, 632, 633, 637, 642, 647, + 648, 649, 650, 651, 652, 656, 661, 669, 670, 671, + 676, 682, 684, 685, 689, 697, 703, 704, 707, 709, + 710, 714 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -738,19 +588,19 @@ static const char *const yytname[] = "PARS_UPDATE_TOKEN", "PARS_SET_TOKEN", "PARS_DELETE_TOKEN", "PARS_CURRENT_TOKEN", "PARS_OF_TOKEN", "PARS_CREATE_TOKEN", "PARS_TABLE_TOKEN", "PARS_INDEX_TOKEN", "PARS_UNIQUE_TOKEN", - "PARS_CLUSTERED_TOKEN", "PARS_DOES_NOT_FIT_IN_MEM_TOKEN", - "PARS_ON_TOKEN", "PARS_ASSIGN_TOKEN", "PARS_DECLARE_TOKEN", - "PARS_CURSOR_TOKEN", "PARS_SQL_TOKEN", "PARS_OPEN_TOKEN", - "PARS_FETCH_TOKEN", "PARS_CLOSE_TOKEN", "PARS_NOTFOUND_TOKEN", - "PARS_TO_CHAR_TOKEN", "PARS_TO_NUMBER_TOKEN", "PARS_TO_BINARY_TOKEN", - "PARS_BINARY_TO_NUMBER_TOKEN", "PARS_SUBSTR_TOKEN", "PARS_REPLSTR_TOKEN", - "PARS_CONCAT_TOKEN", "PARS_INSTR_TOKEN", "PARS_LENGTH_TOKEN", - "PARS_SYSDATE_TOKEN", "PARS_PRINTF_TOKEN", "PARS_ASSERT_TOKEN", - "PARS_RND_TOKEN", "PARS_RND_STR_TOKEN", "PARS_ROW_PRINTF_TOKEN", - "PARS_COMMIT_TOKEN", "PARS_ROLLBACK_TOKEN", "PARS_WORK_TOKEN", - "PARS_UNSIGNED_TOKEN", "PARS_EXIT_TOKEN", "PARS_FUNCTION_TOKEN", - "PARS_LOCK_TOKEN", "PARS_SHARE_TOKEN", "PARS_MODE_TOKEN", - "PARS_LIKE_TOKEN", "PARS_LIKE_TOKEN_EXACT", "PARS_LIKE_TOKEN_PREFIX", + "PARS_CLUSTERED_TOKEN", "PARS_ON_TOKEN", "PARS_ASSIGN_TOKEN", + "PARS_DECLARE_TOKEN", "PARS_CURSOR_TOKEN", "PARS_SQL_TOKEN", + "PARS_OPEN_TOKEN", "PARS_FETCH_TOKEN", "PARS_CLOSE_TOKEN", + "PARS_NOTFOUND_TOKEN", "PARS_TO_CHAR_TOKEN", "PARS_TO_NUMBER_TOKEN", + "PARS_TO_BINARY_TOKEN", "PARS_BINARY_TO_NUMBER_TOKEN", + "PARS_SUBSTR_TOKEN", "PARS_REPLSTR_TOKEN", "PARS_CONCAT_TOKEN", + "PARS_INSTR_TOKEN", "PARS_LENGTH_TOKEN", "PARS_SYSDATE_TOKEN", + "PARS_PRINTF_TOKEN", "PARS_ASSERT_TOKEN", "PARS_RND_TOKEN", + "PARS_RND_STR_TOKEN", "PARS_ROW_PRINTF_TOKEN", "PARS_COMMIT_TOKEN", + "PARS_ROLLBACK_TOKEN", "PARS_WORK_TOKEN", "PARS_UNSIGNED_TOKEN", + "PARS_EXIT_TOKEN", "PARS_FUNCTION_TOKEN", "PARS_LOCK_TOKEN", + "PARS_SHARE_TOKEN", "PARS_MODE_TOKEN", "PARS_LIKE_TOKEN", + "PARS_LIKE_TOKEN_EXACT", "PARS_LIKE_TOKEN_PREFIX", "PARS_LIKE_TOKEN_SUFFIX", "PARS_LIKE_TOKEN_SUBSTR", "PARS_TABLE_NAME_TOKEN", "PARS_COMPACT_TOKEN", "PARS_BLOCK_SIZE_TOKEN", "PARS_BIGINT_TOKEN", "'='", "'<'", "'>'", "'-'", "'+'", "'*'", "'/'", @@ -771,20 +621,19 @@ static const char *const yytname[] = "if_statement", "while_statement", "for_statement", "exit_statement", "return_statement", "open_cursor_statement", "close_cursor_statement", "fetch_statement", "column_def", "column_def_list", "opt_column_len", - "opt_unsigned", "opt_not_null", "not_fit_in_memory", "compact", - "block_size", "create_table", "column_list", "unique_def", - "clustered_def", "create_index", "table_name", "commit_statement", - "rollback_statement", "type_name", "parameter_declaration", - "parameter_declaration_list", "variable_declaration", - "variable_declaration_list", "cursor_declaration", - "function_declaration", "declaration", "declaration_list", - "procedure_definition", 0 + "opt_unsigned", "opt_not_null", "compact", "block_size", "create_table", + "column_list", "unique_def", "clustered_def", "create_index", + "table_name", "commit_statement", "rollback_statement", "type_name", + "parameter_declaration", "parameter_declaration_list", + "variable_declaration", "variable_declaration_list", + "cursor_declaration", "function_declaration", "declaration", + "declaration_list", "procedure_definition", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -797,86 +646,89 @@ static const yytype_uint16 yytoknum[] = 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 61, 60, 62, 45, 43, 42, - 47, 359, 37, 59, 40, 41, 63, 44, 123, 125 + 355, 356, 357, 61, 60, 62, 45, 43, 42, 47, + 358, 37, 59, 40, 41, 63, 44, 123, 125 }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 120, 121, 122, 122, 122, 122, 122, 122, 122, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122, 122, 122, 122, 122, 123, 123, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 126, 126, 126, 127, 128, - 129, 129, 129, 130, 131, 131, 132, 132, 132, 133, - 133, 133, 134, 134, 134, 134, 135, 135, 135, 136, - 136, 136, 137, 137, 138, 138, 139, 139, 140, 140, - 140, 141, 141, 142, 143, 144, 144, 145, 146, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 157, 158, 158, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 166, 167, 168, 168, 169, 169, 170, - 170, 171, 171, 172, 172, 173, 173, 174, 174, 175, - 176, 176, 177, 177, 178, 178, 179, 180, 180, 181, - 182, 183, 183, 183, 183, 183, 183, 184, 184, 185, - 185, 185, 186, 187, 187, 187, 188, 189, 190, 190, - 191, 191, 191, 192 -}; +#define YYPACT_NINF -179 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-179))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = { - 0, 2, 2, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 1, 4, 1, - 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, - 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 2, 3, 3, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 1, 3, 6, 4, - 1, 1, 1, 3, 1, 3, 0, 1, 3, 0, - 1, 3, 1, 4, 5, 4, 0, 1, 3, 1, - 3, 1, 0, 2, 0, 2, 0, 4, 0, 1, - 1, 0, 4, 8, 3, 5, 2, 3, 1, 3, - 4, 4, 2, 2, 3, 2, 2, 2, 3, 4, - 1, 2, 0, 2, 1, 7, 6, 10, 1, 1, - 2, 2, 4, 4, 5, 1, 3, 0, 3, 0, - 1, 0, 2, 0, 1, 0, 1, 0, 3, 9, - 1, 3, 0, 1, 0, 1, 10, 1, 1, 2, - 2, 1, 1, 1, 1, 1, 1, 3, 3, 0, - 1, 3, 3, 0, 1, 2, 6, 4, 1, 1, - 0, 1, 2, 11 + 35, 50, 72, -37, -36, -179, -179, 67, 49, -179, + -78, 13, 13, 53, 67, -179, -179, -179, -179, -179, + -179, -179, -179, 76, -179, 13, -179, 7, -31, -34, + -179, -179, -179, -179, -14, -179, 77, 83, 583, -179, + 78, -10, 42, 284, 284, -179, 17, 96, 58, 2, + 69, -16, 105, 107, 108, -179, -179, -179, 84, 31, + 37, -179, 113, -179, 403, -179, 14, 15, 19, -4, + 21, 89, 23, 24, 89, 25, 26, 32, 33, 44, + 45, 47, 51, 52, 54, 55, 56, 57, 60, 62, + 63, 84, -179, 284, -179, -179, -179, -179, -179, -179, + 43, 284, 59, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, 284, 284, 571, 70, 612, 73, + 74, -179, 699, -179, -45, 95, 145, 2, -179, -179, + 136, 2, 2, -179, 129, -179, 116, -179, -179, -179, + -179, 79, -179, -179, -179, 284, -179, 80, -179, -179, + 194, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, 82, 699, 121, 715, 122, 3, 210, + 284, 284, 284, 284, 284, 583, 190, 284, 284, 284, + 284, 284, 284, 284, 284, 583, 284, -29, 187, 173, + 2, 284, -179, 195, -179, 92, -179, 149, 199, 97, + 699, -72, 284, 156, 699, -179, -179, -179, -179, 715, + 715, 4, 4, 699, 343, -179, 4, 4, 4, 12, + 12, 3, 3, -69, 463, 226, 204, 101, -179, 100, + -179, -32, -179, 642, 114, -179, 103, 217, 218, 117, + -179, 100, -179, -66, -179, 284, -59, 220, 583, 284, + -179, 202, 207, -179, 203, -179, 128, -179, 244, 284, + 2, 216, 284, 284, 195, 13, -179, -52, 200, 146, + 144, 154, 699, -179, -179, 583, 672, -179, 246, -179, + -179, -179, -179, 224, 189, 679, 699, -179, 165, 181, + 217, 2, -179, -179, -179, 583, -179, -179, 265, 239, + 583, 281, 197, -179, 193, -179, 182, 583, 205, 253, + -179, 523, 185, -179, 289, 206, -179, 293, 212, 294, + 274, -179, 300, -179, 307, -179, -51, -179, 22, -179, + -179, -179, -179, 302, -179, -179, -179, -179 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 0, 0, 0, 0, 1, 2, 169, 0, 170, - 0, 0, 0, 0, 0, 165, 166, 161, 162, 164, - 163, 167, 168, 173, 171, 0, 174, 180, 0, 0, - 175, 178, 179, 181, 0, 172, 0, 0, 0, 182, + 0, 0, 0, 0, 0, 1, 2, 167, 0, 168, + 0, 0, 0, 0, 0, 163, 164, 159, 160, 162, + 161, 165, 166, 171, 169, 0, 172, 178, 0, 0, + 173, 176, 177, 179, 0, 170, 0, 0, 0, 180, 0, 0, 0, 0, 0, 129, 86, 0, 0, 0, - 0, 152, 0, 0, 0, 70, 71, 72, 0, 0, + 0, 150, 0, 0, 0, 70, 71, 72, 0, 0, 0, 128, 0, 25, 0, 3, 0, 0, 0, 0, 0, 92, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 177, 0, 29, 30, 31, 32, 33, 34, + 0, 0, 175, 0, 29, 30, 31, 32, 33, 34, 27, 0, 35, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 0, 0, 0, 0, 0, 0, - 0, 89, 82, 87, 91, 0, 0, 0, 157, 158, - 0, 0, 0, 153, 154, 130, 0, 131, 117, 159, - 160, 0, 183, 26, 4, 79, 11, 0, 106, 12, + 0, 89, 82, 87, 91, 0, 0, 0, 155, 156, + 0, 0, 0, 151, 152, 130, 0, 131, 117, 157, + 158, 0, 181, 26, 4, 79, 11, 0, 106, 12, 0, 112, 113, 16, 17, 115, 116, 14, 15, 13, 10, 8, 5, 6, 7, 9, 18, 20, 19, 23, 24, 21, 22, 0, 118, 0, 51, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 76, 0, - 0, 0, 104, 0, 114, 0, 155, 0, 76, 65, - 80, 0, 79, 0, 93, 176, 52, 53, 41, 49, + 0, 0, 104, 0, 114, 0, 153, 0, 76, 65, + 80, 0, 79, 0, 93, 174, 52, 53, 41, 49, 50, 46, 47, 48, 122, 43, 42, 44, 45, 37, 36, 38, 39, 0, 0, 0, 0, 0, 77, 90, 88, 92, 74, 0, 0, 108, 111, 0, 0, 77, @@ -887,386 +739,338 @@ static const yytype_uint8 yydefact[] = 84, 78, 75, 0, 96, 0, 107, 109, 137, 143, 0, 0, 73, 68, 67, 0, 125, 95, 0, 101, 0, 0, 139, 144, 145, 136, 0, 119, 0, 0, - 103, 0, 0, 140, 141, 146, 147, 0, 0, 0, - 0, 138, 0, 134, 0, 149, 150, 0, 97, 98, - 127, 142, 0, 156, 0, 99, 100, 102, 148, 151 + 103, 0, 0, 140, 141, 0, 147, 0, 0, 0, + 0, 138, 0, 134, 0, 148, 0, 97, 98, 127, + 142, 146, 154, 0, 99, 100, 102, 149 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -179, -179, -63, -178, -41, -179, -179, -179, -179, -179, + -179, -179, 104, -154, 123, -179, -179, -68, -179, -179, + -179, -179, -30, -179, -179, 64, -179, 247, -179, -179, + -179, -179, -179, -179, -179, -179, 65, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, 27, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -117, + -179, -179, -12, 309, -179, 298, -179, -179, -179, 303, + -179, -179 }; -/* YYDEFGOTO[NTERM-NUM]. */ + /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 2, 63, 64, 210, 117, 253, 65, 66, 67, 250, 241, 239, 211, 123, 124, 125, 151, 294, 309, - 347, 320, 68, 69, 70, 245, 246, 152, 71, 72, + 346, 320, 68, 69, 70, 245, 246, 152, 71, 72, 73, 74, 75, 76, 77, 78, 260, 261, 262, 79, 80, 81, 82, 83, 84, 85, 86, 276, 277, 312, - 324, 333, 314, 326, 335, 87, 337, 134, 207, 88, - 130, 89, 90, 21, 9, 10, 26, 27, 31, 32, - 33, 34, 3 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -179 -static const yytype_int16 yypact[] = -{ - 24, 36, 58, -48, -25, -179, -179, 57, 31, -179, - -74, 14, 14, 50, 57, -179, -179, -179, -179, -179, - -179, -179, -179, 72, -179, 14, -179, 3, -26, -28, - -179, -179, -179, -179, 4, -179, 91, 95, 589, -179, - 80, -6, 43, 285, 285, -179, 19, 99, 69, -5, - 81, -13, 110, 112, 114, -179, -179, -179, 89, 37, - 41, -179, 122, -179, 406, -179, 25, 40, 44, -3, - 46, 116, 49, 51, 116, 52, 53, 54, 55, 56, - 59, 61, 62, 70, 73, 74, 75, 76, 77, 78, - 79, 89, -179, 285, -179, -179, -179, -179, -179, -179, - 82, 285, 83, -179, -179, -179, -179, -179, -179, -179, - -179, -179, -179, -179, 285, 285, 577, 92, 618, 94, - 97, -179, 706, -179, -33, 124, 153, -5, -179, -179, - 141, -5, -5, -179, 136, -179, 148, -179, -179, -179, - -179, 98, -179, -179, -179, 285, -179, 101, -179, -179, - 195, -179, -179, -179, -179, -179, -179, -179, -179, -179, - -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, - -179, -179, -179, 100, 706, 135, 6, 154, -7, 206, - 285, 285, 285, 285, 285, 589, 218, 285, 285, 285, - 285, 285, 285, 285, 285, 589, 285, -27, 216, 173, - -5, 285, -179, 217, -179, 113, -179, 171, 221, 119, - 706, -56, 285, 185, 706, -179, -179, -179, -179, 6, - 6, 27, 27, 706, 345, -179, 27, 27, 27, 35, - 35, -7, -7, -53, 467, 223, 232, 127, -179, 126, - -179, -31, -179, 638, 151, -179, 142, 251, 253, 150, - -179, 126, -179, -46, -179, 285, -45, 256, 589, 285, - -179, 240, 249, -179, 245, -179, 166, -179, 273, 285, - -5, 242, 285, 285, 217, 14, -179, -39, 222, 170, - 167, 179, 706, -179, -179, 589, 679, -179, 268, -179, - -179, -179, -179, 247, 207, 686, 706, -179, 186, 243, - 251, -5, -179, -179, -179, 589, -179, -179, 286, 261, - 589, 303, 219, -179, 224, -179, 193, 589, 226, 272, - -179, 528, 205, -179, 310, -179, 233, 314, 230, 317, - 302, -179, 328, -179, 235, -179, -179, -38, -179, 7, - -179, -179, 334, -179, 331, -179, -179, -179, -179, -179 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -179, -179, -63, -178, -41, -179, -179, -179, -179, -179, - -179, -179, 133, -155, 143, -179, -179, -68, -179, -179, - -179, -179, -40, -179, -179, 71, -179, 269, -179, -179, - -179, -179, -179, -179, -179, -179, 85, -179, -179, -179, - -179, -179, -179, -179, -179, -179, -179, 47, -179, -179, - -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, - -117, -179, -179, -12, 330, -179, 321, -179, -179, -179, - 315, -179, -179 + 324, 333, 314, 326, 87, 336, 134, 207, 88, 130, + 89, 90, 21, 9, 10, 26, 27, 31, 32, 33, + 34, 3 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint16 yytable[] = { - 22, 143, 116, 118, 128, 122, 155, 224, 184, 269, - 202, 236, 25, 28, 204, 205, 198, 234, 138, 182, - 183, 184, 94, 95, 96, 97, 98, 99, 100, 148, - 38, 101, 46, 15, 16, 17, 18, 36, 19, 233, - 1, 13, 184, 14, 132, 4, 133, 147, 11, 12, - 184, 173, 174, 345, 346, 119, 120, 256, 5, 254, - 176, 255, 263, 37, 255, 6, 8, 29, 29, 280, - 283, 281, 255, 178, 179, 23, 299, 343, 300, 344, - 285, 25, 237, 242, 199, 102, 270, 35, 186, 7, - 103, 104, 105, 106, 107, 129, 108, 109, 110, 111, - 40, 186, 112, 113, 41, 91, 93, 92, 126, 214, - 187, 188, 189, 190, 191, 192, 193, 20, 127, 135, - 131, 136, 186, 137, 46, 139, 114, 317, 121, 140, - 186, 141, 321, 115, 190, 191, 192, 193, 144, 219, - 220, 221, 222, 223, 192, 193, 226, 227, 228, 229, - 230, 231, 232, 292, 145, 235, 150, 146, 122, 149, - 243, 143, 153, 200, 154, 157, 158, 159, 160, 161, - 201, 143, 162, 271, 163, 164, 94, 95, 96, 97, - 98, 99, 100, 165, 316, 101, 166, 167, 168, 169, - 170, 171, 172, 203, 175, 177, 206, 208, 94, 95, - 96, 97, 98, 99, 100, 216, 194, 101, 196, 119, - 120, 197, 209, 215, 282, 212, 180, 181, 286, 182, - 183, 184, 143, 225, 217, 238, 244, 247, 214, 248, - 249, 295, 296, 180, 181, 252, 182, 183, 184, 102, - 257, 266, 267, 268, 103, 104, 105, 106, 107, 213, - 108, 109, 110, 111, 143, 273, 112, 113, 143, 274, - 275, 102, 278, 298, 279, 284, 103, 104, 105, 106, - 107, 259, 108, 109, 110, 111, 288, 289, 112, 113, - 114, 290, 291, 293, 301, 302, 303, 115, 94, 95, - 96, 97, 98, 99, 100, 304, 306, 101, 307, 308, - 311, 186, 114, 318, 313, 319, 322, 327, 323, 115, - 187, 188, 189, 190, 191, 192, 193, 329, 186, 328, - 331, 218, 332, 336, 338, 325, 339, 187, 188, 189, - 190, 191, 192, 193, 340, 334, 341, 348, 265, 342, - 349, 251, 240, 156, 24, 297, 287, 315, 30, 39, - 0, 102, 0, 0, 42, 0, 103, 104, 105, 106, - 107, 0, 108, 109, 110, 111, 0, 0, 112, 113, - 0, 0, 0, 43, 0, 258, 259, 0, 44, 45, - 46, 0, 0, 0, 0, 0, 47, 0, 0, 0, - 0, 0, 114, 48, 0, 0, 49, 0, 50, 115, - 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 52, 53, 54, 42, 0, 0, 0, 0, - 0, 55, 0, 0, 0, 0, 56, 57, 0, 0, - 58, 59, 60, 142, 43, 61, 0, 0, 0, 44, - 45, 46, 0, 0, 0, 0, 0, 47, 0, 0, - 0, 0, 0, 0, 48, 0, 0, 49, 0, 50, - 0, 0, 51, 62, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 52, 53, 54, 42, 0, 0, 0, - 0, 0, 55, 0, 0, 0, 0, 56, 57, 0, - 0, 58, 59, 60, 264, 43, 61, 0, 0, 0, - 44, 45, 46, 0, 0, 0, 0, 0, 47, 0, - 0, 0, 0, 0, 0, 48, 0, 0, 49, 0, - 50, 0, 0, 51, 62, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 53, 54, 42, 0, 0, - 0, 0, 0, 55, 0, 0, 0, 0, 56, 57, - 0, 0, 58, 59, 60, 330, 43, 61, 0, 0, - 0, 44, 45, 46, 0, 0, 0, 0, 0, 47, - 0, 0, 0, 0, 0, 0, 48, 0, 0, 49, - 0, 50, 0, 0, 51, 62, 0, 180, 181, 0, - 182, 183, 184, 0, 0, 52, 53, 54, 42, 0, - 0, 0, 0, 0, 55, 0, 185, 0, 0, 56, - 57, 0, 0, 58, 59, 60, 0, 43, 61, 0, - 0, 0, 44, 45, 46, 0, 0, 0, 180, 181, - 47, 182, 183, 184, 0, 0, 0, 48, 0, 0, - 49, 0, 50, 0, 0, 51, 62, 0, 180, 181, - 195, 182, 183, 184, 0, 0, 52, 53, 54, 0, - 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, - 56, 57, 186, 0, 58, 59, 60, 0, 0, 61, - 272, 187, 188, 189, 190, 191, 192, 193, 0, 180, - 181, 0, 182, 183, 184, 0, 180, 181, 0, 182, - 183, 184, 0, 0, 0, 0, 0, 62, 305, 0, - 0, 0, 0, 186, 0, 0, 180, 181, 310, 182, - 183, 184, 187, 188, 189, 190, 191, 192, 193, 0, + 22, 143, 116, 118, 198, 122, 155, 224, 269, 236, + 202, 128, 38, 28, 204, 205, 25, 234, 184, 184, + 94, 95, 96, 97, 98, 99, 100, 184, 138, 101, + 36, 46, 15, 16, 17, 18, 13, 19, 14, 148, + 233, 132, 254, 133, 255, 263, 147, 255, 280, 29, + 281, 1, 174, 119, 120, 283, 37, 255, 256, 4, + 176, 173, 299, 342, 300, 343, 11, 12, 344, 345, + 29, 199, 5, 178, 179, 6, 8, 7, 23, 237, + 285, 35, 102, 242, 270, 25, 40, 103, 104, 105, + 106, 107, 41, 108, 109, 110, 111, 186, 186, 112, + 113, 129, 92, 91, 93, 126, 186, 127, 131, 214, + 190, 191, 192, 193, 135, 20, 136, 137, 139, 46, + 192, 193, 141, 114, 140, 121, 144, 317, 145, 150, + 115, 146, 321, 149, 200, 153, 154, 157, 158, 219, + 220, 221, 222, 223, 159, 160, 226, 227, 228, 229, + 230, 231, 232, 292, 175, 235, 161, 162, 122, 163, + 243, 143, 201, 164, 165, 208, 166, 167, 168, 169, + 177, 143, 170, 271, 171, 172, 94, 95, 96, 97, + 98, 99, 100, 194, 316, 101, 196, 197, 203, 206, + 216, 217, 209, 212, 215, 225, 238, 94, 95, 96, + 97, 98, 99, 100, 244, 247, 101, 248, 249, 119, + 120, 257, 252, 266, 282, 267, 268, 273, 286, 274, + 180, 181, 143, 182, 183, 184, 275, 278, 214, 284, + 279, 295, 296, 259, 288, 289, 180, 181, 102, 182, + 183, 184, 290, 103, 104, 105, 106, 107, 213, 108, + 109, 110, 111, 291, 143, 112, 113, 293, 143, 102, + 302, 301, 303, 298, 103, 104, 105, 106, 107, 304, + 108, 109, 110, 111, 306, 307, 112, 113, 311, 114, + 308, 313, 318, 319, 322, 323, 115, 94, 95, 96, + 97, 98, 99, 100, 325, 327, 101, 328, 329, 331, + 114, 332, 335, 338, 186, 337, 339, 115, 340, 334, + 341, 347, 251, 187, 188, 189, 190, 191, 192, 193, + 186, 156, 240, 24, 218, 30, 287, 315, 0, 187, + 188, 189, 190, 191, 192, 193, 0, 39, 297, 0, + 265, 0, 0, 0, 0, 0, 0, 0, 0, 102, + 0, 0, 42, 0, 103, 104, 105, 106, 107, 0, + 108, 109, 110, 111, 0, 0, 112, 113, 0, 0, + 0, 43, 0, 258, 259, 0, 44, 45, 46, 0, + 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, + 114, 48, 0, 0, 49, 0, 50, 115, 0, 51, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, + 53, 54, 42, 0, 0, 0, 0, 0, 55, 0, + 0, 0, 0, 56, 57, 0, 0, 58, 59, 60, + 142, 43, 61, 0, 0, 0, 44, 45, 46, 0, + 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, + 0, 48, 0, 0, 49, 0, 50, 0, 0, 51, + 62, 0, 0, 0, 0, 0, 0, 0, 0, 52, + 53, 54, 42, 0, 0, 0, 0, 0, 55, 0, + 0, 0, 0, 56, 57, 0, 0, 58, 59, 60, + 264, 43, 61, 0, 0, 0, 44, 45, 46, 0, + 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, + 0, 48, 0, 0, 49, 0, 50, 0, 0, 51, + 62, 0, 0, 0, 0, 0, 0, 0, 0, 52, + 53, 54, 42, 0, 0, 0, 0, 0, 55, 0, + 0, 0, 0, 56, 57, 0, 0, 58, 59, 60, + 330, 43, 61, 0, 0, 0, 44, 45, 46, 0, + 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, + 0, 48, 0, 0, 49, 0, 50, 0, 0, 51, + 62, 180, 181, 0, 182, 183, 184, 0, 0, 52, + 53, 54, 42, 0, 0, 0, 0, 0, 55, 0, + 185, 0, 0, 56, 57, 0, 0, 58, 59, 60, + 0, 43, 61, 0, 0, 0, 44, 45, 46, 0, + 0, 0, 180, 181, 47, 182, 183, 184, 0, 0, + 0, 48, 0, 0, 49, 0, 50, 0, 0, 51, + 62, 0, 0, 0, 195, 0, 0, 0, 0, 52, + 53, 54, 180, 181, 0, 182, 183, 184, 55, 0, + 0, 0, 0, 56, 57, 186, 0, 58, 59, 60, + 0, 0, 61, 0, 187, 188, 189, 190, 191, 192, + 193, 0, 180, 181, 272, 182, 183, 184, 0, 180, + 181, 0, 182, 183, 184, 0, 0, 0, 0, 0, + 62, 305, 0, 0, 0, 0, 186, 0, 0, 180, + 181, 310, 182, 183, 184, 187, 188, 189, 190, 191, + 192, 193, 0, 0, 0, 0, 0, 0, 182, 183, + 184, 0, 0, 0, 0, 0, 186, 0, 0, 0, + 0, 0, 0, 0, 0, 187, 188, 189, 190, 191, + 192, 193, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 186, 0, 0, 0, + 0, 0, 0, 186, 0, 187, 188, 189, 190, 191, + 192, 193, 187, 188, 189, 190, 191, 192, 193, 0, 0, 0, 0, 186, 0, 0, 0, 0, 0, 0, - 0, 0, 187, 188, 189, 190, 191, 192, 193, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 186, 0, 0, 0, 0, 0, - 0, 186, 0, 187, 188, 189, 190, 191, 192, 193, - 187, 188, 189, 190, 191, 192, 193, 0, 0, 0, - 0, 186, 0, 0, 0, 0, 0, 0, 0, 0, - 187, 188, 189, 190, 191, 192, 193 + 0, 0, 187, 188, 189, 190, 191, 192, 193, 186, + 0, 0, 0, 0, 0, 0, 0, 0, 187, 188, + 189, 190, 191, 192, 193 }; static const yytype_int16 yycheck[] = { - 12, 64, 43, 44, 9, 46, 74, 185, 15, 40, - 127, 38, 9, 25, 131, 132, 49, 195, 58, 13, - 14, 15, 3, 4, 5, 6, 7, 8, 9, 69, - 26, 12, 35, 19, 20, 21, 22, 65, 24, 194, - 16, 115, 15, 117, 57, 9, 59, 50, 17, 18, - 15, 91, 93, 46, 47, 36, 37, 212, 0, 115, - 101, 117, 115, 91, 117, 113, 9, 64, 64, 115, - 115, 117, 117, 114, 115, 25, 115, 115, 117, 117, - 258, 9, 109, 200, 117, 66, 117, 113, 95, 114, - 71, 72, 73, 74, 75, 100, 77, 78, 79, 80, - 9, 95, 83, 84, 9, 25, 63, 113, 9, 150, - 104, 105, 106, 107, 108, 109, 110, 103, 49, 9, - 39, 9, 95, 9, 35, 88, 107, 305, 109, 88, - 95, 9, 310, 114, 107, 108, 109, 110, 113, 180, - 181, 182, 183, 184, 109, 110, 187, 188, 189, 190, - 191, 192, 193, 270, 114, 196, 40, 113, 199, 113, - 201, 224, 113, 39, 113, 113, 113, 113, 113, 113, - 17, 234, 113, 241, 113, 113, 3, 4, 5, 6, - 7, 8, 9, 113, 301, 12, 113, 113, 113, 113, - 113, 113, 113, 52, 112, 112, 60, 49, 3, 4, - 5, 6, 7, 8, 9, 70, 114, 12, 114, 36, - 37, 114, 114, 113, 255, 114, 10, 11, 259, 13, - 14, 15, 285, 5, 70, 9, 9, 114, 269, 58, - 9, 272, 273, 10, 11, 116, 13, 14, 15, 66, - 55, 9, 115, 117, 71, 72, 73, 74, 75, 54, - 77, 78, 79, 80, 317, 104, 83, 84, 321, 117, - 9, 66, 9, 275, 114, 9, 71, 72, 73, 74, - 75, 31, 77, 78, 79, 80, 27, 32, 83, 84, - 107, 115, 9, 41, 62, 115, 119, 114, 3, 4, - 5, 6, 7, 8, 9, 116, 28, 12, 51, 92, - 114, 95, 107, 17, 61, 44, 3, 114, 89, 114, - 104, 105, 106, 107, 108, 109, 110, 45, 95, 93, - 115, 115, 12, 9, 94, 101, 9, 104, 105, 106, - 107, 108, 109, 110, 32, 102, 8, 3, 115, 104, - 9, 208, 199, 74, 14, 274, 261, 300, 27, 34, - -1, 66, -1, -1, 9, -1, 71, 72, 73, 74, - 75, -1, 77, 78, 79, 80, -1, -1, 83, 84, - -1, -1, -1, 28, -1, 30, 31, -1, 33, 34, - 35, -1, -1, -1, -1, -1, 41, -1, -1, -1, - -1, -1, 107, 48, -1, -1, 51, -1, 53, 114, - -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 67, 68, 69, 9, -1, -1, -1, -1, - -1, 76, -1, -1, -1, -1, 81, 82, -1, -1, - 85, 86, 87, 27, 28, 90, -1, -1, -1, 33, - 34, 35, -1, -1, -1, -1, -1, 41, -1, -1, - -1, -1, -1, -1, 48, -1, -1, 51, -1, 53, - -1, -1, 56, 118, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 67, 68, 69, 9, -1, -1, -1, - -1, -1, 76, -1, -1, -1, -1, 81, 82, -1, - -1, 85, 86, 87, 27, 28, 90, -1, -1, -1, - 33, 34, 35, -1, -1, -1, -1, -1, 41, -1, - -1, -1, -1, -1, -1, 48, -1, -1, 51, -1, - 53, -1, -1, 56, 118, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 67, 68, 69, 9, -1, -1, - -1, -1, -1, 76, -1, -1, -1, -1, 81, 82, - -1, -1, 85, 86, 87, 27, 28, 90, -1, -1, - -1, 33, 34, 35, -1, -1, -1, -1, -1, 41, - -1, -1, -1, -1, -1, -1, 48, -1, -1, 51, - -1, 53, -1, -1, 56, 118, -1, 10, 11, -1, - 13, 14, 15, -1, -1, 67, 68, 69, 9, -1, - -1, -1, -1, -1, 76, -1, 29, -1, -1, 81, - 82, -1, -1, 85, 86, 87, -1, 28, 90, -1, - -1, -1, 33, 34, 35, -1, -1, -1, 10, 11, - 41, 13, 14, 15, -1, -1, -1, 48, -1, -1, - 51, -1, 53, -1, -1, 56, 118, -1, 10, 11, - 32, 13, 14, 15, -1, -1, 67, 68, 69, -1, - -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, - 81, 82, 95, -1, 85, 86, 87, -1, -1, 90, - 42, 104, 105, 106, 107, 108, 109, 110, -1, 10, - 11, -1, 13, 14, 15, -1, 10, 11, -1, 13, - 14, 15, -1, -1, -1, -1, -1, 118, 29, -1, - -1, -1, -1, 95, -1, -1, 10, 11, 32, 13, - 14, 15, 104, 105, 106, 107, 108, 109, 110, -1, - -1, -1, -1, 95, -1, -1, -1, -1, -1, -1, - -1, -1, 104, 105, 106, 107, 108, 109, 110, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 95, -1, -1, -1, -1, -1, - -1, 95, -1, 104, 105, 106, 107, 108, 109, 110, - 104, 105, 106, 107, 108, 109, 110, -1, -1, -1, - -1, 95, -1, -1, -1, -1, -1, -1, -1, -1, - 104, 105, 106, 107, 108, 109, 110 + 12, 64, 43, 44, 49, 46, 74, 185, 40, 38, + 127, 9, 26, 25, 131, 132, 9, 195, 15, 15, + 3, 4, 5, 6, 7, 8, 9, 15, 58, 12, + 64, 35, 19, 20, 21, 22, 114, 24, 116, 69, + 194, 57, 114, 59, 116, 114, 50, 116, 114, 63, + 116, 16, 93, 36, 37, 114, 90, 116, 212, 9, + 101, 91, 114, 114, 116, 116, 17, 18, 46, 47, + 63, 116, 0, 114, 115, 112, 9, 113, 25, 108, + 258, 112, 65, 200, 116, 9, 9, 70, 71, 72, + 73, 74, 9, 76, 77, 78, 79, 94, 94, 82, + 83, 99, 112, 25, 62, 9, 94, 49, 39, 150, + 106, 107, 108, 109, 9, 102, 9, 9, 87, 35, + 108, 109, 9, 106, 87, 108, 112, 305, 113, 40, + 113, 112, 310, 112, 39, 112, 112, 112, 112, 180, + 181, 182, 183, 184, 112, 112, 187, 188, 189, 190, + 191, 192, 193, 270, 111, 196, 112, 112, 199, 112, + 201, 224, 17, 112, 112, 49, 112, 112, 112, 112, + 111, 234, 112, 241, 112, 112, 3, 4, 5, 6, + 7, 8, 9, 113, 301, 12, 113, 113, 52, 60, + 69, 69, 113, 113, 112, 5, 9, 3, 4, 5, + 6, 7, 8, 9, 9, 113, 12, 58, 9, 36, + 37, 55, 115, 9, 255, 114, 116, 103, 259, 116, + 10, 11, 285, 13, 14, 15, 9, 9, 269, 9, + 113, 272, 273, 31, 27, 32, 10, 11, 65, 13, + 14, 15, 114, 70, 71, 72, 73, 74, 54, 76, + 77, 78, 79, 9, 317, 82, 83, 41, 321, 65, + 114, 61, 118, 275, 70, 71, 72, 73, 74, 115, + 76, 77, 78, 79, 28, 51, 82, 83, 113, 106, + 91, 100, 17, 44, 3, 88, 113, 3, 4, 5, + 6, 7, 8, 9, 101, 113, 12, 92, 45, 114, + 106, 12, 9, 9, 94, 93, 32, 113, 8, 103, + 3, 9, 208, 103, 104, 105, 106, 107, 108, 109, + 94, 74, 199, 14, 114, 27, 261, 300, -1, 103, + 104, 105, 106, 107, 108, 109, -1, 34, 274, -1, + 114, -1, -1, -1, -1, -1, -1, -1, -1, 65, + -1, -1, 9, -1, 70, 71, 72, 73, 74, -1, + 76, 77, 78, 79, -1, -1, 82, 83, -1, -1, + -1, 28, -1, 30, 31, -1, 33, 34, 35, -1, + -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, + 106, 48, -1, -1, 51, -1, 53, 113, -1, 56, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, + 67, 68, 9, -1, -1, -1, -1, -1, 75, -1, + -1, -1, -1, 80, 81, -1, -1, 84, 85, 86, + 27, 28, 89, -1, -1, -1, 33, 34, 35, -1, + -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, + -1, 48, -1, -1, 51, -1, 53, -1, -1, 56, + 117, -1, -1, -1, -1, -1, -1, -1, -1, 66, + 67, 68, 9, -1, -1, -1, -1, -1, 75, -1, + -1, -1, -1, 80, 81, -1, -1, 84, 85, 86, + 27, 28, 89, -1, -1, -1, 33, 34, 35, -1, + -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, + -1, 48, -1, -1, 51, -1, 53, -1, -1, 56, + 117, -1, -1, -1, -1, -1, -1, -1, -1, 66, + 67, 68, 9, -1, -1, -1, -1, -1, 75, -1, + -1, -1, -1, 80, 81, -1, -1, 84, 85, 86, + 27, 28, 89, -1, -1, -1, 33, 34, 35, -1, + -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, + -1, 48, -1, -1, 51, -1, 53, -1, -1, 56, + 117, 10, 11, -1, 13, 14, 15, -1, -1, 66, + 67, 68, 9, -1, -1, -1, -1, -1, 75, -1, + 29, -1, -1, 80, 81, -1, -1, 84, 85, 86, + -1, 28, 89, -1, -1, -1, 33, 34, 35, -1, + -1, -1, 10, 11, 41, 13, 14, 15, -1, -1, + -1, 48, -1, -1, 51, -1, 53, -1, -1, 56, + 117, -1, -1, -1, 32, -1, -1, -1, -1, 66, + 67, 68, 10, 11, -1, 13, 14, 15, 75, -1, + -1, -1, -1, 80, 81, 94, -1, 84, 85, 86, + -1, -1, 89, -1, 103, 104, 105, 106, 107, 108, + 109, -1, 10, 11, 42, 13, 14, 15, -1, 10, + 11, -1, 13, 14, 15, -1, -1, -1, -1, -1, + 117, 29, -1, -1, -1, -1, 94, -1, -1, 10, + 11, 32, 13, 14, 15, 103, 104, 105, 106, 107, + 108, 109, -1, -1, -1, -1, -1, -1, 13, 14, + 15, -1, -1, -1, -1, -1, 94, -1, -1, -1, + -1, -1, -1, -1, -1, 103, 104, 105, 106, 107, + 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 94, -1, -1, -1, + -1, -1, -1, 94, -1, 103, 104, 105, 106, 107, + 108, 109, 103, 104, 105, 106, 107, 108, 109, -1, + -1, -1, -1, 94, -1, -1, -1, -1, -1, -1, + -1, -1, 103, 104, 105, 106, 107, 108, 109, 94, + -1, -1, -1, -1, -1, -1, -1, -1, 103, 104, + 105, 106, 107, 108, 109 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 16, 121, 192, 9, 0, 113, 114, 9, 184, - 185, 17, 18, 115, 117, 19, 20, 21, 22, 24, - 103, 183, 183, 25, 184, 9, 186, 187, 183, 64, - 186, 188, 189, 190, 191, 113, 65, 91, 26, 190, + 0, 16, 120, 190, 9, 0, 112, 113, 9, 182, + 183, 17, 18, 114, 116, 19, 20, 21, 22, 24, + 102, 181, 181, 25, 182, 9, 184, 185, 181, 63, + 184, 186, 187, 188, 189, 112, 64, 90, 26, 188, 9, 9, 9, 28, 33, 34, 35, 41, 48, 51, - 53, 56, 67, 68, 69, 76, 81, 82, 85, 86, - 87, 90, 118, 122, 123, 127, 128, 129, 142, 143, - 144, 148, 149, 150, 151, 152, 153, 154, 155, 159, - 160, 161, 162, 163, 164, 165, 166, 175, 179, 181, - 182, 25, 113, 63, 3, 4, 5, 6, 7, 8, - 9, 12, 66, 71, 72, 73, 74, 75, 77, 78, - 79, 80, 83, 84, 107, 114, 124, 125, 124, 36, - 37, 109, 124, 134, 135, 136, 9, 49, 9, 100, - 180, 39, 57, 59, 177, 9, 9, 9, 142, 88, - 88, 9, 27, 122, 113, 114, 113, 50, 142, 113, - 40, 137, 147, 113, 113, 137, 147, 113, 113, 113, - 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, - 113, 113, 113, 142, 124, 112, 124, 112, 124, 124, - 10, 11, 13, 14, 15, 29, 95, 104, 105, 106, - 107, 108, 109, 110, 114, 32, 114, 114, 49, 117, - 39, 17, 180, 52, 180, 180, 60, 178, 49, 114, - 124, 133, 114, 54, 124, 113, 70, 70, 115, 124, - 124, 124, 124, 124, 123, 5, 124, 124, 124, 124, - 124, 124, 124, 133, 123, 124, 38, 109, 9, 132, - 134, 131, 180, 124, 9, 145, 146, 114, 58, 9, - 130, 132, 116, 126, 115, 117, 133, 55, 30, 31, - 156, 157, 158, 115, 27, 115, 9, 115, 117, 40, - 117, 137, 42, 104, 117, 9, 167, 168, 9, 114, - 115, 117, 124, 115, 9, 123, 124, 156, 27, 32, - 115, 9, 180, 41, 138, 124, 124, 145, 183, 115, - 117, 62, 115, 119, 116, 29, 28, 51, 92, 139, - 32, 114, 169, 61, 172, 167, 180, 123, 17, 44, - 141, 123, 3, 89, 170, 101, 173, 114, 93, 45, - 27, 115, 12, 171, 102, 174, 9, 176, 94, 9, - 32, 8, 104, 115, 117, 46, 47, 140, 3, 9 + 53, 56, 66, 67, 68, 75, 80, 81, 84, 85, + 86, 89, 117, 121, 122, 126, 127, 128, 141, 142, + 143, 147, 148, 149, 150, 151, 152, 153, 154, 158, + 159, 160, 161, 162, 163, 164, 165, 173, 177, 179, + 180, 25, 112, 62, 3, 4, 5, 6, 7, 8, + 9, 12, 65, 70, 71, 72, 73, 74, 76, 77, + 78, 79, 82, 83, 106, 113, 123, 124, 123, 36, + 37, 108, 123, 133, 134, 135, 9, 49, 9, 99, + 178, 39, 57, 59, 175, 9, 9, 9, 141, 87, + 87, 9, 27, 121, 112, 113, 112, 50, 141, 112, + 40, 136, 146, 112, 112, 136, 146, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 141, 123, 111, 123, 111, 123, 123, + 10, 11, 13, 14, 15, 29, 94, 103, 104, 105, + 106, 107, 108, 109, 113, 32, 113, 113, 49, 116, + 39, 17, 178, 52, 178, 178, 60, 176, 49, 113, + 123, 132, 113, 54, 123, 112, 69, 69, 114, 123, + 123, 123, 123, 123, 122, 5, 123, 123, 123, 123, + 123, 123, 123, 132, 122, 123, 38, 108, 9, 131, + 133, 130, 178, 123, 9, 144, 145, 113, 58, 9, + 129, 131, 115, 125, 114, 116, 132, 55, 30, 31, + 155, 156, 157, 114, 27, 114, 9, 114, 116, 40, + 116, 136, 42, 103, 116, 9, 166, 167, 9, 113, + 114, 116, 123, 114, 9, 122, 123, 155, 27, 32, + 114, 9, 178, 41, 137, 123, 123, 144, 181, 114, + 116, 61, 114, 118, 115, 29, 28, 51, 91, 138, + 32, 113, 168, 100, 171, 166, 178, 122, 17, 44, + 140, 122, 3, 88, 169, 101, 172, 113, 92, 45, + 27, 114, 12, 170, 103, 9, 174, 93, 9, 32, + 8, 3, 114, 116, 46, 47, 139, 9 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 119, 120, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 122, 122, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 125, 125, 125, 126, 127, + 128, 128, 128, 129, 130, 130, 131, 131, 131, 132, + 132, 132, 133, 133, 133, 133, 134, 134, 134, 135, + 135, 135, 136, 136, 137, 137, 138, 138, 139, 139, + 139, 140, 140, 141, 142, 143, 143, 144, 145, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 156, 157, 157, 157, 158, 159, 160, 161, 162, + 163, 164, 165, 165, 166, 167, 167, 168, 168, 169, + 169, 170, 170, 171, 171, 172, 172, 173, 174, 174, + 175, 175, 176, 176, 177, 178, 178, 179, 180, 181, + 181, 181, 181, 181, 181, 182, 182, 183, 183, 183, + 184, 185, 185, 185, 186, 187, 188, 188, 189, 189, + 189, 190 +}; -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 2, 1, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 1, 4, 1, + 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 2, 3, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 1, 3, 6, 4, + 1, 1, 1, 3, 1, 3, 0, 1, 3, 0, + 1, 3, 1, 4, 5, 4, 0, 1, 3, 1, + 3, 1, 0, 2, 0, 2, 0, 4, 0, 1, + 1, 0, 4, 8, 3, 5, 2, 3, 1, 3, + 4, 4, 2, 2, 3, 2, 2, 2, 3, 4, + 1, 2, 0, 2, 1, 7, 6, 10, 1, 1, + 2, 2, 4, 4, 5, 1, 3, 0, 3, 0, + 1, 0, 2, 0, 1, 0, 3, 8, 1, 3, + 0, 1, 0, 1, 10, 1, 1, 2, 2, 1, + 1, 1, 1, 1, 1, 3, 3, 0, 1, 3, + 3, 0, 1, 2, 6, 4, 1, 1, 0, 1, + 2, 11 +}; -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ + YYERROR; \ + } \ +while (0) -#ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -1276,54 +1080,46 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif { + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -1331,22 +1127,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); @@ -1357,66 +1142,54 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) -#else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1430,7 +1203,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1446,7 +1219,6 @@ int yydebug; #endif - #if YYERROR_VERBOSE # ifndef yystrlen @@ -1454,15 +1226,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -1478,16 +1243,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1517,27 +1274,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -1548,204 +1305,209 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) { - int yyn = yypact[yystate]; + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + switch (yycount) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif { YYUSE (yyvaluep); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ +/* The lookahead symbol. */ +static int yychar; -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; - /* Number of syntax errors so far. */ -int yynerrs; - +static int yynerrs; /*----------. | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int yyparse (void) -#else -int -yyparse () - -#endif -#endif { + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; - int yystate; int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ + /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1753,54 +1515,22 @@ yyparse () YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - - #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - - /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - + yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. @@ -1821,25 +1551,23 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1847,23 +1575,22 @@ yyparse () # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1871,16 +1598,18 @@ yyparse () yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1889,20 +1618,20 @@ yyparse () yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (); } if (yychar <= YYEOF) @@ -1924,29 +1653,27 @@ yyparse () yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1969,7 +1696,7 @@ yyparse () yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1983,838 +1710,983 @@ yyparse () switch (yyn) { case 25: -#line 190 "pars0grm.y" - { (yyval) = que_node_list_add_last(NULL, (yyvsp[(1) - (1)])); ;} +#line 191 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); } +#line 1716 "pars0grm.cc" /* yacc.c:1646 */ break; case 26: -#line 192 "pars0grm.y" - { (yyval) = que_node_list_add_last((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)])); ;} +#line 193 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last((yyvsp[-1]), (yyvsp[0])); } +#line 1722 "pars0grm.cc" /* yacc.c:1646 */ break; case 27: -#line 196 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]);;} +#line 197 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]);} +#line 1728 "pars0grm.cc" /* yacc.c:1646 */ break; case 28: -#line 198 "pars0grm.y" - { (yyval) = pars_func((yyvsp[(1) - (4)]), (yyvsp[(3) - (4)])); ;} +#line 199 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_func((yyvsp[-3]), (yyvsp[-1])); } +#line 1734 "pars0grm.cc" /* yacc.c:1646 */ break; case 29: -#line 199 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]);;} +#line 200 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]);} +#line 1740 "pars0grm.cc" /* yacc.c:1646 */ break; case 30: -#line 200 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]);;} +#line 201 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]);} +#line 1746 "pars0grm.cc" /* yacc.c:1646 */ break; case 31: -#line 201 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]);;} +#line 202 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]);} +#line 1752 "pars0grm.cc" /* yacc.c:1646 */ break; case 32: -#line 202 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]);;} +#line 203 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]);} +#line 1758 "pars0grm.cc" /* yacc.c:1646 */ break; case 33: -#line 203 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]);;} +#line 204 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]);} +#line 1764 "pars0grm.cc" /* yacc.c:1646 */ break; case 34: -#line 204 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]);;} +#line 205 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]);} +#line 1770 "pars0grm.cc" /* yacc.c:1646 */ break; case 35: -#line 205 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]);;} +#line 206 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]);} +#line 1776 "pars0grm.cc" /* yacc.c:1646 */ break; case 36: -#line 206 "pars0grm.y" - { (yyval) = pars_op('+', (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 207 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op('+', (yyvsp[-2]), (yyvsp[0])); } +#line 1782 "pars0grm.cc" /* yacc.c:1646 */ break; case 37: -#line 207 "pars0grm.y" - { (yyval) = pars_op('-', (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 208 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op('-', (yyvsp[-2]), (yyvsp[0])); } +#line 1788 "pars0grm.cc" /* yacc.c:1646 */ break; case 38: -#line 208 "pars0grm.y" - { (yyval) = pars_op('*', (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 209 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op('*', (yyvsp[-2]), (yyvsp[0])); } +#line 1794 "pars0grm.cc" /* yacc.c:1646 */ break; case 39: -#line 209 "pars0grm.y" - { (yyval) = pars_op('/', (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 210 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op('/', (yyvsp[-2]), (yyvsp[0])); } +#line 1800 "pars0grm.cc" /* yacc.c:1646 */ break; case 40: -#line 210 "pars0grm.y" - { (yyval) = pars_op('-', (yyvsp[(2) - (2)]), NULL); ;} +#line 211 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op('-', (yyvsp[0]), NULL); } +#line 1806 "pars0grm.cc" /* yacc.c:1646 */ break; case 41: -#line 211 "pars0grm.y" - { (yyval) = (yyvsp[(2) - (3)]); ;} +#line 212 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-1]); } +#line 1812 "pars0grm.cc" /* yacc.c:1646 */ break; case 42: -#line 212 "pars0grm.y" - { (yyval) = pars_op('=', (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 213 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op('=', (yyvsp[-2]), (yyvsp[0])); } +#line 1818 "pars0grm.cc" /* yacc.c:1646 */ break; case 43: -#line 214 "pars0grm.y" - { (yyval) = pars_op(PARS_LIKE_TOKEN, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 215 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op(PARS_LIKE_TOKEN, (yyvsp[-2]), (yyvsp[0])); } +#line 1824 "pars0grm.cc" /* yacc.c:1646 */ break; case 44: -#line 215 "pars0grm.y" - { (yyval) = pars_op('<', (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 216 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op('<', (yyvsp[-2]), (yyvsp[0])); } +#line 1830 "pars0grm.cc" /* yacc.c:1646 */ break; case 45: -#line 216 "pars0grm.y" - { (yyval) = pars_op('>', (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 217 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op('>', (yyvsp[-2]), (yyvsp[0])); } +#line 1836 "pars0grm.cc" /* yacc.c:1646 */ break; case 46: -#line 217 "pars0grm.y" - { (yyval) = pars_op(PARS_GE_TOKEN, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 218 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op(PARS_GE_TOKEN, (yyvsp[-2]), (yyvsp[0])); } +#line 1842 "pars0grm.cc" /* yacc.c:1646 */ break; case 47: -#line 218 "pars0grm.y" - { (yyval) = pars_op(PARS_LE_TOKEN, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 219 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op(PARS_LE_TOKEN, (yyvsp[-2]), (yyvsp[0])); } +#line 1848 "pars0grm.cc" /* yacc.c:1646 */ break; case 48: -#line 219 "pars0grm.y" - { (yyval) = pars_op(PARS_NE_TOKEN, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 220 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op(PARS_NE_TOKEN, (yyvsp[-2]), (yyvsp[0])); } +#line 1854 "pars0grm.cc" /* yacc.c:1646 */ break; case 49: -#line 220 "pars0grm.y" - { (yyval) = pars_op(PARS_AND_TOKEN, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 221 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op(PARS_AND_TOKEN, (yyvsp[-2]), (yyvsp[0])); } +#line 1860 "pars0grm.cc" /* yacc.c:1646 */ break; case 50: -#line 221 "pars0grm.y" - { (yyval) = pars_op(PARS_OR_TOKEN, (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 222 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op(PARS_OR_TOKEN, (yyvsp[-2]), (yyvsp[0])); } +#line 1866 "pars0grm.cc" /* yacc.c:1646 */ break; case 51: -#line 222 "pars0grm.y" - { (yyval) = pars_op(PARS_NOT_TOKEN, (yyvsp[(2) - (2)]), NULL); ;} +#line 223 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op(PARS_NOT_TOKEN, (yyvsp[0]), NULL); } +#line 1872 "pars0grm.cc" /* yacc.c:1646 */ break; case 52: -#line 224 "pars0grm.y" - { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[(1) - (3)]), NULL); ;} +#line 225 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[-2]), NULL); } +#line 1878 "pars0grm.cc" /* yacc.c:1646 */ break; case 53: -#line 226 "pars0grm.y" - { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[(1) - (3)]), NULL); ;} +#line 227 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[-2]), NULL); } +#line 1884 "pars0grm.cc" /* yacc.c:1646 */ break; case 54: -#line 230 "pars0grm.y" - { (yyval) = &pars_to_char_token; ;} +#line 231 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_to_char_token; } +#line 1890 "pars0grm.cc" /* yacc.c:1646 */ break; case 55: -#line 231 "pars0grm.y" - { (yyval) = &pars_to_number_token; ;} +#line 232 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_to_number_token; } +#line 1896 "pars0grm.cc" /* yacc.c:1646 */ break; case 56: -#line 232 "pars0grm.y" - { (yyval) = &pars_to_binary_token; ;} +#line 233 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_to_binary_token; } +#line 1902 "pars0grm.cc" /* yacc.c:1646 */ break; case 57: -#line 234 "pars0grm.y" - { (yyval) = &pars_binary_to_number_token; ;} +#line 235 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_binary_to_number_token; } +#line 1908 "pars0grm.cc" /* yacc.c:1646 */ break; case 58: -#line 235 "pars0grm.y" - { (yyval) = &pars_substr_token; ;} +#line 236 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_substr_token; } +#line 1914 "pars0grm.cc" /* yacc.c:1646 */ break; case 59: -#line 236 "pars0grm.y" - { (yyval) = &pars_concat_token; ;} +#line 237 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_concat_token; } +#line 1920 "pars0grm.cc" /* yacc.c:1646 */ break; case 60: -#line 237 "pars0grm.y" - { (yyval) = &pars_instr_token; ;} +#line 238 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_instr_token; } +#line 1926 "pars0grm.cc" /* yacc.c:1646 */ break; case 61: -#line 238 "pars0grm.y" - { (yyval) = &pars_length_token; ;} +#line 239 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_length_token; } +#line 1932 "pars0grm.cc" /* yacc.c:1646 */ break; case 62: -#line 239 "pars0grm.y" - { (yyval) = &pars_sysdate_token; ;} +#line 240 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_sysdate_token; } +#line 1938 "pars0grm.cc" /* yacc.c:1646 */ break; case 63: -#line 240 "pars0grm.y" - { (yyval) = &pars_rnd_token; ;} +#line 241 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_rnd_token; } +#line 1944 "pars0grm.cc" /* yacc.c:1646 */ break; case 64: -#line 241 "pars0grm.y" - { (yyval) = &pars_rnd_str_token; ;} +#line 242 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_rnd_str_token; } +#line 1950 "pars0grm.cc" /* yacc.c:1646 */ break; case 68: -#line 252 "pars0grm.y" +#line 253 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_stored_procedure_call( - static_cast((yyvsp[(2) - (6)]))); ;} + static_cast((yyvsp[-4]))); } +#line 1957 "pars0grm.cc" /* yacc.c:1646 */ break; case 69: -#line 258 "pars0grm.y" - { (yyval) = pars_procedure_call((yyvsp[(1) - (4)]), (yyvsp[(3) - (4)])); ;} +#line 259 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_procedure_call((yyvsp[-3]), (yyvsp[-1])); } +#line 1963 "pars0grm.cc" /* yacc.c:1646 */ break; case 70: -#line 262 "pars0grm.y" - { (yyval) = &pars_replstr_token; ;} +#line 263 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_replstr_token; } +#line 1969 "pars0grm.cc" /* yacc.c:1646 */ break; case 71: -#line 263 "pars0grm.y" - { (yyval) = &pars_printf_token; ;} +#line 264 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_printf_token; } +#line 1975 "pars0grm.cc" /* yacc.c:1646 */ break; case 72: -#line 264 "pars0grm.y" - { (yyval) = &pars_assert_token; ;} +#line 265 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_assert_token; } +#line 1981 "pars0grm.cc" /* yacc.c:1646 */ break; case 73: -#line 268 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (3)]); ;} +#line 269 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-2]); } +#line 1987 "pars0grm.cc" /* yacc.c:1646 */ break; case 74: -#line 272 "pars0grm.y" - { (yyval) = que_node_list_add_last(NULL, (yyvsp[(1) - (1)])); ;} +#line 273 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); } +#line 1993 "pars0grm.cc" /* yacc.c:1646 */ break; case 75: -#line 274 "pars0grm.y" - { (yyval) = que_node_list_add_last((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 275 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); } +#line 1999 "pars0grm.cc" /* yacc.c:1646 */ break; case 76: -#line 278 "pars0grm.y" - { (yyval) = NULL; ;} +#line 279 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2005 "pars0grm.cc" /* yacc.c:1646 */ break; case 77: -#line 279 "pars0grm.y" - { (yyval) = que_node_list_add_last(NULL, (yyvsp[(1) - (1)])); ;} +#line 280 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); } +#line 2011 "pars0grm.cc" /* yacc.c:1646 */ break; case 78: -#line 281 "pars0grm.y" - { (yyval) = que_node_list_add_last((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 282 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); } +#line 2017 "pars0grm.cc" /* yacc.c:1646 */ break; case 79: -#line 285 "pars0grm.y" - { (yyval) = NULL; ;} +#line 286 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2023 "pars0grm.cc" /* yacc.c:1646 */ break; case 80: -#line 286 "pars0grm.y" - { (yyval) = que_node_list_add_last(NULL, (yyvsp[(1) - (1)]));;} +#line 287 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last(NULL, (yyvsp[0]));} +#line 2029 "pars0grm.cc" /* yacc.c:1646 */ break; case 81: -#line 287 "pars0grm.y" - { (yyval) = que_node_list_add_last((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 288 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); } +#line 2035 "pars0grm.cc" /* yacc.c:1646 */ break; case 82: -#line 291 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]); ;} +#line 292 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 2041 "pars0grm.cc" /* yacc.c:1646 */ break; case 83: -#line 293 "pars0grm.y" +#line 294 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_func(&pars_count_token, que_node_list_add_last(NULL, sym_tab_add_int_lit( - pars_sym_tab_global, 1))); ;} + pars_sym_tab_global, 1))); } +#line 2050 "pars0grm.cc" /* yacc.c:1646 */ break; case 84: -#line 298 "pars0grm.y" +#line 299 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_func(&pars_count_token, que_node_list_add_last(NULL, pars_func(&pars_distinct_token, que_node_list_add_last( - NULL, (yyvsp[(4) - (5)]))))); ;} + NULL, (yyvsp[-1]))))); } +#line 2060 "pars0grm.cc" /* yacc.c:1646 */ break; case 85: -#line 304 "pars0grm.y" +#line 305 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_func(&pars_sum_token, que_node_list_add_last(NULL, - (yyvsp[(3) - (4)]))); ;} + (yyvsp[-1]))); } +#line 2068 "pars0grm.cc" /* yacc.c:1646 */ break; case 86: -#line 310 "pars0grm.y" - { (yyval) = NULL; ;} +#line 311 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2074 "pars0grm.cc" /* yacc.c:1646 */ break; case 87: -#line 311 "pars0grm.y" - { (yyval) = que_node_list_add_last(NULL, (yyvsp[(1) - (1)])); ;} +#line 312 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); } +#line 2080 "pars0grm.cc" /* yacc.c:1646 */ break; case 88: -#line 313 "pars0grm.y" - { (yyval) = que_node_list_add_last((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 314 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); } +#line 2086 "pars0grm.cc" /* yacc.c:1646 */ break; case 89: -#line 317 "pars0grm.y" +#line 318 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_select_list(&pars_star_denoter, - NULL); ;} + NULL); } +#line 2093 "pars0grm.cc" /* yacc.c:1646 */ break; case 90: -#line 320 "pars0grm.y" +#line 321 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_select_list( - (yyvsp[(1) - (3)]), static_cast((yyvsp[(3) - (3)]))); ;} + (yyvsp[-2]), static_cast((yyvsp[0]))); } +#line 2100 "pars0grm.cc" /* yacc.c:1646 */ break; case 91: -#line 322 "pars0grm.y" - { (yyval) = pars_select_list((yyvsp[(1) - (1)]), NULL); ;} +#line 323 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_select_list((yyvsp[0]), NULL); } +#line 2106 "pars0grm.cc" /* yacc.c:1646 */ break; case 92: -#line 326 "pars0grm.y" - { (yyval) = NULL; ;} +#line 327 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2112 "pars0grm.cc" /* yacc.c:1646 */ break; case 93: -#line 327 "pars0grm.y" - { (yyval) = (yyvsp[(2) - (2)]); ;} +#line 328 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 2118 "pars0grm.cc" /* yacc.c:1646 */ break; case 94: -#line 331 "pars0grm.y" - { (yyval) = NULL; ;} +#line 332 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2124 "pars0grm.cc" /* yacc.c:1646 */ break; case 95: -#line 333 "pars0grm.y" - { (yyval) = &pars_update_token; ;} +#line 334 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_update_token; } +#line 2130 "pars0grm.cc" /* yacc.c:1646 */ break; case 96: -#line 337 "pars0grm.y" - { (yyval) = NULL; ;} +#line 338 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2136 "pars0grm.cc" /* yacc.c:1646 */ break; case 97: -#line 339 "pars0grm.y" - { (yyval) = &pars_share_token; ;} +#line 340 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_share_token; } +#line 2142 "pars0grm.cc" /* yacc.c:1646 */ break; case 98: -#line 343 "pars0grm.y" - { (yyval) = &pars_asc_token; ;} +#line 344 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_asc_token; } +#line 2148 "pars0grm.cc" /* yacc.c:1646 */ break; case 99: -#line 344 "pars0grm.y" - { (yyval) = &pars_asc_token; ;} +#line 345 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_asc_token; } +#line 2154 "pars0grm.cc" /* yacc.c:1646 */ break; case 100: -#line 345 "pars0grm.y" - { (yyval) = &pars_desc_token; ;} +#line 346 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_desc_token; } +#line 2160 "pars0grm.cc" /* yacc.c:1646 */ break; case 101: -#line 349 "pars0grm.y" - { (yyval) = NULL; ;} +#line 350 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2166 "pars0grm.cc" /* yacc.c:1646 */ break; case 102: -#line 351 "pars0grm.y" +#line 352 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_order_by( - static_cast((yyvsp[(3) - (4)])), - static_cast((yyvsp[(4) - (4)]))); ;} + static_cast((yyvsp[-1])), + static_cast((yyvsp[0]))); } +#line 2174 "pars0grm.cc" /* yacc.c:1646 */ break; case 103: -#line 362 "pars0grm.y" +#line 363 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_select_statement( - static_cast((yyvsp[(2) - (8)])), - static_cast((yyvsp[(4) - (8)])), - static_cast((yyvsp[(5) - (8)])), - static_cast((yyvsp[(6) - (8)])), - static_cast((yyvsp[(7) - (8)])), - static_cast((yyvsp[(8) - (8)]))); ;} + static_cast((yyvsp[-6])), + static_cast((yyvsp[-4])), + static_cast((yyvsp[-3])), + static_cast((yyvsp[-2])), + static_cast((yyvsp[-1])), + static_cast((yyvsp[0]))); } +#line 2186 "pars0grm.cc" /* yacc.c:1646 */ break; case 104: -#line 373 "pars0grm.y" - { (yyval) = (yyvsp[(3) - (3)]); ;} +#line 374 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 2192 "pars0grm.cc" /* yacc.c:1646 */ break; case 105: -#line 378 "pars0grm.y" +#line 379 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_insert_statement( - static_cast((yyvsp[(1) - (5)])), (yyvsp[(4) - (5)]), NULL); ;} + static_cast((yyvsp[-4])), (yyvsp[-1]), NULL); } +#line 2199 "pars0grm.cc" /* yacc.c:1646 */ break; case 106: -#line 381 "pars0grm.y" +#line 382 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_insert_statement( - static_cast((yyvsp[(1) - (2)])), + static_cast((yyvsp[-1])), NULL, - static_cast((yyvsp[(2) - (2)]))); ;} + static_cast((yyvsp[0]))); } +#line 2208 "pars0grm.cc" /* yacc.c:1646 */ break; case 107: -#line 388 "pars0grm.y" +#line 389 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_column_assignment( - static_cast((yyvsp[(1) - (3)])), - static_cast((yyvsp[(3) - (3)]))); ;} + static_cast((yyvsp[-2])), + static_cast((yyvsp[0]))); } +#line 2216 "pars0grm.cc" /* yacc.c:1646 */ break; case 108: -#line 394 "pars0grm.y" - { (yyval) = que_node_list_add_last(NULL, (yyvsp[(1) - (1)])); ;} +#line 395 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); } +#line 2222 "pars0grm.cc" /* yacc.c:1646 */ break; case 109: -#line 396 "pars0grm.y" - { (yyval) = que_node_list_add_last((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 397 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); } +#line 2228 "pars0grm.cc" /* yacc.c:1646 */ break; case 110: -#line 402 "pars0grm.y" - { (yyval) = (yyvsp[(4) - (4)]); ;} +#line 403 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 2234 "pars0grm.cc" /* yacc.c:1646 */ break; case 111: -#line 408 "pars0grm.y" +#line 409 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_update_statement_start( FALSE, - static_cast((yyvsp[(2) - (4)])), - static_cast((yyvsp[(4) - (4)]))); ;} + static_cast((yyvsp[-2])), + static_cast((yyvsp[0]))); } +#line 2243 "pars0grm.cc" /* yacc.c:1646 */ break; case 112: -#line 416 "pars0grm.y" +#line 417 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_update_statement( - static_cast((yyvsp[(1) - (2)])), + static_cast((yyvsp[-1])), NULL, - static_cast((yyvsp[(2) - (2)]))); ;} + static_cast((yyvsp[0]))); } +#line 2252 "pars0grm.cc" /* yacc.c:1646 */ break; case 113: -#line 424 "pars0grm.y" +#line 425 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_update_statement( - static_cast((yyvsp[(1) - (2)])), - static_cast((yyvsp[(2) - (2)])), - NULL); ;} + static_cast((yyvsp[-1])), + static_cast((yyvsp[0])), + NULL); } +#line 2261 "pars0grm.cc" /* yacc.c:1646 */ break; case 114: -#line 432 "pars0grm.y" +#line 433 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_update_statement_start( TRUE, - static_cast((yyvsp[(3) - (3)])), NULL); ;} + static_cast((yyvsp[0])), NULL); } +#line 2269 "pars0grm.cc" /* yacc.c:1646 */ break; case 115: -#line 439 "pars0grm.y" +#line 440 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_update_statement( - static_cast((yyvsp[(1) - (2)])), + static_cast((yyvsp[-1])), NULL, - static_cast((yyvsp[(2) - (2)]))); ;} + static_cast((yyvsp[0]))); } +#line 2278 "pars0grm.cc" /* yacc.c:1646 */ break; case 116: -#line 447 "pars0grm.y" +#line 448 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_update_statement( - static_cast((yyvsp[(1) - (2)])), - static_cast((yyvsp[(2) - (2)])), - NULL); ;} + static_cast((yyvsp[-1])), + static_cast((yyvsp[0])), + NULL); } +#line 2287 "pars0grm.cc" /* yacc.c:1646 */ break; case 117: -#line 455 "pars0grm.y" +#line 456 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_row_printf_statement( - static_cast((yyvsp[(2) - (2)]))); ;} + static_cast((yyvsp[0]))); } +#line 2294 "pars0grm.cc" /* yacc.c:1646 */ break; case 118: -#line 461 "pars0grm.y" +#line 462 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_assignment_statement( - static_cast((yyvsp[(1) - (3)])), - static_cast((yyvsp[(3) - (3)]))); ;} + static_cast((yyvsp[-2])), + static_cast((yyvsp[0]))); } +#line 2302 "pars0grm.cc" /* yacc.c:1646 */ break; case 119: -#line 469 "pars0grm.y" - { (yyval) = pars_elsif_element((yyvsp[(2) - (4)]), (yyvsp[(4) - (4)])); ;} +#line 470 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_elsif_element((yyvsp[-2]), (yyvsp[0])); } +#line 2308 "pars0grm.cc" /* yacc.c:1646 */ break; case 120: -#line 473 "pars0grm.y" - { (yyval) = que_node_list_add_last(NULL, (yyvsp[(1) - (1)])); ;} +#line 474 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); } +#line 2314 "pars0grm.cc" /* yacc.c:1646 */ break; case 121: -#line 475 "pars0grm.y" - { (yyval) = que_node_list_add_last((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)])); ;} +#line 476 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last((yyvsp[-1]), (yyvsp[0])); } +#line 2320 "pars0grm.cc" /* yacc.c:1646 */ break; case 122: -#line 479 "pars0grm.y" - { (yyval) = NULL; ;} +#line 480 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2326 "pars0grm.cc" /* yacc.c:1646 */ break; case 123: -#line 481 "pars0grm.y" - { (yyval) = (yyvsp[(2) - (2)]); ;} +#line 482 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 2332 "pars0grm.cc" /* yacc.c:1646 */ break; case 124: -#line 482 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]); ;} +#line 483 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 2338 "pars0grm.cc" /* yacc.c:1646 */ break; case 125: -#line 489 "pars0grm.y" - { (yyval) = pars_if_statement((yyvsp[(2) - (7)]), (yyvsp[(4) - (7)]), (yyvsp[(5) - (7)])); ;} +#line 490 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_if_statement((yyvsp[-5]), (yyvsp[-3]), (yyvsp[-2])); } +#line 2344 "pars0grm.cc" /* yacc.c:1646 */ break; case 126: -#line 495 "pars0grm.y" - { (yyval) = pars_while_statement((yyvsp[(2) - (6)]), (yyvsp[(4) - (6)])); ;} +#line 496 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_while_statement((yyvsp[-4]), (yyvsp[-2])); } +#line 2350 "pars0grm.cc" /* yacc.c:1646 */ break; case 127: -#line 503 "pars0grm.y" +#line 504 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_for_statement( - static_cast((yyvsp[(2) - (10)])), - (yyvsp[(4) - (10)]), (yyvsp[(6) - (10)]), (yyvsp[(8) - (10)])); ;} + static_cast((yyvsp[-8])), + (yyvsp[-6]), (yyvsp[-4]), (yyvsp[-2])); } +#line 2358 "pars0grm.cc" /* yacc.c:1646 */ break; case 128: -#line 509 "pars0grm.y" - { (yyval) = pars_exit_statement(); ;} +#line 510 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_exit_statement(); } +#line 2364 "pars0grm.cc" /* yacc.c:1646 */ break; case 129: -#line 513 "pars0grm.y" - { (yyval) = pars_return_statement(); ;} +#line 514 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_return_statement(); } +#line 2370 "pars0grm.cc" /* yacc.c:1646 */ break; case 130: -#line 518 "pars0grm.y" +#line 519 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_open_statement( ROW_SEL_OPEN_CURSOR, - static_cast((yyvsp[(2) - (2)]))); ;} + static_cast((yyvsp[0]))); } +#line 2378 "pars0grm.cc" /* yacc.c:1646 */ break; case 131: -#line 525 "pars0grm.y" +#line 526 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_open_statement( ROW_SEL_CLOSE_CURSOR, - static_cast((yyvsp[(2) - (2)]))); ;} + static_cast((yyvsp[0]))); } +#line 2386 "pars0grm.cc" /* yacc.c:1646 */ break; case 132: -#line 532 "pars0grm.y" +#line 533 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_fetch_statement( - static_cast((yyvsp[(2) - (4)])), - static_cast((yyvsp[(4) - (4)])), NULL); ;} + static_cast((yyvsp[-2])), + static_cast((yyvsp[0])), NULL); } +#line 2394 "pars0grm.cc" /* yacc.c:1646 */ break; case 133: -#line 536 "pars0grm.y" +#line 537 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_fetch_statement( - static_cast((yyvsp[(2) - (4)])), + static_cast((yyvsp[-2])), NULL, - static_cast((yyvsp[(4) - (4)]))); ;} + static_cast((yyvsp[0]))); } +#line 2403 "pars0grm.cc" /* yacc.c:1646 */ break; case 134: -#line 544 "pars0grm.y" +#line 545 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_column_def( - static_cast((yyvsp[(1) - (5)])), - static_cast((yyvsp[(2) - (5)])), - static_cast((yyvsp[(3) - (5)])), - (yyvsp[(4) - (5)]), (yyvsp[(5) - (5)])); ;} + static_cast((yyvsp[-4])), + static_cast((yyvsp[-3])), + static_cast((yyvsp[-2])), + (yyvsp[-1]), (yyvsp[0])); } +#line 2413 "pars0grm.cc" /* yacc.c:1646 */ break; case 135: -#line 552 "pars0grm.y" - { (yyval) = que_node_list_add_last(NULL, (yyvsp[(1) - (1)])); ;} +#line 553 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); } +#line 2419 "pars0grm.cc" /* yacc.c:1646 */ break; case 136: -#line 554 "pars0grm.y" - { (yyval) = que_node_list_add_last((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 555 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); } +#line 2425 "pars0grm.cc" /* yacc.c:1646 */ break; case 137: -#line 558 "pars0grm.y" - { (yyval) = NULL; ;} +#line 559 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2431 "pars0grm.cc" /* yacc.c:1646 */ break; case 138: -#line 560 "pars0grm.y" - { (yyval) = (yyvsp[(2) - (3)]); ;} +#line 561 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-1]); } +#line 2437 "pars0grm.cc" /* yacc.c:1646 */ break; case 139: -#line 564 "pars0grm.y" - { (yyval) = NULL; ;} +#line 565 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2443 "pars0grm.cc" /* yacc.c:1646 */ break; case 140: -#line 566 "pars0grm.y" +#line 567 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = &pars_int_token; - /* pass any non-NULL pointer */ ;} + /* pass any non-NULL pointer */ } +#line 2450 "pars0grm.cc" /* yacc.c:1646 */ break; case 141: -#line 571 "pars0grm.y" - { (yyval) = NULL; ;} +#line 572 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2456 "pars0grm.cc" /* yacc.c:1646 */ break; case 142: -#line 573 "pars0grm.y" +#line 574 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = &pars_int_token; - /* pass any non-NULL pointer */ ;} + /* pass any non-NULL pointer */ } +#line 2463 "pars0grm.cc" /* yacc.c:1646 */ break; case 143: -#line 578 "pars0grm.y" - { (yyval) = NULL; ;} +#line 579 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2469 "pars0grm.cc" /* yacc.c:1646 */ break; case 144: -#line 580 "pars0grm.y" +#line 580 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = &pars_int_token; - /* pass any non-NULL pointer */ ;} + /* pass any non-NULL pointer */ } +#line 2476 "pars0grm.cc" /* yacc.c:1646 */ break; case 145: -#line 585 "pars0grm.y" - { (yyval) = NULL; ;} +#line 585 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2482 "pars0grm.cc" /* yacc.c:1646 */ break; case 146: -#line 586 "pars0grm.y" - { (yyval) = &pars_int_token; - /* pass any non-NULL pointer */ ;} +#line 587 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 2488 "pars0grm.cc" /* yacc.c:1646 */ break; case 147: -#line 591 "pars0grm.y" - { (yyval) = NULL; ;} +#line 594 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_create_table( + static_cast((yyvsp[-5])), + static_cast((yyvsp[-3])), + static_cast((yyvsp[-1])), + static_cast((yyvsp[0]))); } +#line 2498 "pars0grm.cc" /* yacc.c:1646 */ break; case 148: -#line 593 "pars0grm.y" - { (yyval) = (yyvsp[(3) - (3)]); ;} +#line 602 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); } +#line 2504 "pars0grm.cc" /* yacc.c:1646 */ break; case 149: -#line 600 "pars0grm.y" - { (yyval) = pars_create_table( - static_cast((yyvsp[(3) - (9)])), - static_cast((yyvsp[(5) - (9)])), - static_cast((yyvsp[(8) - (9)])), - static_cast((yyvsp[(9) - (9)])), (yyvsp[(7) - (9)])); ;} +#line 604 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); } +#line 2510 "pars0grm.cc" /* yacc.c:1646 */ break; case 150: -#line 608 "pars0grm.y" - { (yyval) = que_node_list_add_last(NULL, (yyvsp[(1) - (1)])); ;} +#line 608 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2516 "pars0grm.cc" /* yacc.c:1646 */ break; case 151: -#line 610 "pars0grm.y" - { (yyval) = que_node_list_add_last((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} +#line 609 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_unique_token; } +#line 2522 "pars0grm.cc" /* yacc.c:1646 */ break; case 152: -#line 614 "pars0grm.y" - { (yyval) = NULL; ;} +#line 613 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2528 "pars0grm.cc" /* yacc.c:1646 */ break; case 153: -#line 615 "pars0grm.y" - { (yyval) = &pars_unique_token; ;} +#line 614 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_clustered_token; } +#line 2534 "pars0grm.cc" /* yacc.c:1646 */ break; case 154: -#line 619 "pars0grm.y" - { (yyval) = NULL; ;} +#line 623 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_create_index( + static_cast((yyvsp[-8])), + static_cast((yyvsp[-7])), + static_cast((yyvsp[-5])), + static_cast((yyvsp[-3])), + static_cast((yyvsp[-1]))); } +#line 2545 "pars0grm.cc" /* yacc.c:1646 */ break; case 155: -#line 620 "pars0grm.y" - { (yyval) = &pars_clustered_token; ;} +#line 632 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 2551 "pars0grm.cc" /* yacc.c:1646 */ break; case 156: -#line 629 "pars0grm.y" - { (yyval) = pars_create_index( - static_cast((yyvsp[(2) - (10)])), - static_cast((yyvsp[(3) - (10)])), - static_cast((yyvsp[(5) - (10)])), - static_cast((yyvsp[(7) - (10)])), - static_cast((yyvsp[(9) - (10)]))); ;} +#line 633 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 2557 "pars0grm.cc" /* yacc.c:1646 */ break; case 157: -#line 638 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]); ;} +#line 638 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_commit_statement(); } +#line 2563 "pars0grm.cc" /* yacc.c:1646 */ break; case 158: -#line 639 "pars0grm.y" - { (yyval) = (yyvsp[(1) - (1)]); ;} +#line 643 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_rollback_statement(); } +#line 2569 "pars0grm.cc" /* yacc.c:1646 */ break; case 159: -#line 644 "pars0grm.y" - { (yyval) = pars_commit_statement(); ;} +#line 647 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_int_token; } +#line 2575 "pars0grm.cc" /* yacc.c:1646 */ break; case 160: -#line 649 "pars0grm.y" - { (yyval) = pars_rollback_statement(); ;} +#line 648 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_int_token; } +#line 2581 "pars0grm.cc" /* yacc.c:1646 */ break; case 161: -#line 653 "pars0grm.y" - { (yyval) = &pars_int_token; ;} +#line 649 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_bigint_token; } +#line 2587 "pars0grm.cc" /* yacc.c:1646 */ break; case 162: -#line 654 "pars0grm.y" - { (yyval) = &pars_int_token; ;} +#line 650 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_char_token; } +#line 2593 "pars0grm.cc" /* yacc.c:1646 */ break; case 163: -#line 655 "pars0grm.y" - { (yyval) = &pars_bigint_token; ;} +#line 651 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_binary_token; } +#line 2599 "pars0grm.cc" /* yacc.c:1646 */ break; case 164: -#line 656 "pars0grm.y" - { (yyval) = &pars_char_token; ;} +#line 652 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = &pars_blob_token; } +#line 2605 "pars0grm.cc" /* yacc.c:1646 */ break; case 165: -#line 657 "pars0grm.y" - { (yyval) = &pars_binary_token; ;} +#line 657 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_parameter_declaration( + static_cast((yyvsp[-2])), + PARS_INPUT, + static_cast((yyvsp[0]))); } +#line 2614 "pars0grm.cc" /* yacc.c:1646 */ break; case 166: -#line 658 "pars0grm.y" - { (yyval) = &pars_blob_token; ;} +#line 662 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = pars_parameter_declaration( + static_cast((yyvsp[-2])), + PARS_OUTPUT, + static_cast((yyvsp[0]))); } +#line 2623 "pars0grm.cc" /* yacc.c:1646 */ break; case 167: -#line 663 "pars0grm.y" - { (yyval) = pars_parameter_declaration( - static_cast((yyvsp[(1) - (3)])), - PARS_INPUT, - static_cast((yyvsp[(3) - (3)]))); ;} +#line 669 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = NULL; } +#line 2629 "pars0grm.cc" /* yacc.c:1646 */ break; case 168: -#line 668 "pars0grm.y" - { (yyval) = pars_parameter_declaration( - static_cast((yyvsp[(1) - (3)])), - PARS_OUTPUT, - static_cast((yyvsp[(3) - (3)]))); ;} +#line 670 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); } +#line 2635 "pars0grm.cc" /* yacc.c:1646 */ break; case 169: -#line 675 "pars0grm.y" - { (yyval) = NULL; ;} +#line 672 "pars0grm.y" /* yacc.c:1646 */ + { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); } +#line 2641 "pars0grm.cc" /* yacc.c:1646 */ break; case 170: -#line 676 "pars0grm.y" - { (yyval) = que_node_list_add_last(NULL, (yyvsp[(1) - (1)])); ;} - break; - - case 171: -#line 678 "pars0grm.y" - { (yyval) = que_node_list_add_last((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} - break; - - case 172: -#line 683 "pars0grm.y" +#line 677 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_variable_declaration( - static_cast((yyvsp[(1) - (3)])), - static_cast((yyvsp[(2) - (3)]))); ;} + static_cast((yyvsp[-2])), + static_cast((yyvsp[-1]))); } +#line 2649 "pars0grm.cc" /* yacc.c:1646 */ break; - case 176: -#line 697 "pars0grm.y" + case 174: +#line 691 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_cursor_declaration( - static_cast((yyvsp[(3) - (6)])), - static_cast((yyvsp[(5) - (6)]))); ;} + static_cast((yyvsp[-3])), + static_cast((yyvsp[-1]))); } +#line 2657 "pars0grm.cc" /* yacc.c:1646 */ break; - case 177: -#line 704 "pars0grm.y" + case 175: +#line 698 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_function_declaration( - static_cast((yyvsp[(3) - (4)]))); ;} + static_cast((yyvsp[-1]))); } +#line 2664 "pars0grm.cc" /* yacc.c:1646 */ break; - case 183: -#line 726 "pars0grm.y" + case 181: +#line 720 "pars0grm.y" /* yacc.c:1646 */ { (yyval) = pars_procedure_definition( - static_cast((yyvsp[(2) - (11)])), - static_cast((yyvsp[(4) - (11)])), - (yyvsp[(10) - (11)])); ;} + static_cast((yyvsp[-9])), + static_cast((yyvsp[-7])), + (yyvsp[-1])); } +#line 2673 "pars0grm.cc" /* yacc.c:1646 */ break; -/* Line 1267 of yacc.c. */ -#line 2826 "pars0grm.cc" +#line 2677 "pars0grm.cc" /* yacc.c:1646 */ default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -2823,8 +2695,7 @@ yyparse () *++yyvsp = yyval; - - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -2839,10 +2710,14 @@ yyparse () goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -2850,37 +2725,36 @@ yyparse () #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char*) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -2888,24 +2762,24 @@ yyparse () if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -2921,7 +2795,7 @@ yyparse () if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2934,38 +2808,37 @@ yyparse () | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2989,7 +2862,7 @@ yyparse () yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -3000,17 +2873,22 @@ yyparse () #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -3021,11 +2899,7 @@ yyparse () if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - -#line 732 "pars0grm.y" - +#line 726 "pars0grm.y" /* yacc.c:1906 */ diff --git a/storage/innobase/pars/pars0grm.y b/storage/innobase/pars/pars0grm.y index 2f0c83da8e3a9..5f3cb41310fb1 100644 --- a/storage/innobase/pars/pars0grm.y +++ b/storage/innobase/pars/pars0grm.y @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -102,7 +103,6 @@ yylex(void); %token PARS_INDEX_TOKEN %token PARS_UNIQUE_TOKEN %token PARS_CLUSTERED_TOKEN -%token PARS_DOES_NOT_FIT_IN_MEM_TOKEN %token PARS_ON_TOKEN %token PARS_ASSIGN_TOKEN %token PARS_DECLARE_TOKEN @@ -154,6 +154,8 @@ yylex(void); %left NEG /* negation--unary minus */ %left '%' +%expect 41 + /* Grammar follows */ %% @@ -573,13 +575,6 @@ opt_not_null: /* pass any non-NULL pointer */ } ; -not_fit_in_memory: - /* Nothing */ { $$ = NULL; } - | PARS_DOES_NOT_FIT_IN_MEM_TOKEN - { $$ = &pars_int_token; - /* pass any non-NULL pointer */ } -; - compact: /* Nothing */ { $$ = NULL; } | PARS_COMPACT_TOKEN { $$ = &pars_int_token; @@ -595,12 +590,12 @@ block_size: create_table: PARS_CREATE_TOKEN PARS_TABLE_TOKEN table_name '(' column_def_list ')' - not_fit_in_memory compact block_size + compact block_size { $$ = pars_create_table( static_cast($3), static_cast($5), - static_cast($8), - static_cast($9), $7); } + static_cast($7), + static_cast($8)); } ; column_list: diff --git a/storage/innobase/pars/pars0lex.l b/storage/innobase/pars/pars0lex.l index 3efcc2c8b4df3..e73472866fbed 100644 --- a/storage/innobase/pars/pars0lex.l +++ b/storage/innobase/pars/pars0lex.l @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -66,7 +67,7 @@ Created 12/14/1997 Heikki Tuuri /* Note: We cast &result to int* from yysize_t* */ #define YY_INPUT(buf, result, max_size) \ - pars_get_lex_chars(buf, (int*) &result, max_size) + (result = pars_get_lex_chars(buf, max_size)) /* String buffer for removing quotes */ static ulint stringbuf_len_alloc = 0; /* Allocated length */ @@ -425,10 +426,6 @@ In the state 'id', only two actions are possible (defined below). */ return(PARS_CLUSTERED_TOKEN); } -"DOES_NOT_FIT_IN_MEMORY" { - return(PARS_DOES_NOT_FIT_IN_MEM_TOKEN); -} - "ON" { return(PARS_ON_TOKEN); } diff --git a/storage/innobase/pars/pars0opt.cc b/storage/innobase/pars/pars0opt.cc index a01d535e595cf..f08037d15aaea 100644 --- a/storage/innobase/pars/pars0opt.cc +++ b/storage/innobase/pars/pars0opt.cc @@ -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 @@ -24,11 +24,6 @@ Created 12/21/1997 Heikki Tuuri *******************************************************/ #include "pars0opt.h" - -#ifdef UNIV_NONINL -#include "pars0opt.ic" -#endif - #include "row0sel.h" #include "row0ins.h" #include "row0upd.h" @@ -1134,6 +1129,15 @@ opt_clust_access( } } +#ifdef UNIV_SQL_DEBUG +/** Print info of a query plan. +@param[in,out] sel_node select node */ +static +void +opt_print_query_plan( + sel_node_t* sel_node); +#endif + /*******************************************************************//** Optimizes a select. Decides which indexes to tables to use. The tables are accessed in the order that they were written to the FROM part in the @@ -1212,13 +1216,13 @@ opt_search_plan( #endif } -#if 1//def UNIV_SQL_DEBUG -/********************************************************************//** -Prints info of a query plan. */ +#ifdef UNIV_SQL_DEBUG +/** Print info of a query plan. +@param[in,out] sel_node select node */ +static void opt_print_query_plan( -/*=================*/ - sel_node_t* sel_node) /*!< in: select node */ + sel_node_t* sel_node) { plan_t* plan; ulint n_fields; diff --git a/storage/innobase/pars/pars0pars.cc b/storage/innobase/pars/pars0pars.cc index 36846e418b0a9..39fd84a2b961b 100644 --- a/storage/innobase/pars/pars0pars.cc +++ b/storage/innobase/pars/pars0pars.cc @@ -29,11 +29,6 @@ on 1/27/1998 */ #include "ha_prototypes.h" #include "pars0pars.h" - -#ifdef UNIV_NONINL -#include "pars0pars.ic" -#endif - #include "row0sel.h" #include "row0ins.h" #include "row0upd.h" @@ -1857,18 +1852,7 @@ pars_create_table( table */ sym_node_t* column_defs, /*!< in: list of column names */ sym_node_t* compact, /* in: non-NULL if COMPACT table. */ - sym_node_t* block_size, /* in: block size (can be NULL) */ - void* not_fit_in_memory MY_ATTRIBUTE((unused))) - /*!< in: a non-NULL pointer means that - this is a table which in simulations - should be simulated as not fitting - in memory; thread is put to sleep - to simulate disk accesses; NOTE that - this flag is not stored to the data - dictionary on disk, and the database - will forget about non-NULL value if - it has to reload the table definition - from disk */ + sym_node_t* block_size) /* in: block size (can be NULL) */ { dict_table_t* table; sym_node_t* column; @@ -1932,11 +1916,6 @@ pars_create_table( table = dict_mem_table_create( table_sym->name, 0, n_cols, 0, flags, flags2); -#ifdef UNIV_DEBUG - if (not_fit_in_memory != NULL) { - table->does_not_fit_in_memory = TRUE; - } -#endif /* UNIV_DEBUG */ column = column_defs; while (column) { diff --git a/storage/innobase/pars/pars0sym.cc b/storage/innobase/pars/pars0sym.cc index b6305368362a1..ed49500dd94a4 100644 --- a/storage/innobase/pars/pars0sym.cc +++ b/storage/innobase/pars/pars0sym.cc @@ -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 @@ -24,11 +24,6 @@ Created 12/15/1997 Heikki Tuuri *******************************************************/ #include "pars0sym.h" - -#ifdef UNIV_NONINL -#include "pars0sym.ic" -#endif - #include "mem0mem.h" #include "data0type.h" #include "data0data.h" diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 9fd12686f57cd..1aebef93ce5c4 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -27,11 +27,6 @@ Created 5/27/1996 Heikki Tuuri #include "ha_prototypes.h" #include "que0que.h" - -#ifdef UNIV_NONINL -#include "que0que.ic" -#endif - #include "usr0sess.h" #include "trx0trx.h" #include "trx0roll.h" diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc index 9cd0f76c7a92b..b14d9c77ad1ad 100644 --- a/storage/innobase/rem/rem0cmp.cc +++ b/storage/innobase/rem/rem0cmp.cc @@ -26,11 +26,6 @@ Created 7/1/1994 Heikki Tuuri #include "ha_prototypes.h" #include "rem0cmp.h" - -#ifdef UNIV_NONINL -#include "rem0cmp.ic" -#endif - #include "handler0alter.h" #include "srv0srv.h" diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index d79b25a35a7fb..cc6117250959d 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -25,11 +25,6 @@ Created 5/30/1994 Heikki Tuuri *************************************************************************/ #include "rem0rec.h" - -#ifdef UNIV_NONINL -#include "rem0rec.ic" -#endif - #include "page0page.h" #include "mtr0mtr.h" #include "mtr0log.h" @@ -150,9 +145,6 @@ end of some field (containing also ). A record is a complete-field prefix of another record, if the corresponding canonical strings have the same property. */ -/* this is used to fool compiler in rec_validate */ -ulint rec_dummy; - /***************************************************************//** Validates the consistency of an old-style physical record. @return TRUE if ok */ @@ -1773,11 +1765,9 @@ rec_validate_old( /*=============*/ const rec_t* rec) /*!< in: physical record */ { - const byte* data; ulint len; ulint n_fields; ulint len_sum = 0; - ulint sum = 0; ulint i; ut_a(rec); @@ -1789,7 +1779,7 @@ rec_validate_old( } for (i = 0; i < n_fields; i++) { - data = rec_get_nth_field_old(rec, i, &len); + rec_get_nth_field_offs_old(rec, i, &len); if (!((len < UNIV_PAGE_SIZE) || (len == UNIV_SQL_NULL))) { ib::error() << "Record field " << i << " len " << len; @@ -1798,10 +1788,6 @@ rec_validate_old( if (len != UNIV_SQL_NULL) { len_sum += len; - sum += *(data + len -1); /* dereference the - end of the field to - cause a memory trap - if possible */ } else { len_sum += rec_get_nth_field_size(rec, i); } @@ -1813,8 +1799,6 @@ rec_validate_old( return(FALSE); } - rec_dummy = sum; /* This is here only to fool the compiler */ - return(TRUE); } @@ -1827,11 +1811,9 @@ rec_validate( const rec_t* rec, /*!< in: physical record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { - const byte* data; ulint len; ulint n_fields; ulint len_sum = 0; - ulint sum = 0; ulint i; ut_a(rec); @@ -1845,7 +1827,7 @@ rec_validate( ut_a(rec_offs_comp(offsets) || n_fields <= rec_get_n_fields_old(rec)); for (i = 0; i < n_fields; i++) { - data = rec_get_nth_field(rec, offsets, i, &len); + rec_get_nth_field_offs(offsets, i, &len); if (!((len < UNIV_PAGE_SIZE) || (len == UNIV_SQL_NULL))) { ib::error() << "Record field " << i << " len " << len; @@ -1854,10 +1836,6 @@ rec_validate( if (len != UNIV_SQL_NULL) { len_sum += len; - sum += *(data + len -1); /* dereference the - end of the field to - cause a memory trap - if possible */ } else if (!rec_offs_comp(offsets)) { len_sum += rec_get_nth_field_size(rec, i); } @@ -1869,8 +1847,6 @@ rec_validate( return(FALSE); } - rec_dummy = sum; /* This is here only to fool the compiler */ - if (!rec_offs_comp(offsets)) { ut_a(rec_validate_old(rec)); } @@ -1932,6 +1908,7 @@ rec_print_old( /***************************************************************//** Prints a physical record in ROW_FORMAT=COMPACT. Ignores the record header. */ +static void rec_print_comp( /*===========*/ @@ -1976,6 +1953,7 @@ rec_print_comp( /***************************************************************//** Prints an old-style spatial index record. */ +static void rec_print_mbr_old( /*==============*/ diff --git a/storage/innobase/row/row0ext.cc b/storage/innobase/row/row0ext.cc index 38c4e2ba6fb0d..72c68940d1171 100644 --- a/storage/innobase/row/row0ext.cc +++ b/storage/innobase/row/row0ext.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 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 @@ -24,11 +24,6 @@ Created September 2006 Marko Makela *******************************************************/ #include "row0ext.h" - -#ifdef UNIV_NONINL -#include "row0ext.ic" -#endif - #include "btr0cur.h" /** Fills the column prefix cache of an externally stored column. diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index 3179c63f162f3..0bf38503a2c5e 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -772,6 +772,7 @@ row_merge_fts_get_next_doc_item( Function performs parallel tokenization of the incoming doc strings. It also performs the initial in memory sort of the parsed records. @return OS_THREAD_DUMMY_RETURN */ +static os_thread_ret_t fts_parallel_tokenization( /*======================*/ @@ -1115,6 +1116,7 @@ row_fts_start_psort( /*********************************************************************//** Function performs the merge and insertion of the sorted records. @return OS_THREAD_DUMMY_RETURN */ +static os_thread_ret_t fts_parallel_merge( /*===============*/ @@ -1256,6 +1258,7 @@ row_merge_write_fts_word( /*********************************************************************//** Read sorted FTS data files and insert data tuples to auxillary tables. @return DB_SUCCESS or error number */ +static void row_fts_insert_tuple( /*=================*/ diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index a6f4b22130248..9bd5cedc8bb28 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -27,11 +27,6 @@ Created 2012-02-08 by Sunny Bains. #include "ha_prototypes.h" #include "row0import.h" - -#ifdef UNIV_NONINL -#include "row0import.ic" -#endif - #include "btr0pcur.h" #include "que0que.h" #include "dict0boot.h" @@ -3388,9 +3383,10 @@ row_import_for_mysql( mutex_enter(&trx->undo_mutex); - /* IMPORT tablespace is blocked for temp-tables and so we don't - need to assign temporary rollback segment for this trx. */ - err = trx_undo_assign_undo(trx, &trx->rsegs.m_redo, TRX_UNDO_UPDATE); + /* TODO: Do not write any undo log for the IMPORT cleanup. */ + trx_undo_t** pundo = &trx->rsegs.m_redo.update_undo; + err = trx_undo_assign_undo(trx, trx->rsegs.m_redo.rseg, pundo, + TRX_UNDO_UPDATE); mutex_exit(&trx->undo_mutex); diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index db8a91ed21eda..9626645ebf28d 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -27,11 +27,6 @@ Created 4/20/1996 Heikki Tuuri #include "ha_prototypes.h" #include "row0ins.h" - -#ifdef UNIV_NONINL -#include "row0ins.ic" -#endif - #include "dict0dict.h" #include "dict0boot.h" #include "trx0rec.h" @@ -2087,7 +2082,7 @@ row_ins_scan_sec_index_for_duplicate( btr_pcur_open(index, entry, PAGE_CUR_GE, s_latch - ? BTR_SEARCH_LEAF | BTR_ALREADY_S_LATCHED + ? BTR_SEARCH_LEAF_ALREADY_S_LATCHED : BTR_SEARCH_LEAF, &pcur, mtr); @@ -2442,6 +2437,74 @@ row_ins_must_modify_rec( && !page_rec_is_infimum(btr_cur_get_rec(cursor))); } +/** Insert the externally stored fields (off-page columns) +of a clustered index entry. +@param[in] entry index entry to insert +@param[in] big_rec externally stored fields +@param[in,out] offsets rec_get_offsets() +@param[in,out] heap memory heap +@param[in] thd client connection, or NULL +@param[in] index clustered index +@return error code +@retval DB_SUCCESS +@retval DB_OUT_OF_FILE_SPACE */ +static +dberr_t +row_ins_index_entry_big_rec( + const dtuple_t* entry, + const big_rec_t* big_rec, + ulint* offsets, + mem_heap_t** heap, +#ifndef DBUG_OFF + const void* thd, +#endif /* DBUG_OFF */ + dict_index_t* index) +{ + mtr_t mtr; + btr_pcur_t pcur; + rec_t* rec; + dberr_t error; + + ut_ad(dict_index_is_clust(index)); + + DEBUG_SYNC_C_IF_THD(thd, "before_row_ins_extern_latch"); + + mtr_start(&mtr); + mtr.set_named_space(index->space); + dict_disable_redo_if_temporary(index->table, &mtr); + + btr_pcur_open(index, entry, PAGE_CUR_LE, BTR_MODIFY_TREE, + &pcur, &mtr); + rec = btr_pcur_get_rec(&pcur); + offsets = rec_get_offsets(rec, index, offsets, + ULINT_UNDEFINED, heap); + + DEBUG_SYNC_C_IF_THD(thd, "before_row_ins_extern"); + error = btr_store_big_rec_extern_fields( + &pcur, 0, offsets, big_rec, &mtr, BTR_STORE_INSERT); + DEBUG_SYNC_C_IF_THD(thd, "after_row_ins_extern"); + + if (error == DB_SUCCESS + && dict_index_is_online_ddl(index)) { + row_log_table_insert(btr_pcur_get_rec(&pcur), entry, + index, offsets); + } + + mtr_commit(&mtr); + + btr_pcur_close(&pcur); + + return(error); +} + +#ifdef DBUG_OFF +# define row_ins_index_entry_big_rec(e,big,ofs,heap,index,thd) \ + row_ins_index_entry_big_rec(e,big,ofs,heap,index) +#else /* DBUG_OFF */ +# define row_ins_index_entry_big_rec(e,big,ofs,heap,index,thd) \ + row_ins_index_entry_big_rec(e,big,ofs,heap,thd,index) +#endif /* DBUG_OFF */ + /***************************************************************//** Tries to insert an entry into a clustered index, ignoring foreign key constraints. If a record with the same unique key is found, the other @@ -2505,7 +2568,7 @@ row_ins_clust_index_entry_low( if (mode == BTR_MODIFY_LEAF && dict_index_is_online_ddl(index)) { - mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED; + mode = BTR_MODIFY_LEAF_ALREADY_S_LATCHED; mtr_s_lock(dict_index_get_lock(index), &mtr); } @@ -2653,8 +2716,7 @@ row_ins_clust_index_entry_low( LSN_MAX, TRUE);); err = row_ins_index_entry_big_rec( entry, big_rec, offsets, &offsets_heap, index, - thr_get_trx(thr)->mysql_thd, - __FILE__, __LINE__); + thr_get_trx(thr)->mysql_thd); dtuple_convert_back_big_rec(index, entry, big_rec); } else { if (err == DB_SUCCESS @@ -3070,61 +3132,6 @@ row_ins_sec_index_entry_low( DBUG_RETURN(err); } -/***************************************************************//** -Tries to insert the externally stored fields (off-page columns) -of a clustered index entry. -@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ -dberr_t -row_ins_index_entry_big_rec_func( -/*=============================*/ - const dtuple_t* entry, /*!< in/out: index entry to insert */ - const big_rec_t* big_rec,/*!< in: externally stored fields */ - ulint* offsets,/*!< in/out: rec offsets */ - mem_heap_t** heap, /*!< in/out: memory heap */ - dict_index_t* index, /*!< in: index */ - const char* file, /*!< in: file name of caller */ -#ifndef DBUG_OFF - const void* thd, /*!< in: connection, or NULL */ -#endif /* DBUG_OFF */ - unsigned line) /*!< in: line number of caller */ -{ - mtr_t mtr; - btr_pcur_t pcur; - rec_t* rec; - dberr_t error; - - ut_ad(dict_index_is_clust(index)); - - DEBUG_SYNC_C_IF_THD(thd, "before_row_ins_extern_latch"); - - mtr_start(&mtr); - mtr.set_named_space(index->space); - dict_disable_redo_if_temporary(index->table, &mtr); - - btr_pcur_open(index, entry, PAGE_CUR_LE, BTR_MODIFY_TREE, - &pcur, &mtr); - rec = btr_pcur_get_rec(&pcur); - offsets = rec_get_offsets(rec, index, offsets, - ULINT_UNDEFINED, heap); - - DEBUG_SYNC_C_IF_THD(thd, "before_row_ins_extern"); - error = btr_store_big_rec_extern_fields( - &pcur, 0, offsets, big_rec, &mtr, BTR_STORE_INSERT); - DEBUG_SYNC_C_IF_THD(thd, "after_row_ins_extern"); - - if (error == DB_SUCCESS - && dict_index_is_online_ddl(index)) { - row_log_table_insert(btr_pcur_get_rec(&pcur), entry, - index, offsets); - } - - mtr_commit(&mtr); - - btr_pcur_close(&pcur); - - return(error); -} - /***************************************************************//** Inserts an entry into a clustered index. Tries first optimistic, then pessimistic descent down the tree. If the entry matches enough diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 0fc1dd097cc0d..7e6975a67f13f 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -25,11 +25,6 @@ Created 2011-05-26 Marko Makela *******************************************************/ #include "row0log.h" - -#ifdef UNIV_NONINL -#include "row0log.ic" -#endif - #include "row0row.h" #include "row0ins.h" #include "row0upd.h" diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index ab5736f88d711..d3fb6db880cbf 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -31,11 +31,6 @@ Created 9/17/2000 Heikki Tuuri #include #include "row0mysql.h" - -#ifdef UNIV_NONINL -#include "row0mysql.ic" -#endif - #include "btr0sea.h" #include "dict0boot.h" #include "dict0crea.h" @@ -75,7 +70,7 @@ Created 9/17/2000 Heikki Tuuri #include #include -const char* MODIFICATIONS_NOT_ALLOWED_MSG_FORCE_RECOVERY = +static const char* MODIFICATIONS_NOT_ALLOWED_MSG_FORCE_RECOVERY = "innodb_force_recovery is on. We do not allow database modifications" " by the user. Shut down mysqld and edit my.cnf to set" " innodb_force_recovery=0"; @@ -378,6 +373,7 @@ row_mysql_store_geometry( /*******************************************************************//** Read geometry data in the MySQL format. @return pointer to geometry data */ +static const byte* row_mysql_read_geometry( /*====================*/ diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index b41e3642cf0e2..ce9a265bd8c12 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -24,11 +24,6 @@ Created 3/14/1997 Heikki Tuuri *******************************************************/ #include "row0purge.h" - -#ifdef UNIV_NONINL -#include "row0purge.ic" -#endif - #include "fsp0fsp.h" #include "mach0data.h" #include "trx0rseg.h" @@ -407,12 +402,13 @@ row_purge_remove_sec_if_poss_leaf( { mtr_t mtr; btr_pcur_t pcur; - ulint mode; + enum btr_latch_mode mode; enum row_search_result search_result; bool success = true; log_free_check(); - + ut_ad(index->table == node->table); + ut_ad(!dict_table_is_temporary(index->table)); mtr_start(&mtr); mtr.set_named_space(index->space); @@ -436,23 +432,17 @@ row_purge_remove_sec_if_poss_leaf( goto func_exit_no_pcur; } - /* Change buffering is disabled for temporary tables. */ - mode = (dict_table_is_temporary(index->table)) - ? BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED - : BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED - | BTR_DELETE; + mode = BTR_PURGE_LEAF_ALREADY_S_LATCHED; } else { /* For secondary indexes, index->online_status==ONLINE_INDEX_COMPLETE if index->is_committed(). */ ut_ad(!dict_index_is_online_ddl(index)); - /* Change buffering is disabled for temporary tables - and spatial index. */ - mode = (dict_table_is_temporary(index->table) - || dict_index_is_spatial(index)) + /* Change buffering is disabled for spatial index. */ + mode = dict_index_is_spatial(index) ? BTR_MODIFY_LEAF - : BTR_MODIFY_LEAF | BTR_DELETE; + : BTR_PURGE_LEAF; } /* Set the purge node for the call to row_purge_poss_sec(). */ @@ -751,13 +741,7 @@ row_purge_upd_exist_or_extern_func( &is_insert, &rseg_id, &page_no, &offset); - /* If table is temp then it can't have its undo log - residing in rollback segment with REDO log enabled. */ - bool is_redo_rseg = - dict_table_is_temporary(node->table) - ? false : true; - rseg = trx_sys_get_nth_rseg( - trx_sys, rseg_id, is_redo_rseg); + rseg = trx_rseg_get_on_id(rseg_id); ut_a(rseg != NULL); ut_a(rseg->id == rseg_id); @@ -867,6 +851,7 @@ row_purge_parse_undo_rec( /* The table has been dropped: no need to do purge */ goto err_exit; } + ut_ad(!dict_table_is_temporary(node->table)); if (node->table->n_v_cols && !node->table->vc_templ && dict_table_has_indexed_v_cols(node->table)) { @@ -886,12 +871,6 @@ row_purge_parse_undo_rec( innobase_init_vc_templ(node->table); } - /* Disable purging for temp-tables as they are short-lived - and no point in re-organzing such short lived tables */ - if (dict_table_is_temporary(node->table)) { - goto close_exit; - } - if (node->table->ibd_file_missing) { /* We skip purge of missing .ibd files */ diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc index d26d81c9239fd..8bd1f5730a278 100644 --- a/storage/innobase/row/row0quiesce.cc +++ b/storage/innobase/row/row0quiesce.cc @@ -26,10 +26,6 @@ Created 2012-02-08 by Sunny Bains. #include "ha_prototypes.h" #include "row0quiesce.h" -#ifdef UNIV_NONINL -#include "row0quiesce.ic" -#endif - #include "row0mysql.h" #include "ibuf0ibuf.h" #include "srv0start.h" diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc index 0f15299e71a6b..9b5ef6a3f3ced 100644 --- a/storage/innobase/row/row0row.cc +++ b/storage/innobase/row/row0row.cc @@ -26,11 +26,6 @@ Created 4/20/1996 Heikki Tuuri #include "ha_prototypes.h" #include "row0row.h" - -#ifdef UNIV_NONINL -#include "row0row.ic" -#endif - #include "data0type.h" #include "dict0dict.h" #include "dict0boot.h" diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index e3d61531728d8..229bd567c488d 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -2,7 +2,7 @@ Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2015, MariaDB Corporation. +Copyright (c) 2015, 2017, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -32,11 +32,6 @@ Created 12/19/1997 Heikki Tuuri *******************************************************/ #include "row0sel.h" - -#ifdef UNIV_NONINL -#include "row0sel.ic" -#endif - #include "dict0dict.h" #include "dict0boot.h" #include "trx0undo.h" @@ -2479,47 +2474,6 @@ fetch_step( return(thr); } -/****************************************************************//** -Sample callback function for fetch that prints each row. -@return always returns non-NULL */ -void* -row_fetch_print( -/*============*/ - void* row, /*!< in: sel_node_t* */ - void* user_arg) /*!< in: not used */ -{ - que_node_t* exp; - ulint i = 0; - sel_node_t* node = static_cast(row); - - UT_NOT_USED(user_arg); - - ib::info() << "row_fetch_print: row " << row; - - for (exp = node->select_list; - exp != 0; - exp = que_node_get_next(exp), i++) { - - dfield_t* dfield = que_node_get_val(exp); - const dtype_t* type = dfield_get_type(dfield); - - fprintf(stderr, " column %lu:\n", (ulong) i); - - dtype_print(type); - putc('\n', stderr); - - if (dfield_get_len(dfield) != UNIV_SQL_NULL) { - ut_print_buf(stderr, dfield_get_data(dfield), - dfield_get_len(dfield)); - putc('\n', stderr); - } else { - fputs(" ;\n", stderr); - } - } - - return((void*)42); -} - /***********************************************************//** Prints a row in a select result. @return query thread to run next or NULL */ @@ -3260,7 +3214,9 @@ row_sel_store_mysql_rec( getting selected. The non-key virtual columns may not be materialized and we should skip them. */ if (dfield_get_type(dfield)->mtype == DATA_MISSING) { +#ifdef UNIV_DEBUG ulint prefix; +#endif /* UNIV_DEBUG */ ut_ad(prebuilt->m_read_virtual_key); /* If it is part of index key the data should @@ -5947,23 +5903,20 @@ row_count_rtree_recs( /*******************************************************************//** Checks if MySQL at the moment is allowed for this table to retrieve a consistent read result, or store it to the query cache. -@return TRUE if storing or retrieving from the query cache is permitted */ -ibool +@return whether storing or retrieving from the query cache is permitted */ +bool row_search_check_if_query_cache_permitted( /*======================================*/ trx_t* trx, /*!< in: transaction object */ const char* norm_name) /*!< in: concatenation of database name, '/' char, table name */ { - dict_table_t* table; - ibool ret = FALSE; - - table = dict_table_open_on_name( + dict_table_t* table = dict_table_open_on_name( norm_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE); if (table == NULL) { - return(FALSE); + return(false); } /* Start the transaction if it is not started yet */ @@ -5975,18 +5928,16 @@ row_search_check_if_query_cache_permitted( read/write from/to the cache. If a read view has not been created for the transaction then it doesn't - really matter what this transactin sees. If a read view was created + really matter what this transaction sees. If a read view was created then the view low_limit_id is the max trx id that this transaction saw at the time of the read view creation. */ - if (lock_table_get_n_locks(table) == 0 - && ((trx->id != 0 && trx->id >= table->query_cache_inv_id) - || !MVCC::is_view_active(trx->read_view) - || trx->read_view->low_limit_id() - >= table->query_cache_inv_id)) { - - ret = TRUE; - + const bool ret = lock_table_get_n_locks(table) == 0 + && ((trx->id != 0 && trx->id >= table->query_cache_inv_id) + || !MVCC::is_view_active(trx->read_view) + || trx->read_view->low_limit_id() + >= table->query_cache_inv_id); + if (ret) { /* If the isolation level is high, assign a read view for the transaction if it does not yet have one */ diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc index 2402b4807ba87..152970d94132a 100644 --- a/storage/innobase/row/row0trunc.cc +++ b/storage/innobase/row/row0trunc.cc @@ -38,6 +38,13 @@ Created 2013-04-12 Sunny Bains #include "os0file.h" #include +/* FIXME: For temporary tables, use a simple approach of btr_free() +and btr_create() of each index tree. */ + +/* FIXME: For persistent tables, remove this code in MDEV-11655 +and use a combination of the transactional DDL log to make atomic the +low-level operations ha_innobase::delete_table(), ha_innobase::create(). */ + bool truncate_t::s_fix_up_active = false; truncate_t::tables_t truncate_t::s_tables; truncate_t::truncated_tables_t truncate_t::s_truncated_tables; @@ -1830,14 +1837,11 @@ row_truncate_table_for_mysql( /* Step-6: Truncate operation can be rolled back in case of error till some point. Associate rollback segment to record undo log. */ if (!dict_table_is_temporary(table)) { - - /* Temporary tables don't need undo logging for autocommit stmt. - On crash (i.e. mysql restart) temporary tables are anyway not - accessible. */ mutex_enter(&trx->undo_mutex); + trx_undo_t** pundo = &trx->rsegs.m_redo.update_undo; err = trx_undo_assign_undo( - trx, &trx->rsegs.m_redo, TRX_UNDO_UPDATE); + trx, trx->rsegs.m_redo.rseg, pundo, TRX_UNDO_UPDATE); mutex_exit(&trx->undo_mutex); diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc index 27be7c1600eef..25504e32087fe 100644 --- a/storage/innobase/row/row0uins.cc +++ b/storage/innobase/row/row0uins.cc @@ -24,11 +24,6 @@ Created 2/25/1997 Heikki Tuuri *******************************************************/ #include "row0uins.h" - -#ifdef UNIV_NONINL -#include "row0uins.ic" -#endif - #include "dict0dict.h" #include "dict0boot.h" #include "dict0crea.h" diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index 81c86f8b6f73a..378cad00b934c 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -26,11 +26,6 @@ Created 2/27/1997 Heikki Tuuri #include "ha_prototypes.h" #include "row0umod.h" - -#ifdef UNIV_NONINL -#include "row0umod.ic" -#endif - #include "dict0dict.h" #include "dict0boot.h" #include "trx0undo.h" diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc index f72e8aa14eac4..b9e79e044de76 100644 --- a/storage/innobase/row/row0undo.cc +++ b/storage/innobase/row/row0undo.cc @@ -26,11 +26,6 @@ Created 1/8/1997 Heikki Tuuri #include "ha_prototypes.h" #include "row0undo.h" - -#ifdef UNIV_NONINL -#include "row0undo.ic" -#endif - #include "fsp0fsp.h" #include "mach0data.h" #include "trx0rseg.h" @@ -264,47 +259,23 @@ row_undo( undo_node_t* node, /*!< in: row undo node */ que_thr_t* thr) /*!< in: query thread */ { - dberr_t err; - trx_t* trx; - roll_ptr_t roll_ptr; - ibool locked_data_dict; - - ut_ad(node != NULL); - ut_ad(thr != NULL); - - trx = node->trx; + trx_t* trx = node->trx; ut_ad(trx->in_rollback); if (node->state == UNDO_NODE_FETCH_NEXT) { node->undo_rec = trx_roll_pop_top_rec_of_trx( - trx, trx->roll_limit, &roll_ptr, node->heap); + trx, &node->roll_ptr, node->heap); if (!node->undo_rec) { /* Rollback completed for this query thread */ - thr->run_node = que_node_get_parent(node); - - /* Mark any partial rollback completed, so - that if the transaction object is committed - and reused later, the roll_limit will remain - at 0. trx->roll_limit will be nonzero during a - partial rollback only. */ - trx->roll_limit = 0; - ut_d(trx->in_rollback = false); - return(DB_SUCCESS); } - node->roll_ptr = roll_ptr; node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec); - - if (trx_undo_roll_ptr_is_insert(roll_ptr)) { - - node->state = UNDO_NODE_INSERT; - } else { - node->state = UNDO_NODE_MODIFY; - } + node->state = trx_undo_roll_ptr_is_insert(node->roll_ptr) + ? UNDO_NODE_INSERT : UNDO_NODE_MODIFY; } /* Prevent DROP TABLE etc. while we are rolling back this row. @@ -312,13 +283,15 @@ row_undo( then we already have dict_operation_lock locked in x-mode. Do not try to lock again, because that would cause a hang. */ - locked_data_dict = (trx->dict_operation_lock_mode == 0); + const bool locked_data_dict = (trx->dict_operation_lock_mode == 0); if (locked_data_dict) { row_mysql_freeze_data_dictionary(trx); } + dberr_t err; + if (node->state == UNDO_NODE_INSERT) { err = row_undo_ins(node, thr); diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 048f75e413f78..9c159c6bd159f 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -27,11 +27,6 @@ Created 12/27/1996 Heikki Tuuri #include "ha_prototypes.h" #include "row0upd.h" - -#ifdef UNIV_NONINL -#include "row0upd.ic" -#endif - #include "dict0dict.h" #include "dict0mem.h" #include "trx0undo.h" @@ -2309,9 +2304,8 @@ row_upd_sec_index_entry( spatial index. */ mode = (referenced || dict_table_is_temporary(index->table) || dict_index_is_spatial(index)) - ? BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED - : BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED - | BTR_DELETE_MARK; + ? BTR_MODIFY_LEAF_ALREADY_S_LATCHED + : BTR_DELETE_MARK_LEAF_ALREADY_S_LATCHED; } else { /* For secondary indexes, index->online_status==ONLINE_INDEX_COMPLETE if @@ -2325,7 +2319,7 @@ row_upd_sec_index_entry( mode = (referenced || dict_table_is_temporary(index->table) || dict_index_is_spatial(index)) ? BTR_MODIFY_LEAF - : BTR_MODIFY_LEAF | BTR_DELETE_MARK; + : BTR_DELETE_MARK_LEAF; } if (dict_index_is_spatial(index)) { @@ -3226,6 +3220,7 @@ to this node, we assume that we have a persistent cursor which was on a record, and the position of the cursor is stored in the cursor. @return DB_SUCCESS if operation successfully completed, else error code or DB_LOCK_WAIT */ +static dberr_t row_upd( /*====*/ diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc index 69e7a889de96c..de33c7c4d1b4d 100644 --- a/storage/innobase/row/row0vers.cc +++ b/storage/innobase/row/row0vers.cc @@ -27,11 +27,6 @@ Created 2/6/1997 Heikki Tuuri #include "ha_prototypes.h" #include "row0vers.h" - -#ifdef UNIV_NONINL -#include "row0vers.ic" -#endif - #include "dict0dict.h" #include "dict0boot.h" #include "btr0btr.h" diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index f42e640f4f321..5a3e1a2c93062 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -35,9 +35,6 @@ Created 12/9/2009 Jimmy Yang #include "srv0srv.h" #include "trx0rseg.h" #include "trx0sys.h" -#ifdef UNIV_NONINL -#include "srv0mon.ic" -#endif /* Macro to standardize the counter names for counters in the "monitor_buf_page" module as they have very structured defines */ diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index d8de29a909d4c..fe4dc7e354753 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -3,7 +3,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2017, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -294,22 +294,11 @@ ulong srv_read_ahead_threshold = 56; of the buffer pool. */ uint srv_change_buffer_max_size = CHANGE_BUFFER_DEFAULT_SIZE; -/* This parameter is used to throttle the number of insert buffers that are -merged in a batch. By increasing this parameter on a faster disk you can -possibly reduce the number of I/O operations performed to complete the -merge operation. The value of this parameter is used as is by the -background loop when the system is idle (low load), on a busy system -the parameter is scaled down by a factor of 4, this is to avoid putting -a heavier load on the I/O sub system. */ +char* srv_file_flush_method_str = NULL; -ulong srv_insert_buffer_batch_size = 20; -char* srv_file_flush_method_str = NULL; -#ifndef _WIN32 -enum srv_unix_flush_t srv_unix_file_flush_method = SRV_UNIX_FSYNC; -#else -enum srv_win_flush_t srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED; -#endif /* _WIN32 */ +enum srv_flush_t srv_file_flush_method = IF_WIN(SRV_ALL_O_DIRECT_FSYNC,SRV_FSYNC); + ulint srv_max_n_open_files = 300; @@ -459,9 +448,9 @@ i/o handler thread */ const char* srv_io_thread_op_info[SRV_MAX_N_IO_THREADS]; const char* srv_io_thread_function[SRV_MAX_N_IO_THREADS]; -time_t srv_last_monitor_time; +static time_t srv_last_monitor_time; -ib_mutex_t srv_innodb_monitor_mutex; +static ib_mutex_t srv_innodb_monitor_mutex; /** Mutex protecting page_zip_stat_per_index */ ib_mutex_t page_zip_stat_per_index_mutex; @@ -484,8 +473,8 @@ ib_mutex_t srv_misc_tmpfile_mutex; /** Temporary file for miscellanous diagnostic output */ FILE* srv_misc_tmpfile; -ulint srv_main_thread_process_no = 0; -ulint srv_main_thread_id = 0; +static ulint srv_main_thread_process_no = 0; +static ulint srv_main_thread_id = 0; /* The following counts are used by the srv_master_thread. */ @@ -1654,12 +1643,8 @@ srv_export_innodb_status(void) #ifdef UNIV_DEBUG rw_lock_s_lock(&purge_sys->latch); - trx_id_t up_limit_id; + trx_id_t up_limit_id = purge_sys->view.up_limit_id();; trx_id_t done_trx_no = purge_sys->done.trx_no; - - up_limit_id = purge_sys->view_active - ? purge_sys->view.up_limit_id() : 0; - rw_lock_s_unlock(&purge_sys->latch); mutex_enter(&trx_sys->mutex); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index c360500b8842d..077b93e9327a1 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1047,8 +1047,7 @@ srv_undo_tablespaces_init( if (space_id == *it) { trx_rseg_header_create( - *it, univ_page_size, ULINT_MAX, - i, &mtr); + *it, ULINT_MAX, i, &mtr); } } @@ -1449,7 +1448,6 @@ innobase_start_or_create_for_mysql(void) dberr_t err = DB_SUCCESS; ulint srv_n_log_files_found = srv_n_log_files; mtr_t mtr; - purge_pq_t* purge_queue; char logfilename[10000]; char* logfile0 = NULL; size_t dirnamelen; @@ -1556,38 +1554,30 @@ innobase_start_or_create_for_mysql(void) if (srv_file_flush_method_str == NULL) { /* These are the default options */ -#ifndef _WIN32 - srv_unix_file_flush_method = SRV_UNIX_FSYNC; + srv_file_flush_method = IF_WIN(SRV_ALL_O_DIRECT_FSYNC,SRV_FSYNC); } else if (0 == ut_strcmp(srv_file_flush_method_str, "fsync")) { - srv_unix_file_flush_method = SRV_UNIX_FSYNC; + srv_file_flush_method = SRV_FSYNC; } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DSYNC")) { - srv_unix_file_flush_method = SRV_UNIX_O_DSYNC; + srv_file_flush_method = SRV_O_DSYNC; } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) { - srv_unix_file_flush_method = SRV_UNIX_O_DIRECT; + srv_file_flush_method = SRV_O_DIRECT; } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT_NO_FSYNC")) { - srv_unix_file_flush_method = SRV_UNIX_O_DIRECT_NO_FSYNC; + srv_file_flush_method = SRV_O_DIRECT_NO_FSYNC; } else if (0 == ut_strcmp(srv_file_flush_method_str, "littlesync")) { - srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC; + srv_file_flush_method = SRV_LITTLESYNC; } else if (0 == ut_strcmp(srv_file_flush_method_str, "nosync")) { - srv_unix_file_flush_method = SRV_UNIX_NOSYNC; -#else - srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED; + srv_file_flush_method = SRV_NOSYNC; +#ifdef _WIN32 } else if (0 == ut_strcmp(srv_file_flush_method_str, "normal")) { - srv_win_file_flush_method = SRV_WIN_IO_NORMAL; - srv_use_native_aio = FALSE; - + srv_file_flush_method = SRV_FSYNC; } else if (0 == ut_strcmp(srv_file_flush_method_str, "unbuffered")) { - srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED; - srv_use_native_aio = FALSE; - } else if (0 == ut_strcmp(srv_file_flush_method_str, "async_unbuffered")) { - srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED; #endif /* _WIN32 */ } else { ib::error() << "Unrecognized value " @@ -1688,10 +1678,6 @@ innobase_start_or_create_for_mysql(void) srv_boot(); - if (err != DB_SUCCESS) { - return(srv_init_abort(err)); - } - ib::info() << ut_crc32_implementation; if (!srv_read_only_mode) { @@ -1717,15 +1703,17 @@ innobase_start_or_create_for_mysql(void) ib::error() << "Unable to create " << srv_monitor_file_name << ": " << strerror(errno); - return(srv_init_abort(DB_ERROR)); + if (err == DB_SUCCESS) { + err = DB_ERROR; + } } } else { srv_monitor_file_name = NULL; srv_monitor_file = os_file_create_tmpfile(NULL); - if (!srv_monitor_file) { - return(srv_init_abort(DB_ERROR)); + if (!srv_monitor_file && err == DB_SUCCESS) { + err = DB_ERROR; } } @@ -1734,8 +1722,8 @@ innobase_start_or_create_for_mysql(void) srv_dict_tmpfile = os_file_create_tmpfile(NULL); - if (!srv_dict_tmpfile) { - return(srv_init_abort(DB_ERROR)); + if (!srv_dict_tmpfile && err == DB_SUCCESS) { + err = DB_ERROR; } mutex_create(LATCH_ID_SRV_MISC_TMPFILE, @@ -1743,11 +1731,15 @@ innobase_start_or_create_for_mysql(void) srv_misc_tmpfile = os_file_create_tmpfile(NULL); - if (!srv_misc_tmpfile) { - return(srv_init_abort(DB_ERROR)); + if (!srv_misc_tmpfile && err == DB_SUCCESS) { + err = DB_ERROR; } } + if (err != DB_SUCCESS) { + return(srv_init_abort(err)); + } + srv_n_file_io_threads = srv_n_read_io_threads; srv_n_file_io_threads += srv_n_write_io_threads; @@ -2135,13 +2127,7 @@ innobase_start_or_create_for_mysql(void) All the remaining rollback segments will be created later, after the double write buffer has been created. */ trx_sys_create_sys_pages(); - - purge_queue = trx_sys_init_at_db_start(); - - /* The purge system needs to create the purge view and - therefore requires that the trx_sys is inited. */ - - trx_purge_sys_create(srv_n_purge_threads, purge_queue); + trx_sys_init_at_db_start(); err = dict_create(); @@ -2226,7 +2212,7 @@ innobase_start_or_create_for_mysql(void) } /* This must precede recv_apply_hashed_log_recs(true). */ - purge_queue = trx_sys_init_at_db_start(); + trx_sys_init_at_db_start(); if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { /* Apply the hashed log records to the @@ -2307,16 +2293,10 @@ innobase_start_or_create_for_mysql(void) " a startup if you are trying to" " recover a badly corrupt database."; - UT_DELETE(purge_queue); return(srv_init_abort(DB_ERROR)); } } - /* The purge system needs to create the purge view and - therefore requires that the trx_sys is inited. */ - - trx_purge_sys_create(srv_n_purge_threads, purge_queue); - /* recv_recovery_from_checkpoint_finish needs trx lists which are initialized in trx_sys_init_at_db_start(). */ @@ -2876,9 +2856,8 @@ innodb_shutdown() trx_sys_file_format_close(); trx_sys_close(); } - if (purge_sys) { - trx_purge_sys_close(); - } + UT_DELETE(purge_sys); + purge_sys = NULL; if (buf_dblwr) { buf_dblwr_free(); } @@ -2917,7 +2896,10 @@ innodb_shutdown() pars_lexer_close(); log_mem_free(); - buf_pool_free(srv_buf_pool_instances); + ut_ad(buf_pool_ptr || !srv_was_started); + if (buf_pool_ptr) { + buf_pool_free(srv_buf_pool_instances); + } /* 6. Free the thread management resoruces. */ os_thread_free(); @@ -2939,9 +2921,11 @@ innodb_shutdown() srv_start_has_been_called = FALSE; } +#if 0 // TODO: Enable this in WL#6608 /******************************************************************** Signal all per-table background threads to shutdown, and wait for them to do so. */ +static void srv_shutdown_table_bg_threads(void) /*===============================*/ @@ -3014,6 +2998,7 @@ srv_shutdown_table_bg_threads(void) table = next; } } +#endif /** Get the meta-data filename from the table name for a single-table tablespace. diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc index 1b561dc329723..49a8d6db35a03 100644 --- a/storage/innobase/sync/sync0arr.cc +++ b/storage/innobase/sync/sync0arr.cc @@ -32,13 +32,7 @@ Created 9/5/1995 Heikki Tuuri *******************************************************/ #include "ha_prototypes.h" -#include "univ.i" - #include "sync0arr.h" -#ifdef UNIV_NONINL -#include "sync0arr.ic" -#endif - #include #include #include @@ -228,6 +222,33 @@ sync_array_t::sync_array_t(ulint num_cells) mutex_create(LATCH_ID_SYNC_ARRAY_MUTEX, &mutex); } +/** Validate the integrity of the wait array. Check +that the number of reserved cells equals the count variable. +@param[in,out] arr sync wait array */ +static +void +sync_array_validate(sync_array_t* arr) +{ + ulint i; + ulint count = 0; + + sync_array_enter(arr); + + for (i = 0; i < arr->n_cells; i++) { + sync_cell_t* cell; + + cell = sync_array_get_nth_cell(arr, i); + + if (cell->latch.mutex != NULL) { + count++; + } + } + + ut_a(count == arr->n_reserved); + + sync_array_exit(arr); +} + /** Destructor */ sync_array_t::~sync_array_t() UNIV_NOTHROW @@ -269,34 +290,6 @@ sync_array_free( UT_DELETE(arr); } -/********************************************************************//** -Validates the integrity of the wait array. Checks -that the number of reserved cells equals the count variable. */ -void -sync_array_validate( -/*================*/ - sync_array_t* arr) /*!< in: sync wait array */ -{ - ulint i; - ulint count = 0; - - sync_array_enter(arr); - - for (i = 0; i < arr->n_cells; i++) { - sync_cell_t* cell; - - cell = sync_array_get_nth_cell(arr, i); - - if (cell->latch.mutex != NULL) { - count++; - } - } - - ut_a(count == arr->n_reserved); - - sync_array_exit(arr); -} - /*******************************************************************//** Returns the event that the thread owning the cell waits for. */ static @@ -697,6 +690,7 @@ Report an error to stderr. @param lock rw-lock instance @param debug rw-lock debug information @param cell thread context */ +static void sync_array_report_error( rw_lock_t* lock, diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc index 1d9e893318597..135c84ad0d8c9 100644 --- a/storage/innobase/sync/sync0debug.cc +++ b/storage/innobase/sync/sync0debug.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, MariaDB Corporation. All Rights Reserved. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -1787,8 +1788,7 @@ sync_check_init() sync_array_init(OS_THREAD_MAX_N); } -/** Frees the resources in InnoDB's own synchronization data structures. Use -os_sync_free() after calling this. */ +/** Free the InnoDB synchronization data structures. */ void sync_check_close() { diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc index 497f7f3f9e982..c748bad1417db 100644 --- a/storage/innobase/sync/sync0rw.cc +++ b/storage/innobase/sync/sync0rw.cc @@ -32,11 +32,6 @@ Created 9/11/1995 Heikki Tuuri *******************************************************/ #include "sync0rw.h" -#ifdef UNIV_NONINL -#include "sync0rw.ic" -#include "sync0arr.ic" -#endif - #include "ha_prototypes.h" #include "os0thread.h" @@ -1176,41 +1171,6 @@ rw_lock_list_print_info( mutex_exit(&rw_lock_list_mutex); } -/***************************************************************//** -Prints debug info of an rw-lock. */ -void -rw_lock_print( -/*==========*/ - rw_lock_t* lock) /*!< in: rw-lock */ -{ - rw_lock_debug_t* info; - - fprintf(stderr, - "-------------\n" - "RW-LATCH INFO\n" - "RW-LATCH: %p ", (void*) lock); - - if (lock->lock_word != X_LOCK_DECR) { - - if (lock->waiters) { - fputs(" Waiters for the lock exist\n", stderr); - } else { - putc('\n', stderr); - } - - rw_lock_debug_mutex_enter(); - - for (info = UT_LIST_GET_FIRST(lock->debug_list); - info != NULL; - info = UT_LIST_GET_NEXT(list, info)) { - - rw_lock_debug_print(stderr, info); - } - - rw_lock_debug_mutex_exit(); - } -} - /*********************************************************************//** Prints info of a debug struct. */ void @@ -1250,32 +1210,6 @@ rw_lock_debug_print( fprintf(f, "\n"); } -/***************************************************************//** -Returns the number of currently locked rw-locks. Works only in the debug -version. -@return number of locked rw-locks */ -ulint -rw_lock_n_locked(void) -/*==================*/ -{ - ulint count = 0; - - mutex_enter(&rw_lock_list_mutex); - - for (const rw_lock_t* lock = UT_LIST_GET_FIRST(rw_lock_list); - lock != NULL; - lock = UT_LIST_GET_NEXT(list, lock)) { - - if (lock->lock_word != X_LOCK_DECR) { - count++; - } - } - - mutex_exit(&rw_lock_list_mutex); - - return(count); -} - /** Print where it was locked from @return the string representation */ std::string diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index a732b1ea150ac..6ff4c882be8d9 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -27,11 +27,6 @@ Created 3/26/1996 Heikki Tuuri #include "ha_prototypes.h" #include "trx0purge.h" - -#ifdef UNIV_NONINL -#include "trx0purge.ic" -#endif - #include "fsp0fsp.h" #include "fut0fut.h" #include "mach0data.h" @@ -58,7 +53,7 @@ ulong srv_max_purge_lag = 0; ulong srv_max_purge_lag_delay = 0; /** The global data structure coordinating a purge */ -trx_purge_t* purge_sys = NULL; +purge_sys_t* purge_sys; /** A dummy undo record used as a return value when we have a whole undo log which needs no purge */ @@ -73,23 +68,20 @@ bool trx_commit_disallowed = false; const TrxUndoRsegs TrxUndoRsegsIterator::NullElement(UINT64_UNDEFINED); /** Constructor */ -TrxUndoRsegsIterator::TrxUndoRsegsIterator(trx_purge_t* purge_sys) +TrxUndoRsegsIterator::TrxUndoRsegsIterator() : - m_purge_sys(purge_sys), m_trx_undo_rsegs(NullElement), m_iter(m_trx_undo_rsegs.end()) { } -/** Sets the next rseg to purge in m_purge_sys. -@return page size of the table for which the log is. -NOTE: if rseg is NULL when this function returns this means that -there are no rollback segments to purge and then the returned page -size object should not be used. */ -const page_size_t +/** Sets the next rseg to purge in purge_sys. +@return whether anything is to be purged */ +inline +bool TrxUndoRsegsIterator::set_next() { - mutex_enter(&m_purge_sys->pq_mutex); + mutex_enter(&purge_sys->pq_mutex); /* Only purge consumes events from the priority queue, user threads only produce the events. */ @@ -103,9 +95,9 @@ TrxUndoRsegsIterator::set_next() number shouldn't increase. Undo increment of expected trx_no done by caller assuming rollback segments from given transaction are done. */ - m_purge_sys->iter.trx_no = (*m_iter)->last_trx_no; + purge_sys->iter.trx_no = (*m_iter)->last_trx_no; - } else if (!m_purge_sys->purge_queue->empty()) { + } else if (!purge_sys->purge_queue.empty()) { /* Read the next element from the queue. Combine elements if they have same transaction number. @@ -115,20 +107,21 @@ TrxUndoRsegsIterator::set_next() rollback segment for purge. */ m_trx_undo_rsegs = NullElement; - while (!m_purge_sys->purge_queue->empty()) { + purge_pq_t& purge_queue = purge_sys->purge_queue; + + while (!purge_queue.empty()) { if (m_trx_undo_rsegs.get_trx_no() == UINT64_UNDEFINED) { - m_trx_undo_rsegs = - purge_sys->purge_queue->top(); - } else if (purge_sys->purge_queue->top().get_trx_no() == + m_trx_undo_rsegs = purge_queue.top(); + } else if (purge_queue.top().get_trx_no() == m_trx_undo_rsegs.get_trx_no()) { m_trx_undo_rsegs.append( - purge_sys->purge_queue->top()); + purge_queue.top()); } else { break; } - m_purge_sys->purge_queue->pop(); + purge_queue.pop(); } m_iter = m_trx_undo_rsegs.begin(); @@ -138,166 +131,111 @@ TrxUndoRsegsIterator::set_next() m_trx_undo_rsegs = NullElement; m_iter = m_trx_undo_rsegs.end(); - mutex_exit(&m_purge_sys->pq_mutex); - - m_purge_sys->rseg = NULL; + mutex_exit(&purge_sys->pq_mutex); - /* return a dummy object, not going to be used by the caller */ - return(univ_page_size); + purge_sys->rseg = NULL; + return false; } - m_purge_sys->rseg = *m_iter++; + purge_sys->rseg = *m_iter++; - mutex_exit(&m_purge_sys->pq_mutex); + mutex_exit(&purge_sys->pq_mutex); - ut_a(m_purge_sys->rseg != NULL); + ut_a(purge_sys->rseg != NULL); - mutex_enter(&m_purge_sys->rseg->mutex); + mutex_enter(&purge_sys->rseg->mutex); - ut_a(m_purge_sys->rseg->last_page_no != FIL_NULL); - ut_ad(m_purge_sys->rseg->last_trx_no == m_trx_undo_rsegs.get_trx_no()); + ut_a(purge_sys->rseg->last_page_no != FIL_NULL); + ut_ad(purge_sys->rseg->last_trx_no == m_trx_undo_rsegs.get_trx_no()); /* We assume in purge of externally stored fields that space id is in the range of UNDO tablespace space ids unless space is system tablespace */ - ut_a(m_purge_sys->rseg->space <= srv_undo_tablespaces_open + ut_a(purge_sys->rseg->space <= srv_undo_tablespaces_open || is_system_tablespace( - m_purge_sys->rseg->space)); - - const page_size_t page_size(m_purge_sys->rseg->page_size); + purge_sys->rseg->space)); ut_a(purge_sys->iter.trx_no <= purge_sys->rseg->last_trx_no); - m_purge_sys->iter.trx_no = m_purge_sys->rseg->last_trx_no; - m_purge_sys->hdr_offset = m_purge_sys->rseg->last_offset; - m_purge_sys->hdr_page_no = m_purge_sys->rseg->last_page_no; + purge_sys->iter.trx_no = purge_sys->rseg->last_trx_no; + purge_sys->hdr_offset = purge_sys->rseg->last_offset; + purge_sys->hdr_page_no = purge_sys->rseg->last_page_no; - mutex_exit(&m_purge_sys->rseg->mutex); + mutex_exit(&purge_sys->rseg->mutex); - return(page_size); + return(true); } -/****************************************************************//** -Builds a purge 'query' graph. The actual purge is performed by executing +/** Build a purge 'query' graph. The actual purge is performed by executing this query graph. +@param[in,out] sess the purge session @return own: the query graph */ static que_t* -trx_purge_graph_build( -/*==================*/ - trx_t* trx, /*!< in: transaction */ - ulint n_purge_threads) /*!< in: number of purge - threads */ +trx_purge_graph_build(sess_t* sess) { - ulint i; - mem_heap_t* heap; - que_fork_t* fork; + ut_a(srv_n_purge_threads > 0); + /* A purge transaction is not a real transaction, we use a transaction + here only because the query threads code requires it. It is otherwise + quite unnecessary. We should get rid of it eventually. */ + trx_t* trx = sess->trx; - heap = mem_heap_create(512); - fork = que_fork_create(NULL, NULL, QUE_FORK_PURGE, heap); - fork->trx = trx; + ut_ad(trx->sess == sess); - for (i = 0; i < n_purge_threads; ++i) { - que_thr_t* thr; + trx->id = 0; + trx->start_time = ut_time(); + trx->state = TRX_STATE_ACTIVE; + trx->op_info = "purge trx"; - thr = que_thr_create(fork, heap, NULL); + mem_heap_t* heap = mem_heap_create(512); + que_fork_t* fork = que_fork_create( + NULL, NULL, QUE_FORK_PURGE, heap); + fork->trx = trx; + for (ulint i = 0; i < srv_n_purge_threads; ++i) { + que_thr_t* thr = que_thr_create(fork, heap, NULL); thr->child = row_purge_node_create(thr, heap); } return(fork); } -/********************************************************************//** -Creates the global purge system control structure and inits the history -mutex. */ -void -trx_purge_sys_create( -/*=================*/ - ulint n_purge_threads, /*!< in: number of purge - threads */ - purge_pq_t* purge_queue) /*!< in, own: UNDO log min - binary heap */ -{ - purge_sys = static_cast( - ut_zalloc_nokey(sizeof(*purge_sys))); - - purge_sys->state = PURGE_STATE_INIT; - purge_sys->event = os_event_create(0); - - new (&purge_sys->iter) purge_iter_t; - new (&purge_sys->limit) purge_iter_t; - new (&purge_sys->undo_trunc) undo::Truncate; +/** Construct the purge system. */ +purge_sys_t::purge_sys_t() + : sess(sess_open()), latch(), event(os_event_create(0)), + n_stop(0), running(false), state(PURGE_STATE_INIT), + query(trx_purge_graph_build(sess)), + view(), n_submitted(0), n_completed(0), + iter(), limit(), #ifdef UNIV_DEBUG - new (&purge_sys->done) purge_iter_t; + done(), #endif /* UNIV_DEBUG */ - - /* Take ownership of purge_queue, we are responsible for freeing it. */ - purge_sys->purge_queue = purge_queue; - - rw_lock_create(trx_purge_latch_key, - &purge_sys->latch, SYNC_PURGE_LATCH); - - mutex_create(LATCH_ID_PURGE_SYS_PQ, &purge_sys->pq_mutex); - - ut_a(n_purge_threads > 0); - - purge_sys->sess = sess_open(); - - purge_sys->trx = purge_sys->sess->trx; - - ut_a(purge_sys->trx->sess == purge_sys->sess); - - /* A purge transaction is not a real transaction, we use a transaction - here only because the query threads code requires it. It is otherwise - quite unnecessary. We should get rid of it eventually. */ - purge_sys->trx->id = 0; - purge_sys->trx->start_time = ut_time(); - purge_sys->trx->state = TRX_STATE_ACTIVE; - purge_sys->trx->op_info = "purge trx"; - - purge_sys->query = trx_purge_graph_build( - purge_sys->trx, n_purge_threads); - - new(&purge_sys->view) ReadView(); - - trx_sys->mvcc->clone_oldest_view(&purge_sys->view); - - purge_sys->view_active = true; - - purge_sys->rseg_iter = UT_NEW_NOKEY(TrxUndoRsegsIterator(purge_sys)); + next_stored(false), rseg(NULL), + page_no(0), offset(0), hdr_page_no(0), hdr_offset(0), + rseg_iter(), purge_queue(), pq_mutex(), undo_trunc() +{ + ut_ad(!purge_sys); + rw_lock_create(trx_purge_latch_key, &latch, SYNC_PURGE_LATCH); + mutex_create(LATCH_ID_PURGE_SYS_PQ, &pq_mutex); } -/************************************************************************ -Frees the global purge system control structure. */ -void -trx_purge_sys_close(void) -/*======================*/ +/** Destruct the purge system. */ +purge_sys_t::~purge_sys_t() { - que_graph_free(purge_sys->query); - - ut_a(purge_sys->trx->id == 0); - ut_a(purge_sys->sess->trx == purge_sys->trx); - - purge_sys->trx->state = TRX_STATE_NOT_STARTED; - - sess_close(purge_sys->sess); - - purge_sys->view.close(); - purge_sys->view.~ReadView(); - - rw_lock_free(&purge_sys->latch); - mutex_free(&purge_sys->pq_mutex); - - UT_DELETE(purge_sys->purge_queue); - - os_event_destroy(purge_sys->event); - - UT_DELETE(purge_sys->rseg_iter); - - ut_free(purge_sys); - - purge_sys = NULL; + ut_ad(this == purge_sys); + + que_graph_free(query); + ut_a(sess->trx->id == 0); + sess->trx->state = TRX_STATE_NOT_STARTED; + sess_close(sess); + view.close(); + rw_lock_free(&latch); + /* rw_lock_free() already called latch.~rw_lock_t(); tame the + debug assertions when the destructor will be called once more. */ + ut_ad(latch.magic_n == 0); + ut_d(latch.magic_n = RW_LOCK_MAGIC_N); + mutex_free(&pq_mutex); + os_event_destroy(event); } /*================ UNDO LOG HISTORY LIST =============================*/ @@ -309,28 +247,15 @@ void trx_purge_add_update_undo_to_history( /*=================================*/ trx_t* trx, /*!< in: transaction */ - trx_undo_ptr_t* undo_ptr, /*!< in/out: update undo log. */ page_t* undo_page, /*!< in: update undo log header page, x-latched */ - bool update_rseg_history_len, - /*!< in: if true: update rseg history - len else skip updating it. */ - ulint n_added_logs, /*!< in: number of logs added */ mtr_t* mtr) /*!< in: mtr */ { - trx_undo_t* undo; - trx_rseg_t* rseg; - trx_rsegf_t* rseg_header; - trx_ulogf_t* undo_header; - - undo = undo_ptr->update_undo; - rseg = undo->rseg; - - rseg_header = trx_rsegf_get( - undo->rseg->space, undo->rseg->page_no, undo->rseg->page_size, - mtr); - - undo_header = undo_page + undo->hdr_offset; + trx_undo_t* undo = trx->rsegs.m_redo.update_undo; + trx_rseg_t* rseg = undo->rseg; + trx_rsegf_t* rseg_header = trx_rsegf_get( + rseg->space, rseg->page_no, mtr); + trx_ulogf_t* undo_header = undo_page + undo->hdr_offset; if (undo->state != TRX_UNDO_CACHED) { ulint hist_size; @@ -365,11 +290,8 @@ trx_purge_add_update_undo_to_history( flst_add_first(rseg_header + TRX_RSEG_HISTORY, undo_header + TRX_UNDO_HISTORY_NODE, mtr); - if (update_rseg_history_len) { - my_atomic_addlint( - &trx_sys->rseg_history_len, n_added_logs); - srv_wake_purge_thread_if_not_active(); - } + my_atomic_addlint(&trx_sys->rseg_history_len, 1); + srv_wake_purge_thread_if_not_active(); /* Write the trx number to the undo log header */ mlog_write_ull(undo_header + TRX_UNDO_TRX_NO, trx->no, mtr); @@ -436,12 +358,10 @@ trx_purge_free_segment( mutex_enter(&rseg->mutex); - rseg_hdr = trx_rsegf_get( - rseg->space, rseg->page_no, rseg->page_size, &mtr); + rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr); undo_page = trx_undo_page_get( - page_id_t(rseg->space, hdr_addr.page), rseg->page_size, - &mtr); + page_id_t(rseg->space, hdr_addr.page), &mtr); seg_hdr = undo_page + TRX_UNDO_SEG_HDR; log_hdr = undo_page + hdr_addr.boffset; @@ -534,8 +454,7 @@ trx_purge_truncate_rseg_history( } mutex_enter(&(rseg->mutex)); - rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, - rseg->page_size, &mtr); + rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr); hdr_addr = trx_purge_get_log_from_hist( flst_get_last(rseg_hdr + TRX_RSEG_HISTORY, &mtr)); @@ -550,7 +469,7 @@ trx_purge_truncate_rseg_history( } undo_page = trx_undo_page_get(page_id_t(rseg->space, hdr_addr.page), - rseg->page_size, &mtr); + &mtr); log_hdr = undo_page + hdr_addr.boffset; @@ -605,8 +524,7 @@ trx_purge_truncate_rseg_history( } mutex_enter(&(rseg->mutex)); - rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, - rseg->page_size, &mtr); + rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr); hdr_addr = prev_hdr_addr; @@ -960,11 +878,11 @@ trx_purge_cleanse_purge_queue( /* Remove rseg instances that are in the purge queue before we start truncate of corresponding UNDO truncate. */ - while (!purge_sys->purge_queue->empty()) { - purge_elem_list.push_back(purge_sys->purge_queue->top()); - purge_sys->purge_queue->pop(); + while (!purge_sys->purge_queue.empty()) { + purge_elem_list.push_back(purge_sys->purge_queue.top()); + purge_sys->purge_queue.pop(); } - ut_ad(purge_sys->purge_queue->empty()); + ut_ad(purge_sys->purge_queue.empty()); for (purge_elem_list_t::iterator it = purge_elem_list.begin(); it != purge_elem_list.end(); @@ -981,12 +899,11 @@ trx_purge_cleanse_purge_queue( } } - const ulint size = it->size(); - if (size != 0) { + if (it->size()) { /* size != 0 suggest that there exist other rsegs that needs processing so add this element to purge queue. Note: Other rseg could be non-redo rsegs. */ - purge_sys->purge_queue->push(*it); + purge_sys->purge_queue.push(*it); } } mutex_exit(&purge_sys->pq_mutex); @@ -1140,7 +1057,7 @@ trx_purge_initiate_truncate( purge_batch_size that can force the purge loop to exit before all the records are purged and in this case purge_sys->rseg could point to a valid rseg waiting for next purge cycle. */ - purge_sys->next_stored = FALSE; + purge_sys->next_stored = false; purge_sys->rseg = NULL; } @@ -1201,15 +1118,6 @@ trx_purge_truncate_history( } } - for (i = 0; i < TRX_SYS_N_RSEGS; ++i) { - trx_rseg_t* rseg = trx_sys->pending_purge_rseg_array[i]; - - if (rseg != NULL) { - ut_a(rseg->id == i); - trx_purge_truncate_rseg_history(rseg, limit); - } - } - /* UNDO tablespace truncate. We will try to truncate as much as we can (greedy approach). This will ensure when the server is idle we try and truncate all the UNDO tablespaces. */ @@ -1245,13 +1153,12 @@ trx_purge_rseg_get_next_history_log( purge_sys->iter.trx_no = rseg->last_trx_no + 1; purge_sys->iter.undo_no = 0; purge_sys->iter.undo_rseg_space = ULINT_UNDEFINED; - purge_sys->next_stored = FALSE; + purge_sys->next_stored = false; mtr_start(&mtr); undo_page = trx_undo_page_get_s_latched( - page_id_t(rseg->space, rseg->last_page_no), - rseg->page_size, &mtr); + page_id_t(rseg->space, rseg->last_page_no), &mtr); log_hdr = undo_page + rseg->last_offset; @@ -1303,7 +1210,7 @@ trx_purge_rseg_get_next_history_log( log_hdr = trx_undo_page_get_s_latched(page_id_t(rseg->space, prev_log_addr.page), - rseg->page_size, &mtr) + &mtr) + prev_log_addr.boffset; trx_no = mach_read_from_8(log_hdr + TRX_UNDO_TRX_NO); @@ -1329,21 +1236,17 @@ trx_purge_rseg_get_next_history_log( mutex_enter(&purge_sys->pq_mutex); - purge_sys->purge_queue->push(elem); + purge_sys->purge_queue.push(elem); mutex_exit(&purge_sys->pq_mutex); mutex_exit(&rseg->mutex); } -/** Position the purge sys "iterator" on the undo record to use for purging. -@param[in,out] purge_sys purge instance -@param[in] page_size page size */ +/** Position the purge sys "iterator" on the undo record to use for purging. */ static void -trx_purge_read_undo_rec( - trx_purge_t* purge_sys, - const page_size_t& page_size) +trx_purge_read_undo_rec() { ulint offset; ulint page_no; @@ -1361,7 +1264,6 @@ trx_purge_read_undo_rec( undo_rec = trx_undo_get_first_rec( purge_sys->rseg->space, - page_size, purge_sys->hdr_page_no, purge_sys->hdr_offset, RW_S_LATCH, &mtr); @@ -1388,7 +1290,7 @@ trx_purge_read_undo_rec( purge_sys->iter.undo_no = undo_no; purge_sys->iter.undo_rseg_space = undo_rseg_space; - purge_sys->next_stored = TRUE; + purge_sys->next_stored = true; } /***********************************************************************//** @@ -1401,12 +1303,10 @@ void trx_purge_choose_next_log(void) /*===========================*/ { - ut_ad(purge_sys->next_stored == FALSE); + ut_ad(!purge_sys->next_stored); - const page_size_t& page_size = purge_sys->rseg_iter->set_next(); - - if (purge_sys->rseg != NULL) { - trx_purge_read_undo_rec(purge_sys, page_size); + if (purge_sys->rseg_iter.set_next()) { + trx_purge_read_undo_rec(); } else { /* There is nothing to do yet. */ os_thread_yield(); @@ -1441,8 +1341,6 @@ trx_purge_get_next_rec( page_no = purge_sys->page_no; offset = purge_sys->offset; - const page_size_t page_size(purge_sys->rseg->page_size); - if (offset == 0) { /* It is the dummy undo log record, which means that there is no need to purge this undo log */ @@ -1460,7 +1358,7 @@ trx_purge_get_next_rec( mtr_start(&mtr); undo_page = trx_undo_page_get_s_latched(page_id_t(space, page_no), - page_size, &mtr); + &mtr); rec = undo_page + offset; @@ -1518,7 +1416,7 @@ trx_purge_get_next_rec( mtr_start(&mtr); undo_page = trx_undo_page_get_s_latched( - page_id_t(space, page_no), page_size, &mtr); + page_id_t(space, page_no), &mtr); rec = undo_page + offset; } else { @@ -1592,7 +1490,7 @@ ulint trx_purge_attach_undo_recs( /*=======================*/ ulint n_purge_threads,/*!< in: number of purge threads */ - trx_purge_t* purge_sys, /*!< in/out: purge instance */ + purge_sys_t* purge_sys, /*!< in/out: purge instance */ ulint batch_size) /*!< in: no. of pages to purge */ { que_thr_t* thr; @@ -1739,7 +1637,7 @@ static void trx_purge_wait_for_workers_to_complete( /*===================================*/ - trx_purge_t* purge_sys) /*!< in: purge instance */ + purge_sys_t* purge_sys) /*!< in: purge instance */ { ulint n_submitted = purge_sys->n_submitted; @@ -1800,13 +1698,7 @@ trx_purge( ut_a(purge_sys->n_submitted == purge_sys->n_completed); rw_lock_x_lock(&purge_sys->latch); - - purge_sys->view_active = false; - trx_sys->mvcc->clone_oldest_view(&purge_sys->view); - - purge_sys->view_active = true; - rw_lock_x_unlock(&purge_sys->latch); #ifdef UNIV_DEBUG diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 3cea123cc1b1b..481e14d44dea6 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -25,11 +25,6 @@ Created 3/26/1996 Heikki Tuuri *******************************************************/ #include "trx0rec.h" - -#ifdef UNIV_NONINL -#include "trx0rec.ic" -#endif - #include "fsp0fsp.h" #include "mach0data.h" #include "trx0undo.h" @@ -671,6 +666,7 @@ trx_undo_rec_get_row_ref( /*******************************************************************//** Skips a row reference from an undo log record. @return pointer to remaining part of undo record */ +static byte* trx_undo_rec_skip_row_ref( /*======================*/ @@ -862,7 +858,7 @@ trx_undo_page_report_modify( virtual column info */ mtr_t* mtr) /*!< in: mtr */ { - dict_table_t* table; + dict_table_t* table = index->table; ulint first_free; byte* ptr; const byte* field; @@ -872,7 +868,6 @@ trx_undo_page_report_modify( byte* type_cmpl_ptr; ulint i; trx_id_t trx_id; - trx_undo_ptr_t* undo_ptr; ibool ignore_prefix = FALSE; byte ext_buf[REC_VERSION_56_MAX_INDEX_COL_LEN + BTR_EXTERN_FIELD_REF_SIZE]; @@ -880,15 +875,13 @@ trx_undo_page_report_modify( ut_a(dict_index_is_clust(index)); ut_ad(rec_offs_validate(rec, index, offsets)); - ut_ad(mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR - + TRX_UNDO_PAGE_TYPE) == TRX_UNDO_UPDATE); - table = index->table; - - /* If table instance is temporary then select noredo rseg as changes - to undo logs don't need REDO logging given that they are not - restored on restart as corresponding object doesn't exist on restart.*/ - undo_ptr = dict_table_is_temporary(index->table) - ? &trx->rsegs.m_noredo : &trx->rsegs.m_redo; + ut_ad(mach_read_from_2(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE + + undo_page) == TRX_UNDO_UPDATE + || (dict_table_is_temporary(table) + && mach_read_from_2(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE + + undo_page) == TRX_UNDO_INSERT)); + trx_undo_t* update_undo = dict_table_is_temporary(table) + ? NULL : trx->rsegs.m_redo.update_undo; first_free = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE); @@ -1006,8 +999,7 @@ trx_undo_page_report_modify( need to double check if there are any non-indexed columns being registered in update vector in case they will be indexed in new table */ - if (dict_index_is_online_ddl(index) - && index->table->n_v_cols > 0) { + if (dict_index_is_online_ddl(index) && table->n_v_cols > 0) { for (i = 0; i < upd_get_n_fields(update); i++) { upd_field_t* fld = upd_get_nth_field( update, i); @@ -1113,7 +1105,9 @@ trx_undo_page_report_modify( /* Notify purge that it eventually has to free the old externally stored field */ - undo_ptr->update_undo->del_marks = TRUE; + if (update_undo) { + update_undo->del_marks = TRUE; + } *type_cmpl_ptr |= TRX_UNDO_UPD_EXTERN; } else { @@ -1182,7 +1176,9 @@ trx_undo_page_report_modify( double mbr[SPDIMS * 2]; mem_heap_t* row_heap = NULL; - undo_ptr->update_undo->del_marks = TRUE; + if (update_undo) { + update_undo->del_marks = TRUE; + } if (trx_undo_left(undo_page, ptr) < 5) { @@ -1866,18 +1862,19 @@ trx_undo_report_row_operation( flag was specified */ { trx_t* trx; - trx_undo_t* undo; ulint page_no; buf_block_t* undo_block; - trx_undo_ptr_t* undo_ptr; mtr_t mtr; - dberr_t err = DB_SUCCESS; #ifdef UNIV_DEBUG int loop_count = 0; #endif /* UNIV_DEBUG */ ut_a(dict_index_is_clust(index)); ut_ad(!rec || rec_offs_validate(rec, index, offsets)); + ut_ad(!srv_read_only_mode); + ut_ad(op_type == TRX_UNDO_INSERT_OP || op_type == TRX_UNDO_MODIFY_OP); + ut_ad((op_type != TRX_UNDO_INSERT_OP) + || (clust_entry && !update && !rec)); if (flags & BTR_NO_UNDO_LOG_FLAG) { @@ -1886,93 +1883,59 @@ trx_undo_report_row_operation( return(DB_SUCCESS); } - ut_ad(thr); - ut_ad(!srv_read_only_mode); - ut_ad((op_type != TRX_UNDO_INSERT_OP) - || (clust_entry && !update && !rec)); - trx = thr_get_trx(thr); - bool is_temp_table = dict_table_is_temporary(index->table); - - /* Temporary tables do not go into INFORMATION_SCHEMA.TABLES, - so do not bother adding it to the list of modified tables by - the transaction - this list is only used for maintaining - INFORMATION_SCHEMA.TABLES.UPDATE_TIME. */ - if (!is_temp_table) { - trx->mod_tables.insert(index->table); - } - - /* If trx is read-only then only temp-tables can be written. - If trx is read-write and involves temp-table only then we - assign temporary rseg. */ - if (trx->read_only || is_temp_table) { + mtr.start(); + trx_undo_t** pundo; + trx_rseg_t* rseg; + const bool is_temp = dict_table_is_temporary(index->table); - ut_ad(!srv_read_only_mode || is_temp_table); + if (is_temp) { + mtr.set_log_mode(MTR_LOG_NO_REDO); - /* MySQL should block writes to non-temporary tables. */ - ut_a(is_temp_table); + rseg = trx->rsegs.m_noredo.rseg; - if (trx->rsegs.m_noredo.rseg == 0) { + if (!rseg) { trx_assign_rseg(trx); + rseg = trx->rsegs.m_noredo.rseg; } - } - - /* If object is temporary, disable REDO logging that is done to track - changes done to UNDO logs. This is feasible given that temporary tables - are not restored on restart. */ - mtr_start(&mtr); - dict_disable_redo_if_temporary(index->table, &mtr); - mutex_enter(&trx->undo_mutex); - /* If object is temp-table then select noredo rseg as changes - to undo logs don't need REDO logging given that they are not - restored on restart as corresponding object doesn't exist on restart.*/ - undo_ptr = is_temp_table ? &trx->rsegs.m_noredo : &trx->rsegs.m_redo; - - switch (op_type) { - case TRX_UNDO_INSERT_OP: - undo = undo_ptr->insert_undo; - - if (undo == NULL) { - - err = trx_undo_assign_undo( - trx, undo_ptr, TRX_UNDO_INSERT); - undo = undo_ptr->insert_undo; - - if (undo == NULL) { - /* Did not succeed */ - ut_ad(err != DB_SUCCESS); - goto err_exit; - } + pundo = &trx->rsegs.m_noredo.undo; + } else { + ut_ad(!trx->read_only); + /* Keep INFORMATION_SCHEMA.TABLES.UPDATE_TIME + up-to-date for persistent tables. Temporary tables are + not listed there. */ + trx->mod_tables.insert(index->table); - ut_ad(err == DB_SUCCESS); - } - break; - default: - ut_ad(op_type == TRX_UNDO_MODIFY_OP); + pundo = op_type == TRX_UNDO_INSERT_OP + ? &trx->rsegs.m_redo.insert_undo + : &trx->rsegs.m_redo.update_undo; + rseg = trx->rsegs.m_redo.rseg; + } - undo = undo_ptr->update_undo; + mutex_enter(&trx->undo_mutex); + dberr_t err; - if (undo == NULL) { - err = trx_undo_assign_undo( - trx, undo_ptr, TRX_UNDO_UPDATE); - undo = undo_ptr->update_undo; + if (*pundo) { + err = DB_SUCCESS; + } else if (op_type == TRX_UNDO_INSERT_OP || is_temp) { + err = trx_undo_assign_undo(trx, rseg, pundo, TRX_UNDO_INSERT); + } else { + err = trx_undo_assign_undo(trx, rseg, pundo, TRX_UNDO_UPDATE); + } - if (undo == NULL) { - /* Did not succeed */ - ut_ad(err != DB_SUCCESS); - goto err_exit; - } - } + trx_undo_t* undo = *pundo; - ut_ad(err == DB_SUCCESS); + ut_ad((err == DB_SUCCESS) == (undo != NULL)); + if (undo == NULL) { + goto err_exit; } page_no = undo->last_page_no; undo_block = buf_page_get_gen( - page_id_t(undo->space, page_no), undo->page_size, RW_X_LATCH, + page_id_t(undo->space, page_no), univ_page_size, RW_X_LATCH, buf_pool_is_obsolete(undo->withdraw_clock) ? NULL : undo->guess_block, BUF_GET, __FILE__, __LINE__, &mtr, &err); @@ -2020,13 +1983,14 @@ trx_undo_report_row_operation( latches, such as SYNC_FSP and SYNC_FSP_PAGE. */ mtr_commit(&mtr); - mtr_start_trx(&mtr, trx); - dict_disable_redo_if_temporary( - index->table, &mtr); + mtr.start(trx); + if (is_temp) { + mtr.set_log_mode(MTR_LOG_NO_REDO); + } - mutex_enter(&undo_ptr->rseg->mutex); - trx_undo_free_last_page(trx, undo, &mtr); - mutex_exit(&undo_ptr->rseg->mutex); + mutex_enter(&rseg->mutex); + trx_undo_free_last_page(undo, &mtr); + mutex_exit(&rseg->mutex); err = DB_UNDO_RECORD_TOO_BIG; goto err_exit; @@ -2041,17 +2005,16 @@ trx_undo_report_row_operation( undo->empty = FALSE; undo->top_page_no = page_no; undo->top_offset = offset; - undo->top_undo_no = trx->undo_no; + undo->top_undo_no = trx->undo_no++; undo->guess_block = undo_block; - trx->undo_no++; - trx->undo_rseg_space = undo_ptr->rseg->space; + trx->undo_rseg_space = rseg->space; mutex_exit(&trx->undo_mutex); *roll_ptr = trx_undo_build_roll_ptr( op_type == TRX_UNDO_INSERT_OP, - undo_ptr->rseg->id, page_no, offset); + rseg->id, page_no, offset); return(DB_SUCCESS); } @@ -2060,17 +2023,13 @@ trx_undo_report_row_operation( /* We have to extend the undo log by one page */ ut_ad(++loop_count < 2); - mtr_start_trx(&mtr, trx); - dict_disable_redo_if_temporary(index->table, &mtr); - - /* When we add a page to an undo log, this is analogous to - a pessimistic insert in a B-tree, and we must reserve the - counterpart of the tree latch, which is the rseg mutex. */ + mtr.start(trx); - mutex_enter(&undo_ptr->rseg->mutex); - undo_block = trx_undo_add_page(trx, undo, undo_ptr, &mtr); - mutex_exit(&undo_ptr->rseg->mutex); + if (is_temp) { + mtr.set_log_mode(MTR_LOG_NO_REDO); + } + undo_block = trx_undo_add_page(trx, undo, &mtr); page_no = undo->last_page_no; DBUG_EXECUTE_IF("ib_err_ins_undo_page_add_failure", @@ -2084,10 +2043,8 @@ trx_undo_report_row_operation( " log pages. Please add new data file to the tablespace or" " check if filesystem is full or enable auto-extension for" " the tablespace", - ((undo->space == srv_sys_space.space_id()) - ? "system" : - ((fsp_is_system_temporary(undo->space)) - ? "temporary" : "undo"))); + undo->space == TRX_SYS_SPACE + ? "system" : is_temp ? "temporary" : "undo"); /* Did not succeed: out of space */ err = DB_OUT_OF_FILE_SPACE; @@ -2104,12 +2061,12 @@ trx_undo_report_row_operation( Copies an undo record to heap. This function can be called if we know that the undo log record exists. @return own: copy of the record */ +static trx_undo_rec_t* trx_undo_get_undo_rec_low( /*======================*/ roll_ptr_t roll_ptr, /*!< in: roll pointer to record */ - mem_heap_t* heap, /*!< in: memory heap where copied */ - bool is_redo_rseg) /*!< in: true if redo rseg. */ + mem_heap_t* heap) /*!< in: memory heap where copied */ { trx_undo_rec_t* undo_rec; ulint rseg_id; @@ -2122,13 +2079,12 @@ trx_undo_get_undo_rec_low( trx_undo_decode_roll_ptr(roll_ptr, &is_insert, &rseg_id, &page_no, &offset); - rseg = trx_rseg_get_on_id(rseg_id, is_redo_rseg); + rseg = trx_rseg_get_on_id(rseg_id); mtr_start(&mtr); undo_page = trx_undo_page_get_s_latched( - page_id_t(rseg->space, page_no), rseg->page_size, - &mtr); + page_id_t(rseg->space, page_no), &mtr); undo_rec = trx_undo_rec_copy(undo_page + offset, heap); @@ -2144,7 +2100,6 @@ Copies an undo record to heap. the roll pointer: it points to an undo log of this transaction @param[in] heap memory heap where copied -@param[in] is_redo_rseg true if redo rseg. @param[in] name table name @param[out] undo_rec own: copy of the record @retval true if the undo log has been @@ -2158,7 +2113,6 @@ trx_undo_get_undo_rec( roll_ptr_t roll_ptr, trx_id_t trx_id, mem_heap_t* heap, - bool is_redo_rseg, const table_name_t& name, trx_undo_rec_t** undo_rec) { @@ -2168,8 +2122,7 @@ trx_undo_get_undo_rec( missing_history = purge_sys->view.changes_visible(trx_id, name); if (!missing_history) { - *undo_rec = trx_undo_get_undo_rec_low( - roll_ptr, heap, is_redo_rseg); + *undo_rec = trx_undo_get_undo_rec_low(roll_ptr, heap); } rw_lock_s_unlock(&purge_sys->latch); @@ -2252,17 +2205,11 @@ trx_undo_prev_version_build( rec_trx_id = row_get_rec_trx_id(rec, index, offsets); - /* REDO rollback segment are used only for non-temporary objects. - For temporary objects NON-REDO rollback segments are used. */ - bool is_redo_rseg = - dict_table_is_temporary(index->table) ? false : true; if (trx_undo_get_undo_rec( - roll_ptr, rec_trx_id, heap, is_redo_rseg, - index->table->name, &undo_rec)) { + roll_ptr, rec_trx_id, heap, index->table->name, &undo_rec)) { if (v_status & TRX_UNDO_PREV_IN_PURGE) { /* We are fetching the record being purged */ - undo_rec = trx_undo_get_undo_rec_low( - roll_ptr, heap, is_redo_rseg); + undo_rec = trx_undo_get_undo_rec_low(roll_ptr, heap); } else { /* The undo record may already have been purged, during purge or semi-consistent read. */ diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index dc779fefc5879..1a997330a9ede 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2016, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -28,10 +28,6 @@ Created 3/26/1996 Heikki Tuuri #include "trx0roll.h" -#ifdef UNIV_NONINL -#include "trx0roll.ic" -#endif - #include #include "fsp0fsp.h" @@ -217,8 +213,7 @@ trx_rollback_low( case TRX_STATE_PREPARED: ut_ad(!trx_is_autocommit_non_locking(trx)); - if (trx->rsegs.m_redo.rseg != NULL - && trx_is_redo_rseg_updated(trx)) { + if (trx_is_redo_rseg_updated(trx)) { /* Change the undo log state back from TRX_UNDO_PREPARED to TRX_UNDO_ACTIVE so that if the system gets killed, @@ -810,7 +805,7 @@ trx_rollback_or_clean_recovered( if (all) { ib::info() << "Starting in background the rollback" - " of uncommitted transactions"; + " of recovered transactions"; } /* Note: For XA recovered transactions, we rely on MySQL to @@ -830,6 +825,12 @@ trx_rollback_or_clean_recovered( assert_trx_in_rw_list(trx); + if (srv_shutdown_state != SRV_SHUTDOWN_NONE + && srv_fast_shutdown != 0) { + all = FALSE; + break; + } + /* If this function does a cleanup or rollback then it will release the trx_sys->mutex, therefore we need to reacquire it before retrying the loop. */ @@ -885,27 +886,38 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)( OS_THREAD_DUMMY_RETURN; } -/***********************************************************************//** -Tries truncate the undo logs. */ +/** Try to truncate the undo logs. +@param[in,out] trx transaction */ static void -trx_roll_try_truncate( -/*==================*/ - trx_t* trx, /*!< in/out: transaction */ - trx_undo_ptr_t* undo_ptr) /*!< in: rollback segment to look - for next undo log record. */ +trx_roll_try_truncate(trx_t* trx) { ut_ad(mutex_own(&trx->undo_mutex)); - ut_ad(mutex_own(&undo_ptr->rseg->mutex)); trx->pages_undone = 0; - if (undo_ptr->insert_undo) { - trx_undo_truncate_end(trx, undo_ptr->insert_undo, trx->undo_no); + undo_no_t undo_no = trx->undo_no; + trx_undo_t* insert_undo = trx->rsegs.m_redo.insert_undo; + trx_undo_t* update_undo = trx->rsegs.m_redo.update_undo; + + if (insert_undo || update_undo) { + mutex_enter(&trx->rsegs.m_redo.rseg->mutex); + if (insert_undo) { + ut_ad(insert_undo->rseg == trx->rsegs.m_redo.rseg); + trx_undo_truncate_end(insert_undo, undo_no, false); + } + if (update_undo) { + ut_ad(update_undo->rseg == trx->rsegs.m_redo.rseg); + trx_undo_truncate_end(update_undo, undo_no, false); + } + mutex_exit(&trx->rsegs.m_redo.rseg->mutex); } - if (undo_ptr->update_undo) { - trx_undo_truncate_end(trx, undo_ptr->update_undo, trx->undo_no); + if (trx_undo_t* undo = trx->rsegs.m_noredo.undo) { + ut_ad(undo->rseg == trx->rsegs.m_noredo.rseg); + mutex_enter(&undo->rseg->mutex); + trx_undo_truncate_end(undo, undo_no, true); + mutex_exit(&undo->rseg->mutex); } #ifdef WITH_WSREP_OUT @@ -930,8 +942,7 @@ trx_roll_pop_top_rec( ut_ad(mutex_own(&trx->undo_mutex)); page_t* undo_page = trx_undo_page_get_s_latched( - page_id_t(undo->space, undo->top_page_no), - undo->page_size, mtr); + page_id_t(undo->space, undo->top_page_no), mtr); ulint offset = undo->top_offset; @@ -958,75 +969,73 @@ trx_roll_pop_top_rec( return(undo_page + offset); } - -/********************************************************************//** -Pops the topmost record when the two undo logs of a transaction are seen -as a single stack of records ordered by their undo numbers. -@return undo log record copied to heap, NULL if none left, or if the -undo number of the top record would be less than the limit */ +/** Get the last undo log record of a transaction (for rollback). +@param[in,out] trx transaction +@param[out] roll_ptr DB_ROLL_PTR to the undo record +@param[in,out] heap memory heap for allocation +@return undo log record copied to heap +@retval NULL if none left or the roll_limit (savepoint) was reached */ trx_undo_rec_t* -trx_roll_pop_top_rec_of_trx_low( -/*============================*/ - trx_t* trx, /*!< in/out: transaction */ - trx_undo_ptr_t* undo_ptr, /*!< in: rollback segment to look - for next undo log record. */ - undo_no_t limit, /*!< in: least undo number we need */ - roll_ptr_t* roll_ptr, /*!< out: roll pointer to undo record */ - mem_heap_t* heap) /*!< in/out: memory heap where copied */ +trx_roll_pop_top_rec_of_trx(trx_t* trx, roll_ptr_t* roll_ptr, mem_heap_t* heap) { - trx_undo_t* undo; - trx_undo_t* ins_undo; - trx_undo_t* upd_undo; - trx_undo_rec_t* undo_rec; - trx_undo_rec_t* undo_rec_copy; - undo_no_t undo_no; - ibool is_insert; - trx_rseg_t* rseg; - mtr_t mtr; - - rseg = undo_ptr->rseg; - mutex_enter(&trx->undo_mutex); if (trx->pages_undone >= TRX_ROLL_TRUNC_THRESHOLD) { - mutex_enter(&rseg->mutex); - - trx_roll_try_truncate(trx, undo_ptr); - - mutex_exit(&rseg->mutex); + trx_roll_try_truncate(trx); } - ins_undo = undo_ptr->insert_undo; - upd_undo = undo_ptr->update_undo; - - if (!ins_undo || ins_undo->empty) { - undo = upd_undo; - } else if (!upd_undo || upd_undo->empty) { - undo = ins_undo; - } else if (upd_undo->top_undo_no > ins_undo->top_undo_no) { - undo = upd_undo; + trx_undo_t* undo; + trx_undo_t* insert = trx->rsegs.m_redo.insert_undo; + trx_undo_t* update = trx->rsegs.m_redo.update_undo; + trx_undo_t* temp = trx->rsegs.m_noredo.undo; + const undo_no_t limit = trx->roll_limit; + + ut_ad(!insert || !update || insert->empty || update->empty + || insert->top_undo_no != update->top_undo_no); + ut_ad(!insert || !temp || insert->empty || temp->empty + || insert->top_undo_no != temp->top_undo_no); + ut_ad(!update || !temp || update->empty || temp->empty + || update->top_undo_no != temp->top_undo_no); + + if (insert && !insert->empty && limit <= insert->top_undo_no) { + if (update && !update->empty + && update->top_undo_no > insert->top_undo_no) { + undo = update; + } else { + undo = insert; + } + } else if (update && !update->empty && limit <= update->top_undo_no) { + undo = update; + } else if (temp && !temp->empty && limit <= temp->top_undo_no) { + undo = temp; } else { - undo = ins_undo; - } - - if (!undo || undo->empty || limit > undo->top_undo_no) { - mutex_enter(&rseg->mutex); - trx_roll_try_truncate(trx, undo_ptr); - mutex_exit(&rseg->mutex); + trx_roll_try_truncate(trx); + /* Mark any ROLLBACK TO SAVEPOINT completed, so that + if the transaction object is committed and reused + later, we will default to a full ROLLBACK. */ + trx->roll_limit = 0; + ut_d(trx->in_rollback = false); mutex_exit(&trx->undo_mutex); return(NULL); } - is_insert = (undo == ins_undo); + ut_ad(!undo->empty); + ut_ad(limit <= undo->top_undo_no); *roll_ptr = trx_undo_build_roll_ptr( - is_insert, undo->rseg->id, undo->top_page_no, undo->top_offset); + false, undo->rseg->id, undo->top_page_no, undo->top_offset); - mtr_start(&mtr); + mtr_t mtr; + mtr.start(); - undo_rec = trx_roll_pop_top_rec(trx, undo, &mtr); - - undo_no = trx_undo_rec_get_undo_no(undo_rec); + trx_undo_rec_t* undo_rec = trx_roll_pop_top_rec(trx, undo, &mtr); + const undo_no_t undo_no = trx_undo_rec_get_undo_no(undo_rec); + if (trx_undo_rec_get_type(undo_rec) == TRX_UNDO_INSERT_REC) { + ut_ad(undo == insert || undo == temp); + *roll_ptr |= 1ULL << ROLL_PTR_INSERT_FLAG_POS; + } else { + ut_ad(undo == update || undo == temp); + } ut_ad(trx_roll_check_undo_rec_ordering( undo_no, undo->rseg->space, trx)); @@ -1054,43 +1063,14 @@ trx_roll_pop_top_rec_of_trx_low( trx->undo_no = undo_no; trx->undo_rseg_space = undo->rseg->space; - - undo_rec_copy = trx_undo_rec_copy(undo_rec, heap); - mutex_exit(&trx->undo_mutex); - mtr_commit(&mtr); + trx_undo_rec_t* undo_rec_copy = trx_undo_rec_copy(undo_rec, heap); + mtr.commit(); return(undo_rec_copy); } -/********************************************************************//** -Get next undo log record from redo and noredo rollback segments. -@return undo log record copied to heap, NULL if none left, or if the -undo number of the top record would be less than the limit */ -trx_undo_rec_t* -trx_roll_pop_top_rec_of_trx( -/*========================*/ - trx_t* trx, /*!< in: transaction */ - undo_no_t limit, /*!< in: least undo number we need */ - roll_ptr_t* roll_ptr, /*!< out: roll pointer to undo record */ - mem_heap_t* heap) /*!< in: memory heap where copied */ -{ - trx_undo_rec_t* undo_rec = 0; - - if (trx_is_redo_rseg_updated(trx)) { - undo_rec = trx_roll_pop_top_rec_of_trx_low( - trx, &trx->rsegs.m_redo, limit, roll_ptr, heap); - } - - if (undo_rec == 0 && trx_is_noredo_rseg_updated(trx)) { - undo_rec = trx_roll_pop_top_rec_of_trx_low( - trx, &trx->rsegs.m_noredo, limit, roll_ptr, heap); - } - - return(undo_rec); -} - /****************************************************************//** Builds an undo 'query' graph for a transaction. The actual rollback is performed by executing this query graph like a query subprocedure call. diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc index d5520b783b1ea..883e2eb60b2b5 100644 --- a/storage/innobase/trx/trx0rseg.cc +++ b/storage/innobase/trx/trx0rseg.cc @@ -1,6 +1,7 @@ /***************************************************************************** -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) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -24,11 +25,6 @@ Created 3/26/1996 Heikki Tuuri *******************************************************/ #include "trx0rseg.h" - -#ifdef UNIV_NONINL -#include "trx0rseg.ic" -#endif - #include "trx0undo.h" #include "fut0lst.h" #include "srv0srv.h" @@ -42,7 +38,6 @@ Created 3/26/1996 Heikki Tuuri This function is called only when a new rollback segment is created in the database. @param[in] space space id -@param[in] page_size page size @param[in] max_size max size in pages @param[in] rseg_slot_no rseg id == slot number in trx sys @param[in,out] mtr mini-transaction @@ -50,7 +45,6 @@ the database. ulint trx_rseg_header_create( ulint space, - const page_size_t& page_size, ulint max_size, ulint rseg_slot_no, mtr_t* mtr) @@ -79,7 +73,7 @@ trx_rseg_header_create( page_no = block->page.id.page_no(); /* Get the rollback segment file page */ - rsegf = trx_rsegf_get_new(space, page_no, page_size, mtr); + rsegf = trx_rsegf_get_new(space, page_no, mtr); /* Initialize max size field */ mlog_write_ulint(rsegf + TRX_RSEG_MAX_SIZE, max_size, @@ -116,14 +110,9 @@ trx_rseg_header_create( return(page_no); } -/***********************************************************************//** -Free's an instance of the rollback segment in memory. */ +/** Free a rollback segment in memory. */ void -trx_rseg_mem_free( -/*==============*/ - trx_rseg_t* rseg, /* in, own: instance to free */ - trx_rseg_t** rseg_array) /*!< out: add rseg reference to this - central array. */ +trx_rseg_mem_free(trx_rseg_t* rseg) { trx_undo_t* undo; trx_undo_t* next_undo; @@ -160,9 +149,6 @@ trx_rseg_mem_free( trx_undo_mem_free(undo); } - ut_a(*((trx_rseg_t**) rseg_array + rseg->id) == rseg); - *((trx_rseg_t**) rseg_array + rseg->id) = NULL; - ut_free(rseg); } @@ -173,20 +159,13 @@ array in the trx system object. @param[in] id rollback segment id @param[in] space space where the segment is placed @param[in] page_no page number of the segment header -@param[in] page_size page size -@param[in,out] purge_queue rseg queue -@param[out] rseg_array add rseg reference to this central array -@param[in,out] mtr mini-transaction -@return own: rollback segment object */ +@param[in,out] mtr mini-transaction */ static -trx_rseg_t* +void trx_rseg_mem_create( ulint id, ulint space, ulint page_no, - const page_size_t& page_size, - purge_pq_t* purge_queue, - trx_rseg_t** rseg_array, mtr_t* mtr) { ulint len; @@ -200,7 +179,6 @@ trx_rseg_mem_create( rseg->id = id; rseg->space = space; - rseg->page_size.copy_from(page_size); rseg->page_no = page_no; rseg->trx_ref_count = 0; rseg->skip_allocation = false; @@ -216,9 +194,9 @@ trx_rseg_mem_create( UT_LIST_INIT(rseg->insert_undo_list, &trx_undo_t::undo_list); UT_LIST_INIT(rseg->insert_undo_cached, &trx_undo_t::undo_list); - *((trx_rseg_t**) rseg_array + rseg->id) = rseg; + trx_sys->rseg_array[id] = rseg; - rseg_header = trx_rsegf_get_new(space, page_no, page_size, mtr); + rseg_header = trx_rsegf_get_new(space, page_no, mtr); rseg->max_size = mtr_read_ulint( rseg_header + TRX_RSEG_MAX_SIZE, MLOG_4BYTES, mtr); @@ -243,8 +221,8 @@ trx_rseg_mem_create( rseg->last_offset = node_addr.boffset; undo_log_hdr = trx_undo_page_get( - page_id_t(rseg->space, node_addr.page), - rseg->page_size, mtr) + node_addr.boffset; + page_id_t(rseg->space, node_addr.page), mtr) + + node_addr.boffset; rseg->last_trx_no = mach_read_from_8( undo_log_hdr + TRX_UNDO_TRX_NO); @@ -260,116 +238,33 @@ trx_rseg_mem_create( /* There is no need to cover this operation by the purge mutex because we are still bootstrapping. */ - purge_queue->push(elem); + purge_sys->purge_queue.push(elem); } } else { rseg->last_page_no = FIL_NULL; } - - return(rseg); -} - -/******************************************************************** -Check if rseg in given slot needs to be scheduled for purge. */ -static -void -trx_rseg_schedule_pending_purge( -/*============================*/ - trx_sysf_t* sys_header, /*!< in: trx system header */ - purge_pq_t* purge_queue, /*!< in/out: rseg queue */ - ulint slot, /*!< in: check rseg from given slot. */ - mtr_t* mtr) /*!< in: mtr */ -{ - ulint page_no; - ulint space; - - page_no = trx_sysf_rseg_get_page_no(sys_header, slot, mtr); - space = trx_sysf_rseg_get_space(sys_header, slot, mtr); - - if (page_no != FIL_NULL - && is_system_or_undo_tablespace(space)) { - - /* rseg resides in system or undo tablespace and so - this is an upgrade scenario. trx_rseg_mem_create - will add rseg to purge queue if needed. */ - - trx_rseg_t* rseg = NULL; - bool found = true; - const page_size_t& page_size - = is_system_tablespace(space) - ? univ_page_size - : fil_space_get_page_size(space, &found); - - ut_ad(found); - - trx_rseg_t** rseg_array = - ((trx_rseg_t**) trx_sys->pending_purge_rseg_array); - rseg = trx_rseg_mem_create( - slot, space, page_no, page_size, - purge_queue, rseg_array, mtr); - - ut_a(rseg->id == slot); - } } -/******************************************************************** -Creates the memory copies for the rollback segments and initializes the -rseg array in trx_sys at a database startup. */ -static +/** Initialize the rollback segments in memory at database startup. */ void -trx_rseg_create_instance( -/*=====================*/ - purge_pq_t* purge_queue) /*!< in/out: rseg queue */ +trx_rseg_array_init() { - ulint i; - - for (i = 0; i < TRX_SYS_N_RSEGS; i++) { - ulint page_no; + mtr_t mtr; - mtr_t mtr; + for (ulint i = 0; i < TRX_SYS_N_RSEGS; i++) { + ut_ad(!trx_rseg_get_on_id(i)); mtr.start(); - trx_sysf_t* sys_header = trx_sysf_get(&mtr); - - page_no = trx_sysf_rseg_get_page_no(sys_header, i, &mtr); - - /* Slot-1....Slot-n are reserved for non-redo rsegs. - Non-redo rsegs are recreated on server re-start so - avoid initializing the existing non-redo rsegs. */ - if (trx_sys_is_noredo_rseg_slot(i)) { - - /* If this is an upgrade scenario then existing rsegs - in range from slot-1....slot-n needs to be scheduled - for purge if there are pending purge operation. */ - trx_rseg_schedule_pending_purge( - sys_header, purge_queue, i, &mtr); - - } else if (page_no != FIL_NULL) { - ulint space; - trx_rseg_t* rseg = NULL; - - ut_a(!trx_rseg_get_on_id(i, true)); - - space = trx_sysf_rseg_get_space(sys_header, i, &mtr); - - bool found = true; - const page_size_t& page_size - = is_system_tablespace(space) - ? univ_page_size - : fil_space_get_page_size(space, &found); - - ut_ad(found); - - trx_rseg_t** rseg_array = - static_cast(trx_sys->rseg_array); - - rseg = trx_rseg_mem_create( - i, space, page_no, page_size, - purge_queue, rseg_array, &mtr); - - ut_a(rseg->id == i); - } else { - ut_a(trx_sys->rseg_array[i] == NULL); + trx_sysf_t* sys_header = trx_sysf_get(&mtr); + ulint page_no = trx_sysf_rseg_get_page_no( + sys_header, i, &mtr); + + if (page_no != FIL_NULL) { + trx_rseg_mem_create( + i, + trx_sysf_rseg_get_space(sys_header, i, &mtr), + page_no, &mtr); } + mtr.commit(); } } @@ -385,10 +280,8 @@ trx_rseg_create( 0 means next free slots. */ { mtr_t mtr; - ulint slot_no; - trx_rseg_t* rseg = NULL; - mtr_start(&mtr); + mtr.start(); /* To obey the latching order, acquire the file space x-latch before the trx_sys->mutex. */ @@ -399,59 +292,31 @@ trx_rseg_create( case FIL_TYPE_IMPORT: ut_ad(0); case FIL_TYPE_TEMPORARY: - mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO); + mtr.set_log_mode(MTR_LOG_NO_REDO); break; case FIL_TYPE_TABLESPACE: break; } - slot_no = trx_sysf_rseg_find_free( + ulint slot_no = trx_sysf_rseg_find_free( &mtr, space->purpose == FIL_TYPE_TEMPORARY, nth_free_slot); + ulint page_no = slot_no == ULINT_UNDEFINED + ? FIL_NULL + : trx_rseg_header_create(space_id, ULINT_MAX, slot_no, &mtr); - if (slot_no != ULINT_UNDEFINED) { - ulint id; - ulint page_no; - trx_sysf_t* sys_header; - page_size_t page_size(space->flags); + if (page_no != FIL_NULL) { + trx_sysf_t* sys_header = trx_sysf_get(&mtr); - page_no = trx_rseg_header_create( - space_id, page_size, ULINT_MAX, slot_no, &mtr); - - if (page_no == FIL_NULL) { - mtr_commit(&mtr); - - return(rseg); - } - - sys_header = trx_sysf_get(&mtr); - - id = trx_sysf_rseg_get_space(sys_header, slot_no, &mtr); + ulint id = trx_sysf_rseg_get_space( + sys_header, slot_no, &mtr); ut_a(id == space_id || trx_sys_is_noredo_rseg_slot(slot_no)); - trx_rseg_t** rseg_array = - ((trx_rseg_t**) trx_sys->rseg_array); - - rseg = trx_rseg_mem_create( - slot_no, space_id, page_no, page_size, - purge_sys->purge_queue, rseg_array, &mtr); + trx_rseg_mem_create(slot_no, space_id, page_no, &mtr); } - mtr_commit(&mtr); - - return(rseg); -} - -/*********************************************************************//** -Creates the memory copies for rollback segments and initializes the -rseg array in trx_sys at a database startup. */ -void -trx_rseg_array_init( -/*================*/ - purge_pq_t* purge_queue) /*!< in: rseg queue */ -{ - trx_sys->rseg_history_len = 0; + mtr.commit(); - trx_rseg_create_instance(purge_queue); + return(page_no == FIL_NULL ? NULL : trx_sys->rseg_array[slot_no]); } /******************************************************************** diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index 27321d73bd204..f08736ae1f128 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -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) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -29,9 +29,6 @@ Created 3/26/1996 Heikki Tuuri #include "mysqld.h" #include "trx0sys.h" #include "sql_error.h" -#ifdef UNIV_NONINL -#include "trx0sys.ic" -#endif #include "fsp0fsp.h" #include "mtr0log.h" @@ -60,7 +57,7 @@ struct file_format_t { }; /** The transaction system */ -trx_sys_t* trx_sys = NULL; +trx_sys_t* trx_sys; /** List of animal names representing file format. */ static const char* file_format_name_map[] = { @@ -140,37 +137,6 @@ updated via SET GLOBAL innodb_file_format_max = 'x' or when we open or create a table. */ static file_format_t file_format_max; -#ifdef UNIV_DEBUG -/****************************************************************//** -Checks whether a trx is in one of rw_trx_list -@return true if is in */ -bool -trx_in_rw_trx_list( -/*============*/ - const trx_t* in_trx) /*!< in: transaction */ -{ - const trx_t* trx; - - /* Non-locking autocommits should not hold any locks. */ - check_trx_state(in_trx); - - ut_ad(trx_sys_mutex_own()); - - ut_ad(trx_assert_started(in_trx)); - - for (trx = UT_LIST_GET_FIRST(trx_sys->rw_trx_list); - trx != NULL && trx != in_trx; - trx = UT_LIST_GET_NEXT(trx_list, trx)) { - - check_trx_state(trx); - - ut_ad(trx->rsegs.m_redo.rseg != NULL && !trx->read_only); - } - - return(trx != 0); -} -#endif /* UNIV_DEBUG */ - /*****************************************************************//** Writes the value of max_trx_id to the file based trx system header. */ void @@ -224,10 +190,6 @@ trx_sys_update_mysql_binlog_offset( return; } - if (sys_header == NULL) { - sys_header = trx_sysf_get(mtr); - } - if (mach_read_from_4(sys_header + field + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD) != TRX_SYS_MYSQL_LOG_MAGIC_N) { @@ -571,36 +533,21 @@ trx_sysf_create( /* Create the first rollback segment in the SYSTEM tablespace */ slot_no = trx_sysf_rseg_find_free(mtr, false, 0); - page_no = trx_rseg_header_create(TRX_SYS_SPACE, univ_page_size, + page_no = trx_rseg_header_create(TRX_SYS_SPACE, ULINT_MAX, slot_no, mtr); ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID); ut_a(page_no == FSP_FIRST_RSEG_PAGE_NO); } -/*****************************************************************//** -Creates and initializes the central memory structures for the transaction -system. This is called when the database is started. -@return min binary heap of rsegs to purge */ -purge_pq_t* -trx_sys_init_at_db_start(void) -/*==========================*/ +/** Initialize the transaction system main-memory data structures. */ +void +trx_sys_init_at_db_start() { - purge_pq_t* purge_queue; trx_sysf_t* sys_header; ib_uint64_t rows_to_undo = 0; const char* unit = ""; - /* We create the min binary heap here and pass ownership to - purge when we init the purge sub-system. Purge is responsible - for freeing the binary heap. */ - purge_queue = UT_NEW_NOKEY(purge_pq_t()); - ut_a(purge_queue != NULL); - - if (srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN) { - trx_rseg_array_init(purge_queue); - } - /* VERY important: after the database is started, max_trx_id value is divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the 'if' in trx_sys_get_new_trx_id will evaluate to TRUE when the function @@ -661,7 +608,7 @@ trx_sys_init_at_db_start(void) trx_sys_mutex_exit(); - return(purge_queue); + trx_sys->mvcc->clone_oldest_view(&purge_sys->view); } /*****************************************************************//** @@ -1108,28 +1055,10 @@ trx_sys_close(void) } /* There can't be any active transactions. */ - trx_rseg_t** rseg_array = static_cast( - trx_sys->rseg_array); for (ulint i = 0; i < TRX_SYS_N_RSEGS; ++i) { - trx_rseg_t* rseg; - - rseg = trx_sys->rseg_array[i]; - - if (rseg != NULL) { - trx_rseg_mem_free(rseg, rseg_array); - } - } - - rseg_array = ((trx_rseg_t**) trx_sys->pending_purge_rseg_array); - - for (ulint i = 0; i < TRX_SYS_N_RSEGS; ++i) { - trx_rseg_t* rseg; - - rseg = trx_sys->pending_purge_rseg_array[i]; - - if (rseg != NULL) { - trx_rseg_mem_free(rseg, rseg_array); + if (trx_rseg_t* rseg = trx_sys->rseg_array[i]) { + trx_rseg_mem_free(rseg); } } diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 609f7f8d39c9f..f7a488d7507a5 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -28,10 +28,6 @@ Created 3/26/1996 Heikki Tuuri #include "trx0trx.h" -#ifdef UNIV_NONINL -#include "trx0trx.ic" -#endif - #ifdef WITH_WSREP #include #endif @@ -177,10 +173,6 @@ trx_init( trx->internal = false; -#ifdef UNIV_DEBUG - trx->is_dd_trx = false; -#endif /* UNIV_DEBUG */ - ut_d(trx->start_file = 0); ut_d(trx->start_line = 0); @@ -510,7 +502,6 @@ trx_free(trx_t*& trx) trx->mod_tables.clear(); ut_ad(trx->read_view == NULL); - ut_ad(trx->is_dd_trx == false); /* trx locking state should have been reset before returning trx to pool */ @@ -750,8 +741,7 @@ trx_resurrect_table_locks( /* trx_rseg_mem_create() may have acquired an X-latch on this page, so we cannot acquire an S-latch. */ undo_page = trx_undo_page_get( - page_id_t(undo->space, undo->top_page_no), undo->page_size, - &mtr); + page_id_t(undo->space, undo->top_page_no), &mtr); undo_rec = undo_page + undo->top_offset; @@ -1007,21 +997,21 @@ trx_resurrect_update( } } -/****************************************************************//** -Creates trx objects for transactions and initializes the trx list of -trx_sys at database start. Rollback segment and undo log lists must -already exist when this function is called, because the lists of -transactions to be rolled back or cleaned up are built based on the -undo log lists. */ +/** Initialize (resurrect) transactions at startup. */ void -trx_lists_init_at_db_start(void) -/*============================*/ +trx_lists_init_at_db_start() { ut_a(srv_is_being_started); + ut_ad(!srv_was_started); + ut_ad(!purge_sys); + + purge_sys = UT_NEW_NOKEY(purge_sys_t()); + + if (srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN) { + trx_rseg_array_init(); + } /* Look from the rollback segments if there exist undo logs for - transactions. Upgrade demands clean shutdown and so there is - not need to look at pending_purge_rseg_array for rollbacking transactions. */ for (ulint i = 0; i < TRX_SYS_N_RSEGS; ++i) { @@ -1364,15 +1354,6 @@ trx_start_low( trx->read_only = true; } -#ifdef UNIV_DEBUG - /* If the transaction is DD attachable trx, it should be AC-NL-RO-RC - (AutoCommit-NonLocking-ReadOnly-ReadCommited) trx */ - if (trx->is_dd_trx) { - ut_ad(trx->read_only && trx->auto_commit - && trx->isolation_level == TRX_ISO_READ_COMMITTED); - } -#endif /* UNIV_DEBUG */ - #ifdef WITH_WSREP memset(trx->xid, 0, sizeof(xid_t)); trx->xid->formatID = -1; @@ -1488,65 +1469,29 @@ trx_start_low( MONITOR_INC(MONITOR_TRX_ACTIVE); } -/****************************************************************//** -Set the transaction serialisation number. -@return true if the transaction number was added to the serialisation_list. */ +/** Set the serialisation number for a persistent committed transaction. +@param[in,out] trx committed transaction with persistent changes +@param[in,out] rseg rollback segment for update_undo, or NULL */ static -bool -trx_serialisation_number_get( -/*=========================*/ - trx_t* trx, /*!< in/out: transaction */ - trx_undo_ptr_t* redo_rseg_undo_ptr, /*!< in/out: Set trx - serialisation number in - referred undo rseg. */ - trx_undo_ptr_t* noredo_rseg_undo_ptr) /*!< in/out: Set trx - serialisation number in - referred undo rseg. */ +void +trx_serialise(trx_t* trx, trx_rseg_t* rseg) { - bool added_trx_no; - trx_rseg_t* redo_rseg = 0; - trx_rseg_t* noredo_rseg = 0; - - if (redo_rseg_undo_ptr != NULL) { - ut_ad(mutex_own(&redo_rseg_undo_ptr->rseg->mutex)); - redo_rseg = redo_rseg_undo_ptr->rseg; - } - - if (noredo_rseg_undo_ptr != NULL) { - ut_ad(mutex_own(&noredo_rseg_undo_ptr->rseg->mutex)); - noredo_rseg = noredo_rseg_undo_ptr->rseg; - } + ut_ad(!rseg || rseg == trx->rsegs.m_redo.rseg); trx_sys_mutex_enter(); trx->no = trx_sys_get_new_trx_id(); /* Track the minimum serialisation number. */ - if (!trx->read_only) { - UT_LIST_ADD_LAST(trx_sys->serialisation_list, trx); - added_trx_no = true; - } else { - added_trx_no = false; - } + UT_LIST_ADD_LAST(trx_sys->serialisation_list, trx); /* If the rollack segment is not empty then the new trx_t::no can't be less than any trx_t::no already in the rollback segment. User threads only produce events when a rollback segment is empty. */ - if ((redo_rseg != NULL && redo_rseg->last_page_no == FIL_NULL) - || (noredo_rseg != NULL && noredo_rseg->last_page_no == FIL_NULL)) { - + if (rseg && rseg->last_page_no == FIL_NULL) { TrxUndoRsegs elem(trx->no); - - if (redo_rseg != NULL && redo_rseg->last_page_no == FIL_NULL) { - elem.push_back(redo_rseg); - } - - if (noredo_rseg != NULL - && noredo_rseg->last_page_no == FIL_NULL) { - - elem.push_back(noredo_rseg); - } + elem.push_back(rseg); mutex_enter(&purge_sys->pq_mutex); @@ -1557,28 +1502,25 @@ trx_serialisation_number_get( trx_sys_mutex_exit(); - purge_sys->purge_queue->push(elem); + purge_sys->purge_queue.push(elem); mutex_exit(&purge_sys->pq_mutex); } else { trx_sys_mutex_exit(); } - - return(added_trx_no); } /****************************************************************//** Assign the transaction its history serialisation number and write the update UNDO log record to the assigned rollback segment. @return true if a serialisation log was written */ +static bool trx_write_serialisation_history( /*============================*/ trx_t* trx, /*!< in/out: transaction */ mtr_t* mtr) /*!< in/out: mini-transaction */ { - trx_sysf_t* sys_header = NULL; - /* Change the undo log segment states from TRX_UNDO_ACTIVE to some other state: these modifications to the file data structure define the transaction as committed in the file based domain, at the @@ -1589,117 +1531,62 @@ trx_write_serialisation_history( UNDO trx number. This is required for the purge in-memory data structures too. */ - bool own_redo_rseg_mutex = false; - bool own_noredo_rseg_mutex = false; + if (trx_undo_t* undo = trx->rsegs.m_noredo.undo) { + /* Undo log for temporary tables is discarded at transaction + commit. There is no purge for temporary tables, and also no + MVCC, because they are private to a session. */ - /* Get rollback segment mutex. */ - if (trx->rsegs.m_redo.rseg != NULL && trx_is_redo_rseg_updated(trx)) { - - mutex_enter(&trx->rsegs.m_redo.rseg->mutex); - own_redo_rseg_mutex = true; - } - - mtr_t temp_mtr; - - if (trx->rsegs.m_noredo.rseg != NULL - && trx_is_noredo_rseg_updated(trx)) { - - mutex_enter(&trx->rsegs.m_noredo.rseg->mutex); - own_noredo_rseg_mutex = true; - mtr_start(&temp_mtr); + mtr_t temp_mtr; + temp_mtr.start(); temp_mtr.set_log_mode(MTR_LOG_NO_REDO); - } - /* If transaction involves insert then truncate undo logs. */ - if (trx->rsegs.m_redo.insert_undo != NULL) { - trx_undo_set_state_at_finish( - trx->rsegs.m_redo.insert_undo, mtr); + mutex_enter(&trx->rsegs.m_noredo.rseg->mutex); + trx_undo_set_state_at_finish(undo, &temp_mtr); + mutex_exit(&trx->rsegs.m_noredo.rseg->mutex); + temp_mtr.commit(); } - if (trx->rsegs.m_noredo.insert_undo != NULL) { - trx_undo_set_state_at_finish( - trx->rsegs.m_noredo.insert_undo, &temp_mtr); + if (!trx->rsegs.m_redo.rseg) { + ut_ad(!trx->rsegs.m_redo.insert_undo); + ut_ad(!trx->rsegs.m_redo.update_undo); + return false; } - bool serialised = false; - - /* If transaction involves update then add rollback segments - to purge queue. */ - if (trx->rsegs.m_redo.update_undo != NULL - || trx->rsegs.m_noredo.update_undo != NULL) { - - /* Assign the transaction serialisation number and add these - rollback segments to purge trx-no sorted priority queue - if this is the first UNDO log being written to assigned - rollback segments. */ + trx_undo_t* insert = trx->rsegs.m_redo.insert_undo; + trx_undo_t* update = trx->rsegs.m_redo.update_undo; - trx_undo_ptr_t* redo_rseg_undo_ptr = - trx->rsegs.m_redo.update_undo != NULL - ? &trx->rsegs.m_redo : NULL; - - trx_undo_ptr_t* noredo_rseg_undo_ptr = - trx->rsegs.m_noredo.update_undo != NULL - ? &trx->rsegs.m_noredo : NULL; - - /* Will set trx->no and will add rseg to purge queue. */ - serialised = trx_serialisation_number_get( - trx, redo_rseg_undo_ptr, noredo_rseg_undo_ptr); - - /* It is not necessary to obtain trx->undo_mutex here because - only a single OS thread is allowed to do the transaction commit - for this transaction. */ - if (trx->rsegs.m_redo.update_undo != NULL) { - - page_t* undo_hdr_page; - - undo_hdr_page = trx_undo_set_state_at_finish( - trx->rsegs.m_redo.update_undo, mtr); - - /* Delay update of rseg_history_len if we plan to add - non-redo update_undo too. This is to avoid immediate - invocation of purge as we need to club these 2 segments - with same trx-no as single unit. */ - bool update_rseg_len = - !(trx->rsegs.m_noredo.update_undo != NULL); - - trx_undo_update_cleanup( - trx, &trx->rsegs.m_redo, undo_hdr_page, - update_rseg_len, (update_rseg_len ? 1 : 0), - mtr); - } - - DBUG_EXECUTE_IF("ib_trx_crash_during_commit", DBUG_SUICIDE();); - - if (trx->rsegs.m_noredo.update_undo != NULL) { - page_t* undo_hdr_page; + if (!insert && !update) { + return false; + } - undo_hdr_page = trx_undo_set_state_at_finish( - trx->rsegs.m_noredo.update_undo, &temp_mtr); + ut_ad(!trx->read_only); + trx_rseg_t* update_rseg = update ? trx->rsegs.m_redo.rseg : NULL; + mutex_enter(&trx->rsegs.m_redo.rseg->mutex); - ulint n_added_logs = - (redo_rseg_undo_ptr != NULL) ? 2 : 1; + /* Assign the transaction serialisation number and add any + update_undo log to the purge queue. */ + trx_serialise(trx, update_rseg); - trx_undo_update_cleanup( - trx, &trx->rsegs.m_noredo, undo_hdr_page, - true, n_added_logs, &temp_mtr); - } + /* It is not necessary to acquire trx->undo_mutex here because + only a single OS thread is allowed to commit this transaction. */ + if (insert) { + trx_undo_set_state_at_finish(insert, mtr); } + if (update) { + /* The undo logs and possible delete-marked records + for updates and deletes will be purged later. */ + page_t* undo_hdr_page = trx_undo_set_state_at_finish( + update, mtr); - if (own_redo_rseg_mutex) { - mutex_exit(&trx->rsegs.m_redo.rseg->mutex); - own_redo_rseg_mutex = false; + trx_undo_update_cleanup(trx, undo_hdr_page, mtr); } - if (own_noredo_rseg_mutex) { - mutex_exit(&trx->rsegs.m_noredo.rseg->mutex); - own_noredo_rseg_mutex = false; - mtr_commit(&temp_mtr); - } + mutex_exit(&trx->rsegs.m_redo.rseg->mutex); MONITOR_INC(MONITOR_TRX_COMMIT_UNDO); + trx_sysf_t* sys_header = trx_sysf_get(mtr); #ifdef WITH_WSREP - sys_header = trx_sysf_get(mtr); /* Update latest MySQL wsrep XID in trx sys header. */ if (wsrep_is_wsrep_xid(trx->xid)) { trx_sys_update_wsrep_checkpoint(trx->xid, sys_header, mtr); @@ -1723,7 +1610,7 @@ trx_write_serialisation_history( trx->mysql_log_file_name = NULL; } - return(serialised); + return(true); } /******************************************************************** @@ -1806,11 +1693,7 @@ trx_flush_log_if_needed_low( lsn_t lsn) /*!< in: lsn up to which logs are to be flushed. */ { -#ifdef _WIN32 - bool flush = true; -#else - bool flush = srv_unix_file_flush_method != SRV_UNIX_NOSYNC; -#endif /* _WIN32 */ + bool flush = srv_file_flush_method != SRV_NOSYNC; switch (srv_flush_log_at_trx_commit) { case 3: @@ -2012,21 +1895,28 @@ trx_commit_in_memory( } } - if (trx->rsegs.m_redo.rseg != NULL) { - trx_rseg_t* rseg = trx->rsegs.m_redo.rseg; + ut_ad(!trx->rsegs.m_redo.update_undo); + + if (trx_rseg_t* rseg = trx->rsegs.m_redo.rseg) { mutex_enter(&rseg->mutex); ut_ad(rseg->trx_ref_count > 0); --rseg->trx_ref_count; mutex_exit(&rseg->mutex); - } - if (mtr != NULL) { - if (trx->rsegs.m_redo.insert_undo != NULL) { - trx_undo_insert_cleanup(&trx->rsegs.m_redo, false); + if (trx_undo_t*& insert = trx->rsegs.m_redo.insert_undo) { + ut_ad(insert->rseg == rseg); + trx_undo_commit_cleanup(insert, false); + insert = NULL; } + } + + ut_ad(!trx->rsegs.m_redo.insert_undo); - if (trx->rsegs.m_noredo.insert_undo != NULL) { - trx_undo_insert_cleanup(&trx->rsegs.m_noredo, true); + if (mtr != NULL) { + if (trx_undo_t*& undo = trx->rsegs.m_noredo.undo) { + ut_ad(undo->rseg == trx->rsegs.m_noredo.rseg); + trx_undo_commit_cleanup(undo, true); + undo = NULL; } /* NOTE that we could possibly make a group commit more @@ -2081,6 +1971,8 @@ trx_commit_in_memory( srv_active_wake_master_thread(); } + ut_ad(!trx->rsegs.m_noredo.undo); + /* Free all savepoints, starting from the first. */ trx_named_savept_t* savep = UT_LIST_GET_FIRST(trx->trx_savepoints); @@ -2249,13 +2141,13 @@ trx_cleanup_at_db_startup( trx_t* trx) /*!< in: transaction */ { ut_ad(trx->is_recovered); + ut_ad(!trx->rsegs.m_noredo.undo); + ut_ad(!trx->rsegs.m_redo.update_undo); - /* At db start-up there shouldn't be any active trx on temp-table - that needs insert_cleanup as temp-table are not visible on - restart and temporary rseg is re-created. */ - if (trx->rsegs.m_redo.insert_undo != NULL) { - - trx_undo_insert_cleanup(&trx->rsegs.m_redo, false); + if (trx_undo_t*& undo = trx->rsegs.m_redo.insert_undo) { + ut_ad(undo->rseg == trx->rsegs.m_redo.rseg); + trx_undo_commit_cleanup(undo, false); + undo = NULL; } memset(&trx->rsegs, 0x0, sizeof(trx->rsegs)); @@ -2772,66 +2664,67 @@ trx_weight_ge( return(TRX_WEIGHT(a) >= TRX_WEIGHT(b)); } -/****************************************************************//** -Prepares a transaction for given rollback segment. -@return lsn_t: lsn assigned for commit of scheduled rollback segment */ +/** Prepare a transaction. +@return log sequence number that makes the XA PREPARE durable +@retval 0 if no changes needed to be made durable */ static lsn_t -trx_prepare_low( -/*============*/ - trx_t* trx, /*!< in/out: transaction */ - trx_undo_ptr_t* undo_ptr, /*!< in/out: pointer to rollback - segment scheduled for prepare. */ - bool noredo_logging) /*!< in: turn-off redo logging. */ +trx_prepare_low(trx_t* trx) { - lsn_t lsn; + mtr_t mtr; - if (undo_ptr->insert_undo != NULL || undo_ptr->update_undo != NULL) { - mtr_t mtr; - trx_rseg_t* rseg = undo_ptr->rseg; + /* It is not necessary to acquire trx->undo_mutex here because + only the owning (connection) thread of the transaction is + allowed to perform XA PREPARE. */ - mtr_start_sync(&mtr); + if (trx_undo_t* undo = trx->rsegs.m_noredo.undo) { + ut_ad(undo->rseg == trx->rsegs.m_noredo.rseg); - if (noredo_logging) { - mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO); - } + mtr.start(); + mtr.set_log_mode(MTR_LOG_NO_REDO); - /* Change the undo log segment states from TRX_UNDO_ACTIVE to - TRX_UNDO_PREPARED: these modifications to the file data - structure define the transaction as prepared in the file-based - world, at the serialization point of lsn. */ + mutex_enter(&undo->rseg->mutex); + trx_undo_set_state_at_prepare(trx, undo, false, &mtr); + mutex_exit(&undo->rseg->mutex); - mutex_enter(&rseg->mutex); + mtr.commit(); + } - if (undo_ptr->insert_undo != NULL) { + trx_undo_t* insert = trx->rsegs.m_redo.insert_undo; + trx_undo_t* update = trx->rsegs.m_redo.update_undo; - /* It is not necessary to obtain trx->undo_mutex here - because only a single OS thread is allowed to do the - transaction prepare for this transaction. */ - trx_undo_set_state_at_prepare( - trx, undo_ptr->insert_undo, false, &mtr); - } + if (!insert && !update) { + /* There were no changes to persistent tables. */ + return(0); + } - if (undo_ptr->update_undo != NULL) { - trx_undo_set_state_at_prepare( - trx, undo_ptr->update_undo, false, &mtr); - } + trx_rseg_t* rseg = trx->rsegs.m_redo.rseg; - mutex_exit(&rseg->mutex); + mtr.start(true); - /*--------------*/ - /* This mtr commit makes the transaction prepared in - file-based world. */ - mtr_commit(&mtr); - /*--------------*/ + /* Change the undo log segment states from TRX_UNDO_ACTIVE to + TRX_UNDO_PREPARED: these modifications to the file data + structure define the transaction as prepared in the file-based + world, at the serialization point of lsn. */ - lsn = mtr.commit_lsn(); - ut_ad(noredo_logging || lsn > 0); - } else { - lsn = 0; + mutex_enter(&rseg->mutex); + + if (insert) { + ut_ad(insert->rseg == rseg); + trx_undo_set_state_at_prepare(trx, insert, false, &mtr); + } + + if (update) { + ut_ad(update->rseg == rseg); + trx_undo_set_state_at_prepare(trx, update, false, &mtr); } - return(lsn); + mutex_exit(&rseg->mutex); + + /* Make the XA PREPARE durable. */ + mtr.commit(); + ut_ad(mtr.commit_lsn() > 0); + return(mtr.commit_lsn()); } /****************************************************************//** @@ -2846,25 +2739,14 @@ trx_prepare( be rolled back asynchronously now. It must commit or rollback synhronously. */ - lsn_t lsn = 0; - /* Only fresh user transactions can be prepared. Recovered transactions cannot. */ ut_a(!trx->is_recovered); - if (trx->rsegs.m_redo.rseg != NULL && trx_is_redo_rseg_updated(trx)) { - - lsn = trx_prepare_low(trx, &trx->rsegs.m_redo, false); - } + lsn_t lsn = trx_prepare_low(trx); DBUG_EXECUTE_IF("ib_trx_crash_during_xa_prepare_step", DBUG_SUICIDE();); - if (trx->rsegs.m_noredo.rseg != NULL - && trx_is_noredo_rseg_updated(trx)) { - - trx_prepare_low(trx, &trx->rsegs.m_noredo, true); - } - /*--------------------------------------*/ ut_a(trx->state == TRX_STATE_ACTIVE); trx_sys_mutex_enter(); diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index 4bc40680c4b7f..d92f664191085 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -27,11 +27,6 @@ Created 3/26/1996 Heikki Tuuri #include "ha_prototypes.h" #include "trx0undo.h" - -#ifdef UNIV_NONINL -#include "trx0undo.ic" -#endif - #include "fsp0fsp.h" #include "mach0data.h" #include "mtr0log.h" @@ -178,14 +173,8 @@ trx_undo_get_prev_rec_from_prev_page( space = page_get_space_id(undo_page); - bool found; - const page_size_t& page_size = fil_space_get_page_size(space, - &found); - - ut_ad(found); - buf_block_t* block = buf_page_get( - page_id_t(space, prev_page_no), page_size, + page_id_t(space, prev_page_no), univ_page_size, shared ? RW_S_LATCH : RW_X_LATCH, mtr); buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); @@ -225,7 +214,6 @@ trx_undo_get_prev_rec( /** Gets the next record in an undo log from the next page. @param[in] space undo log header space -@param[in] page_size page size @param[in] undo_page undo log page @param[in] page_no undo log header page number @param[in] offset undo log header offset on page @@ -236,7 +224,6 @@ static trx_undo_rec_t* trx_undo_get_next_rec_from_next_page( ulint space, - const page_size_t& page_size, const page_t* undo_page, ulint page_no, ulint offset, @@ -271,10 +258,10 @@ trx_undo_get_next_rec_from_next_page( if (mode == RW_S_LATCH) { next_page = trx_undo_page_get_s_latched( - next_page_id, page_size, mtr); + next_page_id, mtr); } else { ut_ad(mode == RW_X_LATCH); - next_page = trx_undo_page_get(next_page_id, page_size, mtr); + next_page = trx_undo_page_get(next_page_id, mtr); } return(trx_undo_page_get_first_rec(next_page, page_no, offset)); @@ -302,13 +289,7 @@ trx_undo_get_next_rec( space = page_get_space_id(page_align(rec)); - bool found; - const page_size_t& page_size = fil_space_get_page_size(space, - &found); - - ut_ad(found); - - return(trx_undo_get_next_rec_from_next_page(space, page_size, + return(trx_undo_get_next_rec_from_next_page(space, page_align(rec), page_no, offset, RW_S_LATCH, mtr)); @@ -316,7 +297,6 @@ trx_undo_get_next_rec( /** Gets the first record in an undo log. @param[in] space undo log header space -@param[in] page_size page size @param[in] page_no undo log header page number @param[in] offset undo log header offset on page @param[in] mode latching mode: RW_S_LATCH or RW_X_LATCH @@ -325,7 +305,6 @@ trx_undo_get_next_rec( trx_undo_rec_t* trx_undo_get_first_rec( ulint space, - const page_size_t& page_size, ulint page_no, ulint offset, ulint mode, @@ -337,10 +316,9 @@ trx_undo_get_first_rec( const page_id_t page_id(space, page_no); if (mode == RW_S_LATCH) { - undo_page = trx_undo_page_get_s_latched( - page_id, page_size, mtr); + undo_page = trx_undo_page_get_s_latched(page_id, mtr); } else { - undo_page = trx_undo_page_get(page_id, page_size, mtr); + undo_page = trx_undo_page_get(page_id, mtr); } rec = trx_undo_page_get_first_rec(undo_page, page_no, offset); @@ -349,7 +327,7 @@ trx_undo_get_first_rec( return(rec); } - return(trx_undo_get_next_rec_from_next_page(space, page_size, + return(trx_undo_get_next_rec_from_next_page(space, undo_page, page_no, offset, mode, mtr)); } @@ -879,45 +857,37 @@ trx_undo_discard_latest_update_undo( trx_undo_discard_latest_log(undo_page, mtr); } -/********************************************************************//** -Tries to add a page to the undo log segment where the undo log is placed. -@return X-latched block if success, else NULL */ +/** Allocate an undo log page. +@param[in,out] trx transaction +@param[in,out] undo undo log +@param[in,out] mtr mini-transaction that does not hold any page latch +@return X-latched block if success +@retval NULL on failure */ buf_block_t* -trx_undo_add_page( -/*==============*/ - trx_t* trx, /*!< in: transaction */ - trx_undo_t* undo, /*!< in: undo log memory object */ - trx_undo_ptr_t* undo_ptr, /*!< in: assign undo log from - referred rollback segment. */ - mtr_t* mtr) /*!< in: mtr which does not have - a latch to any undo log page; - the caller must have reserved - the rollback segment mutex */ +trx_undo_add_page(trx_t* trx, trx_undo_t* undo, mtr_t* mtr) { - page_t* header_page; - buf_block_t* new_block; - page_t* new_page; - trx_rseg_t* rseg; - ulint n_reserved; + ut_ad(mutex_own(&trx->undo_mutex)); - ut_ad(mutex_own(&(trx->undo_mutex))); - ut_ad(mutex_own(&(undo_ptr->rseg->mutex))); + trx_rseg_t* rseg = undo->rseg; + buf_block_t* new_block = NULL; + ulint n_reserved; + page_t* header_page; - rseg = undo_ptr->rseg; + /* When we add a page to an undo log, this is analogous to + a pessimistic insert in a B-tree, and we must reserve the + counterpart of the tree latch, which is the rseg mutex. */ + mutex_enter(&rseg->mutex); if (rseg->curr_size == rseg->max_size) { - - return(NULL); + goto func_exit; } header_page = trx_undo_page_get( - page_id_t(undo->space, undo->hdr_page_no), - undo->page_size, mtr); + page_id_t(undo->space, undo->hdr_page_no), mtr); if (!fsp_reserve_free_extents(&n_reserved, undo->space, 1, FSP_UNDO, mtr)) { - - return(NULL); + goto func_exit; } new_block = fseg_alloc_free_page_general( @@ -927,26 +897,26 @@ trx_undo_add_page( fil_space_release_free_extents(undo->space, n_reserved); - if (new_block == NULL) { - - /* No space left */ - - return(NULL); + if (!new_block) { + goto func_exit; } ut_ad(rw_lock_get_x_lock_count(&new_block->lock) == 1); buf_block_dbg_add_level(new_block, SYNC_TRX_UNDO_PAGE); undo->last_page_no = new_block->page.id.page_no(); - new_page = buf_block_get_frame(new_block); - - trx_undo_page_init(new_page, undo->type, mtr); + trx_undo_page_init(new_block->frame, undo->type, mtr); - flst_add_last(header_page + TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST, - new_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, mtr); + flst_add_last(TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST + + header_page, + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE + + new_block->frame, + mtr); undo->size++; rseg->curr_size++; +func_exit: + mutex_exit(&rseg->mutex); return(new_block); } @@ -977,11 +947,9 @@ trx_undo_free_page( ut_a(hdr_page_no != page_no); ut_ad(mutex_own(&(rseg->mutex))); - undo_page = trx_undo_page_get( - page_id_t(space, page_no), rseg->page_size, mtr); + undo_page = trx_undo_page_get(page_id_t(space, page_no), mtr); - header_page = trx_undo_page_get( - page_id_t(space, hdr_page_no), rseg->page_size, mtr); + header_page = trx_undo_page_get(page_id_t(space, hdr_page_no), mtr); flst_remove(header_page + TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST, undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, mtr); @@ -994,8 +962,7 @@ trx_undo_free_page( rseg->curr_size--; if (in_history) { - rseg_header = trx_rsegf_get(space, rseg->page_no, - rseg->page_size, mtr); + rseg_header = trx_rsegf_get(space, rseg->page_no, mtr); hist_size = mtr_read_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE, MLOG_4BYTES, mtr); @@ -1007,21 +974,13 @@ trx_undo_free_page( return(last_addr.page); } -/********************************************************************//** -Frees the last undo log page. -The caller must hold the rollback segment mutex. */ +/** Free the last undo log page. The caller must hold the rseg mutex. +@param[in,out] undo undo log +@param[in,out] mtr mini-transaction that does not hold any undo log page + or that has allocated the undo log page */ void -trx_undo_free_last_page_func( -/*==========================*/ -#ifdef UNIV_DEBUG - const trx_t* trx, /*!< in: transaction */ -#endif /* UNIV_DEBUG */ - trx_undo_t* undo, /*!< in/out: undo log memory copy */ - mtr_t* mtr) /*!< in/out: mini-transaction which does not - have a latch to any undo log page or which - has allocated the undo log page */ +trx_undo_free_last_page(trx_undo_t* undo, mtr_t* mtr) { - ut_ad(mutex_own(&trx->undo_mutex)); ut_ad(undo->hdr_page_no != undo->last_page_no); ut_ad(undo->size > 0); @@ -1036,7 +995,6 @@ trx_undo_free_last_page_func( Other undo logs may still have records on that page, if it is an update undo log. @param[in] space space -@param[in] page_size page size @param[in] hdr_page_no header page number @param[in] hdr_offset header offset @param[in,out] mtr mini-transaction */ @@ -1044,7 +1002,6 @@ static void trx_undo_empty_header_page( ulint space, - const page_size_t& page_size, ulint hdr_page_no, ulint hdr_offset, mtr_t* mtr) @@ -1053,8 +1010,7 @@ trx_undo_empty_header_page( trx_ulogf_t* log_hdr; ulint end; - header_page = trx_undo_page_get( - page_id_t(space, hdr_page_no), page_size, mtr); + header_page = trx_undo_page_get(page_id_t(space, hdr_page_no), mtr); log_hdr = header_page + hdr_offset; @@ -1063,47 +1019,28 @@ trx_undo_empty_header_page( mlog_write_ulint(log_hdr + TRX_UNDO_LOG_START, end, MLOG_2BYTES, mtr); } -/***********************************************************************//** -Truncates an undo log from the end. This function is used during a rollback -to free space from an undo log. */ +/** Truncate the tail of an undo log during rollback. +@param[in,out] undo undo log +@param[in] limit all undo logs after this limit will be discarded +@param[in] is_temp whether this is temporary undo log */ void -trx_undo_truncate_end_func( -/*=======================*/ - trx_t* trx, /*!< in: transaction whose undo log it is */ - trx_undo_t* undo, /*!< in: undo log */ - undo_no_t limit) /*!< in: all undo records with undo number - >= this value should be truncated */ +trx_undo_truncate_end(trx_undo_t* undo, undo_no_t limit, bool is_temp) { - page_t* undo_page; - ulint last_page_no; - trx_undo_rec_t* rec; - trx_undo_rec_t* trunc_here; - mtr_t mtr; - const bool noredo = trx_sys_is_noredo_rseg_slot(undo->rseg->id); - - ut_ad(mutex_own(&(trx->undo_mutex))); - ut_ad(mutex_own(&undo->rseg->mutex)); + ut_ad(is_temp == trx_sys_is_noredo_rseg_slot(undo->rseg->id)); for (;;) { - mtr_start_trx(&mtr, trx); - if (noredo) { + mtr_t mtr; + mtr.start(); + if (is_temp) { mtr.set_log_mode(MTR_LOG_NO_REDO); - ut_ad(trx->rsegs.m_noredo.rseg == undo->rseg); - } else { - ut_ad(trx->rsegs.m_redo.rseg == undo->rseg); } - trunc_here = NULL; - - last_page_no = undo->last_page_no; - - undo_page = trx_undo_page_get( - page_id_t(undo->space, last_page_no), - undo->page_size, &mtr); - - rec = trx_undo_page_get_last_rec(undo_page, undo->hdr_page_no, - undo->hdr_offset); + trx_undo_rec_t* trunc_here = NULL; + page_t* undo_page = trx_undo_page_get( + page_id_t(undo->space, undo->last_page_no), &mtr); + trx_undo_rec_t* rec = trx_undo_page_get_last_rec( + undo_page, undo->hdr_page_no, undo->hdr_offset); while (rec) { if (trx_undo_rec_get_undo_no(rec) >= limit) { /* Truncate at least this record off, maybe @@ -1118,25 +1055,22 @@ trx_undo_truncate_end_func( undo->hdr_offset); } - if (last_page_no == undo->hdr_page_no) { + if (undo->last_page_no == undo->hdr_page_no) { +function_exit: + if (trunc_here) { + mlog_write_ulint(undo_page + TRX_UNDO_PAGE_HDR + + TRX_UNDO_PAGE_FREE, + trunc_here - undo_page, + MLOG_2BYTES, &mtr); + } - goto function_exit; + mtr.commit(); + return; } - ut_ad(last_page_no == undo->last_page_no); - trx_undo_free_last_page(trx, undo, &mtr); - - mtr_commit(&mtr); - } - -function_exit: - if (trunc_here) { - mlog_write_ulint(undo_page + TRX_UNDO_PAGE_HDR - + TRX_UNDO_PAGE_FREE, - trunc_here - undo_page, MLOG_2BYTES, &mtr); + trx_undo_free_last_page(undo, &mtr); + mtr.commit(); } - - mtr_commit(&mtr); } /** Truncate the head of an undo log. @@ -1172,8 +1106,7 @@ trx_undo_truncate_start( mtr.set_log_mode(MTR_LOG_NO_REDO); } - rec = trx_undo_get_first_rec(rseg->space, rseg->page_size, - hdr_page_no, hdr_offset, + rec = trx_undo_get_first_rec(rseg->space, hdr_page_no, hdr_offset, RW_X_LATCH, &mtr); if (rec == NULL) { /* Already empty */ @@ -1197,7 +1130,7 @@ trx_undo_truncate_start( page_no = page_get_page_no(undo_page); if (page_no == hdr_page_no) { - trx_undo_empty_header_page(rseg->space, rseg->page_size, + trx_undo_empty_header_page(rseg->space, hdr_page_no, hdr_offset, &mtr); } else { @@ -1240,7 +1173,7 @@ trx_undo_seg_free( seg_header = trx_undo_page_get(page_id_t(undo->space, undo->hdr_page_no), - undo->page_size, &mtr) + &mtr) + TRX_UNDO_SEG_HDR; file_seg = seg_header + TRX_UNDO_FSEG_HEADER; @@ -1250,8 +1183,7 @@ trx_undo_seg_free( if (finished) { /* Update the rseg header */ rseg_header = trx_rsegf_get( - rseg->space, rseg->page_no, rseg->page_size, - &mtr); + rseg->space, rseg->page_no, &mtr); trx_rsegf_set_nth_undo(rseg_header, undo->id, FIL_NULL, &mtr); @@ -1296,8 +1228,7 @@ trx_undo_mem_create_at_db_start( ut_a(id < TRX_RSEG_N_SLOTS); - undo_page = trx_undo_page_get( - page_id_t(rseg->space, page_no), rseg->page_size, mtr); + undo_page = trx_undo_page_get(page_id_t(rseg->space, page_no), mtr); page_header = undo_page + TRX_UNDO_PAGE_HDR; @@ -1349,8 +1280,7 @@ trx_undo_mem_create_at_db_start( undo->top_page_no = last_addr.page; last_page = trx_undo_page_get( - page_id_t(rseg->space, undo->last_page_no), - rseg->page_size, mtr); + page_id_t(rseg->space, undo->last_page_no), mtr); rec = trx_undo_page_get_last_rec(last_page, page_no, offset); @@ -1405,8 +1335,7 @@ trx_undo_lists_init( mtr_start(&mtr); - rseg_header = trx_rsegf_get_new( - rseg->space, rseg->page_no, rseg->page_size, &mtr); + rseg_header = trx_rsegf_get_new(rseg->space, rseg->page_no, &mtr); for (i = 0; i < TRX_RSEG_N_SLOTS; i++) { ulint page_no; @@ -1433,8 +1362,7 @@ trx_undo_lists_init( mtr_start(&mtr); rseg_header = trx_rsegf_get( - rseg->space, rseg->page_no, rseg->page_size, - &mtr); + rseg->space, rseg->page_no, &mtr); /* Found a used slot */ MONITOR_INC(MONITOR_NUM_UNDO_SLOT_USED); @@ -1488,7 +1416,6 @@ trx_undo_mem_create( undo->rseg = rseg; undo->space = rseg->space; - undo->page_size.copy_from(rseg->page_size); undo->hdr_page_no = page_no; undo->hdr_offset = offset; undo->last_page_no = page_no; @@ -1577,8 +1504,7 @@ trx_undo_create( rseg->curr_size++; - rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, - rseg->page_size, mtr); + rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, mtr); err = trx_undo_seg_create(rseg, rseg_header, type, &id, &undo_page, mtr); @@ -1660,8 +1586,7 @@ trx_undo_reuse_cached( ut_a(undo->id < TRX_RSEG_N_SLOTS); undo_page = trx_undo_page_get( - page_id_t(undo->space, undo->hdr_page_no), - undo->page_size, mtr); + page_id_t(undo->space, undo->hdr_page_no), mtr); if (type == TRX_UNDO_INSERT) { offset = trx_undo_insert_header_reuse(undo_page, trx_id, mtr); @@ -1698,8 +1623,7 @@ trx_undo_mark_as_dict_operation( page_t* hdr_page; hdr_page = trx_undo_page_get( - page_id_t(undo->space, undo->hdr_page_no), - undo->page_size, mtr); + page_id_t(undo->space, undo->hdr_page_no), mtr); switch (trx_get_dict_operation(trx)) { case TRX_DICT_OP_NONE: @@ -1723,90 +1647,70 @@ trx_undo_mark_as_dict_operation( undo->dict_operation = TRUE; } -/**********************************************************************//** -Assigns an undo log for a transaction. A new undo log is created or a cached -undo log reused. -@return DB_SUCCESS if undo log assign successful, possible error codes -are: DB_TOO_MANY_CONCURRENT_TRXS DB_OUT_OF_FILE_SPACE DB_READ_ONLY -DB_OUT_OF_MEMORY */ +/** Assign an undo log for a transaction. +A new undo log is created or a cached undo log reused. +@param[in,out] trx transaction +@param[in] rseg rollback segment +@param[out] undo the undo log +@param[in] type TRX_UNDO_INSERT or TRX_UNDO_UPDATE +@retval DB_SUCCESS on success +@retval DB_TOO_MANY_CONCURRENT_TRXS +@retval DB_OUT_OF_FILE_SPACE +@retval DB_READ_ONLY +@retval DB_OUT_OF_MEMORY */ dberr_t trx_undo_assign_undo( -/*=================*/ - trx_t* trx, /*!< in: transaction */ - trx_undo_ptr_t* undo_ptr, /*!< in: assign undo log from - referred rollback segment. */ - ulint type) /*!< in: TRX_UNDO_INSERT or - TRX_UNDO_UPDATE */ + trx_t* trx, + trx_rseg_t* rseg, + trx_undo_t** undo, + ulint type) { - trx_rseg_t* rseg; - trx_undo_t* undo; + const bool is_temp = rseg == trx->rsegs.m_noredo.rseg; mtr_t mtr; dberr_t err = DB_SUCCESS; - ut_ad(trx); - - /* In case of read-only scenario trx->rsegs.m_redo.rseg can be NULL but - still request for assigning undo logs is valid as temporary tables - can be updated in read-only mode. - If there is no rollback segment assigned to trx and still there is - object being updated there is something wrong and so this condition - check. */ - ut_ad(trx_is_rseg_assigned(trx)); - - rseg = undo_ptr->rseg; + ut_ad(mutex_own(&trx->undo_mutex)); + ut_ad(rseg == trx->rsegs.m_redo.rseg + || rseg == trx->rsegs.m_noredo.rseg); + ut_ad(type == TRX_UNDO_INSERT || type == TRX_UNDO_UPDATE); - ut_ad(mutex_own(&(trx->undo_mutex))); + mtr.start(trx); - mtr_start_trx(&mtr, trx); - if (&trx->rsegs.m_noredo == undo_ptr) { - mtr.set_log_mode(MTR_LOG_NO_REDO);; - } else { - ut_ad(&trx->rsegs.m_redo == undo_ptr); - } - - if (trx_sys_is_noredo_rseg_slot(rseg->id)) { - mtr.set_log_mode(MTR_LOG_NO_REDO);; - ut_ad(undo_ptr == &trx->rsegs.m_noredo); + if (is_temp) { + mtr.set_log_mode(MTR_LOG_NO_REDO); + ut_ad(undo == &trx->rsegs.m_noredo.undo); } else { - ut_ad(undo_ptr == &trx->rsegs.m_redo); + ut_ad(undo == (type == TRX_UNDO_INSERT + ? &trx->rsegs.m_redo.insert_undo + : &trx->rsegs.m_redo.update_undo)); } mutex_enter(&rseg->mutex); - DBUG_EXECUTE_IF( - "ib_create_table_fail_too_many_trx", - err = DB_TOO_MANY_CONCURRENT_TRXS; - goto func_exit; - ); - - undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, trx->xid, + *undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, trx->xid, &mtr); - if (undo == NULL) { + if (*undo == NULL) { err = trx_undo_create(trx, rseg, type, trx->id, trx->xid, - &undo, &mtr); + undo, &mtr); if (err != DB_SUCCESS) { - goto func_exit; } } - if (type == TRX_UNDO_INSERT) { - UT_LIST_ADD_FIRST(rseg->insert_undo_list, undo); - ut_ad(undo_ptr->insert_undo == NULL); - undo_ptr->insert_undo = undo; + if (is_temp) { + UT_LIST_ADD_FIRST(rseg->insert_undo_list, *undo); } else { - UT_LIST_ADD_FIRST(rseg->update_undo_list, undo); - ut_ad(undo_ptr->update_undo == NULL); - undo_ptr->update_undo = undo; - } - - if (trx_get_dict_operation(trx) != TRX_DICT_OP_NONE) { - trx_undo_mark_as_dict_operation(trx, undo, &mtr); + UT_LIST_ADD_FIRST(type == TRX_UNDO_INSERT + ? rseg->insert_undo_list + : rseg->update_undo_list, *undo); + if (trx_get_dict_operation(trx) != TRX_DICT_OP_NONE) { + trx_undo_mark_as_dict_operation(trx, *undo, &mtr); + } } func_exit: - mutex_exit(&(rseg->mutex)); - mtr_commit(&mtr); + mutex_exit(&rseg->mutex); + mtr.commit(); return(err); } @@ -1828,8 +1732,7 @@ trx_undo_set_state_at_finish( ut_a(undo->id < TRX_RSEG_N_SLOTS); undo_page = trx_undo_page_get( - page_id_t(undo->space, undo->hdr_page_no), - undo->page_size, mtr); + page_id_t(undo->space, undo->hdr_page_no), mtr); seg_hdr = undo_page + TRX_UNDO_SEG_HDR; page_hdr = undo_page + TRX_UNDO_PAGE_HDR; @@ -1877,8 +1780,7 @@ trx_undo_set_state_at_prepare( ut_a(undo->id < TRX_RSEG_N_SLOTS); undo_page = trx_undo_page_get( - page_id_t(undo->space, undo->hdr_page_no), - undo->page_size, mtr); + page_id_t(undo->space, undo->hdr_page_no), mtr); seg_hdr = undo_page + TRX_UNDO_SEG_HDR; @@ -1918,30 +1820,20 @@ trx_undo_update_cleanup( /*====================*/ trx_t* trx, /*!< in: trx owning the update undo log */ - trx_undo_ptr_t* undo_ptr, /*!< in: update undo log. */ page_t* undo_page, /*!< in: update undo log header page, x-latched */ - bool update_rseg_history_len, - /*!< in: if true: update rseg history - len else skip updating it. */ - ulint n_added_logs, /*!< in: number of logs added */ mtr_t* mtr) /*!< in: mtr */ { - trx_rseg_t* rseg; - trx_undo_t* undo; - - undo = undo_ptr->update_undo; - rseg = undo_ptr->rseg; + trx_undo_t* undo = trx->rsegs.m_redo.update_undo; + trx_rseg_t* rseg = undo->rseg; - ut_ad(mutex_own(&(rseg->mutex))); + ut_ad(mutex_own(&rseg->mutex)); - trx_purge_add_update_undo_to_history( - trx, undo_ptr, undo_page, - update_rseg_history_len, n_added_logs, mtr); + trx_purge_add_update_undo_to_history(trx, undo_page, mtr); UT_LIST_REMOVE(rseg->update_undo_list, undo); - undo_ptr->update_undo = NULL; + trx->rsegs.m_redo.update_undo = NULL; if (undo->state == TRX_UNDO_CACHED) { @@ -1955,55 +1847,39 @@ trx_undo_update_cleanup( } } -/** Frees an insert undo log after a transaction commit or rollback. -Knowledge of inserts is not needed after a commit or rollback, therefore +/** Free an insert or temporary undo log after commit or rollback. +The information is not needed after a commit or rollback, therefore the data can be discarded. -@param[in,out] undo_ptr undo log to clean up -@param[in] noredo whether the undo tablespace is redo logged */ +@param[in,out] undo undo log +@param[in] is_temp whether this is temporary undo log */ void -trx_undo_insert_cleanup( - trx_undo_ptr_t* undo_ptr, - bool noredo) +trx_undo_commit_cleanup(trx_undo_t* undo, bool is_temp) { - trx_undo_t* undo; - trx_rseg_t* rseg; - - undo = undo_ptr->insert_undo; - ut_ad(undo != NULL); - - rseg = undo_ptr->rseg; + trx_rseg_t* rseg = undo->rseg; + ut_ad(is_temp == trx_sys_is_noredo_rseg_slot(rseg->id)); - ut_ad(noredo == trx_sys_is_noredo_rseg_slot(rseg->id)); - - mutex_enter(&(rseg->mutex)); + mutex_enter(&rseg->mutex); UT_LIST_REMOVE(rseg->insert_undo_list, undo); - undo_ptr->insert_undo = NULL; if (undo->state == TRX_UNDO_CACHED) { - UT_LIST_ADD_FIRST(rseg->insert_undo_cached, undo); - MONITOR_INC(MONITOR_NUM_UNDO_SLOT_CACHED); } else { ut_ad(undo->state == TRX_UNDO_TO_FREE); /* Delete first the undo log segment in the file */ - - mutex_exit(&(rseg->mutex)); - - trx_undo_seg_free(undo, noredo); - - mutex_enter(&(rseg->mutex)); + mutex_exit(&rseg->mutex); + trx_undo_seg_free(undo, is_temp); + mutex_enter(&rseg->mutex); ut_ad(rseg->curr_size > undo->size); - rseg->curr_size -= undo->size; trx_undo_mem_free(undo); } - mutex_exit(&(rseg->mutex)); + mutex_exit(&rseg->mutex); } /********************************************************************//** @@ -2059,27 +1935,13 @@ trx_undo_free_prepared( trx->rsegs.m_redo.insert_undo = NULL; } - if (trx->rsegs.m_noredo.update_undo) { - - ut_a(trx->rsegs.m_noredo.update_undo->state - == TRX_UNDO_PREPARED); - - UT_LIST_REMOVE(trx->rsegs.m_noredo.rseg->update_undo_list, - trx->rsegs.m_noredo.update_undo); - trx_undo_mem_free(trx->rsegs.m_noredo.update_undo); - - trx->rsegs.m_noredo.update_undo = NULL; - } - if (trx->rsegs.m_noredo.insert_undo) { - - ut_a(trx->rsegs.m_noredo.insert_undo->state - == TRX_UNDO_PREPARED); + if (trx_undo_t*& undo = trx->rsegs.m_noredo.undo) { + ut_a(undo->state == TRX_UNDO_PREPARED); UT_LIST_REMOVE(trx->rsegs.m_noredo.rseg->insert_undo_list, - trx->rsegs.m_noredo.insert_undo); - trx_undo_mem_free(trx->rsegs.m_noredo.insert_undo); - - trx->rsegs.m_noredo.insert_undo = NULL; + undo); + trx_undo_mem_free(undo); + undo = NULL; } } @@ -2123,10 +1985,9 @@ trx_undo_truncate_tablespace( trx_rseg_t* rseg = undo_trunc->get_ith_rseg(i); rseg->page_no = trx_rseg_header_create( - space_id, univ_page_size, ULINT_MAX, rseg->id, &mtr); + space_id, ULINT_MAX, rseg->id, &mtr); - rseg_header = trx_rsegf_get_new( - space_id, rseg->page_no, rseg->page_size, &mtr); + rseg_header = trx_rsegf_get_new(space_id, rseg->page_no, &mtr); /* Before re-initialization ensure that we free the existing structure. There can't be any active transactions. */ diff --git a/storage/innobase/usr/usr0sess.cc b/storage/innobase/usr/usr0sess.cc index 0cb2ea0db15d6..85eca604d80f0 100644 --- a/storage/innobase/usr/usr0sess.cc +++ b/storage/innobase/usr/usr0sess.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 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 @@ -24,11 +24,6 @@ Created 6/25/1996 Heikki Tuuri *******************************************************/ #include "usr0sess.h" - -#ifdef UNIV_NONINL -#include "usr0sess.ic" -#endif - #include "trx0trx.h" /*********************************************************************//** diff --git a/storage/innobase/ut/ut0byte.cc b/storage/innobase/ut/ut0byte.cc deleted file mode 100644 index bc592edc6bfab..0000000000000 --- a/storage/innobase/ut/ut0byte.cc +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1994, 2009, 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 ut/ut0byte.cc -Byte utilities - -Created 5/11/1994 Heikki Tuuri -********************************************************************/ - -#include "ut0byte.h" - -#ifdef UNIV_NONINL -#include "ut0byte.ic" -#endif diff --git a/storage/innobase/ut/ut0list.cc b/storage/innobase/ut/ut0list.cc index f62cbf8232b03..2e7ac64f773d4 100644 --- a/storage/innobase/ut/ut0list.cc +++ b/storage/innobase/ut/ut0list.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 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 @@ -24,9 +24,6 @@ Created 4/26/2006 Osku Salerma ************************************************************************/ #include "ut0list.h" -#ifdef UNIV_NONINL -#include "ut0list.ic" -#endif /****************************************************************//** Create a new list. @@ -35,35 +32,7 @@ ib_list_t* ib_list_create(void) /*=================*/ { - ib_list_t* list; - - list = static_cast(ut_malloc_nokey(sizeof(*list))); - - list->first = NULL; - list->last = NULL; - list->is_heap_list = FALSE; - - return(list); -} - -/****************************************************************//** -Create a new list using the given heap. ib_list_free MUST NOT BE CALLED for -lists created with this function. -@return list */ -ib_list_t* -ib_list_create_heap( -/*================*/ - mem_heap_t* heap) /*!< in: memory heap to use */ -{ - ib_list_t* list; - - list = static_cast(mem_heap_alloc(heap, sizeof(*list))); - - list->first = NULL; - list->last = NULL; - list->is_heap_list = TRUE; - - return(list); + return(static_cast(ut_zalloc_nokey(sizeof(ib_list_t)))); } /****************************************************************//** @@ -73,8 +42,6 @@ ib_list_free( /*=========*/ ib_list_t* list) /*!< in: list */ { - ut_a(!list->is_heap_list); - /* We don't check that the list is empty because it's entirely valid to e.g. have all the nodes allocated from a single heap that is then freed after the list itself is freed. */ @@ -82,35 +49,10 @@ ib_list_free( ut_free(list); } -/****************************************************************//** -Add the data to the start of the list. -@return new list node */ -ib_list_node_t* -ib_list_add_first( -/*==============*/ - ib_list_t* list, /*!< in: list */ - void* data, /*!< in: data */ - mem_heap_t* heap) /*!< in: memory heap to use */ -{ - return(ib_list_add_after(list, ib_list_get_first(list), data, heap)); -} - -/****************************************************************//** -Add the data to the end of the list. -@return new list node */ -ib_list_node_t* -ib_list_add_last( -/*=============*/ - ib_list_t* list, /*!< in: list */ - void* data, /*!< in: data */ - mem_heap_t* heap) /*!< in: memory heap to use */ -{ - return(ib_list_add_after(list, ib_list_get_last(list), data, heap)); -} - /****************************************************************//** Add the data after the indicated node. @return new list node */ +static ib_list_node_t* ib_list_add_after( /*==============*/ @@ -164,6 +106,19 @@ ib_list_add_after( return(node); } +/****************************************************************//** +Add the data to the end of the list. +@return new list node */ +ib_list_node_t* +ib_list_add_last( +/*=============*/ + ib_list_t* list, /*!< in: list */ + void* data, /*!< in: data */ + mem_heap_t* heap) /*!< in: memory heap to use */ +{ + return(ib_list_add_after(list, ib_list_get_last(list), data, heap)); +} + /****************************************************************//** Remove the node from the list. */ void diff --git a/storage/innobase/ut/ut0mem.cc b/storage/innobase/ut/ut0mem.cc index 39b86568aa372..4d4ce7d29c6f0 100644 --- a/storage/innobase/ut/ut0mem.cc +++ b/storage/innobase/ut/ut0mem.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 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 @@ -24,11 +24,6 @@ Created 5/11/1994 Heikki Tuuri *************************************************************************/ #include "ut0mem.h" - -#ifdef UNIV_NONINL -#include "ut0mem.ic" -#endif - #include "os0thread.h" #include "srv0srv.h" #include @@ -79,39 +74,6 @@ ut_strlcpy_rev( return(src_size); } -/**********************************************************************//** -Return the number of times s2 occurs in s1. Overlapping instances of s2 -are only counted once. -@return the number of times s2 occurs in s1 */ -ulint -ut_strcount( -/*========*/ - const char* s1, /*!< in: string to search in */ - const char* s2) /*!< in: string to search for */ -{ - ulint count = 0; - ulint len = strlen(s2); - - if (len == 0) { - - return(0); - } - - for (;;) { - s1 = strstr(s1, s2); - - if (!s1) { - - break; - } - - count++; - s1 += len; - } - - return(count); -} - /******************************************************************** Concatenate 3 strings.*/ char* @@ -138,61 +100,3 @@ ut_str3cat( return(s); } -/**********************************************************************//** -Replace every occurrence of s1 in str with s2. Overlapping instances of s1 -are only replaced once. -@return own: modified string, must be freed with ut_free() */ -char* -ut_strreplace( -/*==========*/ - const char* str, /*!< in: string to operate on */ - const char* s1, /*!< in: string to replace */ - const char* s2) /*!< in: string to replace s1 with */ -{ - char* new_str; - char* ptr; - const char* str_end; - ulint str_len = strlen(str); - ulint s1_len = strlen(s1); - ulint s2_len = strlen(s2); - ulint count = 0; - int len_delta = (int) s2_len - (int) s1_len; - - str_end = str + str_len; - - if (len_delta <= 0) { - len_delta = 0; - } else { - count = ut_strcount(str, s1); - } - - new_str = static_cast( - ut_malloc_nokey(str_len + count * len_delta + 1)); - - ptr = new_str; - - while (str) { - const char* next = strstr(str, s1); - - if (!next) { - next = str_end; - } - - memcpy(ptr, str, next - str); - ptr += next - str; - - if (next == str_end) { - - break; - } - - memcpy(ptr, s2, s2_len); - ptr += s2_len; - - str = next + s1_len; - } - - *ptr = '\0'; - - return(new_str); -} diff --git a/storage/innobase/ut/ut0rbt.cc b/storage/innobase/ut/ut0rbt.cc index 8345c2c7593c8..d3e4ceae97d70 100644 --- a/storage/innobase/ut/ut0rbt.cc +++ b/storage/innobase/ut/ut0rbt.cc @@ -1,6 +1,6 @@ /***************************************************************************//** -Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2007, 2015, 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 @@ -54,24 +54,6 @@ red-black properties: #define ROOT(t) (t->root->left) #define SIZEOF_NODE(t) ((sizeof(ib_rbt_node_t) + t->sizeof_value) - 1) -/**********************************************************************//** -Print out the sub-tree recursively. */ -static -void -rbt_print_subtree( -/*==============*/ - const ib_rbt_t* tree, /*!< in: tree to traverse */ - const ib_rbt_node_t* node, /*!< in: node to print */ - ib_rbt_print_node print) /*!< in: print key function */ -{ - /* FIXME: Doesn't do anything yet */ - if (node != tree->nil) { - print(node); - rbt_print_subtree(tree, node->left, print); - rbt_print_subtree(tree, node->right, print); - } -} - /**********************************************************************//** Verify that the keys are in order. @return TRUE of OK. FALSE if not ordered */ @@ -880,7 +862,7 @@ rbt_add_node( ++tree->n_nodes; -#if defined(IB_RBT_TESTING) +#if defined UNIV_DEBUG || defined IB_RBT_TESTING ut_a(rbt_validate(tree)); #endif return(node); @@ -889,6 +871,7 @@ rbt_add_node( /**********************************************************************//** Find a matching node in the rb tree. @return NULL if not found else the node where key was found */ +static const ib_rbt_node_t* rbt_lookup( /*=======*/ @@ -965,86 +948,6 @@ rbt_remove_node( return((ib_rbt_node_t*) const_node); } -/**********************************************************************//** -Find the node that has the lowest key that is >= key. -@return node satisfying the lower bound constraint or NULL */ -const ib_rbt_node_t* -rbt_lower_bound( -/*============*/ - const ib_rbt_t* tree, /*!< in: rb tree */ - const void* key) /*!< in: key to search */ -{ - ib_rbt_node_t* lb_node = NULL; - ib_rbt_node_t* current = ROOT(tree); - - while (current != tree->nil) { - int result; - - if (tree->cmp_arg) { - result = tree->compare_with_arg( - tree->cmp_arg, key, current->value); - } else { - result = tree->compare(key, current->value); - } - - if (result > 0) { - - current = current->right; - - } else if (result < 0) { - - lb_node = current; - current = current->left; - - } else { - lb_node = current; - break; - } - } - - return(lb_node); -} - -/**********************************************************************//** -Find the node that has the greatest key that is <= key. -@return node satisfying the upper bound constraint or NULL */ -const ib_rbt_node_t* -rbt_upper_bound( -/*============*/ - const ib_rbt_t* tree, /*!< in: rb tree */ - const void* key) /*!< in: key to search */ -{ - ib_rbt_node_t* ub_node = NULL; - ib_rbt_node_t* current = ROOT(tree); - - while (current != tree->nil) { - int result; - - if (tree->cmp_arg) { - result = tree->compare_with_arg( - tree->cmp_arg, key, current->value); - } else { - result = tree->compare(key, current->value); - } - - if (result > 0) { - - ub_node = current; - current = current->right; - - } else if (result < 0) { - - current = current->left; - - } else { - ub_node = current; - break; - } - } - - return(ub_node); -} - /**********************************************************************//** Find the node that has the greatest key that is <= key. @return value of result */ @@ -1191,19 +1094,6 @@ rbt_prev( return(current ? rbt_find_predecessor(tree, current) : NULL); } -/**********************************************************************//** -Reset the tree. Delete all the nodes. */ -void -rbt_clear( -/*======*/ - ib_rbt_t* tree) /*!< in: rb tree */ -{ - rbt_free_node(ROOT(tree), tree->nil); - - tree->n_nodes = 0; - tree->root->left = tree->root->right = tree->nil; -} - /**********************************************************************//** Merge the node from dst into src. Return the number of nodes merged. @return no. of recs merged */ @@ -1232,53 +1122,7 @@ rbt_merge_uniq( return(n_merged); } -/**********************************************************************//** -Merge the node from dst into src. Return the number of nodes merged. -Delete the nodes from src after copying node to dst. As a side effect -the duplicates will be left untouched in the src. -@return no. of recs merged */ -ulint -rbt_merge_uniq_destructive( -/*=======================*/ - ib_rbt_t* dst, /*!< in: dst rb tree */ - ib_rbt_t* src) /*!< in: src rb tree */ -{ - ib_rbt_bound_t parent; - ib_rbt_node_t* src_node; - ulint old_size = rbt_size(dst); - - if (rbt_empty(src) || dst == src) { - return(0); - } - - for (src_node = (ib_rbt_node_t*) rbt_first(src); src_node; /* */) { - ib_rbt_node_t* prev = src_node; - - src_node = (ib_rbt_node_t*) rbt_next(src, prev); - - /* Skip duplicates. */ - if (rbt_search(dst, &parent, prev->value) != 0) { - - /* Remove and reset the node but preserve - the node (data) value. */ - rbt_remove_node_and_rebalance(src, prev); - - /* The nil should be taken from the dst tree. */ - prev->parent = prev->left = prev->right = dst->nil; - rbt_tree_add_child(dst, &parent, prev); - rbt_balance_tree(dst, prev); - - ++dst->n_nodes; - } - } - -#if defined(IB_RBT_TESTING) - ut_a(rbt_validate(dst)); - ut_a(rbt_validate(src)); -#endif - return(rbt_size(dst) - old_size); -} - +#if defined UNIV_DEBUG || defined IB_RBT_TESTING /**********************************************************************//** Check that every path from the root to the leaves has the same count and the tree nodes are in order. @@ -1294,14 +1138,4 @@ rbt_validate( return(FALSE); } - -/**********************************************************************//** -Iterate over the tree in depth first order. */ -void -rbt_print( -/*======*/ - const ib_rbt_t* tree, /*!< in: tree to traverse */ - ib_rbt_print_node print) /*!< in: print function */ -{ - rbt_print_subtree(tree, ROOT(tree), print); -} +#endif /* UNIV_DEBUG || IB_RBT_TESTING */ diff --git a/storage/innobase/ut/ut0rnd.cc b/storage/innobase/ut/ut0rnd.cc index 2d2d8977ad7d7..64d707325808f 100644 --- a/storage/innobase/ut/ut0rnd.cc +++ b/storage/innobase/ut/ut0rnd.cc @@ -25,10 +25,6 @@ Created 5/11/1994 Heikki Tuuri #include "ut0rnd.h" -#ifdef UNIV_NONINL -#include "ut0rnd.ic" -#endif - /** These random numbers are used in ut_find_prime */ /*@{*/ #define UT_RANDOM_1 1.0412321 diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index 2b9e3115a03c8..c352323eca90a 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -33,9 +33,6 @@ Created 5/11/1994 Heikki Tuuri #include #include "os0thread.h" #include "ut0ut.h" -#ifdef UNIV_NONINL -#include "ut0ut.ic" -#endif #include "trx0trx.h" #include #include "log.h" diff --git a/storage/innobase/ut/ut0vec.cc b/storage/innobase/ut/ut0vec.cc index f4a893967c75b..b652ad83b64e0 100644 --- a/storage/innobase/ut/ut0vec.cc +++ b/storage/innobase/ut/ut0vec.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 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 @@ -24,9 +24,6 @@ Created 4/6/2006 Osku Salerma ************************************************************************/ #include "ut0vec.h" -#ifdef UNIV_NONINL -#include "ut0vec.ic" -#endif #include "mem0mem.h" /******************************************************************** diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index d411272c273f0..0d177072ec701 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -869,13 +869,13 @@ static my_off_t read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, uint sort_length) { register ha_keys count; - my_off_t length; + size_t length; if ((count= (ha_keys) MY_MIN((ha_rows) buffpek->max_keys, (ha_rows) buffpek->count))) { if (my_b_pread(fromfile, (uchar*) buffpek->base, - (length= (my_off_t) (sort_length * count)), + (length= (size_t) (sort_length * count)), buffpek->file_pos)) return(HA_OFFSET_ERROR); buffpek->key=buffpek->base; diff --git a/storage/perfschema/pfs_autosize.cc b/storage/perfschema/pfs_autosize.cc index 9bf70ceb2166f..6f267cb459959 100644 --- a/storage/perfschema/pfs_autosize.cc +++ b/storage/perfschema/pfs_autosize.cc @@ -132,7 +132,7 @@ PFS_sizing_data small_data= /* Min tables */ 200, /* Load factors */ - 0.90, 0.90, 0.90 + 0.90f, 0.90f, 0.90f }; PFS_sizing_data medium_data= @@ -148,7 +148,7 @@ PFS_sizing_data medium_data= /* Min tables */ 500, /* Load factors */ - 0.70, 0.80, 0.90 + 0.70f, 0.80f, 0.90f }; PFS_sizing_data large_data= @@ -164,7 +164,7 @@ PFS_sizing_data large_data= /* Min tables */ 10000, /* Load factors */ - 0.50, 0.65, 0.80 + 0.50f, 0.65f, 0.80f }; static inline ulong apply_load_factor(ulong raw_value, float factor) diff --git a/storage/sequence/sequence.cc b/storage/sequence/sequence.cc index 8d9465f08c5af..599374c6f8c71 100644 --- a/storage/sequence/sequence.cc +++ b/storage/sequence/sequence.cc @@ -95,9 +95,9 @@ class ha_seq: public handler ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); - double scan_time() { return nvalues(); } - double read_time(uint index, uint ranges, ha_rows rows) { return rows; } - double keyread_time(uint index, uint ranges, ha_rows rows) { return rows; } + double scan_time() { return (double)nvalues(); } + double read_time(uint index, uint ranges, ha_rows rows) { return (double)rows; } + double keyread_time(uint index, uint ranges, ha_rows rows) { return (double)rows; } private: void set(uchar *buf); diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 79ad8ca7302bc..e3ed531df9360 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -31610,7 +31610,7 @@ my_uca_implicit_weight_put(uint16 *to, my_wc_t code, uint level) break; } /* Primary level */ - to[0]= (code >> 15) + my_uca_implicit_weight_base(code); + to[0]= (uint16)(code >> 15) + my_uca_implicit_weight_base(code); to[1]= (code & 0x7FFF) | 0x8000; to[2]= 0; } diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 6ab07d99e231d..683c80f643d45 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -4831,7 +4831,6 @@ my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags) { - my_wc_t UNINIT_VAR(wc); uchar *dst0= dst; uchar *de= dst + dstlen; @@ -4877,7 +4876,6 @@ my_strnxfrm_unicode_full_nopad_bin(CHARSET_INFO *cs, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags) { - my_wc_t UNINIT_VAR(wc); uchar *dst0= dst; uchar *de= dst + dstlen; diff --git a/strings/json_lib.c b/strings/json_lib.c index 2a5d71a21334d..5eda81d96c56d 100644 --- a/strings/json_lib.c +++ b/strings/json_lib.c @@ -366,6 +366,7 @@ static int skip_str_constant(json_engine_t *j) break; if (j->s.c_next == '\\') { + j->value_escaped= 1; if (json_handle_esc(&j->s)) return 1; continue; @@ -394,6 +395,7 @@ static int read_strn(json_engine_t *j) { j->value= j->s.c_str; j->value_type= JSON_VALUE_STRING; + j->value_escaped= 0; if (skip_str_constant(j)) return 1; diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index a1c28f0d750b2..cc81663e1d1fe 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -19530,6 +19530,33 @@ static void test_big_packet() } +static void test_prepare_analyze() +{ + MYSQL_STMT *stmt; + const char *query= "ANALYZE SELECT 1"; + int rc; + myheader("test_prepare_analyze"); + + stmt= mysql_stmt_init(mysql); + check_stmt(stmt); + rc= mysql_stmt_prepare(stmt, query, strlen(query)); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + rc= mysql_stmt_store_result(stmt); + check_execute(stmt, rc); + + while (!(rc= mysql_stmt_fetch(stmt))) + ; + + DIE_UNLESS(rc == MYSQL_NO_DATA); + + rc= mysql_stmt_close(stmt); + check_execute(stmt, rc); +} + static struct my_tests_st my_tests[]= { { "disable_query_logs", disable_query_logs }, { "test_view_sp_list_fields", test_view_sp_list_fields }, @@ -19804,6 +19831,7 @@ static struct my_tests_st my_tests[]= { { "test_ps_sp_out_params", test_ps_sp_out_params }, { "test_compressed_protocol", test_compressed_protocol }, { "test_big_packet", test_big_packet }, + { "test_prepare_analyze", test_prepare_analyze }, { 0, 0 } }; diff --git a/win/packaging/extra.wxs.in b/win/packaging/extra.wxs.in index 016f6a8a97fd3..3aba129fdf373 100644 --- a/win/packaging/extra.wxs.in +++ b/win/packaging/extra.wxs.in @@ -12,7 +12,7 @@ - + @@ -55,13 +55,14 @@ - - - - + + + + - + + @@ -267,18 +268,7 @@ NOT ModifyRootPassword - - {\Font1}Create An Anonymous Account - - - This option will create an anonymous account on this server. - - - Please note: this setting can lead to insecure systems. - - - + {\Font1}Use UTF8 as default server's character set @@ -336,29 +326,23 @@ Not EnableNetworking - - - {\Font1}Optimize for transactions - - - - (Uses transactional storage engine and "strict" SQL mode) - STDCONFIG - Not STDCONFIG - - - STDCONFIG - Not STDCONFIG - - - STDCONFIG - Not STDCONFIG + + {\Font1}Innodb engine settings - - STDCONFIG - Not STDCONFIG + + + + + + + + + + + + + - @@ -493,26 +477,11 @@ - + - STDCONFIG - - - - - FEEDBACK