diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-12 16:36:46 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-12 16:36:46 +0300 |
commit | d28686ada6f72035f23b83960e63599f50fbc38d (patch) | |
tree | c7295d08ffa9f27d7f8b19b5741b286acaa40b9b | |
parent | 9d26f3dabb8299149af99faafa52398cce44e610 (diff) | |
parent | 60c04be6599597548ad07ce11e1d7d4004a7cc9c (diff) | |
download | mariadb-git-d28686ada6f72035f23b83960e63599f50fbc38d.tar.gz |
Merge 10.4 into 10.5
55 files changed, 1014 insertions, 238 deletions
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 7fb9c91049b..c48e3eb07f2 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -188,11 +188,18 @@ IF(MSVC) IF(MYSQL_MAINTAINER_MODE MATCHES "ERR") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + FOREACH(type EXE SHARED MODULE) + FOREACH(cfg RELEASE DEBUG RELWITHDEBINFO) + SET(CMAKE_${type}_LINKER_FLAGS_${cfg} "${CMAKE_${type}_LINKER_FLAGS_${cfg}} /WX") + ENDFOREACH() + ENDFOREACH() ENDIF() IF(MSVC_VERSION LESS 1910) # Noisy warning C4800: 'type': forcing value to bool 'true' or 'false' (performance warning), # removed in VS2017 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800") + ELSE() + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /d2OptimizeHugeFunctions") ENDIF() ENDIF() diff --git a/debian/libmariadb3.install b/debian/libmariadb3.install index 8636166a493..9783e7b0b01 100644 --- a/debian/libmariadb3.install +++ b/debian/libmariadb3.install @@ -3,3 +3,4 @@ usr/lib/mysql/plugin/client_ed25519.so usr/lib/mysql/plugin/dialog.so usr/lib/mysql/plugin/mysql_clear_password.so usr/lib/mysql/plugin/sha256_password.so +usr/lib/mysql/plugin/client_ed25519.so diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 13922ed95f1..dc855259a9b 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -942,6 +942,15 @@ def json_depnth 3 10 1 N 32897 0 63 json_length json_depnth 2 3 # +# MDEV-19670 json escaped unicode parse error +# +SELECT json_valid('{"value":"\\ud83d\\ude0a"}'); +json_valid('{"value":"\\ud83d\\ude0a"}') +1 +SELECT json_valid('{"test": "\\ud83d\\ude0b"}'); +json_valid('{"test": "\\ud83d\\ude0b"}') +1 +# # End of 10.3 tests # # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 55f3fbae9ef..3e695934ef2 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -562,6 +562,13 @@ SELECT --disable_metadata --echo # +--echo # MDEV-19670 json escaped unicode parse error +--echo # + +SELECT json_valid('{"value":"\\ud83d\\ude0a"}'); +SELECT json_valid('{"test": "\\ud83d\\ude0b"}'); + +--echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result index 1d284e45545..f4645ed089d 100644 --- a/mysql-test/main/func_misc.result +++ b/mysql-test/main/func_misc.result @@ -1557,6 +1557,15 @@ numgtfmt DROP VIEW v1; DROP TABLE t1; # +# MDEV-20517 Assertion `!is_expensive()' failed in Item::value_depends_on_sql_mode_const_item +# +SELECT ( 1 LIKE GET_LOCK( 'foo', 0 ) ) - 2; +( 1 LIKE GET_LOCK( 'foo', 0 ) ) - 2 +-1 +SELECT RELEASE_LOCK('foo'); +RELEASE_LOCK('foo') +1 +# # End of 10.2 tests # # diff --git a/mysql-test/main/func_misc.test b/mysql-test/main/func_misc.test index a2805f0438b..ea76bce3f6e 100644 --- a/mysql-test/main/func_misc.test +++ b/mysql-test/main/func_misc.test @@ -1192,6 +1192,12 @@ SELECT * FROM v1 WHERE numgtfmt = NAME_CONST('wnumgtfmt',_utf8'QEDITIONS' COLLA DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # MDEV-20517 Assertion `!is_expensive()' failed in Item::value_depends_on_sql_mode_const_item +--echo # + +SELECT ( 1 LIKE GET_LOCK( 'foo', 0 ) ) - 2; +SELECT RELEASE_LOCK('foo'); --echo # --echo # End of 10.2 tests diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index 35e58f3ad62..f994f6f7fd6 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -7636,7 +7636,7 @@ SELECT 1; 1 1 DROP PROCEDURE sp; -CREATE PROCEDURE sp() SHOW USER_STATISTICS; +CREATE PROCEDURE sp() SET STATEMENT SQL_SELECT_LIMIT=0 FOR SHOW USER_STATISTICS; CALL sp; User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_read Rows_sent Rows_deleted Rows_inserted Rows_updated Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries Total_ssl_connections Max_statement_time_exceeded SELECT 1; diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 9aec4627c2c..7d1e8e2a8f9 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -9070,7 +9070,7 @@ CREATE PROCEDURE sp() ALTER TABLE non_existing_table OPTIMIZE PARTITION p0; CALL sp; SELECT 1; DROP PROCEDURE sp; -CREATE PROCEDURE sp() SHOW USER_STATISTICS; +CREATE PROCEDURE sp() SET STATEMENT SQL_SELECT_LIMIT=0 FOR SHOW USER_STATISTICS; CALL sp; SELECT 1; DROP PROCEDURE sp; diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 1ba6bfe3077..7951b4511ac 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -21,7 +21,6 @@ galera_as_master_gtid_change_master : Requires MySQL GTID galera_as_slave_gtid_replicate_do_db_cc : Requires MySQL GTID galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event() -galera_autoinc_sst_mariabackup : MDEV-19926 Galera SST tests fail galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_bf_abort_group_commit galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events galera_binlog_stmt_autoinc: MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc @@ -35,15 +34,10 @@ galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_ galera_kill_nochanges : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk galera_migrate : MariaDB does not support START SLAVE USER -galera_pc_ignore_sb : MDEV-15811/MDEV-17357 Test failure galera_split_brain : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges -galera_ssl_upgrade : MDEV-13549 Galera test failures -galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure -galera_var_node_address : MDEV-17151 Galera test failure -galera_var_notify_cmd : MDEV-13549 Galera test failures +galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade galera_var_reject_queries : assertion in inline_mysql_socket_send galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit -galera_sst_mariabackup_encrypt_with_key : MDEV-19926 Galera SST tests fail galera_var_node_address : MDEV-20485 Galera test failure on galera.galera_var_node_address galera_wan : MDEV-17259 Test failure on galera.galera_wan mysql-wsrep#198 : MDEV-18935 Galera test mysql-wsrep#198 sporaric assertion transaction.cpp:362: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed. diff --git a/mysql-test/suite/galera/r/galera_events2.result b/mysql-test/suite/galera/r/galera_events2.result new file mode 100644 index 00000000000..fa33e75ff57 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_events2.result @@ -0,0 +1,122 @@ +connection node_1; +connection node_2; +connection node_1; +CREATE TABLE event_table(a int) engine=innodb; +CREATE EVENT event_2 ON SCHEDULE EVERY 1 SECOND +ENDS NOW() + INTERVAL 6 SECOND +ON COMPLETION NOT PRESERVE +DO +INSERT INTO event_table VALUES (1); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +# node_1 event should be there +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def test event_2 root@localhost SQL INSERT INTO event_table VALUES (1) RECURRING NULL 1 SECOND ENABLED NOT PRESERVE +connection node_2; +# node_2 event should be there +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def test event_2 root@localhost SQL INSERT INTO event_table VALUES (1) RECURRING NULL 1 SECOND SLAVESIDE_DISABLED NOT PRESERVE +connection node_1; +SET GLOBAL event_scheduler=ON; +SHOW VARIABLES LIKE 'event_scheduler'; +Variable_name Value +event_scheduler ON +# node_1 event should be removed +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +connection node_2; +# node_2 event should be removed +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +connection node_1; +SET GLOBAL event_scheduler=OFF; +DROP TABLE event_table; +connection node_1; +CREATE DATABASE IF NOT EXISTS events_test; +use events_test; +CREATE USER ev_test@localhost; +GRANT ALL ON events_test.* to ev_test@localhost; +connect ev_con1,localhost,ev_test,,events_test; +CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test one_event ev_test@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE +ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND; +"The definer should be ev_test@localhost" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE +connection node_2; +use events_test; +"The definer should be ev_test@localhost" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND SLAVESIDE_DISABLED NOT PRESERVE +connection node_1; +disconnect ev_con1; +use test; +DROP EVENT events_test.one_event; +DROP USER ev_test@localhost; +DROP DATABASE events_test; +connection node_1; +use test; +CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +# node_1 Event should be enabled +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE +connection node_2; +use test; +# node_2 Event should be SERVERSIDE_DISABLED +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND SLAVESIDE_DISABLED NOT PRESERVE +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=InnoDB; +INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'); +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 a +Shutting down server ... +connection node_1; +UPDATE t1 SET f2 = 'b' WHERE f1 > 1; +UPDATE t1 SET f2 = 'c' WHERE f1 > 2; +SELECT * FROM t1; +f1 f2 +1 a +2 b +3 c +connection node_2; +# Force SST from node_1 to node_2 +Starting server ... +SELECT * FROM t1; +f1 f2 +1 a +2 b +3 c +# node_2 Event should be SERVERSIDE_DISABLED +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND SLAVESIDE_DISABLED NOT PRESERVE +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 b +3 c +# node_1 Event should be ENABLED +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE +DROP TABLE t1; +DROP EVENT one_event; diff --git a/mysql-test/suite/galera/r/galera_var_node_address.result b/mysql-test/suite/galera/r/galera_var_node_address.result index cf45861c8ad..6b91a9f3ea3 100644 --- a/mysql-test/suite/galera/r/galera_var_node_address.result +++ b/mysql-test/suite/galera/r/galera_var_node_address.result @@ -1,19 +1,22 @@ connection node_2; connection node_1; -call mtr.add_suppression("WSREP: Stray state UUID msg: .* current group state WAIT_STATE_UUID .*"); -call mtr.add_suppression("WSREP: Protocol violation. JOIN message sender .* is not in state transfer (.*). Message ignored."); -call mtr.add_suppression("WSREP: Sending JOIN failed: -[0-9]+ (Transport endpoint is not connected). Will retry in new primary component."); -SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE = 4 -1 +call mtr.add_suppression("WSREP: Stray state UUID msg: .*"); +call mtr.add_suppression("WSREP: Protocol violation. JOIN message sender .*"); +call mtr.add_suppression("WSREP: Sending JOIN failed: .*"); +flush tables; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE +4 connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB; connection node_2; +set global wsrep_sync_wait=15; INSERT INTO t1 VALUES (1); connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_3; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +set global wsrep_sync_wait=15; +SELECT COUNT(*) FROM t1; +COUNT(*) 1 connection node_1; DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MW-328B.test b/mysql-test/suite/galera/t/MW-328B.test index 11969dd0b47..04503ce31e3 100644 --- a/mysql-test/suite/galera/t/MW-328B.test +++ b/mysql-test/suite/galera/t/MW-328B.test @@ -8,6 +8,7 @@ # --source include/galera_cluster.inc +--source include/big_test.inc --source suite/galera/t/MW-328-header.inc --connection node_2 diff --git a/mysql-test/suite/galera/t/galera_events2.test b/mysql-test/suite/galera/t/galera_events2.test new file mode 100644 index 00000000000..54b90386851 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_events2.test @@ -0,0 +1,144 @@ +--source include/galera_cluster.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +# +# Test case 1: "ONE TIME" events should be dropped on slave nodes after expiring on master (event creator node) +# + +--connection node_1 + +CREATE TABLE event_table(a int) engine=innodb; + +CREATE EVENT event_2 ON SCHEDULE EVERY 1 SECOND +ENDS NOW() + INTERVAL 6 SECOND +ON COMPLETION NOT PRESERVE +DO + INSERT INTO event_table VALUES (1); + +--echo # node_1 event should be there +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; + +--connection node_2 +--echo # node_2 event should be there +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; + +--connection node_1 +SET GLOBAL event_scheduler=ON; +SHOW VARIABLES LIKE 'event_scheduler'; + +# Let event_2 reach the end of its execution interval +let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_2'; +--source include/wait_condition.inc + +--echo # node_1 event should be removed +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; + +--connection node_2 +--echo # node_2 event should be removed +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; + +--connection node_1 +SET GLOBAL event_scheduler=OFF; +DROP TABLE event_table; + +# +# Test case 2: After doing ALTER EVENT, slave nodes should have same definer as master +# + +--connection node_1 + +CREATE DATABASE IF NOT EXISTS events_test; +use events_test; +CREATE USER ev_test@localhost; +GRANT ALL ON events_test.* to ev_test@localhost; +connect (ev_con1,localhost,ev_test,,events_test); + +CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; +--replace_column 8 # 9 # +SHOW EVENTS; +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; +ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND; +--echo "The definer should be ev_test@localhost" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; + +--connection node_2 +use events_test; +--echo "The definer should be ev_test@localhost" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; + +--connection node_1 +--disconnect ev_con1 +use test; +DROP EVENT events_test.one_event; +DROP USER ev_test@localhost; +DROP DATABASE events_test; + +# +# Test case 3: After SST from master node (the one where event is ENABLED) , slave event status should be 'SLAVESIDE_DISABLED' +# + +--connection node_1 +use test; +CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; + +--echo # node_1 Event should be enabled +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; + +--connection node_2 +use test; +--echo # node_2 Event should be SERVERSIDE_DISABLED +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=InnoDB; +INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'); + +SELECT * FROM t1; + +# Initiate normal shutdown on the node 2 and wait until shutdown has been completed: + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc + +--connection node_1 + +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +UPDATE t1 SET f2 = 'b' WHERE f1 > 1; +UPDATE t1 SET f2 = 'c' WHERE f1 > 2; + +SELECT * FROM t1; + +--connection node_2 + +# Remove the "grastate.dat" file (to initiate new SST) and restart node 2 + +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat + +--echo # Force SST from node_1 to node_2 +--let $start_mysqld_params= +--echo Starting server ... +--source include/start_mysqld.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# Sanity check (node 2 is running now and can perform SQL operators): + +SELECT * FROM t1; +--echo # node_2 Event should be SERVERSIDE_DISABLED +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; + +--connection node_1 +SELECT * FROM t1; +--echo # node_1 Event should be ENABLED +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; + +DROP TABLE t1; +DROP EVENT one_event; + +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_var_node_address.test b/mysql-test/suite/galera/t/galera_var_node_address.test index b50265be5ae..99cb30e7b91 100644 --- a/mysql-test/suite/galera/t/galera_var_node_address.test +++ b/mysql-test/suite/galera/t/galera_var_node_address.test @@ -6,27 +6,27 @@ --source include/galera_cluster.inc --source include/have_innodb.inc -call mtr.add_suppression("WSREP: Stray state UUID msg: .* current group state WAIT_STATE_UUID .*"); -call mtr.add_suppression("WSREP: Protocol violation. JOIN message sender .* is not in state transfer (.*). Message ignored."); -call mtr.add_suppression("WSREP: Sending JOIN failed: -[0-9]+ (Transport endpoint is not connected). Will retry in new primary component."); +call mtr.add_suppression("WSREP: Stray state UUID msg: .*"); +call mtr.add_suppression("WSREP: Protocol violation. JOIN message sender .*"); +call mtr.add_suppression("WSREP: Sending JOIN failed: .*"); +flush tables; -SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB; --connection node_2 -let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; ---source include/wait_condition.inc +set global wsrep_sync_wait=15; INSERT INTO t1 VALUES (1); --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_3 -let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; ---source include/wait_condition.inc -let $wait_condition= SELECT COUNT(*) = 1 FROM t1; ---source include/wait_condition.inc -SELECT COUNT(*) = 1 FROM t1; +set global wsrep_sync_wait=15; +SELECT COUNT(*) FROM t1; --connection node_1 DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns-debug.result b/mysql-test/suite/innodb/r/innodb-virtual-columns-debug.result index efe43945c69..df6bf83d24f 100644 --- a/mysql-test/suite/innodb/r/innodb-virtual-columns-debug.result +++ b/mysql-test/suite/innodb/r/innodb-virtual-columns-debug.result @@ -6,11 +6,11 @@ SET debug_sync= "ib_open_after_dict_open SIGNAL delete_open WAIT_FOR another_ope DELETE FROM t1; connection default; SET debug_sync= "now WAIT_FOR delete_open"; -SET debug_sync= "ib_open_after_dict_open SIGNAL another_open"; SELECT a FROM t1; a NULL NULL +SET debug_sync= "now SIGNAL another_open"; connection con1; disconnect con1; connection default; diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result index 109cbffe871..045b7468049 100644 --- a/mysql-test/suite/innodb/r/instant_alter_bugs.result +++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result @@ -269,3 +269,17 @@ ALTER TABLE t1 ADD COLUMN (b INT, c INT, d INT, e INT NOT NULL DEFAULT 0); ALTER TABLE t1 ADD UNIQUE INDEX(e); ALTER TABLE t1 DROP b, DROP c, DROP d, DROP e; DROP TABLE t1; +# +# MDEV-20565 Assertion on CHANGE COLUMN...SYSTEM VERSIONING +# +set @@system_versioning_alter_history = keep; +CREATE TABLE t (a INT WITHOUT SYSTEM VERSIONING, b INT) ENGINE=InnoDB +WITH SYSTEM VERSIONING; +ALTER TABLE t CHANGE COLUMN a alpha INT WITH SYSTEM VERSIONING, +ALGORITHM=INSTANT; +DROP TABLE t; +CREATE TABLE t (alpha INT, b INT) ENGINE=InnoDB WITH SYSTEM VERSIONING; +ALTER TABLE t CHANGE COLUMN alpha a INT WITHOUT SYSTEM VERSIONING, +ALGORITHM=INSTANT; +DROP TABLE t; +set @@system_versioning_alter_history = error; diff --git a/mysql-test/suite/innodb/r/temporary_table_optimization.result b/mysql-test/suite/innodb/r/temporary_table_optimization.result index 63c4f388bf7..c3325d86386 100644 --- a/mysql-test/suite/innodb/r/temporary_table_optimization.result +++ b/mysql-test/suite/innodb/r/temporary_table_optimization.result @@ -112,7 +112,7 @@ count(*) drop table t1; drop procedure populate_t1; create temporary table t1 (t1_i int, t1_f float) engine = innodb; -insert into t1 values (1, 1.1), (2, 2.2), (3, 2.2), (4, 4.4); +insert into t1 values (1, 1.1), (2, 2.5), (3, 2.5), (4, 4.4); explain select * from t1 where t1_i = 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where @@ -124,22 +124,22 @@ select * from t1 where t1_i = 1; t1_i t1_f 1 1.1 alter table t1 add unique index sec_index(t1_f); -ERROR 23000: Duplicate entry '2.2' for key 'sec_index' +ERROR 23000: Duplicate entry '2.5' for key 'sec_index' alter table t1 add index sec_index(t1_f); -explain select * from t1 where t1_f > 2.2; +explain select * from t1 where t1_f >= 2.5; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL sec_index NULL NULL NULL 4 Using where -select * from t1 where t1_f > 2.2; +select * from t1 where t1_f >= 2.5; t1_i t1_f -2 2.2 -3 2.2 +2 2.5 +3 2.5 4 4.4 alter table t1 add column (t1_c char(10)); select * from t1; t1_i t1_f t1_c 1 1.1 NULL -2 2.2 NULL -3 2.2 NULL +2 2.5 NULL +3 2.5 NULL 4 4.4 NULL insert into t1 values (5, 5.5, 'krunal'); alter table t1 drop column t1_f; @@ -150,7 +150,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `t1_c` char(10) DEFAULT NULL, UNIQUE KEY `pri_index` (`t1_i`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -select * from t1 where t1_f > 2.2; +select * from t1 where t1_f >= 2.5; ERROR 42S22: Unknown column 't1_f' in 'where clause' alter table t1 add index sec_index2(t1_c), algorithm=inplace; ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY diff --git a/mysql-test/suite/innodb/t/innodb-virtual-columns-debug.test b/mysql-test/suite/innodb/t/innodb-virtual-columns-debug.test index 6de43dd80f8..d4947ca4d8b 100644 --- a/mysql-test/suite/innodb/t/innodb-virtual-columns-debug.test +++ b/mysql-test/suite/innodb/t/innodb-virtual-columns-debug.test @@ -15,8 +15,8 @@ SET debug_sync= "ib_open_after_dict_open SIGNAL delete_open WAIT_FOR another_ope DELETE FROM t1; --connection default SET debug_sync= "now WAIT_FOR delete_open"; -SET debug_sync= "ib_open_after_dict_open SIGNAL another_open"; SELECT a FROM t1; +SET debug_sync= "now SIGNAL another_open"; --connection con1 --reap diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test index fc5e3ca56e4..fda8e88d70c 100644 --- a/mysql-test/suite/innodb/t/instant_alter_bugs.test +++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test @@ -277,3 +277,19 @@ ALTER TABLE t1 ADD COLUMN (b INT, c INT, d INT, e INT NOT NULL DEFAULT 0); ALTER TABLE t1 ADD UNIQUE INDEX(e); ALTER TABLE t1 DROP b, DROP c, DROP d, DROP e; DROP TABLE t1; + +--echo # +--echo # MDEV-20565 Assertion on CHANGE COLUMN...SYSTEM VERSIONING +--echo # +set @@system_versioning_alter_history = keep; +CREATE TABLE t (a INT WITHOUT SYSTEM VERSIONING, b INT) ENGINE=InnoDB +WITH SYSTEM VERSIONING; +ALTER TABLE t CHANGE COLUMN a alpha INT WITH SYSTEM VERSIONING, +ALGORITHM=INSTANT; +DROP TABLE t; + +CREATE TABLE t (alpha INT, b INT) ENGINE=InnoDB WITH SYSTEM VERSIONING; +ALTER TABLE t CHANGE COLUMN alpha a INT WITHOUT SYSTEM VERSIONING, +ALGORITHM=INSTANT; +DROP TABLE t; +set @@system_versioning_alter_history = error; diff --git a/mysql-test/suite/innodb/t/temporary_table_optimization.test b/mysql-test/suite/innodb/t/temporary_table_optimization.test index ae41c87839b..967965f9998 100644 --- a/mysql-test/suite/innodb/t/temporary_table_optimization.test +++ b/mysql-test/suite/innodb/t/temporary_table_optimization.test @@ -100,7 +100,7 @@ drop procedure populate_t1; # 3. Alter of temp-table. # create temporary table t1 (t1_i int, t1_f float) engine = innodb; -insert into t1 values (1, 1.1), (2, 2.2), (3, 2.2), (4, 4.4); +insert into t1 values (1, 1.1), (2, 2.5), (3, 2.5), (4, 4.4); # explain select * from t1 where t1_i = 1; alter table t1 add unique index pri_index(t1_i); @@ -110,8 +110,8 @@ select * from t1 where t1_i = 1; --error ER_DUP_ENTRY alter table t1 add unique index sec_index(t1_f); alter table t1 add index sec_index(t1_f); -explain select * from t1 where t1_f > 2.2; -select * from t1 where t1_f > 2.2; +explain select * from t1 where t1_f >= 2.5; +select * from t1 where t1_f >= 2.5; # alter table t1 add column (t1_c char(10)); select * from t1; @@ -120,7 +120,7 @@ insert into t1 values (5, 5.5, 'krunal'); alter table t1 drop column t1_f; show create table t1; --error ER_BAD_FIELD_ERROR -select * from t1 where t1_f > 2.2; +select * from t1 where t1_f >= 2.5; # --error ER_ALTER_OPERATION_NOT_SUPPORTED alter table t1 add index sec_index2(t1_c), algorithm=inplace; diff --git a/mysql-test/suite/parts/r/alter_data_directory_innodb.result b/mysql-test/suite/parts/r/alter_data_directory_innodb.result index 8a43588ea52..de2da0b9a05 100644 --- a/mysql-test/suite/parts/r/alter_data_directory_innodb.result +++ b/mysql-test/suite/parts/r/alter_data_directory_innodb.result @@ -57,6 +57,9 @@ ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO ( PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB ); +Warnings: +Warning 1982 <DATA DIRECTORY> option ignored for InnoDB partition +Warning 1982 <DATA DIRECTORY> option ignored for InnoDB partition SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( diff --git a/mysql-test/suite/parts/r/reorganize_partition_innodb.result b/mysql-test/suite/parts/r/reorganize_partition_innodb.result new file mode 100644 index 00000000000..a0a3344a39d --- /dev/null +++ b/mysql-test/suite/parts/r/reorganize_partition_innodb.result @@ -0,0 +1,160 @@ +# +# MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir +# +CREATE TABLE t ( +a INT NOT NULL +) ENGINE=INNODB +PARTITION BY HASH (a) ( +PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here/' ENGINE = INNODB, +PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here/' ENGINE = INNODB +); +INSERT INTO t VALUES (1); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY HASH (`a`) +(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, + PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) +ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE; +Warnings: +Warning 1280 Name 'pk' ignored for PRIMARY key. +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY HASH (`a`) +(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, + PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) +ALTER TABLE t DROP PRIMARY KEY, ALGORITHM=COPY; +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY HASH (`a`) +(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, + PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) +SET @TMP = @@GLOBAL.INNODB_FILE_PER_TABLE; +SET GLOBAL INNODB_FILE_PER_TABLE=OFF; +ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE; +Warnings: +Warning 1280 Name 'pk' ignored for PRIMARY key. +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY HASH (`a`) +(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, + PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) +SET GLOBAL INNODB_FILE_PER_TABLE=@TMP; +ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO ( +PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB, +PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB +); +Warnings: +Warning 1982 <DATA DIRECTORY> option ignored for InnoDB partition +Warning 1982 <DATA DIRECTORY> option ignored for InnoDB partition +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY HASH (`a`) +(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, + PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) +ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO ( +PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/', +PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' +); +Warnings: +Warning 1982 <DATA DIRECTORY> option ignored for InnoDB partition +Warning 1982 <DATA DIRECTORY> option ignored for InnoDB partition +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY HASH (`a`) +(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, + PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) +ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO ( +PARTITION p1 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB, +PARTITION p2 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB +); +Warnings: +Warning 1982 <INDEX DIRECTORY> option ignored for InnoDB partition +Warning 1982 <INDEX DIRECTORY> option ignored for InnoDB partition +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY HASH (`a`) +(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, + PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) +DROP TABLE t; +SET @strict = @@innodb_strict_mode; +SET innodb_strict_mode=OFF; +CREATE TABLE t ( +a INT NOT NULL +) ENGINE=INNODB +PARTITION BY RANGE (a) +SUBPARTITION BY HASH (a) +SUBPARTITIONS 2 +( +PARTITION p1 VALUES LESS THAN (7) +DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here/' + INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here/' + ENGINE = INNODB, +PARTITION p2 VALUES LESS THAN MAXVALUE +DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here/' + INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here/' + ENGINE = INNODB +); +Warnings: +Warning 1618 <INDEX DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored +SET innodb_strict_mode=@strict; +ALTER TABLE t +REORGANIZE PARTITION p1,p2 INTO +( +PARTITION p1 VALUES LESS THAN (7) +DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' + INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' + ENGINE = INNODB, +PARTITION p2 VALUES LESS THAN MAXVALUE +DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' + INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' + ENGINE = INNODB +); +Warnings: +Warning 1982 <DATA DIRECTORY> option ignored for InnoDB partition +Warning 1982 <INDEX DIRECTORY> option ignored for InnoDB partition +Warning 1982 <DATA DIRECTORY> option ignored for InnoDB partition +Warning 1982 <INDEX DIRECTORY> option ignored for InnoDB partition +Warning 1982 <DATA DIRECTORY> option ignored for InnoDB partition +Warning 1982 <INDEX DIRECTORY> option ignored for InnoDB partition +Warning 1982 <DATA DIRECTORY> option ignored for InnoDB partition +Warning 1982 <INDEX DIRECTORY> option ignored for InnoDB partition +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY RANGE (`a`) +SUBPARTITION BY HASH (`a`) +SUBPARTITIONS 2 +(PARTITION `p1` VALUES LESS THAN (7) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = InnoDB, + PARTITION `p2` VALUES LESS THAN MAXVALUE DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = InnoDB) +DROP TABLE t; diff --git a/mysql-test/suite/parts/t/reorganize_partition_innodb.test b/mysql-test/suite/parts/t/reorganize_partition_innodb.test new file mode 100644 index 00000000000..db73650c54b --- /dev/null +++ b/mysql-test/suite/parts/t/reorganize_partition_innodb.test @@ -0,0 +1,103 @@ +--source include/have_innodb.inc +--source include/have_partition.inc + +--echo # +--echo # MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir +--echo # + +mkdir $MYSQLTEST_VARDIR/tmp/partitions_here; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval CREATE TABLE t ( + a INT NOT NULL + ) ENGINE=INNODB +PARTITION BY HASH (a) ( + PARTITION p1 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/' ENGINE = INNODB, + PARTITION p2 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/' ENGINE = INNODB +); +INSERT INTO t VALUES (1); + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW CREATE TABLE t; +ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW CREATE TABLE t; +ALTER TABLE t DROP PRIMARY KEY, ALGORITHM=COPY; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW CREATE TABLE t; +SET @TMP = @@GLOBAL.INNODB_FILE_PER_TABLE; +SET GLOBAL INNODB_FILE_PER_TABLE=OFF; +ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW CREATE TABLE t; +SET GLOBAL INNODB_FILE_PER_TABLE=@TMP; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO ( + PARTITION p1 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB, + PARTITION p2 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB +); +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW CREATE TABLE t; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO ( + PARTITION p1 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/', + PARTITION p2 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' +); +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW CREATE TABLE t; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO ( + PARTITION p1 INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB, + PARTITION p2 INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB +); +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW CREATE TABLE t; + +DROP TABLE t; + +SET @strict = @@innodb_strict_mode; +SET innodb_strict_mode=OFF; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval CREATE TABLE t ( + a INT NOT NULL + ) ENGINE=INNODB +PARTITION BY RANGE (a) + SUBPARTITION BY HASH (a) + SUBPARTITIONS 2 + ( + PARTITION p1 VALUES LESS THAN (7) + DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/' + INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/' + ENGINE = INNODB, + PARTITION p2 VALUES LESS THAN MAXVALUE + DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/' + INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/' + ENGINE = INNODB + ); +SET innodb_strict_mode=@strict; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval ALTER TABLE t +REORGANIZE PARTITION p1,p2 INTO +( + PARTITION p1 VALUES LESS THAN (7) + DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' + INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' + ENGINE = INNODB, + PARTITION p2 VALUES LESS THAN MAXVALUE + DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' + INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' + ENGINE = INNODB +); + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW CREATE TABLE t; + +DROP TABLE t; + +rmdir $MYSQLTEST_VARDIR/tmp/partitions_here/test; +rmdir $MYSQLTEST_VARDIR/tmp/partitions_here; + diff --git a/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result b/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result index 2e6b730f104..9362a213a07 100644 --- a/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result +++ b/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result @@ -52,14 +52,12 @@ INSERT DELAYED INTO t1 VALUES('39','1','1'); INSERT DELAYED INTO t1 VALUES('40','1','1'); INSERT DELAYED INTO t1 VALUES('41','1','1'); INSERT DELAYED INTO t1 VALUES('42','1','1'); -INSERT DELAYED INTO t1 VALUES('43','1','1');| +INSERT DELAYED INTO t1 VALUES('43','1','1'); connection con0; SELECT COUNT(*) FROM t1; connection default; ** Wait till con0 is blocked ** UNLOCK TABLES; -connection con1; -Asynchronous "reap" result connection con0; Asynchronous "reap" result The next result suffers from @@ -85,7 +83,6 @@ INSERT INTO t1 VALUES('5'); INSERT INTO t1 VALUES('6'); LOCK TABLE v1 READ; connection con1; -Asynchronous execute INSERT DELAYED INTO t1 VALUES('7'); INSERT DELAYED INTO t1 VALUES('8'); INSERT DELAYED INTO t1 VALUES('9'); @@ -101,23 +98,22 @@ INSERT DELAYED INTO t1 VALUES('18'); INSERT DELAYED INTO t1 VALUES('19'); INSERT DELAYED INTO t1 VALUES('20'); INSERT DELAYED INTO t1 VALUES('21'); -INSERT DELAYED INTO t1 VALUES('22');| +INSERT DELAYED INTO t1 VALUES('22'); connection con0; Asynchronous execute -SELECT COUNT(*) BETWEEN 6 AND 22 FROM t1; +SELECT COUNT(*) FROM t1; connection default; ** Wait till con0 is blocked ** UNLOCK TABLES; -connection con1; connection con0; Asynchronous "reap" result -COUNT(*) BETWEEN 6 AND 22 -1 +COUNT(*) +22 connection default; Checking if the delayed insert gives the same result afterwards -SELECT COUNT(*) BETWEEN 6 AND 22 FROM t1; -COUNT(*) BETWEEN 6 AND 22 -1 +SELECT COUNT(*) FROM t1; +COUNT(*) +22 connection default; DROP TABLE t1; DROP VIEW v1; diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result index fc0078581fb..2cb3fc76e30 100644 --- a/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result @@ -55,6 +55,12 @@ Warnings: Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '-2' set global innodb_change_buffering_debug=1e1; ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug' +set global innodb_change_buffering_debug=2; +Warnings: +Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '2' +select @@global.innodb_change_buffering_debug; +@@global.innodb_change_buffering_debug +1 SET @@global.innodb_change_buffering_debug = @start_global_value; SELECT @@global.innodb_change_buffering_debug; @@global.innodb_change_buffering_debug diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index e44b5a06e3d..ddd47f3c819 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -326,9 +326,9 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE INT UNSIGNED -VARIABLE_COMMENT Debug flags for InnoDB change buffering (0=none, 2=crash at merge) +VARIABLE_COMMENT Debug flags for InnoDB change buffering (0=none, 1=try to buffer) NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 2 +NUMERIC_MAX_VALUE 1 NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO diff --git a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test index fe0c579acf4..6a95dda3e57 100644 --- a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test +++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test @@ -63,8 +63,6 @@ LOCK TABLE v1 READ; connection con1; -delimiter |; -send INSERT DELAYED INTO t1 VALUES('7','1','1'); INSERT DELAYED INTO t1 VALUES('8','1','1'); INSERT DELAYED INTO t1 VALUES('9','1','1'); @@ -101,8 +99,7 @@ INSERT DELAYED INTO t1 VALUES('39','1','1'); INSERT DELAYED INTO t1 VALUES('40','1','1'); INSERT DELAYED INTO t1 VALUES('41','1','1'); INSERT DELAYED INTO t1 VALUES('42','1','1'); -INSERT DELAYED INTO t1 VALUES('43','1','1');| -delimiter ;| +INSERT DELAYED INTO t1 VALUES('43','1','1'); connection con0; let $wait_condition= @@ -121,10 +118,6 @@ let $wait_condition= --source include/wait_condition.inc UNLOCK TABLES; -connection con1; ---echo Asynchronous "reap" result -reap; - connection con0; --echo Asynchronous "reap" result --echo The next result suffers from @@ -161,10 +154,6 @@ LOCK TABLE v1 READ; connection con1; ---echo Asynchronous execute -delimiter |; - -send INSERT DELAYED INTO t1 VALUES('7'); INSERT DELAYED INTO t1 VALUES('8'); INSERT DELAYED INTO t1 VALUES('9'); @@ -180,9 +169,7 @@ INSERT DELAYED INTO t1 VALUES('18'); INSERT DELAYED INTO t1 VALUES('19'); INSERT DELAYED INTO t1 VALUES('20'); INSERT DELAYED INTO t1 VALUES('21'); -INSERT DELAYED INTO t1 VALUES('22');| - -delimiter ;| +INSERT DELAYED INTO t1 VALUES('22'); connection con0; let $wait_condition= @@ -192,7 +179,7 @@ let $wait_condition= --echo Asynchronous execute # Due to performance and server behaveiour the test observes values between 6 and 22. # In any case the value must not be outside of that range. -let $my_select= SELECT COUNT(*) BETWEEN 6 AND 22 FROM t1; +let $my_select= SELECT COUNT(*) FROM t1; send; eval $my_select; @@ -204,9 +191,6 @@ let $wait_condition= --source include/wait_condition.inc UNLOCK TABLES; -connection con1; -reap; - connection con0; --echo Asynchronous "reap" result reap; diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test index a6fc09f767e..70f8bee1523 100644 --- a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test @@ -48,9 +48,8 @@ set global innodb_change_buffering_debug='foo'; set global innodb_change_buffering_debug=-2; --error ER_WRONG_TYPE_FOR_VAR set global innodb_change_buffering_debug=1e1; -# The value 2 is supposed to kill the server if there are unmerged changes. -# Do not try to set the value to 2 or anything that can be clamped to 2. -#set global innodb_change_buffering_debug=2; +set global innodb_change_buffering_debug=2; +select @@global.innodb_change_buffering_debug; # # Cleanup diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result index e380c207555..d7ebb4dd096 100644 --- a/mysql-test/suite/versioning/r/alter.result +++ b/mysql-test/suite/versioning/r/alter.result @@ -642,3 +642,45 @@ create or replace table t1 (f1 int) with system versioning; alter table t1 drop system versioning, add f2 int with system versioning; ERROR HY000: Table `t1` is not system-versioned drop table t1; +# MDEV-16490 It's possible to make a system versioned table without any versioning field +set @@system_versioning_alter_history=keep; +create or replace table t (a int) with system versioning engine=innodb; +alter table t change column a a int without system versioning; +ERROR HY000: Table `t` must have at least one versioned column +alter table t +change column a a int without system versioning, +add column b int with system versioning; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING, + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +alter table t +change column a new_a int, +drop system versioning; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `new_a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +alter table t add system versioning; +alter table t change column new_a a int without system versioning; +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING, + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING +alter table t +add column c int, +change column c c int without system versioning, +change column b b int without system versioning; +ERROR HY000: Table `t` must have at least one versioned column +alter table t +add column c int without system versioning, +change column c c int, +change column b b int without system versioning; +drop database test; +create database test; diff --git a/mysql-test/suite/versioning/r/create.result b/mysql-test/suite/versioning/r/create.result index 47d069fc4ef..747da5483ec 100644 --- a/mysql-test/suite/versioning/r/create.result +++ b/mysql-test/suite/versioning/r/create.result @@ -527,3 +527,13 @@ row_end datetime(6) generated always as row end, period for system_time(row_start, row_end) ) with system versioning; ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t` +# MDEV-16490 It's possible to make a system versioned table without any versioning field +create or replace table t1 (x int without system versioning) +with system versioning +select 1 as y; +create or replace table t1 (x int without system versioning) +with system versioning +select 1 as x; +ERROR HY000: Table `t1` must have at least one versioned column +drop database test; +create database test; diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index b7e623b2897..4cab4798777 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.test @@ -543,3 +543,37 @@ alter table t1 drop system versioning, add f2 int with system versioning; drop table t1; --source suite/versioning/common_finish.inc +--echo # MDEV-16490 It's possible to make a system versioned table without any versioning field + +set @@system_versioning_alter_history=keep; +create or replace table t (a int) with system versioning engine=innodb; +--error ER_VERS_TABLE_MUST_HAVE_COLUMNS +alter table t change column a a int without system versioning; + +alter table t + change column a a int without system versioning, + add column b int with system versioning; +show create table t; + +alter table t + change column a new_a int, + drop system versioning; +show create table t; + +alter table t add system versioning; +alter table t change column new_a a int without system versioning; +show create table t; + +--error ER_VERS_TABLE_MUST_HAVE_COLUMNS +alter table t + add column c int, + change column c c int without system versioning, + change column b b int without system versioning; + +alter table t + add column c int without system versioning, + change column c c int, + change column b b int without system versioning; + +drop database test; +create database test; diff --git a/mysql-test/suite/versioning/t/create.test b/mysql-test/suite/versioning/t/create.test index 64858bbe0ec..c98c23f4c05 100644 --- a/mysql-test/suite/versioning/t/create.test +++ b/mysql-test/suite/versioning/t/create.test @@ -396,3 +396,14 @@ create table t ( ) with system versioning; --source suite/versioning/common_finish.inc +--echo # MDEV-16490 It's possible to make a system versioned table without any versioning field +create or replace table t1 (x int without system versioning) +with system versioning +select 1 as y; +--error ER_VERS_TABLE_MUST_HAVE_COLUMNS +create or replace table t1 (x int without system versioning) +with system versioning +select 1 as x; + +drop database test; +create database test; diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def index 276ed34f747..af99868fbed 100644 --- a/mysql-test/suite/wsrep/disabled.def +++ b/mysql-test/suite/wsrep/disabled.def @@ -11,6 +11,4 @@ ############################################################################## foreign_key : Sporadic failure "WSREP has not yet prepared node for application use" -variables : MDEV-19746 Galera test failures because of wsrep_slave_threads identification wsrep.pool_of_threads : Sporadic failure "WSREP has not yet prepared node for application use" -wsrep.variables : Global wsrep_on manipulation causes debug asserts diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index ba5daf05365..2591f21174b 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -220,9 +220,9 @@ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS) # without necessity.E.g source modifications, that do not # change list of exported symbols, will not result in a relink for plugins. - SET(MYSQLD_DEF ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.def) - SET(MYSQLD_EXP ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.exp) - SET(MYSQLD_LIB ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.lib) + SET(MYSQLD_DEF ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib${CMAKE_CFG_INTDIR}.def) + SET(MYSQLD_EXP ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib${CMAKE_CFG_INTDIR}.exp) + SET(MYSQLD_LIB ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib${CMAKE_CFG_INTDIR}.lib) SET(MYSQLD_CORELIBS sql mysys dbug strings) FOREACH (CORELIB ${MYSQLD_CORELIBS}) SET (LIB_LOCATIONS ${LIB_LOCATIONS} $<TARGET_FILE:${CORELIB}>) @@ -235,12 +235,12 @@ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS) # Create a cmake script to generate import and export libs # from a .def file SET(CMAKE_CONFIGURABLE_FILE_CONTENT " - IF ((mysqld_lib.def IS_NEWER_THAN mysqld_lib.lib) OR - (mysqld_lib.def IS_NEWER_THAN mysqld_lib.exp)) - FILE(REMOVE mysqld_lib.lib mysqld_lib.exp) + IF ((mysqld_lib\${CFG}.def IS_NEWER_THAN mysqld_lib\${CFG}.lib) OR + (mysqld_lib\${CFG}.def IS_NEWER_THAN mysqld_lib\${CFG}.exp)) + FILE(REMOVE mysqld_lib\${CFG}.lib mysqld_lib\${CFG}.exp) SET(ENV{VS_UNICODE_OUTPUT}) EXECUTE_PROCESS ( - COMMAND \"${CMAKE_LINKER}\" /lib /NAME:mysqld.exe \"/DEF:${MYSQLD_DEF}\" /MACHINE:${_PLATFORM} + COMMAND \"${CMAKE_LINKER}\" /lib /NAME:mysqld.exe \"/DEF:${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib\${CFG}.def\" /MACHINE:${_PLATFORM} RESULT_VARIABLE ret) IF(NOT ret EQUAL 0) MESSAGE(FATAL_ERROR \"process failed ret=\${ret}\") @@ -250,41 +250,22 @@ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS) CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/cmake/configurable_file_content.in - make_mysqld_lib.cmake) + make_mysqld_lib.cmake + @ONLY) IF(CMAKE_VERSION VERSION_GREATER "3.2.0") SET(MYSQLD_LIB_BYPRODUCTS BYPRODUCTS ${MYSQLD_DEF} ${MYSQLD_LIB} ${MYSQLD_EXP}) ENDIF() - # Create a cmake script to generate import and export libs - # from a .def file - SET(CMAKE_CONFIGURABLE_FILE_CONTENT " - IF ((mysqld_lib.def IS_NEWER_THAN mysqld_lib.lib) OR - (mysqld_lib.def IS_NEWER_THAN mysqld_lib.exp)) - FILE(REMOVE mysqld_lib.lib mysqld_lib.exp) - SET(ENV{VS_UNICODE_OUTPUT}) - EXECUTE_PROCESS ( - COMMAND \"${CMAKE_LINKER}\" /lib /NAME:mysqld.exe \"/DEF:${MYSQLD_DEF}\" /MACHINE:${_PLATFORM} - RESULT_VARIABLE ret) - IF(NOT ret EQUAL 0) - MESSAGE(FATAL_ERROR \"process failed ret=\${ret}\") - ENDIF() - ENDIF() - ") - - CONFIGURE_FILE( - ${PROJECT_SOURCE_DIR}/cmake/configurable_file_content.in - make_mysqld_lib.cmake) - ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.stamp ${MYSQLD_LIB_BYPRODUCTS} - COMMENT "Generating mysqld_lib.def, mysqld_lib.lib, mysqld_lib.exp" + COMMENT "Generating ${MYSQLD_DEF}, ${MYSQLD_LIB}, ${MYSQLD_EXP}" COMMAND cscript //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js - ${_PLATFORM} /forLib ${LIB_LOCATIONS} > mysqld_lib.def.tmp - COMMAND ${CMAKE_COMMAND} -E copy_if_different mysqld_lib.def.tmp mysqld_lib.def - COMMAND ${CMAKE_COMMAND} -E remove mysqld_lib.def.tmp - COMMAND ${CMAKE_COMMAND} -P make_mysqld_lib.cmake + ${_PLATFORM} /forLib ${LIB_LOCATIONS} > ${MYSQLD_DEF}.tmp + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MYSQLD_DEF}.tmp ${MYSQLD_DEF} + COMMAND ${CMAKE_COMMAND} -E remove ${MYSQLD_DEF}.tmp + COMMAND ${CMAKE_COMMAND} "-DCFG=${CMAKE_CFG_INTDIR}" -P make_mysqld_lib.cmake COMMAND ${CMAKE_COMMAND} -E touch mysqld_lib.stamp WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${MYSQLD_CORELIBS} diff --git a/sql/events.cc b/sql/events.cc index 166fa992f88..242689f8370 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -1202,6 +1202,46 @@ Events::load_events_from_db(THD *thd) delete et; goto end; } + +#ifdef WITH_WSREP + /** + IF SST is done from a galera node that is also acting as MASTER + newly synced node in galera eco-system will also copy-over the event state + enabling duplicate event in galera eco-system. + DISABLE such events if the current node is not event orginator. + (Also, make sure you skip disabling it if is already disabled to avoid + creation of redundant action) + NOTE: + This complete system relies on server-id. Ideally server-id should be + same for all nodes of galera eco-system but they aren't same. + Infact, based on galera use-case it seems like it recommends to have each + node with different server-id. + */ + if (et->originator != thd->variables.server_id) + { + if (et->status == Event_parse_data::SLAVESIDE_DISABLED) + continue; + + store_record(table, record[1]); + table->field[ET_FIELD_STATUS]-> + store((longlong) Event_parse_data::SLAVESIDE_DISABLED, + TRUE); + + /* All the dmls to mysql.events tables are stmt bin-logged. */ + bool save_binlog_row_based; + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->set_current_stmt_binlog_format_stmt(); + + (void) table->file->ha_update_row(table->record[1], table->record[0]); + + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); + + delete et; + continue; + } +#endif /* WITH_WSREP */ + /** Since the Event_queue_element object could be deleted inside Event_queue::create_event we should save the value of dropped flag diff --git a/sql/handler.cc b/sql/handler.cc index 5f0c8e0b5ec..7db7f95daa7 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -7331,8 +7331,7 @@ bool Vers_parse_info::fix_implicit(THD *thd, Alter_info *alter_info) bool Table_scope_and_contents_source_st::vers_fix_system_fields( - THD *thd, Alter_info *alter_info, const TABLE_LIST &create_table, - bool create_select) + THD *thd, Alter_info *alter_info, const TABLE_LIST &create_table) { DBUG_ASSERT(!(alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING)); @@ -7372,41 +7371,59 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields( if (vers_info.fix_implicit(thd, alter_info)) return true; - int plain_cols= 0; // columns don't have WITH or WITHOUT SYSTEM VERSIONING - int vers_cols= 0; // columns have WITH SYSTEM VERSIONING - it.rewind(); - while (const Create_field *f= it++) - { - if (vers_info.is_start(*f) || vers_info.is_end(*f)) - continue; - - if (f->versioning == Column_definition::VERSIONING_NOT_SET) - plain_cols++; - else if (f->versioning == Column_definition::WITH_VERSIONING) - vers_cols++; - } - - if (!thd->lex->tmp_table() && - // CREATE from SELECT (Create_fields are not yet added) - !create_select && vers_cols == 0 && (plain_cols == 0 || !vers_info)) - { - my_error(ER_VERS_TABLE_MUST_HAVE_COLUMNS, MYF(0), - create_table.table_name.str); - return true; - } - return false; } bool Table_scope_and_contents_source_st::vers_check_system_fields( - THD *thd, Alter_info *alter_info, const TABLE_LIST &create_table) + THD *thd, Alter_info *alter_info, const Lex_table_name &table_name, + const Lex_table_name &db, int select_count) { if (!(options & HA_VERSIONED_TABLE)) return false; - return vers_info.check_sys_fields( - create_table.table_name, create_table.db, alter_info, - ha_check_storage_engine_flag(db_type, HTON_NATIVE_SYS_VERSIONING)); + + if (!(alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING)) + { + uint versioned_fields= 0; + uint fieldnr= 0; + List_iterator<Create_field> field_it(alter_info->create_list); + while (Create_field *f= field_it++) + { + /* + The field from the CREATE part can be duplicated in the SELECT part of + CREATE...SELECT. In that case double counts should be avoided. + select_create::create_table_from_items just pushes the fields back into + the create_list, without additional manipulations, so the fields from + SELECT go last there. + */ + bool is_dup= false; + if (fieldnr >= alter_info->create_list.elements - select_count) + { + List_iterator<Create_field> dup_it(alter_info->create_list); + for (Create_field *dup= dup_it++; !is_dup && dup != f; dup= dup_it++) + is_dup= my_strcasecmp(default_charset_info, + dup->field_name.str, f->field_name.str) == 0; + } + + if (!(f->flags & VERS_UPDATE_UNVERSIONED_FLAG) && !is_dup) + versioned_fields++; + fieldnr++; + } + if (versioned_fields == VERSIONING_FIELDS) + { + my_error(ER_VERS_TABLE_MUST_HAVE_COLUMNS, MYF(0), table_name.str); + return true; + } + } + + if (!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING)) + return false; + + bool can_native= ha_check_storage_engine_flag(db_type, + HTON_NATIVE_SYS_VERSIONING) + || db_type->db_type == DB_TYPE_PARTITION_DB; + + return vers_info.check_sys_fields(table_name, db, alter_info, can_native); } @@ -7510,20 +7527,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info, return false; } - if (fix_implicit(thd, alter_info)) - return true; - - if (alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING) - { - const bool can_native= - ha_check_storage_engine_flag(create_info->db_type, - HTON_NATIVE_SYS_VERSIONING) || - create_info->db_type->db_type == DB_TYPE_PARTITION_DB; - if (check_sys_fields(table_name, share->db, alter_info, can_native)) - return true; - } - - return false; + return fix_implicit(thd, alter_info); } bool @@ -7731,10 +7735,12 @@ bool Table_period_info::check_field(const Create_field* f, } bool Table_scope_and_contents_source_st::check_fields( - THD *thd, Alter_info *alter_info, TABLE_LIST &create_table) + THD *thd, Alter_info *alter_info, + const Lex_table_name &table_name, const Lex_table_name &db, int select_count) { - return vers_check_system_fields(thd, alter_info, create_table) - || check_period_fields(thd, alter_info); + return vers_check_system_fields(thd, alter_info, + table_name, db, select_count) || + check_period_fields(thd, alter_info); } bool Table_scope_and_contents_source_st::check_period_fields( @@ -7783,10 +7789,9 @@ bool Table_scope_and_contents_source_st::check_period_fields( bool Table_scope_and_contents_source_st::fix_create_fields(THD *thd, Alter_info *alter_info, - const TABLE_LIST &create_table, - bool create_select) + const TABLE_LIST &create_table) { - return vers_fix_system_fields(thd, alter_info, create_table, create_select) + return vers_fix_system_fields(thd, alter_info, create_table) || fix_period_fields(thd, alter_info); } diff --git a/sql/handler.h b/sql/handler.h index 4f66aed3b6f..89af002b1dc 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -2168,18 +2168,22 @@ struct Table_scope_and_contents_source_st: } bool fix_create_fields(THD *thd, Alter_info *alter_info, - const TABLE_LIST &create_table, - bool create_select= false); + const TABLE_LIST &create_table); bool fix_period_fields(THD *thd, Alter_info *alter_info); - bool check_fields(THD *thd, Alter_info *alter_info, TABLE_LIST &create_table); + bool check_fields(THD *thd, Alter_info *alter_info, + const Lex_table_name &table_name, + const Lex_table_name &db, + int select_count= 0); bool check_period_fields(THD *thd, Alter_info *alter_info); bool vers_fix_system_fields(THD *thd, Alter_info *alter_info, - const TABLE_LIST &create_table, - bool create_select= false); + const TABLE_LIST &create_table); bool vers_check_system_fields(THD *thd, Alter_info *alter_info, - const TABLE_LIST &create_table); + const Lex_table_name &table_name, + const Lex_table_name &db, + int select_count= 0); + }; diff --git a/sql/item_func.cc b/sql/item_func.cc index 88f36cf1e98..10ac0f74644 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1235,17 +1235,22 @@ bool Item_func_minus::fix_length_and_dec() if (Item_func_minus::type_handler()->Item_func_minus_fix_length_and_dec(this)) DBUG_RETURN(TRUE); DBUG_PRINT("info", ("Type: %s", type_handler()->name().ptr())); - m_sql_mode_dependency= Item_func::value_depends_on_sql_mode(); - if (unsigned_flag) - { - m_sql_mode_dependency|= Sql_mode_dependency(0,MODE_NO_UNSIGNED_SUBTRACTION); - if (current_thd->variables.sql_mode & MODE_NO_UNSIGNED_SUBTRACTION) - unsigned_flag= false; - } + if ((m_depends_on_sql_mode_no_unsigned_subtraction= unsigned_flag) && + (current_thd->variables.sql_mode & MODE_NO_UNSIGNED_SUBTRACTION)) + unsigned_flag= false; DBUG_RETURN(FALSE); } +Sql_mode_dependency Item_func_minus::value_depends_on_sql_mode() const +{ + Sql_mode_dependency dep= Item_func_additive_op::value_depends_on_sql_mode(); + if (m_depends_on_sql_mode_no_unsigned_subtraction) + dep|= Sql_mode_dependency(0, MODE_NO_UNSIGNED_SUBTRACTION); + return dep; +} + + double Item_func_minus::real_op() { double value= args[0]->val_real() - args[1]->val_real(); diff --git a/sql/item_func.h b/sql/item_func.h index a48e1895a5f..51ade5a9068 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1342,16 +1342,15 @@ public: class Item_func_minus :public Item_func_additive_op { - Sql_mode_dependency m_sql_mode_dependency; + bool m_depends_on_sql_mode_no_unsigned_subtraction; public: Item_func_minus(THD *thd, Item *a, Item *b): - Item_func_additive_op(thd, a, b) {} + Item_func_additive_op(thd, a, b), + m_depends_on_sql_mode_no_unsigned_subtraction(false) + { } const char *func_name() const { return "-"; } enum precedence precedence() const { return ADD_PRECEDENCE; } - Sql_mode_dependency value_depends_on_sql_mode() const - { - return m_sql_mode_dependency; - } + Sql_mode_dependency value_depends_on_sql_mode() const; longlong int_op(); double real_op(); my_decimal *decimal_op(my_decimal *); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7b36bcf861a..9988cdeab74 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1878,6 +1878,7 @@ extern "C" void unireg_abort(int exit_code) #ifdef WITH_WSREP if (WSREP_ON && + Wsrep_server_state::is_inited() && Wsrep_server_state::instance().state() != wsrep::server_state::s_disconnected) { /* @@ -4944,6 +4945,7 @@ static int init_server_components() #ifdef WITH_WSREP if (wsrep_init_server()) unireg_abort(1); + if (WSREP_ON && !wsrep_recovery && !opt_abort) { if (opt_bootstrap) // bootsrap option given - disable wsrep functionality diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 4cb8750ccf8..dfbacccc169 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7340,6 +7340,8 @@ ER_NO_EIS_FOR_FIELD ER_WARN_AGGFUNC_DEPENDENCE eng "Aggregate function '%-.192s)' of SELECT #%d belongs to SELECT #%d" ukr "Агрегатна функція '%-.192s)' з SELECTу #%d належить до SELECTу #%d" +WARN_INNODB_PARTITION_OPTION_IGNORED + eng "<%-.64s> option ignored for InnoDB partition" # # Internal errors, not used diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index bf21a717fed..4180089a501 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4200,7 +4200,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, if (!opt_explicit_defaults_for_timestamp) promote_first_timestamp_column(&alter_info->create_list); - if (create_info->fix_create_fields(thd, alter_info, *create_table, true)) + if (create_info->fix_create_fields(thd, alter_info, *create_table)) DBUG_RETURN(NULL); while ((item=it++)) @@ -4240,7 +4240,10 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, alter_info->create_list.push_back(cr_field, thd->mem_root); } - if (create_info->check_fields(thd, alter_info, *create_table)) + if (create_info->check_fields(thd, alter_info, + create_table->table_name, + create_table->db, + select_field_count)) DBUG_RETURN(NULL); DEBUG_SYNC(thd,"create_table_select_before_create"); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index a0fd64c72ad..802e62585d4 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4788,6 +4788,69 @@ bool compare_partition_options(HA_CREATE_INFO *table_create_info, } +/** + Check if the ALTER command tries to change DATA DIRECTORY + or INDEX DIRECTORY for its partitions and warn if so. + @param thd THD + @param part_elem partition_element to check + */ +static void warn_if_datadir_altered(THD *thd, + const partition_element *part_elem) +{ + DBUG_ASSERT(part_elem); + + if (part_elem->engine_type && + part_elem->engine_type->db_type != DB_TYPE_INNODB) + return; + + if (part_elem->data_file_name) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + WARN_INNODB_PARTITION_OPTION_IGNORED, + ER(WARN_INNODB_PARTITION_OPTION_IGNORED), + "DATA DIRECTORY"); + } + if (part_elem->index_file_name) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + WARN_INNODB_PARTITION_OPTION_IGNORED, + ER(WARN_INNODB_PARTITION_OPTION_IGNORED), + "INDEX DIRECTORY"); + } +} + + +/** + Currently changing DATA DIRECTORY and INDEX DIRECTORY for InnoDB partitions is + not possible. This function checks it and warns on that case. + @param thd THD + @param tab_part_info old partition info + @param alt_part_info new partition info + */ +static void check_datadir_altered_for_innodb(THD *thd, + partition_info *tab_part_info, + partition_info *alt_part_info) +{ + if (tab_part_info->default_engine_type->db_type != DB_TYPE_INNODB) + return; + + for (List_iterator_fast<partition_element> it(alt_part_info->partitions); + partition_element *part_elem= it++;) + { + if (alt_part_info->is_sub_partitioned()) + { + for (List_iterator_fast<partition_element> it2(part_elem->subpartitions); + const partition_element *sub_part_elem= it2++;) + { + warn_if_datadir_altered(thd, sub_part_elem); + } + } + else + warn_if_datadir_altered(thd, part_elem); + } +} + + /* Prepare for ALTER TABLE of partition structure @@ -5623,6 +5686,8 @@ state of p1. { goto err; } + check_datadir_altered_for_innodb(thd, tab_part_info, alt_part_info); + /* Online handling: REORGANIZE PARTITION: diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9d540d18c7d..4128942f4fc 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -8711,13 +8711,6 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, } } - if (table->versioned() && !(alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING) && - new_create_list.elements == VERSIONING_FIELDS) - { - my_error(ER_VERS_TABLE_MUST_HAVE_COLUMNS, MYF(0), table->s->table_name.str); - goto err; - } - if (!create_info->comment.str) { create_info->comment.str= table->s->comment.str; @@ -9802,8 +9795,9 @@ do_continue:; set_table_default_charset(thd, create_info, alter_ctx.db); - if (create_info->check_period_fields(thd, alter_info) - || create_info->fix_period_fields(thd, alter_info)) + if (create_info->check_fields(thd, alter_info, + table_list->table_name, table_list->db) || + create_info->fix_period_fields(thd, alter_info)) DBUG_RETURN(true); if (!opt_explicit_defaults_for_timestamp) @@ -10319,7 +10313,7 @@ do_continue:; close_all_tables_for_name(thd, table->s, alter_ctx.is_table_renamed() ? - HA_EXTRA_PREPARE_FOR_RENAME: + HA_EXTRA_PREPARE_FOR_RENAME: HA_EXTRA_NOT_USED, NULL); table_list->table= table= NULL; /* Safety */ @@ -10533,7 +10527,7 @@ bool mysql_trans_prepare_alter_copy_data(THD *thd) /* Turn off recovery logging since rollback of an alter table is to delete the new table so there is no need to log the changes to it. - + This needs to be done before external_lock. */ DBUG_RETURN(ha_enable_transaction(thd, FALSE) != 0); @@ -10690,7 +10684,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, { char warn_buff[MYSQL_ERRMSG_SIZE]; Abort_on_warning_instant_set aws(thd, false); - my_snprintf(warn_buff, sizeof(warn_buff), + my_snprintf(warn_buff, sizeof(warn_buff), "ORDER BY ignored as there is a user-defined clustered index" " in the table '%-.192s'", from->s->table_name.str); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, @@ -11458,7 +11452,8 @@ bool Sql_cmd_create_table_like::execute(THD *thd) else { if (create_info.fix_create_fields(thd, &alter_info, *create_table) || - create_info.check_fields(thd, &alter_info, *create_table)) + create_info.check_fields(thd, &alter_info, + create_table->table_name, create_table->db)) goto end_with_restore_list; /* diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 49ca047e89b..440a27d2e35 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7139,7 +7139,8 @@ field_length: '(' LONG_NUM ')' { $$= $2.str; } | '(' ULONGLONG_NUM ')' { $$= $2.str; } | '(' DECIMAL_NUM ')' { $$= $2.str; } - | '(' NUM ')' { $$= $2.str; }; + | '(' NUM ')' { $$= $2.str; } + ; opt_field_length: /* empty */ { $$= (char*) 0; /* use default length */ } @@ -7758,7 +7759,8 @@ string_list: text_string { Lex->last_field->interval_list.push_back($1, thd->mem_root); } | string_list ',' text_string - { Lex->last_field->interval_list.push_back($3, thd->mem_root); }; + { Lex->last_field->interval_list.push_back($3, thd->mem_root); } + ; /* ** Alter table @@ -14905,7 +14907,8 @@ line_term: opt_xml_rows_identified_by: /* empty */ { } | ROWS_SYM IDENTIFIED_SYM BY text_string - { Lex->exchange->line_term = $4; }; + { Lex->exchange->line_term = $4; } + ; opt_ignore_lines: /* empty */ @@ -17514,7 +17517,7 @@ opt_release: { $$= TVL_UNKNOWN; } | RELEASE_SYM { $$= TVL_YES; } | NO_SYM RELEASE_SYM { $$= TVL_NO; } -; + ; commit: COMMIT_SYM opt_work opt_chain opt_release @@ -17989,9 +17992,9 @@ uninstall: /* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */ keep_gcc_happy: IMPOSSIBLE_ACTION - { - YYERROR; - } + { + YYERROR; + } ; /** diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index cff3a5be47c..f976c1f68e1 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -13,7 +13,7 @@ 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* sql_yacc.yy */ @@ -7190,7 +7190,8 @@ field_length: '(' LONG_NUM ')' { $$= $2.str; } | '(' ULONGLONG_NUM ')' { $$= $2.str; } | '(' DECIMAL_NUM ')' { $$= $2.str; } - | '(' NUM ')' { $$= $2.str; }; + | '(' NUM ')' { $$= $2.str; } + ; opt_field_length: /* empty */ { $$= (char*) 0; /* use default length */ } @@ -7849,7 +7850,8 @@ string_list: text_string { Lex->last_field->interval_list.push_back($1, thd->mem_root); } | string_list ',' text_string - { Lex->last_field->interval_list.push_back($3, thd->mem_root); }; + { Lex->last_field->interval_list.push_back($3, thd->mem_root); } + ; /* ** Alter table @@ -15027,7 +15029,8 @@ line_term: opt_xml_rows_identified_by: /* empty */ { } | ROWS_SYM IDENTIFIED_SYM BY text_string - { Lex->exchange->line_term = $4; }; + { Lex->exchange->line_term = $4; } + ; opt_ignore_lines: /* empty */ @@ -17734,7 +17737,7 @@ opt_release: { $$= TVL_UNKNOWN; } | RELEASE_SYM { $$= TVL_YES; } | NO_SYM RELEASE_SYM { $$= TVL_NO; } -; + ; commit: COMMIT_SYM opt_work opt_chain opt_release @@ -18221,9 +18224,9 @@ uninstall: /* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */ keep_gcc_happy: IMPOSSIBLE_ACTION - { - YYERROR; - } + { + YYERROR; + } ; /** diff --git a/sql/threadpool_win.cc b/sql/threadpool_win.cc index 50fde8b52b3..c9968d48c06 100644 --- a/sql/threadpool_win.cc +++ b/sql/threadpool_win.cc @@ -268,6 +268,7 @@ TP_connection_win::~TP_connection_win() if (timer) { + SetThreadpoolTimer(timer, 0, 0, 0); WaitForThreadpoolTimerCallbacks(timer, TRUE); CloseThreadpoolTimer(timer); } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 22b274bef1b..8fee6e8fffc 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -47,7 +47,6 @@ #include <string> #include "log_event.h" #include <slave.h> -#include "sql_plugin.h" /* wsrep_plugins_pre_init() */ #include <sstream> diff --git a/sql/wsrep_server_state.h b/sql/wsrep_server_state.h index 34ff4105180..1ef937300f6 100644 --- a/sql/wsrep_server_state.h +++ b/sql/wsrep_server_state.h @@ -35,11 +35,17 @@ public: const wsrep::gtid& initial_position, int max_protocol_version); static void destroy(); + static Wsrep_server_state& instance() { return *m_instance; } + static bool is_inited() + { + return (m_instance != NULL); + } + static wsrep::provider& get_provider() { return instance().provider(); diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index fd0ed4cb232..2731211db72 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -2972,7 +2972,7 @@ btr_cur_open_at_rnd_pos_func( index->table->file_unreadable = true; } - goto exit_loop; + break; } page = buf_block_get_frame(block); @@ -3129,12 +3129,11 @@ btr_cur_open_at_rnd_pos_func( n_blocks++; } - exit_loop: if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } - return(true); + return err == DB_SUCCESS; } /*==================== B-TREE INSERT =========================*/ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9f4c04741b6..c592dfaf0b8 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19225,8 +19225,8 @@ static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method, #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug, PLUGIN_VAR_RQCMDARG, - "Debug flags for InnoDB change buffering (0=none, 2=crash at merge)", - NULL, NULL, 0, 0, 2, 0); + "Debug flags for InnoDB change buffering (0=none, 1=try to buffer)", + NULL, NULL, 0, 0, 1, 0); static MYSQL_SYSVAR_BOOL(disable_background_merge, srv_ibuf_disable_background_merge, diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index f280c735e05..5a7360e516a 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -9139,7 +9139,7 @@ innobase_rename_or_enlarge_column_try( case DATA_BLOB: break; default: - ut_ad(col->prtype == prtype); + ut_ad(!((col->prtype ^ prtype) & ~DATA_VERSIONED)); ut_ad(col->mtype == mtype); ut_ad(col->len == len); } diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 5ea6f7d1783..51498712c1c 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -4182,23 +4182,6 @@ ibuf_delete_rec( ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no); ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space); -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG - if (ibuf_debug == 2) { - /* Inject a fault (crash). We do this before trying - optimistic delete, because a pessimistic delete in the - change buffer would require a larger test case. */ - - /* Flag the buffered record as processed, to avoid - an assertion failure after crash recovery. */ - btr_cur_set_deleted_flag_for_ibuf( - btr_pcur_get_rec(pcur), NULL, TRUE, mtr); - - ibuf_mtr_commit(mtr); - log_write_up_to(LSN_MAX, true); - DBUG_SUICIDE(); - } -#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), 0, mtr); diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 4136dd5e327..a3cf4e9dea0 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -2005,7 +2005,7 @@ dberr_t trx_undo_report_rename(trx_t* trx, const dict_table_t* table) ut_ad(err == DB_SUCCESS); ut_ad(undo); for (ut_d(int loop_count = 0);;) { - ut_ad(++loop_count < 2); + ut_ad(loop_count++ < 2); ut_ad(undo->last_page_no == block->page.id.page_no()); if (ulint offset = trx_undo_page_report_rename( diff --git a/strings/json_lib.c b/strings/json_lib.c index 11ca6f61322..b00d0e29626 100644 --- a/strings/json_lib.c +++ b/strings/json_lib.c @@ -320,15 +320,17 @@ static int json_handle_esc(json_string_t *s) if (s->c_next != '\\') return s->error= JE_SYN; + s->c_str+= c_len; if ((c_len= json_next_char(s)) <= 0) return s->error= json_eos(s) ? JE_EOS : JE_BAD_CHR; if (s->c_next != 'u') return s->error= JE_SYN; + s->c_str+= c_len; if (read_4_hexdigits(s, code+2)) return 1; - if ((c_len= my_utf16_uni(0, &s->c_next, code, code+4)) == 2) + if ((c_len= my_utf16_uni(0, &s->c_next, code, code+4)) == 4) return 0; } return s->error= JE_BAD_CHR; |