summaryrefslogtreecommitdiff
path: root/sql/rpl_rli.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-06-06 21:32:29 +0200
committerSergei Golubchik <sergii@pisem.net>2013-06-06 21:32:29 +0200
commit72ba95873a6d99def07a4bfecda44fb942165142 (patch)
tree4bcb11afc568c4894f4cb109d57c14968320a58b /sql/rpl_rli.cc
parentfab9a55d077b4f2a511b273d5f51272f1e3dc1ff (diff)
parent4749d40c635634e25e07d28ce1a04e9263bcc375 (diff)
downloadmariadb-git-72ba95873a6d99def07a4bfecda44fb942165142.tar.gz
10.0-base merge
(without InnoDB - all InnoDB changes were ignored)
Diffstat (limited to 'sql/rpl_rli.cc')
-rw-r--r--sql/rpl_rli.cc34
1 files changed, 21 insertions, 13 deletions
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 543c6d9fffe..7c8396ceaae 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -327,8 +327,7 @@ Failed to open the existing relay log info file '%s' (errno %d)",
msg="Error reading slave log configuration";
goto err;
}
- strmake(rli->event_relay_log_name,rli->group_relay_log_name,
- sizeof(rli->event_relay_log_name)-1);
+ strmake_buf(rli->event_relay_log_name,rli->group_relay_log_name);
rli->group_relay_log_pos= rli->event_relay_log_pos= relay_log_pos;
rli->group_master_log_pos= master_log_pos;
@@ -546,10 +545,8 @@ int init_relay_log_pos(Relay_log_info* rli,const char* log,
*errmsg="Could not find target log during relay log initialization";
goto err;
}
- strmake(rli->group_relay_log_name,rli->linfo.log_file_name,
- sizeof(rli->group_relay_log_name)-1);
- strmake(rli->event_relay_log_name,rli->linfo.log_file_name,
- sizeof(rli->event_relay_log_name)-1);
+ strmake_buf(rli->group_relay_log_name,rli->linfo.log_file_name);
+ strmake_buf(rli->event_relay_log_name,rli->linfo.log_file_name);
if (rli->relay_log.is_active(rli->linfo.log_file_name))
{
/*
@@ -889,8 +886,7 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
mysql_mutex_lock(&data_lock);
inc_event_relay_log_pos();
group_relay_log_pos= event_relay_log_pos;
- strmake(group_relay_log_name,event_relay_log_name,
- sizeof(group_relay_log_name)-1);
+ strmake_buf(group_relay_log_name,event_relay_log_name);
notify_group_relay_log_name_update();
@@ -1025,10 +1021,8 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
if (!just_reset)
{
/* Save name of used relay log file */
- strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(),
- sizeof(rli->group_relay_log_name)-1);
- strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(),
- sizeof(rli->event_relay_log_name)-1);
+ strmake_buf(rli->group_relay_log_name, rli->relay_log.get_log_fname());
+ strmake_buf(rli->event_relay_log_name, rli->relay_log.get_log_fname());
rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE;
rli->log_space_total= 0;
@@ -1426,7 +1420,10 @@ rpl_load_gtid_slave_state(THD *thd)
bitmap_set_all(table->read_set);
if ((err= table->file->ha_rnd_init_with_error(1)))
+ {
+ table->file->print_error(err, MYF(0));
goto end;
+ }
table_scanned= true;
for (;;)
{
@@ -1441,7 +1438,10 @@ rpl_load_gtid_slave_state(THD *thd)
else if (err == HA_ERR_END_OF_FILE)
break;
else
+ {
+ table->file->print_error(err, MYF(0));
goto end;
+ }
}
domain_id= (ulonglong)table->field[0]->val_int();
sub_id= (ulonglong)table->field[1]->val_int();
@@ -1466,6 +1466,7 @@ rpl_load_gtid_slave_state(THD *thd)
if (!(entry= (struct local_element *)my_malloc(sizeof(*entry),
MYF(MY_WME))))
{
+ my_error(ER_OUTOFMEMORY, MYF(0), (int)sizeof(*entry));
err= 1;
goto end;
}
@@ -1476,12 +1477,18 @@ rpl_load_gtid_slave_state(THD *thd)
if ((err= my_hash_insert(&hash, (uchar *)entry)))
{
my_free(entry);
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
goto end;
}
}
}
rpl_global_gtid_slave_state.lock();
+ if (rpl_global_gtid_slave_state.loaded)
+ {
+ rpl_global_gtid_slave_state.unlock();
+ goto end;
+ }
for (i= 0; i < hash.records; ++i)
{
entry= (struct local_element *)my_hash_element(&hash, i);
@@ -1491,14 +1498,15 @@ rpl_load_gtid_slave_state(THD *thd)
entry->gtid.seq_no)))
{
rpl_global_gtid_slave_state.unlock();
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
goto end;
}
if (opt_bin_log &&
mysql_bin_log.bump_seq_no_counter_if_needed(entry->gtid.domain_id,
entry->gtid.seq_no))
{
- my_error(ER_OUT_OF_RESOURCES, MYF(0));
rpl_global_gtid_slave_state.unlock();
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
goto end;
}
}