1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

fixed mutex bug ( or lack of it) when reading log entries on COM_BINLOG_DUMP

added error_code to query event, and checking to see if we get the
expected error on the slave
removed obsolete code from slave.cc


sql/log_event.cc:
  added mutex as an argument to FILE read_log_event functions
sql/log_event.h:
  added error_code for the query event
sql/mysqlbinlog.cc:
  fix for new form of read_log_event
sql/slave.cc:
  removed obsolte code with fetch nx table
  added check to see if the query runs with the same error on the slave
  as it did on the master
sql/sql_repl.cc:
  fixed mutex problem around read_log_event
This commit is contained in:
unknown
2000-10-03 19:53:13 -06:00
parent ddae2009f5
commit cfc4a2e74e
5 changed files with 103 additions and 61 deletions

View File

@ -599,36 +599,23 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
thd->query_id = query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->last_nx_table = thd->last_nx_db = 0;
for(;;)
{
thd->query_error = 0; // clear error
thd->last_nx_table = thd->last_nx_db = 0;
thd->net.last_errno = 0;
thd->net.last_error[0] = 0;
mysql_parse(thd, thd->query, q_len); // try query
if(!thd->query_error || slave_killed(thd)) // break if ok
break;
// if not ok
if(thd->last_nx_table && thd->last_nx_db)
thd->query_error = 0; // clear error
thd->net.last_errno = 0;
thd->net.last_error[0] = 0;
mysql_parse(thd, thd->query, q_len);
int expected_error,actual_error;
if((expected_error = qev->error_code) !=
(actual_error = thd->net.last_errno) && expected_error)
{
// for now, let's just fail if the table is not
// there, and not try to be a smart alec...
// if table was not there
//if(fetch_nx_table(thd,&glob_mi))
// try to to fetch from master
break; // if we can't, just break
sql_print_error("Slave: did not get the expected error\
running query from master - expected: '%s', got '%s'",
ER(expected_error),
actual_error ? ER(actual_error):"no error"
);
thd->query_error = 1;
}
else
break; // if failed for some other reason, bail out
// if fetched the table from master successfully
// we need to restore query info in thd because
// fetch_nx_table executes create table
thd->query = (char*)qev->query;
thd->set_time((time_t)qev->when);
thd->current_tablenr = 0;
}
else if(expected_error == actual_error)
thd->query_error = 0;
}
thd->db = 0;// prevent db from being freed
thd->query = 0; // just to be sure