revision-id: b748affcf0724b70b6a54c13b9fa617c118aa043 (mariadb-10.2.22-72-gb748affcf07) parent(s): bb8c82c66abddf796e8d44f817518e5ab38ae6e4 85fb868e42145df90f0f0054d4e4b444c39152bb author: Jan Lindström committer: Jan Lindström timestamp: 2019-03-15 09:48:09 +0200 message: Merge branch 'sysprg/MDEV-17262' of git://github.com/tempesta-tech/mariadb into tempesta-tech-sysprg/MDEV-17262 include/mysql/service_wsrep.h | 6 + .../galera_3nodes/r/galera_load_data_ist.result | 36 ++++++ .../suite/galera_3nodes/t/galera_load_data_ist.cnf | 4 + .../galera_3nodes/t/galera_load_data_ist.test | 124 +++++++++++++++++++++ sql/field.cc | 1 - sql/item.cc | 1 - sql/log.cc | 51 +++++++++ sql/sql_class.cc | 2 + sql/sql_class.h | 8 ++ sql/sql_load.cc | 46 +++++--- sql/sql_plugin_services.ic | 2 + sql/wsrep_dummy.cc | 6 + sql/wsrep_hton.cc | 1 + sql/wsrep_thd.cc | 9 ++ storage/innobase/handler/ha_innodb.cc | 10 ++ 15 files changed, 291 insertions(+), 16 deletions(-) diff --cc include/mysql/service_wsrep.h index ee28856ac73,f4d3be943c1..7237cccfaeb --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@@ -107,7 -107,8 +107,9 @@@ extern struct wsrep_service_st bool (*wsrep_thd_ignore_table_func)(THD *thd); long long (*wsrep_thd_trx_seqno_func)(THD *thd); struct wsrep_ws_handle * (*wsrep_thd_ws_handle_func)(THD *thd); + void (*wsrep_thd_auto_increment_variables_func)(THD *thd, unsigned long long *offset, unsigned long long *increment); + void (*wsrep_set_load_multi_commit_func)(THD *thd, bool split); + bool (*wsrep_is_load_multi_commit_func)(THD *thd); int (*wsrep_trx_is_aborting_func)(MYSQL_THD thd); int (*wsrep_trx_order_before_func)(MYSQL_THD, MYSQL_THD); void (*wsrep_unlock_rollback_func)(); @@@ -151,7 -151,8 +153,9 @@@ #define wsrep_thd_ignore_table(T) wsrep_service->wsrep_thd_ignore_table_func(T) #define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T) #define wsrep_thd_ws_handle(T) wsrep_service->wsrep_thd_ws_handle_func(T) +#define wsrep_thd_auto_increment_variables(T,O,I) wsrep_service->wsrep_thd_auto_increment_variables_func(T,O,I) + #define wsrep_set_load_multi_commit(T,S) wsrep_service->wsrep_set_load_multi_commit_func(T,S) + #define wsrep_is_load_multi_commit(T) wsrep_service->wsrep_is_load_multi_commit_func(T) #define wsrep_trx_is_aborting(T) wsrep_service->wsrep_trx_is_aborting_func(T) #define wsrep_trx_order_before(T1,T2) wsrep_service->wsrep_trx_order_before_func(T1,T2) #define wsrep_unlock_rollback() wsrep_service->wsrep_unlock_rollback_func() @@@ -205,7 -205,8 +209,9 @@@ my_bool wsrep_thd_is_BF(MYSQL_THD thd, my_bool wsrep_thd_is_wsrep(MYSQL_THD thd); struct wsrep *get_wsrep(); struct wsrep_ws_handle *wsrep_thd_ws_handle(THD *thd); +void wsrep_thd_auto_increment_variables(THD *thd, unsigned long long *offset, unsigned long long *increment); + void wsrep_set_load_multi_commit(THD *thd, bool split); + bool wsrep_is_load_multi_commit(THD *thd); void wsrep_aborting_thd_enqueue(THD *thd); void wsrep_lock_rollback(); void wsrep_post_commit(THD* thd, bool all); diff --cc sql/sql_load.cc index 8c2f17dac3f,48a49f7e614..59dae80852b --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@@ -1269,11 -1284,8 +1287,11 @@@ read_xml_field(THD *thd, COPY_INFO &inf } WSREP_LOAD_DATA_SPLIT(thd, table, info); - WRITE_RECORD(thd, table, info); + err= write_record(thd, table, &info); + table->auto_increment_field_not_null= false; + if (err) + DBUG_RETURN(1); - + /* We don't need to reset auto-increment field since we are restoring its default value at the beginning of each loop iteration. diff --cc sql/sql_plugin_services.ic index 3d6cf0a0723,2e15b3fa14d..e7de45b5ee2 --- a/sql/sql_plugin_services.ic +++ b/sql/sql_plugin_services.ic @@@ -177,7 -177,8 +177,9 @@@ static struct wsrep_service_st wsrep_ha wsrep_thd_ignore_table, wsrep_thd_trx_seqno, wsrep_thd_ws_handle, + wsrep_thd_auto_increment_variables, + wsrep_set_load_multi_commit, + wsrep_is_load_multi_commit, wsrep_trx_is_aborting, wsrep_trx_order_before, wsrep_unlock_rollback, diff --cc sql/wsrep_dummy.cc index 7297dbfe0fd,3f7136ef609..aff75cf7790 --- a/sql/wsrep_dummy.cc +++ b/sql/wsrep_dummy.cc @@@ -125,14 -125,12 +125,20 @@@ longlong wsrep_thd_trx_seqno(THD * struct wsrep_ws_handle* wsrep_thd_ws_handle(THD *) { return 0; } +void wsrep_thd_auto_increment_variables(THD *thd, + unsigned long long *offset, + unsigned long long *increment) +{ + *offset= thd->variables.auto_increment_offset; + *increment= thd->variables.auto_increment_increment; +} + + void wsrep_set_load_multi_commit(THD *thd, bool split) + { } + + bool wsrep_is_load_multi_commit(THD *thd) + { return false; } + int wsrep_trx_is_aborting(THD *) { return 0; } diff --cc sql/wsrep_thd.cc index dab9f91b381,9342032f9a0..db1b2969504 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@@ -678,33 -678,12 +678,42 @@@ bool wsrep_thd_has_explicit_locks(THD * return thd->mdl_context.has_explicit_locks(); } + void wsrep_set_load_multi_commit(THD *thd, bool split) + { + thd->wsrep_split_flag= split; + } + + bool wsrep_is_load_multi_commit(THD *thd) + { + return thd->wsrep_split_flag; + } +/* + Get auto increment variables for THD. Use global settings for + applier threads. + */ +void wsrep_thd_auto_increment_variables(THD* thd, + unsigned long long* offset, + unsigned long long* increment) +{ + if (thd->wsrep_exec_mode == REPL_RECV && + thd->wsrep_conflict_state != REPLAYING) + { + *offset= global_system_variables.auto_increment_offset; + *increment= global_system_variables.auto_increment_increment; + } + else + { + *offset= thd->variables.auto_increment_offset; + *increment= thd->variables.auto_increment_increment; + } +} + +my_bool wsrep_thd_is_applier(MYSQL_THD thd) +{ + my_bool is_applier= false; + + if (thd && thd->wsrep_applier) + is_applier= true; + + return (is_applier); +}