Commit c942889d authored by Seppo Jaakola's avatar Seppo Jaakola

References: lp:1206129 - Merged revision 3904 from lp:~codership/codership-mysql/5.5-23

enable LOAD DATA transaction splitting
Added new global variable: wsrep_load_data_splitting to control if splitting is wanted or not
parent fca065f9
......@@ -3834,6 +3834,11 @@ static Sys_var_ulong Sys_wsrep_mysql_replication_bundle(
GLOBAL_VAR(wsrep_mysql_replication_bundle), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 1000), DEFAULT(0), BLOCK_SIZE(1));
static Sys_var_mybool Sys_wsrep_load_data_splitting(
"wsrep_load_data_splitting", "To commit LOAD DATA "
"transaction after every 10K rows inserted",
GLOBAL_VAR(wsrep_load_data_splitting),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
#endif /* WITH_WSREP */
static Sys_var_charptr Sys_ignore_db_dirs(
......
......@@ -48,7 +48,8 @@ ulong wsrep_forced_binlog_format = BINLOG_FORMAT_UNSPEC;
my_bool wsrep_recovery = 0; // recovery
my_bool wsrep_replicate_myisam = 0; // enable myisam replication
my_bool wsrep_log_conflicts = 0; //
ulong wsrep_mysql_replication_bundle = 0;
ulong wsrep_mysql_replication_bundle = 0;
my_bool wsrep_load_data_splitting = 1; // commit load data every 10K intervals
/*
* End configuration options
......
......@@ -97,6 +97,8 @@ extern my_bool wsrep_recovery;
extern my_bool wsrep_replicate_myisam;
extern my_bool wsrep_log_conflicts;
extern ulong wsrep_mysql_replication_bundle;
extern ulong wsrep_mysql_replication_bundle;
extern my_bool wsrep_load_data_splitting;
enum enum_wsrep_OSU_method { WSREP_OSU_TOI, WSREP_OSU_RSU };
......
......@@ -130,6 +130,9 @@ extern bool wsrep_prepare_key_for_innodb(const uchar *cache_key,
wsrep_key_part_t* key,
size_t* key_len);
extern handlerton * wsrep_hton;
extern handlerton * binlog_hton;
extern void wsrep_cleanup_transaction(THD *thd);
#endif /* WITH_WSREP */
/** to protect innobase_open_files */
static mysql_mutex_t innobase_share_mutex;
......@@ -5608,7 +5611,8 @@ ha_innobase::write_row(
|| sql_command == SQLCOM_OPTIMIZE
|| sql_command == SQLCOM_CREATE_INDEX
#ifdef WITH_WSREP
|| (wsrep_on(user_thd) && sql_command == SQLCOM_LOAD)
|| (wsrep_on(user_thd) && wsrep_load_data_splitting &&
sql_command == SQLCOM_LOAD)
#endif /* WITH_WSREP */
|| sql_command == SQLCOM_DROP_INDEX)
&& num_write_row >= 10000) {
......@@ -5651,6 +5655,20 @@ ha_innobase::write_row(
*/
;
} else if (src_table == prebuilt->table) {
#ifdef WITH_WSREP
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{
case WSREP_TRX_OK:
break;
case WSREP_TRX_ROLLBACK:
case WSREP_TRX_ERROR:
DBUG_RETURN(1);
}
binlog_hton->commit(binlog_hton, user_thd, 1);
wsrep_cleanup_transaction(user_thd);
#endif /* WITH_WSREP */
/* Source table is not in InnoDB format:
no need to re-acquire locks on it. */
......@@ -5661,6 +5679,18 @@ ha_innobase::write_row(
/* We will need an IX lock on the destination table. */
prebuilt->sql_stat_start = TRUE;
} else {
#ifdef WITH_WSREP
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{
case WSREP_TRX_OK:
break;
case WSREP_TRX_ROLLBACK:
case WSREP_TRX_ERROR:
DBUG_RETURN(1);
}
binlog_hton->commit(binlog_hton, user_thd, 1);
wsrep_cleanup_transaction(user_thd);
#endif /* WITH_WSREP */
/* Ensure that there are no other table locks than
LOCK_IX and LOCK_AUTO_INC on the destination table. */
......
......@@ -147,6 +147,9 @@ extern bool wsrep_prepare_key_for_innodb(const uchar *cache_key,
wsrep_key_part_t* key,
size_t* key_len);
extern handlerton * wsrep_hton;
extern handlerton * binlog_hton;
extern void wsrep_cleanup_transaction(THD *thd);
#endif /* WITH_WSREP */
/** to protect innobase_open_files */
static mysql_mutex_t innobase_share_mutex;
......@@ -6533,7 +6536,8 @@ ha_innobase::write_row(
|| sql_command == SQLCOM_OPTIMIZE
|| sql_command == SQLCOM_CREATE_INDEX
#ifdef WITH_WSREP
|| (wsrep_on(user_thd) && sql_command == SQLCOM_LOAD)
|| (wsrep_on(user_thd) && wsrep_load_data_splitting &&
sql_command == SQLCOM_LOAD)
#endif /* WITH_WSREP */
|| sql_command == SQLCOM_DROP_INDEX)
&& num_write_row >= 10000) {
......@@ -6576,6 +6580,20 @@ ha_innobase::write_row(
*/
;
} else if (src_table == prebuilt->table) {
#ifdef WITH_WSREP
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{
case WSREP_TRX_OK:
break;
case WSREP_TRX_ROLLBACK:
case WSREP_TRX_ERROR:
DBUG_RETURN(1);
}
binlog_hton->commit(binlog_hton, user_thd, 1);
wsrep_cleanup_transaction(user_thd);
#endif /* WITH_WSREP */
/* Source table is not in InnoDB format:
no need to re-acquire locks on it. */
......@@ -6586,6 +6604,18 @@ ha_innobase::write_row(
/* We will need an IX lock on the destination table. */
prebuilt->sql_stat_start = TRUE;
} else {
#ifdef WITH_WSREP
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{
case WSREP_TRX_OK:
break;
case WSREP_TRX_ROLLBACK:
case WSREP_TRX_ERROR:
DBUG_RETURN(1);
}
binlog_hton->commit(binlog_hton, user_thd, 1);
wsrep_cleanup_transaction(user_thd);
#endif /* WITH_WSREP */
/* Ensure that there are no other table locks than
LOCK_IX and LOCK_AUTO_INC on the destination table. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment