mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
cleanup: galera misc cleanups
also disable galera-specific output in mysql_tzinfo_to_sql, it'll be enabled later.
This commit is contained in:
parent
8596b70f96
commit
03ec3511a8
23 changed files with 149 additions and 284 deletions
|
@ -524,7 +524,16 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
|
|||
File fd;
|
||||
char query_file_path[FN_REFLEN];
|
||||
#ifdef WITH_WSREP
|
||||
/* Note: wsrep_on=ON implicitly enables binary logging. */
|
||||
/*
|
||||
Strictly speaking, WITH_WSREP on the client only means that the
|
||||
client was compiled with WSREP, it doesn't mean the server was,
|
||||
so the server might not have WSREP_ON variable.
|
||||
|
||||
But mysql_upgrade is tightly bound to a specific server version
|
||||
anyway - it was mysql_fix_privilege_tables_sql script embedded
|
||||
into its binary - so even if it won't assume anything about server
|
||||
wsrep-ness, it won't be any less server-dependend.
|
||||
*/
|
||||
const uchar sql_log_bin[]= "SET SQL_LOG_BIN=0, WSREP_ON=OFF;";
|
||||
#else
|
||||
const uchar sql_log_bin[]= "SET SQL_LOG_BIN=0;";
|
||||
|
|
|
@ -734,13 +734,8 @@ static int use_db(char *database)
|
|||
/* Do not send commands to replication slaves. */
|
||||
static int disable_binlog()
|
||||
{
|
||||
#ifdef WITH_WSREP
|
||||
/* Additionally turn off @@wsrep_on to disable implicit binary logging. */
|
||||
const char *stmt= "SET SQL_LOG_BIN=0, WSREP_ON=OFF";
|
||||
#else
|
||||
const char *stmt= "SET SQL_LOG_BIN=0";
|
||||
#endif /* WITH_WSREP */
|
||||
return run_query(stmt);
|
||||
mysql_query(sock, "SET WSREP_ON=0"); /* ignore the error, if any */
|
||||
return run_query("SET SQL_LOG_BIN=0");
|
||||
}
|
||||
|
||||
static int handle_request_for_tables(char *tables, uint length)
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#
|
||||
# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
|
||||
#
|
||||
SET SESSION wsrep_replicate_myisam=ON;
|
||||
# Verbose run
|
||||
set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?');
|
||||
prepare set_wsrep_myisam from @prep;
|
||||
set @toggle=1; execute set_wsrep_myisam using @toggle;
|
||||
TRUNCATE TABLE time_zone;
|
||||
TRUNCATE TABLE time_zone_name;
|
||||
TRUNCATE TABLE time_zone_transition;
|
||||
|
@ -26,7 +28,11 @@ Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zo
|
|||
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
|
||||
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
|
||||
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
|
||||
set @toggle=0; execute set_wsrep_myisam using @toggle;
|
||||
# Silent run
|
||||
set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?');
|
||||
prepare set_wsrep_myisam from @prep;
|
||||
set @toggle=1; execute set_wsrep_myisam using @toggle;
|
||||
TRUNCATE TABLE time_zone;
|
||||
TRUNCATE TABLE time_zone_name;
|
||||
TRUNCATE TABLE time_zone_transition;
|
||||
|
@ -47,17 +53,26 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
|
|||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
|
||||
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
|
||||
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
|
||||
set @toggle=0; execute set_wsrep_myisam using @toggle;
|
||||
#
|
||||
# Testing with explicit timezonefile
|
||||
#
|
||||
set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?');
|
||||
prepare set_wsrep_myisam from @prep;
|
||||
set @toggle=1; execute set_wsrep_myisam using @toggle;
|
||||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
|
||||
SET @time_zone_id= LAST_INSERT_ID();
|
||||
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
|
||||
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
|
||||
(@time_zone_id, 0, 0, 0, 'GMT')
|
||||
;
|
||||
set @toggle=0; execute set_wsrep_myisam using @toggle;
|
||||
#
|
||||
# Testing --leap
|
||||
#
|
||||
set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?');
|
||||
prepare set_wsrep_myisam from @prep;
|
||||
set @toggle=1; execute set_wsrep_myisam using @toggle;
|
||||
TRUNCATE TABLE time_zone_leap_second;
|
||||
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
|
||||
set @toggle=0; execute set_wsrep_myisam using @toggle;
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
#
|
||||
# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
|
||||
#
|
||||
# Verbose run
|
||||
SET GLOBAL wsrep_replicate_myisam= ON;
|
||||
TRUNCATE TABLE time_zone;
|
||||
TRUNCATE TABLE time_zone_name;
|
||||
TRUNCATE TABLE time_zone_transition;
|
||||
TRUNCATE TABLE time_zone_transition_type;
|
||||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
|
||||
SET @time_zone_id= LAST_INSERT_ID();
|
||||
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
|
||||
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
|
||||
(@time_zone_id, 0, 0, 0, 'GMT')
|
||||
;
|
||||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it.
|
||||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/ignored.tab' as time zone. Skipping it.
|
||||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
|
||||
SET @time_zone_id= LAST_INSERT_ID();
|
||||
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id);
|
||||
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
|
||||
(@time_zone_id, 0, 0, 0, 'GMT')
|
||||
;
|
||||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
|
||||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
|
||||
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
|
||||
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
|
||||
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
|
||||
SET GLOBAL wsrep_replicate_myisam= OFF;
|
||||
# Silent run
|
||||
SET GLOBAL wsrep_replicate_myisam= ON;
|
||||
TRUNCATE TABLE time_zone;
|
||||
TRUNCATE TABLE time_zone_name;
|
||||
TRUNCATE TABLE time_zone_transition;
|
||||
TRUNCATE TABLE time_zone_transition_type;
|
||||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
|
||||
SET @time_zone_id= LAST_INSERT_ID();
|
||||
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
|
||||
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
|
||||
(@time_zone_id, 0, 0, 0, 'GMT')
|
||||
;
|
||||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it.
|
||||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
|
||||
SET @time_zone_id= LAST_INSERT_ID();
|
||||
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id);
|
||||
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
|
||||
(@time_zone_id, 0, 0, 0, 'GMT')
|
||||
;
|
||||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
|
||||
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
|
||||
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
|
||||
SET GLOBAL wsrep_replicate_myisam= OFF;
|
||||
#
|
||||
# Testing with explicit timezonefile
|
||||
#
|
||||
SET GLOBAL wsrep_replicate_myisam= ON;
|
||||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
|
||||
SET @time_zone_id= LAST_INSERT_ID();
|
||||
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
|
||||
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
|
||||
(@time_zone_id, 0, 0, 0, 'GMT')
|
||||
;
|
||||
SET GLOBAL wsrep_replicate_myisam= OFF;
|
||||
#
|
||||
# Testing --leap
|
||||
#
|
||||
SET GLOBAL wsrep_replicate_myisam= ON;
|
||||
TRUNCATE TABLE time_zone_leap_second;
|
||||
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
|
||||
SET GLOBAL wsrep_replicate_myisam= OFF;
|
|
@ -16,9 +16,11 @@ return "No wsrep provider library" unless -f $provider;
|
|||
|
||||
$ENV{WSREP_PROVIDER} = $provider;
|
||||
|
||||
my ($path) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir;
|
||||
my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir;
|
||||
return "No SST scripts" unless $spath;
|
||||
|
||||
return "No SST scripts" unless $path;
|
||||
my ($epath) = grep { -f "$_/my_print_defaults"; } "$::bindir/extra", $::path_client_bindir;
|
||||
return "No my_print_defaults" unless $epath;
|
||||
|
||||
push @::global_suppressions,
|
||||
(
|
||||
|
@ -32,7 +34,8 @@ push @::global_suppressions,
|
|||
);
|
||||
|
||||
|
||||
$ENV{PATH}="$path:$ENV{PATH}";
|
||||
$ENV{PATH}="$epath:$ENV{PATH}";
|
||||
$ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath;
|
||||
|
||||
bless { };
|
||||
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
--source include/have_wsrep.inc
|
||||
--source include/have_symlink.inc
|
||||
--source include/not_windows.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
|
||||
--echo #
|
||||
|
||||
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
|
||||
--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
|
||||
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
|
||||
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage
|
||||
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab
|
||||
|
||||
--echo # Verbose run
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1
|
||||
|
||||
--echo # Silent run
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
|
||||
|
||||
--echo #
|
||||
--echo # Testing with explicit timezonefile
|
||||
--echo #
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
|
||||
|
||||
--echo #
|
||||
--echo # Testing --leap
|
||||
--echo #
|
||||
|
||||
--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
|
||||
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
|
|
@ -1,11 +1,5 @@
|
|||
--source include/have_symlink.inc
|
||||
--source include/not_windows.inc
|
||||
--source include/not_wsrep.inc
|
||||
|
||||
# Note: The output of mysql_tzinfo_to_sql is different if server is compiled
|
||||
# with wsrep. Hence a copy of this test has been placed under wsrep suite with
|
||||
# the updated result. (lp:1161432)
|
||||
--source include/not_wsrep.inc
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
|
||||
|
|
|
@ -68,10 +68,6 @@ uint my_large_page_size= 0;
|
|||
int volatile my_have_got_alarm=0; /* declare variable to reset */
|
||||
ulong my_time_to_wait_for_lock=2; /* In seconds */
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
my_bool mysys_wsrep= 0;
|
||||
#endif
|
||||
|
||||
/* from errors.c */
|
||||
#ifdef SHARED_LIBRARY
|
||||
const char *globerrs[GLOBERRS]; /* my_error_messages is here */
|
||||
|
|
|
@ -62,8 +62,6 @@ extern mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache;
|
|||
extern mysql_mutex_t THR_LOCK_lock, THR_LOCK_net;
|
||||
extern mysql_mutex_t THR_LOCK_charset;
|
||||
|
||||
extern my_bool mysys_wsrep;
|
||||
|
||||
#include <mysql/psi/mysql_file.h>
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
|
|
|
@ -688,7 +688,7 @@ wsrep_break_lock(
|
|||
THR_LOCK_DATA *data, struct st_lock_list *lock_queue1,
|
||||
struct st_lock_list *wait_queue)
|
||||
{
|
||||
if (wsrep_on(data->owner->mysql_thd) &&
|
||||
if (wsrep_on && wsrep_on(data->owner->mysql_thd) &&
|
||||
wsrep_thd_is_brute_force &&
|
||||
wsrep_thd_is_brute_force(data->owner->mysql_thd, TRUE))
|
||||
{
|
||||
|
@ -858,7 +858,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
|
|||
In the latter case we should yield the lock to the writer.
|
||||
*/
|
||||
#ifdef WITH_WSREP
|
||||
if (mysys_wsrep && wsrep_break_lock(data, &lock->write, &lock->read_wait))
|
||||
if (wsrep_break_lock(data, &lock->write, &lock->read_wait))
|
||||
{
|
||||
wsrep_lock_inserted= TRUE;
|
||||
}
|
||||
|
@ -1006,7 +1006,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
|
|||
lock->read.data->owner->thread_id, data->type));
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
if (mysys_wsrep && wsrep_break_lock(data, &lock->write, &lock->write_wait))
|
||||
if (wsrep_break_lock(data, &lock->write, &lock->write_wait))
|
||||
{
|
||||
wsrep_lock_inserted= TRUE;
|
||||
}
|
||||
|
@ -1016,7 +1016,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
|
|||
}
|
||||
/* Can't get lock yet; Wait for it */
|
||||
#ifdef WITH_WSREP
|
||||
if (mysys_wsrep && wsrep_lock_inserted && wsrep_on(data->owner->mysql_thd))
|
||||
if (wsrep_lock_inserted && wsrep_on(data->owner->mysql_thd))
|
||||
DBUG_RETURN(wait_for_lock(wait_queue, data, 1, lock_wait_timeout));
|
||||
#endif
|
||||
result= wait_for_lock(wait_queue, data, 0, lock_wait_timeout);
|
||||
|
|
|
@ -564,7 +564,8 @@ Event_parse_data::init_definer(THD *thd)
|
|||
void Event_parse_data::check_originator_id(THD *thd)
|
||||
{
|
||||
/* Disable replicated events on slave. */
|
||||
if ((thd->system_thread == SYSTEM_THREAD_SLAVE_SQL) ||
|
||||
if (IF_WSREP(WSREP(thd) && thd->wsrep_applier, 0) ||
|
||||
(thd->system_thread == SYSTEM_THREAD_SLAVE_SQL) ||
|
||||
(thd->system_thread == SYSTEM_THREAD_SLAVE_IO))
|
||||
{
|
||||
DBUG_PRINT("info", ("Invoked object status set to SLAVESIDE_DISABLED."));
|
||||
|
|
|
@ -1130,23 +1130,6 @@ Events::load_events_from_db(THD *thd)
|
|||
delete et;
|
||||
goto end;
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
/*
|
||||
When SST from master node who initials event, the event status is ENABLED
|
||||
this is problematic because there are two nodes with same events and
|
||||
both enabled.
|
||||
*/
|
||||
if (WSREP(thd) && et->originator != thd->variables.server_id)
|
||||
{
|
||||
store_record(table, record[1]);
|
||||
table->field[ET_FIELD_STATUS]->
|
||||
store((longlong) Event_parse_data::SLAVESIDE_DISABLED,
|
||||
TRUE);
|
||||
(void) table->file->ha_update_row(table->record[1], table->record[0]);
|
||||
delete et;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
Since the Event_queue_element object could be deleted inside
|
||||
Event_queue::create_event we should save the value of dropped flag
|
||||
|
|
|
@ -1144,6 +1144,25 @@ void trans_register_ha(THD *thd, bool all, handlerton *ht_arg)
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
static int prepare_or_error(handlerton *ht, THD *thd, bool all)
|
||||
{
|
||||
int err= ht->prepare(ht, thd, all);
|
||||
status_var_increment(thd->status_var.ha_prepare_count);
|
||||
if (err)
|
||||
{
|
||||
/* avoid sending error, if we're going to replay the transaction */
|
||||
#ifdef WITH_WSREP
|
||||
if (ht == wsrep_hton &&
|
||||
err != WSREP_TRX_SIZE_EXCEEDED &&
|
||||
thd->wsrep_conflict_state != MUST_REPLAY)
|
||||
#endif
|
||||
my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@retval
|
||||
0 ok
|
||||
|
@ -1161,32 +1180,14 @@ int ha_prepare(THD *thd)
|
|||
{
|
||||
for (; ha_info; ha_info= ha_info->next())
|
||||
{
|
||||
int err;
|
||||
handlerton *ht= ha_info->ht();
|
||||
status_var_increment(thd->status_var.ha_prepare_count);
|
||||
if (ht->prepare)
|
||||
{
|
||||
if ((err= ht->prepare(ht, thd, all)))
|
||||
if (prepare_or_error(ht, thd, all))
|
||||
{
|
||||
#ifdef WITH_WSREP
|
||||
if (ht == wsrep_hton)
|
||||
{
|
||||
error= 1;
|
||||
/* avoid sending error, if we need to replay */
|
||||
if (thd->wsrep_conflict_state!= MUST_REPLAY)
|
||||
{
|
||||
my_error(ER_LOCK_DEADLOCK, MYF(0), err);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* not wsrep hton, bail to native mysql behavior */
|
||||
my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
|
||||
ha_rollback_trans(thd, all);
|
||||
error=1;
|
||||
break;
|
||||
}
|
||||
ha_rollback_trans(thd, all);
|
||||
error=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1417,7 +1418,6 @@ int ha_commit_trans(THD *thd, bool all)
|
|||
|
||||
for (Ha_trx_info *hi= ha_info; hi; hi= hi->next())
|
||||
{
|
||||
int err;
|
||||
handlerton *ht= hi->ht();
|
||||
/*
|
||||
Do not call two-phase commit if this particular
|
||||
|
@ -1430,32 +1430,9 @@ int ha_commit_trans(THD *thd, bool all)
|
|||
Sic: we know that prepare() is not NULL since otherwise
|
||||
trans->no_2pc would have been set.
|
||||
*/
|
||||
err= ht->prepare(ht, thd, all);
|
||||
status_var_increment(thd->status_var.ha_prepare_count);
|
||||
if (err)
|
||||
{
|
||||
#ifdef WITH_WSREP
|
||||
if (ht == wsrep_hton)
|
||||
{
|
||||
switch (err) {
|
||||
case WSREP_TRX_SIZE_EXCEEDED:
|
||||
/* give user size exeeded error from wsrep_api.h */
|
||||
my_error(ER_ERROR_DURING_COMMIT, MYF(0), WSREP_SIZE_EXCEEDED);
|
||||
break;
|
||||
case WSREP_TRX_CERT_FAIL:
|
||||
case WSREP_TRX_ERROR:
|
||||
/* avoid sending error, if we need to replay */
|
||||
if (thd->wsrep_conflict_state!= MUST_REPLAY)
|
||||
{
|
||||
my_error(ER_LOCK_DEADLOCK, MYF(0), err);
|
||||
}
|
||||
}
|
||||
goto err;
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
|
||||
if (prepare_or_error(ht, thd, all))
|
||||
goto err;
|
||||
}
|
||||
|
||||
need_prepare_ordered|= (ht->prepare_ordered != NULL);
|
||||
need_commit_ordered|= (ht->commit_ordered != NULL);
|
||||
}
|
||||
|
|
|
@ -2230,8 +2230,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
|
|||
DBUG_RETURN(mysql_bin_log.write(&qinfo));
|
||||
}
|
||||
|
||||
if (!wsrep_emulate_bin_log)
|
||||
binlog_trans_log_truncate(thd, *(my_off_t*)sv);
|
||||
binlog_trans_log_truncate(thd, *(my_off_t*)sv);
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
|
|
@ -4368,7 +4368,7 @@ pthread_handler_t handle_slave_sql(void *arg)
|
|||
my_off_t saved_skip= 0;
|
||||
Master_info *mi= ((Master_info*)arg);
|
||||
Relay_log_info* rli = &mi->rli;
|
||||
my_bool wsrep_node_dropped= FALSE;
|
||||
my_bool wsrep_node_dropped __attribute__((unused)) = FALSE;
|
||||
const char *errmsg;
|
||||
rpl_group_info *serial_rgi;
|
||||
rpl_sql_thread_info sql_info(mi->rpl_filter);
|
||||
|
@ -4379,9 +4379,6 @@ pthread_handler_t handle_slave_sql(void *arg)
|
|||
|
||||
wsrep_restart_point:
|
||||
|
||||
LINT_INIT(saved_master_log_pos);
|
||||
LINT_INIT(saved_log_pos);
|
||||
|
||||
serial_rgi= new rpl_group_info(rli);
|
||||
thd = new THD; // note that contructor of THD uses DBUG_ !
|
||||
thd->thread_stack = (char*)&thd; // remember where our stack is
|
||||
|
|
|
@ -2655,11 +2655,11 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||
TABLE_LIST tables[TABLES_MAX];
|
||||
/* Buffer should be extended when password length is extended. */
|
||||
char buff[512];
|
||||
ulong query_length=0;
|
||||
ulong query_length= 0;
|
||||
enum_binlog_format save_binlog_format;
|
||||
uint new_password_len= (uint) strlen(new_password);
|
||||
int result=0;
|
||||
const CSET_STRING query_save = thd->query_string;
|
||||
const CSET_STRING query_save __attribute__((unused)) = thd->query_string;
|
||||
|
||||
DBUG_ENTER("change_password");
|
||||
DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'",
|
||||
|
@ -2669,16 +2669,18 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||
if (check_change_password(thd, host, user, new_password, new_password_len))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd) && !thd->wsrep_applier)
|
||||
if (mysql_bin_log.is_open() ||
|
||||
(WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0)))
|
||||
{
|
||||
query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
|
||||
safe_str(user), safe_str(host), new_password);
|
||||
thd->set_query_inner(buff, query_length, system_charset_info);
|
||||
safe_str(user), safe_str(host), new_password);
|
||||
}
|
||||
|
||||
if (WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0))
|
||||
{
|
||||
thd->set_query_inner(buff, query_length, system_charset_info);
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL);
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
if ((result= open_grant_tables(thd, tables, TL_WRITE, Table_user)))
|
||||
DBUG_RETURN(result != 1);
|
||||
|
@ -2730,34 +2732,27 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||
result= 0;
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
query_length=
|
||||
sprintf(buff,"SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
|
||||
safe_str(acl_user->user.str),
|
||||
safe_str(acl_user->host.hostname),
|
||||
new_password);
|
||||
DBUG_ASSERT(query_length);
|
||||
thd->clear_error();
|
||||
result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length,
|
||||
FALSE, FALSE, FALSE, 0);
|
||||
}
|
||||
end:
|
||||
close_mysql_tables(thd);
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
error: // this label is used in WSREP_TO_ISOLATION_END
|
||||
if (WSREP(thd) && !thd->wsrep_applier)
|
||||
{
|
||||
WSREP_TO_ISOLATION_END;
|
||||
|
||||
thd->query_string = query_save;
|
||||
thd->set_query_inner(query_save);
|
||||
thd->wsrep_exec_mode = LOCAL_STATE;
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
thd->restore_stmt_binlog_format(save_binlog_format);
|
||||
|
||||
DBUG_RETURN(result);
|
||||
|
||||
error:
|
||||
WSREP_ERROR("Repliation of SET PASSWORD failed: %s", buff);
|
||||
DBUG_RETURN(result);
|
||||
|
||||
}
|
||||
|
||||
int acl_check_set_default_role(THD *thd, const char *host, const char *user)
|
||||
|
@ -2773,10 +2768,11 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
|
|||
char user_key[MAX_KEY_LENGTH];
|
||||
int result= 1;
|
||||
int error;
|
||||
ulong query_length= 0;
|
||||
bool clear_role= FALSE;
|
||||
char buff[512];
|
||||
enum_binlog_format save_binlog_format;
|
||||
const CSET_STRING query_save = thd->query_string;
|
||||
const CSET_STRING query_save __attribute__((unused)) = thd->query_string;
|
||||
|
||||
DBUG_ENTER("acl_set_default_role");
|
||||
DBUG_PRINT("enter",("host: '%s' user: '%s' rolename: '%s'",
|
||||
|
@ -2795,6 +2791,20 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
|
|||
if (!strcasecmp(rolename, "NONE"))
|
||||
clear_role= TRUE;
|
||||
|
||||
if (mysql_bin_log.is_open() ||
|
||||
(WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0)))
|
||||
{
|
||||
query_length=
|
||||
sprintf(buff,"SET DEFAULT ROLE '%-.120s' FOR '%-.120s'@'%-.120s'",
|
||||
safe_str(rolename), safe_str(user), safe_str(host));
|
||||
}
|
||||
|
||||
if (WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0))
|
||||
{
|
||||
thd->set_query_inner(buff, query_length, system_charset_info);
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL);
|
||||
}
|
||||
|
||||
if ((result= open_grant_tables(thd, tables, TL_WRITE, Table_user)))
|
||||
DBUG_RETURN(result != 1);
|
||||
|
||||
|
@ -2871,11 +2881,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
|
|||
result= 0;
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
int query_length=
|
||||
sprintf(buff,"SET DEFAULT ROLE '%-.120s' FOR '%-.120s'@'%-.120s'",
|
||||
safe_str(acl_user->default_rolename.str),
|
||||
safe_str(acl_user->user.str),
|
||||
safe_str(acl_user->host.hostname));
|
||||
DBUG_ASSERT(query_length);
|
||||
thd->clear_error();
|
||||
result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length,
|
||||
FALSE, FALSE, FALSE, 0);
|
||||
|
@ -2884,11 +2890,12 @@ end:
|
|||
close_mysql_tables(thd);
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
error: // this label is used in WSREP_TO_ISOLATION_END
|
||||
if (WSREP(thd) && !thd->wsrep_applier)
|
||||
{
|
||||
WSREP_TO_ISOLATION_END;
|
||||
|
||||
thd->query_string = query_save;
|
||||
thd->set_query_inner(query_save);
|
||||
thd->wsrep_exec_mode = LOCAL_STATE;
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
|
|
|
@ -4417,7 +4417,7 @@ restart:
|
|||
flags))
|
||||
{
|
||||
error= TRUE;
|
||||
goto err;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4427,7 +4427,7 @@ restart:
|
|||
ot_ctx.get_timeout(), flags))
|
||||
{
|
||||
error= TRUE;
|
||||
goto err;
|
||||
goto error;
|
||||
}
|
||||
for (table= *start; table && table != thd->lex->first_not_own_table();
|
||||
table= table->next_global)
|
||||
|
@ -4485,16 +4485,16 @@ restart:
|
|||
it may change in future.
|
||||
*/
|
||||
if (ot_ctx.recover_from_failed_open())
|
||||
goto err;
|
||||
goto error;
|
||||
|
||||
/* Re-open temporary tables after close_tables_for_reopen(). */
|
||||
if (open_temporary_tables(thd, *start))
|
||||
goto err;
|
||||
goto error;
|
||||
|
||||
error= FALSE;
|
||||
goto restart;
|
||||
}
|
||||
goto err;
|
||||
goto error;
|
||||
}
|
||||
|
||||
DEBUG_SYNC(thd, "open_tables_after_open_and_process_table");
|
||||
|
@ -4542,11 +4542,11 @@ restart:
|
|||
close_tables_for_reopen(thd, start,
|
||||
ot_ctx.start_of_statement_svp());
|
||||
if (ot_ctx.recover_from_failed_open())
|
||||
goto err;
|
||||
goto error;
|
||||
|
||||
/* Re-open temporary tables after close_tables_for_reopen(). */
|
||||
if (open_temporary_tables(thd, *start))
|
||||
goto err;
|
||||
goto error;
|
||||
|
||||
error= FALSE;
|
||||
goto restart;
|
||||
|
@ -4556,7 +4556,7 @@ restart:
|
|||
Something is wrong with the table or its contents, and an error has
|
||||
been emitted; we must abort.
|
||||
*/
|
||||
goto err;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4567,44 +4567,37 @@ restart:
|
|||
children, attach the children to their parents. At end of statement,
|
||||
the children are detached. Attaching and detaching are always done,
|
||||
even under LOCK TABLES.
|
||||
|
||||
And start wsrep TOI if needed.
|
||||
*/
|
||||
for (tables= *start; tables; tables= tables->next_global)
|
||||
{
|
||||
TABLE *tbl= tables->table;
|
||||
|
||||
if (!tbl)
|
||||
continue;
|
||||
|
||||
if (WSREP_ON && sqlcom_can_generate_row_events(thd) &&
|
||||
wsrep_replicate_myisam && tables && tbl->file->ht == myisam_hton &&
|
||||
tables->lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
{
|
||||
WSREP_TO_ISOLATION_BEGIN(NULL, NULL, tables);
|
||||
}
|
||||
|
||||
/* Schema tables may not have a TABLE object here. */
|
||||
if (tbl && tbl->file->ht->db_type == DB_TYPE_MRG_MYISAM)
|
||||
if (tbl->file->ht->db_type == DB_TYPE_MRG_MYISAM)
|
||||
{
|
||||
/* MERGE tables need to access parent and child TABLE_LISTs. */
|
||||
DBUG_ASSERT(tbl->pos_in_table_list == tables);
|
||||
if (tbl->file->extra(HA_EXTRA_ATTACH_CHILDREN))
|
||||
{
|
||||
error= TRUE;
|
||||
goto err;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP_ON &&
|
||||
(thd->lex->sql_command== SQLCOM_INSERT ||
|
||||
thd->lex->sql_command== SQLCOM_INSERT_SELECT ||
|
||||
thd->lex->sql_command== SQLCOM_REPLACE ||
|
||||
thd->lex->sql_command== SQLCOM_REPLACE_SELECT ||
|
||||
thd->lex->sql_command== SQLCOM_UPDATE ||
|
||||
thd->lex->sql_command== SQLCOM_UPDATE_MULTI ||
|
||||
thd->lex->sql_command== SQLCOM_LOAD ||
|
||||
thd->lex->sql_command== SQLCOM_DELETE) &&
|
||||
wsrep_replicate_myisam &&
|
||||
(*start) &&
|
||||
(*start)->table && (*start)->table->file->ht->db_type == DB_TYPE_MYISAM)
|
||||
{
|
||||
WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (*start));
|
||||
}
|
||||
error:
|
||||
#endif
|
||||
|
||||
err:
|
||||
error:
|
||||
THD_STAGE_INFO(thd, stage_after_opening_tables);
|
||||
thd_proc_info(thd, 0);
|
||||
|
||||
|
|
|
@ -4764,14 +4764,12 @@ end_with_restore_list:
|
|||
thd->print_aborted_warning(3, "RELEASE");
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd))
|
||||
if (WSREP(thd) && (thd->wsrep_conflict_state != NO_CONFLICT &&
|
||||
thd->wsrep_conflict_state != REPLAYING))
|
||||
{
|
||||
if (thd->wsrep_conflict_state == NO_CONFLICT ||
|
||||
thd->wsrep_conflict_state == REPLAYING)
|
||||
{
|
||||
my_ok(thd);
|
||||
}
|
||||
} else
|
||||
DBUG_ASSERT(thd->is_error()); // the error is already issued
|
||||
}
|
||||
else
|
||||
#endif /* WITH_WSREP */
|
||||
my_ok(thd);
|
||||
break;
|
||||
|
@ -4810,11 +4808,9 @@ end_with_restore_list:
|
|||
if (tx_release)
|
||||
thd->killed= KILL_CONNECTION;
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd))
|
||||
if (WSREP(thd) && thd->wsrep_conflict_state != NO_CONFLICT)
|
||||
{
|
||||
if (thd->wsrep_conflict_state == NO_CONFLICT) {
|
||||
my_ok(thd);
|
||||
}
|
||||
DBUG_ASSERT(thd->is_error()); // the error is already issued
|
||||
}
|
||||
else
|
||||
#endif /* WITH_WSREP */
|
||||
|
|
|
@ -2709,11 +2709,11 @@ main(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
// Replicate MyISAM DDL for this session, cf. lp:1161432
|
||||
// timezone info unfixable in XtraDB Cluster
|
||||
printf("SET GLOBAL wsrep_replicate_myisam= ON;\n");
|
||||
#endif /* WITH_WSREP */
|
||||
printf("set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?');\n"
|
||||
"prepare set_wsrep_myisam from @prep;\n"
|
||||
"set @toggle=1; execute set_wsrep_myisam using @toggle;\n");
|
||||
|
||||
if (argc == 1 && !opt_leap)
|
||||
{
|
||||
|
@ -2762,10 +2762,8 @@ main(int argc, char **argv)
|
|||
free_root(&tz_storage, MYF(0));
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
// Reset wsrep_replicate_myisam. lp:1161432
|
||||
printf("SET GLOBAL wsrep_replicate_myisam= OFF;\n");
|
||||
#endif /* WITH_WSREP */
|
||||
printf("set @toggle=0; execute set_wsrep_myisam using @toggle;\n");
|
||||
|
||||
free_defaults(default_argv);
|
||||
my_end(0);
|
||||
|
|
|
@ -157,6 +157,11 @@ static int wsrep_prepare(handlerton *hton, THD *thd, bool all)
|
|||
!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
|
||||
(thd->variables.wsrep_on && !wsrep_trans_cache_is_empty(thd)))
|
||||
{
|
||||
int res= wsrep_run_wsrep_commit(thd, hton, all);
|
||||
if (res == WSREP_TRX_SIZE_EXCEEDED)
|
||||
res= EMSGSIZE;
|
||||
else
|
||||
res= EDEADLK; // for a better error message
|
||||
DBUG_RETURN (wsrep_run_wsrep_commit(thd, hton, all));
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
|
|
@ -37,6 +37,12 @@
|
|||
#include <slave.h>
|
||||
|
||||
wsrep_t *wsrep = NULL;
|
||||
/*
|
||||
wsrep_emulate_bin_log is a flag to tell that binlog has not been configured.
|
||||
wsrep needs to get binlog events from transaction cache even when binlog is
|
||||
not enabled, wsrep_emulate_bin_log opens needed code paths to make this
|
||||
possible
|
||||
*/
|
||||
my_bool wsrep_emulate_bin_log = FALSE; // activating parts of binlog interface
|
||||
#ifdef GTID_SUPPORT
|
||||
/* Sidno in global_sid_map corresponding to group uuid */
|
||||
|
|
|
@ -330,6 +330,7 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
|
|||
#define wsrep_deinit(X) do { } while(0)
|
||||
#define wsrep_recover() do { } while(0)
|
||||
#define wsrep_slave_threads (1)
|
||||
#define wsrep_replicate_myisam (0)
|
||||
|
||||
#endif /* WITH_WSREP */
|
||||
#endif /* WSREP_MYSQLD_H */
|
||||
|
|
|
@ -31,6 +31,9 @@ void wsrep_create_rollbacker();
|
|||
int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr,
|
||||
my_bool signal);
|
||||
|
||||
/*
|
||||
PA = Parallel Applying (on the slave side)
|
||||
*/
|
||||
extern void wsrep_thd_set_PA_safe(void *thd_ptr, my_bool safe);
|
||||
extern my_bool wsrep_thd_is_BF(THD *thd, my_bool sync);
|
||||
extern my_bool wsrep_thd_is_wsrep(void *thd_ptr);
|
||||
|
@ -44,7 +47,7 @@ extern "C" int wsrep_thd_in_locking_session(void *thd_ptr);
|
|||
|
||||
#define wsrep_thd_is_BF(T, S) (0)
|
||||
#define wsrep_abort_thd(X,Y,Z) do { } while(0)
|
||||
#define wsrep_create_appliers(T) (0)
|
||||
#define wsrep_create_appliers(T) do { } while(0)
|
||||
|
||||
#endif
|
||||
#endif /* WSREP_THD_H */
|
||||
|
|
Loading…
Reference in a new issue