revision-id: 89137263ae49d2818e1a4ff9b3726c0cf6bdd6bc (mariadb-10.3.6-159-g89137263ae4) parent(s): 0f85f09fd77be9479bd603e467c76b8856deafed 187f570b239749224c0a1b25d5cc458459f926a4 author: Jan Lindström committer: Jan Lindström timestamp: 2018-10-13 15:54:22 +0300 message: Merge remote-tracking branch 'maria-wsrep/10.4-wsrep_api-26' into 10.4 CMakeLists.txt | 8 +- cmake/wsrep.cmake | 11 + include/mysql/service_wsrep.h | 2 +- include/wsrep.h | 29 +-- mysql-test/suite/galera/r/galera_defaults.result | 5 + .../galera/r/galera_ist_innodb_flush_logs.result | 11 + .../suite/galera/r/galera_ist_xtrabackup-v2.result | 11 + mysql-test/suite/galera/r/galera_kill_ddl.result | 2 +- .../suite/galera/r/galera_kill_largechanges.result | 2 +- .../suite/galera/r/galera_kill_smallchanges.result | 2 +- .../suite/galera/r/galera_var_slave_threads.result | 92 ++++++++ mysql-test/suite/galera/r/galera_wan.result | 4 +- sql/handler.cc | 20 +- sql/handler.h | 2 + sql/log.cc | 11 +- sql/log.h | 5 +- sql/mysqld.cc | 13 +- sql/protocol.cc | 2 + sql/sp_head.cc | 4 +- sql/sql_alter.cc | 4 +- sql/sql_base.cc | 5 +- sql/sql_basic_types.h | 2 + sql/sql_class.cc | 5 +- sql/sql_class.h | 5 +- sql/sql_insert.cc | 8 +- sql/sql_parse.cc | 26 ++- sql/sql_plugin.cc | 2 - sql/sql_truncate.cc | 9 +- sql/table_cache.cc | 4 +- sql/wsrep_client_service.cc | 2 +- sql/wsrep_client_service.h | 6 +- sql/wsrep_client_state.h | 2 +- sql/wsrep_condition_variable.h | 2 +- sql/wsrep_dummy.cc | 31 +-- sql/wsrep_high_priority_service.cc | 2 +- sql/wsrep_mutex.h | 2 +- sql/wsrep_mysqld.cc | 241 +++++++++------------ sql/wsrep_mysqld.h | 90 ++++---- sql/wsrep_server_service.cc | 8 +- sql/wsrep_server_service.h | 6 +- sql/wsrep_server_state.h | 4 +- sql/wsrep_sst.cc | 20 +- sql/wsrep_sst.h | 4 +- sql/wsrep_storage_service.cc | 14 +- sql/wsrep_thd.h | 6 +- sql/wsrep_trans_observer.h | 6 +- sql/wsrep_var.cc | 12 +- sql/wsrep_var.h | 5 +- storage/innobase/handler/ha_innodb.cc | 32 ++- storage/innobase/row/row0upd.cc | 3 +- storage/innobase/srv/srv0srv.cc | 2 + wsrep-lib | 2 +- 52 files changed, 467 insertions(+), 341 deletions(-) diff --cc include/mysql/service_wsrep.h index 82fecdb3d2e,0f6d2a46108..e695229fb9d --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@@ -134,9 -132,8 +134,9 @@@ extern my_bool wsrep_load_data_splittin extern my_bool wsrep_drupal_282555_workaround; extern my_bool wsrep_recovery; extern long wsrep_protocol_version; +extern my_thread_id wsrep_thd_thread_id(THD *thd); - + -extern "C" bool wsrep_consistency_check(THD *thd); +bool wsrep_consistency_check(THD *thd); bool wsrep_prepare_key_for_innodb(THD* thd, const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len); extern "C" const char *wsrep_thd_query(const void* thd); int wsrep_is_wsrep_xid(const void* xid); diff --cc include/wsrep.h index 77d50fc7678,9dd99b92056..f0e1d2087db --- a/include/wsrep.h +++ b/include/wsrep.h @@@ -33,9 -33,9 +33,9 @@@ table_list_, alter_info_)) \ goto error; --#define WSREP_TO_ISOLATION_END \ - if ((WSREP(thd) && thd && wsrep_thd_is_local_toi(thd)) || \ - if ((WSREP(thd) && thd && wsrep_thd_is_local_toi(thd)) || \ -- wsrep_thd_is_in_rsu(thd)) \ ++#define WSREP_TO_ISOLATION_END \ ++ if (WSREP_ON && WSREP(thd) && (wsrep_thd_is_local_toi(thd) || \ ++ wsrep_thd_is_in_rsu(thd))) \ wsrep_to_isolation_end(thd); /* diff --cc mysql-test/suite/galera/r/galera_defaults.result index 9590ed2963b,381b334908e..39345036876 --- a/mysql-test/suite/galera/r/galera_defaults.result +++ b/mysql-test/suite/galera/r/galera_defaults.result @@@ -63,8 -63,76 +63,13 @@@ WSREP_SYNC_WAIT 1 WSREP_TRX_FRAGMENT_SIZE 0 WSREP_TRX_FRAGMENT_UNIT bytes <BASE_DIR>; <BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT30S; evs.info_log_mask = 0; evs.install_timeout = PT15S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT10S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 1; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.recover = yes; gcache.size = 10M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <GCS_RECV_Q_HARD_LIMIT>; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <G MCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = PT30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; <REPL_PROTO_MAX>; socket.checksum = 2; socket.recv_buf_size = 212992; -SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS -WHERE VARIABLE_NAME LIKE 'wsrep_%' -AND VARIABLE_NAME != 'wsrep_debug_sync_waiters'; -COUNT(*) -63 -SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_STATUS -WHERE VARIABLE_NAME LIKE 'wsrep_%' -AND VARIABLE_NAME != 'wsrep_debug_sync_waiters' -ORDER BY VARIABLE_NAME; -VARIABLE_NAME -WSREP_APPLY_OOOE -WSREP_APPLY_OOOL -WSREP_APPLY_WINDOW -WSREP_CAUSAL_READS -WSREP_CERT_DEPS_DISTANCE -WSREP_CERT_INDEX_SIZE -WSREP_CERT_INTERVAL WSREP_CLUSTER_CAPABILITIES -WSREP_CLUSTER_CONF_ID -WSREP_CLUSTER_SIZE -WSREP_CLUSTER_STATE_UUID -WSREP_CLUSTER_STATUS WSREP_CLUSTER_WEIGHT -WSREP_COMMIT_OOOE -WSREP_COMMIT_OOOL -WSREP_COMMIT_WINDOW -WSREP_CONNECTED -WSREP_DESYNC_COUNT -WSREP_EVS_DELAYED -WSREP_EVS_EVICT_LIST -WSREP_EVS_REPL_LATENCY -WSREP_EVS_STATE -WSREP_FLOW_CONTROL_PAUSED -WSREP_FLOW_CONTROL_PAUSED_NS -WSREP_FLOW_CONTROL_RECV -WSREP_FLOW_CONTROL_SENT -WSREP_GCOMM_UUID -WSREP_INCOMING_ADDRESSES -WSREP_LAST_COMMITTED -WSREP_LOCAL_BF_ABORTS -WSREP_LOCAL_CACHED_DOWNTO -WSREP_LOCAL_CERT_FAILURES -WSREP_LOCAL_COMMITS -WSREP_LOCAL_INDEX -WSREP_LOCAL_RECV_QUEUE -WSREP_LOCAL_RECV_QUEUE_AVG -WSREP_LOCAL_RECV_QUEUE_MAX -WSREP_LOCAL_RECV_QUEUE_MIN -WSREP_LOCAL_REPLAYS -WSREP_LOCAL_SEND_QUEUE -WSREP_LOCAL_SEND_QUEUE_AVG -WSREP_LOCAL_SEND_QUEUE_MAX -WSREP_LOCAL_SEND_QUEUE_MIN -WSREP_LOCAL_STATE -WSREP_LOCAL_STATE_COMMENT -WSREP_LOCAL_STATE_UUID WSREP_OPEN_CONNECTIONS WSREP_OPEN_TRANSACTIONS -WSREP_PROTOCOL_VERSION WSREP_PROVIDER_CAPABILITIES -WSREP_PROVIDER_NAME -WSREP_PROVIDER_VENDOR -WSREP_PROVIDER_VERSION -WSREP_READY -WSREP_RECEIVED -WSREP_RECEIVED_BYTES -WSREP_REPLICATED -WSREP_REPLICATED_BYTES -WSREP_REPL_DATA_BYTES -WSREP_REPL_KEYS -WSREP_REPL_KEYS_BYTES -WSREP_REPL_OTHER_BYTES -WSREP_THREAD_COUNT ++WSREP_CLUSTER_CAPABILITIES ++WSREP_CLUSTER_WEIGHT ++WSREP_OPEN_CONNECTIONS ++WSREP_OPEN_TRANSACTIONS ++WSREP_PROVIDER_CAPABILITIES diff --cc mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result index 146cae1e896,cad00aaee48..2f74beb7e82 --- a/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result +++ b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result @@@ -96,15 -96,111 +96,26 @@@ COUNT(*) = DROP TABLE t1; COMMIT; SET AUTOCOMMIT=ON; -Performing State Transfer on a server that has been killed and restarted -while a DDL was in progress on it connection node_1; -CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); connection node_2; -START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -COMMIT; +connection node_1; +connection node_2; +connection node_1; +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_2; +connection node_2; +connection node_1; +connection node_1a_galera_st_kill_slave_ddl; +connection node_1; ++connection node_2; + SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; + connection node_1; -ALTER TABLE t1 ADD COLUMN f2 INTEGER; + connection node_2; -SET wsrep_sync_wait = 0; -Killing server ... + connection node_1; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -COMMIT; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); + connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); + connection node_2; -Performing --wsrep-recover ... + connection node_2; -Starting server ... -Using --wsrep-start-position when starting mysqld ... -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -COMMIT; + connection node_1; -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -COMMIT; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -COMMIT; + connection node_1a_galera_st_kill_slave_ddl; -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -ROLLBACK; -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -COUNT(*) = 2 -1 -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 -SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; -COUNT(*) = 0 -1 -COMMIT; -SET AUTOCOMMIT=ON; + connection node_1; -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -COUNT(*) = 2 -1 -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 -SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; -COUNT(*) = 0 -1 -DROP TABLE t1; -COMMIT; -SET AUTOCOMMIT=ON; SET GLOBAL debug_dbug = $debug_orig; diff --cc mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result index f9fdc70e9d0,579370fb25c..a5a776d3b77 --- a/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result +++ b/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result @@@ -285,15 -285,111 +285,26 @@@ COUNT(*) = DROP TABLE t1; COMMIT; SET AUTOCOMMIT=ON; -Performing State Transfer on a server that has been killed and restarted -while a DDL was in progress on it connection node_1; -CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); -INSERT INTO t1 VALUES ('node1_committed_before'); connection node_2; -START TRANSACTION; -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -INSERT INTO t1 VALUES ('node2_committed_before'); -COMMIT; +connection node_1; +connection node_2; +connection node_1; +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_2; +connection node_2; +connection node_1; +connection node_1a_galera_st_kill_slave_ddl; +connection node_1; ++connection node_2; + SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; + connection node_1; -ALTER TABLE t1 ADD COLUMN f2 INTEGER; + connection node_2; -SET wsrep_sync_wait = 0; -Killing server ... + connection node_1; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -INSERT INTO t1 (f1) VALUES ('node1_committed_during'); -COMMIT; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); + connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); + connection node_2; -Performing --wsrep-recover ... + connection node_2; -Starting server ... -Using --wsrep-start-position when starting mysqld ... -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -INSERT INTO t1 (f1) VALUES ('node2_committed_after'); -COMMIT; + connection node_1; -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); -COMMIT; -SET AUTOCOMMIT=OFF; -START TRANSACTION; -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -INSERT INTO t1 (f1) VALUES ('node1_committed_after'); -COMMIT; + connection node_1a_galera_st_kill_slave_ddl; -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); -ROLLBACK; -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -COUNT(*) = 2 -1 -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 -SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; -COUNT(*) = 0 -1 -COMMIT; -SET AUTOCOMMIT=ON; + connection node_1; -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -COUNT(*) = 2 -1 -SELECT COUNT(*) = 35 FROM t1; -COUNT(*) = 35 -1 -SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; -COUNT(*) = 0 -1 -DROP TABLE t1; -COMMIT; -SET AUTOCOMMIT=ON; SET GLOBAL debug_dbug = $debug_orig; diff --cc mysql-test/suite/galera/r/galera_var_slave_threads.result index e774e620ccd,6196e6b1b78..0ba64da318c --- a/mysql-test/suite/galera/r/galera_var_slave_threads.result +++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result @@@ -79,6 -43,106 +79,98 @@@ INSERT INTO t2 VALUES (DEFAULT) INSERT INTO t2 VALUES (DEFAULT); INSERT INTO t2 VALUES (DEFAULT); INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); -connection node_2; -SELECT COUNT(*) = 64 FROM t2; -COUNT(*) = 64 -1 + SET wsrep_sync_wait=0; + SELECT COUNT(*) = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND COMMAND != 'Daemon'; + COUNT(*) = @@wsrep_slave_threads + 2 + 1 + SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; + COUNT(*) = 1 + 1 -SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; -COUNT(*) -1 + SET GLOBAL wsrep_slave_threads = 5; -SET GLOBAL wsrep_slave_threads = 1; + connection node_2; + Shutting down server ... + connection node_1; + SET wsrep_sync_wait=0; + show status like 'wsrep_cluster_size'; + Variable_name Value + wsrep_cluster_size 1 + SET GLOBAL wsrep_slave_threads = 6; + SET GLOBAL wsrep_slave_threads = 1; + SET GLOBAL wsrep_cluster_address=''; + SET GLOBAL wsrep_cluster_address='gcomm://'; + SET GLOBAL wsrep_slave_threads = 10; + connection node_2; + SELECT COUNT(*) = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND COMMAND != 'Daemon'; + COUNT(*) = @@wsrep_slave_threads + 2 + 1 + connection node_1; + SET GLOBAL wsrep_slave_threads = 1; + connection node_2; + SET GLOBAL wsrep_slave_threads = 1; + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); + INSERT INTO t2 VALUES (DEFAULT); INSERT INTO t2 VALUES (DEFAULT); INSERT INTO t2 VALUES (DEFAULT); INSERT INTO t2 VALUES (DEFAULT); diff --cc mysql-test/suite/galera/r/galera_wan.result index 41b915fa5bf,ff961c6e633..24be2330297 --- a/mysql-test/suite/galera/r/galera_wan.result +++ b/mysql-test/suite/galera/r/galera_wan.result @@@ -1,7 -1,5 +1,7 @@@ - CALL mtr.add_suppression("WSREP: Stray state UUID msg:.*"); - CALL mtr.add_suppression("WSREP: Sending JOIN failed:.*"); + connection node_2; + connection node_1; +CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +call mtr.add_suppression("WSREP: Sending JOIN failed:.*"); SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 diff --cc sql/handler.cc index 19d31b32381,c9880b1c98b..eabc17db627 --- a/sql/handler.cc +++ b/sql/handler.cc @@@ -54,8 -53,8 +54,8 @@@ #include "semisync_master.h" #include "mysql/service_wsrep.h" - #include "wsrep.h" -#include "wsrep_mysqld.h" + #ifdef WITH_WSREP +#include "wsrep_mysqld.h" #include "wsrep_binlog.h" #include "wsrep_xid.h" #include "wsrep_thd.h" diff --cc sql/log.h index 1aa83eaabb1,bae48c493ad..77855484468 --- a/sql/log.h +++ b/sql/log.h @@@ -1221,16 -1220,11 +1220,20 @@@ static inline TC_LOG *get_tc_log_implem return &mysql_bin_log; return &tc_log_mmap; } +#ifdef WITH_WSREP +IO_CACHE* wsrep_get_trans_cache(THD *); +void wsrep_thd_binlog_trx_reset(THD * thd); +#define WSREP_BINLOG_FORMAT(my_format) \ + ((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) ? \ + wsrep_forced_binlog_format : my_format) +#else +#define WSREP_BINLOG_FORMAT(my_format) my_format +#endif /* WITH_WSREP */ + #ifdef WITH_WSREP + IO_CACHE* wsrep_get_trans_cache(THD *); + void wsrep_thd_binlog_trx_reset(THD * thd); + #endif /* WITH_WSREP */ class Gtid_list_log_event; const char * diff --cc sql/mysqld.cc index 0758603a810,02d95c88a2f..2a38f0036fd --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@@ -8535,8 -8832,8 +8536,10 @@@ static int mysql_init_variables(void set_sys_var_value_origin(&mysql_home_ptr, sys_var::ENV); #endif ++#ifdef WITH_WSREP if (wsrep_init_vars()) return 1; ++#endif return 0; } diff --cc sql/sql_alter.cc index 06147a52004,fb89e0bc5b2..92717760cb1 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@@ -476,17 -476,15 +476,19 @@@ bool Sql_cmd_alter_table::execute(THD * thd->work_part_info= 0; #endif + #ifdef WITH_WSREP - if ((!thd->is_current_stmt_binlog_format_row() || + if (WSREP(thd) && + (!thd->is_current_stmt_binlog_format_row() || !thd->find_temporary_table(first_table))) { - WSREP_TO_ISOLATION_BEGIN(((lex->name.str) ? select_lex->db.str : NULL), - ((lex->name.str) ? lex->name.str : NULL), - first_table); + WSREP_TO_ISOLATION_BEGIN_ALTER((lex->name.str ? select_lex->db.str : NULL), + (lex->name.str ? lex->name.str : NULL), + first_table, &alter_info); + + thd->variables.auto_increment_offset = 1; + thd->variables.auto_increment_increment = 1; } + #endif /* WITH_WSREP */ result= mysql_alter_table(thd, &select_lex->db, &lex->name, &create_info, @@@ -499,12 -497,10 +501,12 @@@ DBUG_RETURN(result); #ifdef WITH_WSREP -error: - // Jump to error may happen from WSREP_TO_ISOLATION_BEGIN - DBUG_RETURN(TRUE); -#endif /* WITH_WSREP */ +error: /* Used by WSREP_TO_ISOLATION_BEGIN_ALTER */ - #endif + { + WSREP_WARN("ALTER TABLE isolation failure"); + DBUG_RETURN(TRUE); + } ++#endif } bool Sql_cmd_discard_import_tablespace::execute(THD *thd) diff --cc sql/sql_base.cc index 9d2c6b81169,829c8dc9efc..83fcfe4f8f3 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@@ -61,8 -61,8 +61,9 @@@ #ifdef __WIN__ #include <io.h> #endif - #ifdef WITH_WSREP ++ #include "wsrep_mysqld.h" + #ifdef WITH_WSREP #include "wsrep_thd.h" #include "wsrep_trans_observer.h" #endif /* WITH_WSREP */ diff --cc sql/sql_class.cc index a3cabaf7c5d,097c76ee3ed..4543f6f39e6 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@@ -65,14 -65,13 +65,13 @@@ #include "sql_parse.h" // is_update_query #include "sql_callback.h" #include "lock.h" -#include "wsrep_mysqld.h" + #include "sql_connect.h" -#include "my_atomic.h" #ifdef WITH_WSREP #include "mysql/service_wsrep.h" +//#include "wsrep_client_service.h" +#include "wsrep_mysqld.h" #include "wsrep_binlog.h" /* wsrep_fragment_unit() */ #include "wsrep_thd.h" - #include "sql_connect.h" - #include "my_atomic.h" #endif /* WITH_WSREP */ #ifdef HAVE_SYS_SYSCALL_H @@@ -538,12 -537,6 +537,12 @@@ char *thd_security_context(THD *thd return thd_get_error_context_description(thd, buffer, length, max_query_len); } #endif +#ifdef WITH_WSREP +extern "C" bool wsrep_consistency_check(void *thd) +{ - return ((THD*)thd)->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING; ++ return ((THD*)thd)->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING; +} +#endif /* WITH_WSREP */ /** Implementation of Drop_table_error_handler::handle_condition(). diff --cc sql/sql_class.h index c97c1d55c1a,56e9563a526..8aadfd26f4c --- a/sql/sql_class.h +++ b/sql/sql_class.h @@@ -69,10 -70,9 +69,11 @@@ void set_thd_stage_info(void *thd #include "wsrep_mutex.h" #include "wsrep_condition_variable.h" +#include "wsrep_mysqld.h" ++ class Wsrep_applier_service; - #endif + #endif /* WITH_WSREP */ class Reprepare_observer; class Relay_log_info; struct rpl_group_info; diff --cc sql/sql_insert.cc index ff4ebc8d986,57596ce3f1d..28cebc23cb8 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@@ -4617,12 -4617,12 +4617,12 @@@ bool select_create::send_eof( mysql_mutex_lock(&thd->LOCK_thd_data); if (thd->wsrep_trx().state() != wsrep::transaction::s_executing) { - WSREP_DEBUG("select_create commit failed, thd: %lu err: %s %s", - thd->thread_id, wsrep_thd_transaction_state_str(thd), - WSREP_QUERY(thd)); + WSREP_DEBUG("select_create commit failed, thd: %llu err: %s %s", + thd->thread_id, + wsrep_thd_transaction_state_str(thd), WSREP_QUERY(thd)); - mysql_mutex_unlock(&thd->LOCK_thd_data); - abort_result_set(); - DBUG_RETURN(true); + mysql_mutex_unlock(&thd->LOCK_thd_data); + abort_result_set(); + DBUG_RETURN(true); } mysql_mutex_unlock(&thd->LOCK_thd_data); thd->wsrep_cs().after_statement(); diff --cc sql/sql_parse.cc index 71bdec30a08,78fa984f270..a1310a52dbb --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@@ -109,8 -109,9 +109,10 @@@ #include "../storage/maria/ha_maria.h" #endif +#include "mysql/service_wsrep.h" #include "wsrep_mysqld.h" + #ifdef WITH_WSREP + #include "mysql/service_wsrep.h" #include "wsrep_thd.h" #include "wsrep_trans_observer.h" /* wsrep transaction hooks */ @@@ -7957,10 -7967,8 +7966,9 @@@ static bool wsrep_mysql_parse(THD *thd "WAIT_FOR wsrep_retry_autocommit_continue"; DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); }); + WSREP_DEBUG("Retry autocommit query: %s", thd->query()); mysql_parse(thd, rawbuf, length, parser_state, is_com_multi, is_next_command); - /* Convert all ER_QUERY_INTERRUPTED errors to ER_LOCK_DEADLOCK if the transaction was BF aborted. This can happen when the diff --cc sql/wsrep_mysqld.cc index c314fc65ce4,0362958c30b..39ce4aaa8ca --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@@ -517,9 -521,6 +521,10 @@@ static std::string wsrep_server_node_ad char node_addr[512] = {0, }; const size_t node_addr_max= sizeof(node_addr) - 1; size_t guess_ip_ret= wsrep_guess_ip(node_addr, node_addr_max); ++ ++ if (!wsrep_data_home_dir || strlen(wsrep_data_home_dir) == 0) ++ wsrep_data_home_dir = mysql_real_data_home; ++ if (!(guess_ip_ret > 0 && guess_ip_ret < node_addr_max)) { WSREP_WARN("Failed to guess base node address. Set it explicitly via " @@@ -759,6 -760,6 +764,9 @@@ int wsrep_init( wsrep_capabilities_export(Wsrep_server_state::instance().provider().capabilities(), &wsrep_provider_capabilities); ++ if (!wsrep_data_home_dir || strlen(wsrep_data_home_dir) == 0) ++ wsrep_data_home_dir = mysql_real_data_home; ++ WSREP_DEBUG("SR storage init for: %s", (wsrep_SR_store_type == WSREP_SR_STORE_TABLE) ? "table" : (wsrep_SR_store_type == WSREP_SR_STORE_FILE) ? "file" : "void"); @@@ -2080,7 -2032,7 +2037,7 @@@ static void wsrep_TOI_end(THD *thd) if (ret == 0) { -- WSREP_DEBUG("TO END: %lld", client_state.toi_meta().seqno().get()); ++ WSREP_DEBUG("TO END: %ld", client_state.toi_meta().seqno().get()); } else { @@@ -2098,7 -2050,7 +2055,7 @@@ static int wsrep_RSU_begin(THD *thd, const char *db_, const char *table_) { -- WSREP_DEBUG("RSU BEGIN: %lld, : %s", wsrep_thd_trx_seqno(thd), ++ WSREP_DEBUG("RSU BEGIN: %ld, : %s", wsrep_thd_trx_seqno(thd), WSREP_QUERY(thd)); if (thd->wsrep_cs().begin_rsu(5000)) { diff --cc sql/wsrep_mysqld.h index 09f09d495e0,88ae0c77e36..b242ace3bd1 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@@ -581,7 -548,7 +549,6 @@@ bool wsrep_node_is_synced() * @return true if SR capable */ bool wsrep_provider_is_SR_capable(); -- /** * Mark current commit ordered if binlogging is not enabled. * @@@ -625,4 -592,40 +592,39 @@@ void wsrep_init_globals() * Deinit and release WSREP resources. */ void wsrep_deinit_server(); + + #else /* !WITH_WSREP */ + + /* These macros are needed to compile MariaDB without WSREP support + * (e.g. embedded) */ - + #define WSREP(T) (0) + #define WSREP_ON (0) + #define WSREP_EMULATE_BINLOG(thd) (0) + #define WSREP_EMULATE_BINLOG_NNULL(thd) (0) + //#define WSREP_CLIENT(thd) (0) + #define WSREP_BINLOG_FORMAT(my_format) ((ulong)my_format) + #define WSREP_PROVIDER_EXISTS (0) + #define wsrep_emulate_bin_log (0) + #define wsrep_to_isolation (0) + //#define wsrep_init() (1) + //#define wsrep_prepend_PATH(X) + //#define wsrep_before_SE() (0) + //#define wsrep_init_startup(X) + //#define wsrep_must_sync_wait(...) (0) + //#define wsrep_sync_wait(...) (0) + //#define wsrep_to_isolation_begin(...) (0) + //#define wsrep_register_hton(...) do { } while(0) + //#define wsrep_check_opts() (0) + //#define wsrep_stop_replication(X) do { } while(0) + //#define wsrep_inited (0) + //#define wsrep_deinit(X) do { } while(0) + //#define wsrep_recover() do { } while(0) + //#define wsrep_slave_threads (1) + //#define wsrep_replicate_myisam (0) + //#define wsrep_thr_init() do {} while(0) + #define wsrep_thr_deinit() do {} while(0) + //#define wsrep_running_threads (0) + + #endif /* WITH_WSREP */ + #endif /* WSREP_MYSQLD_H */ diff --cc sql/wsrep_sst.h index 79d0d9e8a1e,0d0ccfc4482..65c7d12d717 --- a/sql/wsrep_sst.h +++ b/sql/wsrep_sst.h @@@ -16,8 -16,8 +16,8 @@@ #ifndef WSREP_SST_H #define WSREP_SST_H + #include <my_config.h> - ++#include <my_global.h> #include "wsrep/gtid.hpp" #include <my_global.h> #include <string> diff --cc sql/wsrep_thd.h index a2fdd7d1a36,f6e749fd559..f6179d784d7 --- a/sql/wsrep_thd.h +++ b/sql/wsrep_thd.h @@@ -16,9 -16,10 +16,9 @@@ #ifndef WSREP_THD_H #define WSREP_THD_H + #include <my_config.h> - #include "mysql/service_wsrep.h" + #include "wsrep/client_state.hpp" #include "sql_class.h" #include "wsrep_utils.h" #include <deque> diff --cc sql/wsrep_var.cc index 791bd1c2b2a,85297d8fc3f..37c29944d8a --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@@ -579,8 -579,9 +579,8 @@@ static void wsrep_slave_count_change_up { // wsrep_running_threads = appliers threads + 2 rollbacker threads wsrep_slave_count_change = (wsrep_slave_threads - wsrep_running_threads + 2); - WSREP_DEBUG("Change on slave threads: New %lu old %lu difference %lu", + WSREP_DEBUG("Change on slave threads: New %lu old %lu difference %d", - wsrep_slave_threads, wsrep_running_threads, - wsrep_slave_count_change); + wsrep_slave_threads, wsrep_running_threads, wsrep_slave_count_change); } bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) @@@ -755,6 -756,6 +755,7 @@@ wsrep_assign_to_mysql (SHOW_VAR* mysql } } ++ #ifdef OLD_MARIADB int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff, enum enum_var_type scope) diff --cc storage/innobase/handler/ha_innodb.cc index 0f703c53dca,f622af0fa35..9b1fb0f1f36 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@@ -18527,16 -18594,15 +18526,13 @@@ wsrep_innobase_kill_one_trx WSREP_LOG_CONFLICT((const void*)bf_thd, (const void*)thd, TRUE); wsrep_thd_LOCK(thd); - WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%llu) trx: %llu", - signal, (long long)bf_seqno, - (long long)thd_get_thread_id(thd), + WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: %llu", + signal, (long long)bf_seqno, thd_get_thread_id(thd), (long long)victim_trx->id); -- WSREP_DEBUG("Aborting query: %s conf %s trx: %lld", (thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void", wsrep_thd_transaction_state_str(thd), wsrep_thd_transaction_id(thd)); -- wsrep_thd_UNLOCK(thd); if (wsrep_thd_bf_abort(bf_thd, thd, signal)) { @@@ -18552,7 -18618,7 +18548,7 @@@ victim_trx->lock.was_chosen_as_deadlock_victim= TRUE; lock_cancel_waiting_and_release(wait_lock); } -- wsrep_thd_awake((const void*)thd, signal); ++ wsrep_thd_awake((const void*)thd, signal); } else { /* abort currently executing query */ DBUG_PRINT("wsrep",("sending KILL_QUERY to: %lu", @@@ -18641,10 -18707,9 +18637,10 @@@ static void wsrep_fake_trx_id(handlerto trx_id_t trx_id = trx_sys.get_new_trx_id(); WSREP_DEBUG("innodb fake trx id: " TRX_ID_FMT " thd: %s", trx_id, wsrep_thd_query(thd)); + wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), trx_id); } - + #endif /* UNUSED */ #endif /* WITH_WSREP */ /* plugin options */