List:Commits« Previous MessageNext Message »
From:Mats Kindahl Date:January 8 2007 12:52pm
Subject:bk commit into 5.1 tree (mats:1.2361) BUG#24954
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of mats. When mats does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-01-08 12:52:08+01:00, mats@romeo.(none) +34 -0
  BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached):
  Adding new fields Last_{IO,SQL}_Errno and Last_{IO,SQL}_Error to output
  of SHOW SLAVE STATUS to hold errors from I/O and SQL thread respectively.
  Old fields Last_Error and Last_Errno are aliases for Last_SQL_Error and
  Last_SQL_Errno respectively.
  
  Fields are added last to output of SHOW SLAVE STATUS to allow old applications
  to use the same positional arguments into the row, while allowing new
  application to benefit from the added information.

  mysql-test/r/binlog_row_mix_innodb_myisam.result@stripped, 2007-01-08 12:51:59+01:00,
mats@romeo.(none) +2 -2
    Result change

  mysql-test/r/rpl_000015.result@stripped, 2007-01-08 12:51:59+01:00, mats@romeo.(none) +7 -7
    Result change

  mysql-test/r/rpl_change_master.result@stripped, 2007-01-08 12:51:59+01:00, mats@romeo.(none)
+4 -4
    Result change

  mysql-test/r/rpl_deadlock_innodb.result@stripped, 2007-01-08 12:51:59+01:00,
mats@romeo.(none) +12 -0
    Result change

  mysql-test/r/rpl_empty_master_crash.result@stripped, 2007-01-08 12:51:59+01:00,
mats@romeo.(none) +1 -1
    Result change

  mysql-test/r/rpl_extraCol_innodb.result@stripped, 2007-01-08 12:52:00+01:00,
mats@romeo.(none) +32 -0
    Result change

  mysql-test/r/rpl_extraCol_myisam.result@stripped, 2007-01-08 12:52:00+01:00,
mats@romeo.(none) +32 -0
    Result change

  mysql-test/r/rpl_flushlog_loop.result@stripped, 2007-01-08 12:52:00+01:00, mats@romeo.(none)
+4 -0
    Result change

  mysql-test/r/rpl_log_pos.result@stripped, 2007-01-08 12:52:00+01:00, mats@romeo.(none) +8 -8
    Result change

  mysql-test/r/rpl_openssl.result@stripped, 2007-01-08 12:52:00+01:00, mats@romeo.(none) +4 -4
    Result change

  mysql-test/r/rpl_redirect.result@stripped, 2007-01-08 12:52:00+01:00, mats@romeo.(none) +1
-1
    Result change

  mysql-test/r/rpl_replicate_do.result@stripped, 2007-01-08 12:52:00+01:00, mats@romeo.(none)
+2 -2
    Result change

  mysql-test/r/rpl_row_inexist_tbl.result@stripped, 2007-01-08 12:52:00+01:00,
mats@romeo.(none) +4 -0
    Result change

  mysql-test/r/rpl_row_log.result@stripped, 2007-01-08 12:52:00+01:00, mats@romeo.(none) +2 -2
    Result change

  mysql-test/r/rpl_row_log_innodb.result@stripped, 2007-01-08 12:52:00+01:00,
mats@romeo.(none) +2 -2
    Result change

  mysql-test/r/rpl_row_max_relay_size.result@stripped, 2007-01-08 12:52:00+01:00,
mats@romeo.(none) +24 -0
    Result change

  mysql-test/r/rpl_row_reset_slave.result@stripped, 2007-01-08 12:52:01+01:00,
mats@romeo.(none) +8 -8
    Result change

  mysql-test/r/rpl_row_tabledefs_2myisam.result@stripped, 2007-01-08 12:52:01+01:00,
mats@romeo.(none) +24 -0
    Result change

  mysql-test/r/rpl_row_tabledefs_3innodb.result@stripped, 2007-01-08 12:52:01+01:00,
mats@romeo.(none) +24 -0
    Result change

  mysql-test/r/rpl_row_until.result@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +8
-8
    Result change

  mysql-test/r/rpl_server_id1.result@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +2
-2
    Result change

  mysql-test/r/rpl_server_id2.result@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +2
-2
    Result change

  mysql-test/r/rpl_slave_status.result@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none)
+4 -0
    Result change

  mysql-test/t/binlog_row_mix_innodb_myisam.test@stripped, 2007-01-08 12:52:01+01:00,
mats@romeo.(none) +2 -1
    Test fixed.

  sql/log_event.cc@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +40 -30
    Changes to use new version of slave_print_msg().
    Changes to handle array of slave errors.

  sql/repl_failsafe.cc@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +1 -1
    Name change SLAVE_% -> SLAVE_%_MASK.

  sql/rpl_mi.cc@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +1 -1
    Name change SLAVE_% to SLAVE_%_MASK

  sql/rpl_rli.cc@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +4 -4
    Changes to use array of slave error messages.

  sql/rpl_rli.h@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +49 -2
    Moving slave thread masks SLAVE_SQL and SLAVE_IO here and renaming them.
    Defining SLAVE_IO_THREAD and SLAVE_SQL_THREAD as ids for slave threads.
    Adding error information structure.
    Changing slave error fields to use an array for handling both I/O and SQL
    thread messages.

  sql/rpl_utility.cc@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +3 -2
    Changes to use new slave_print_msg()

  sql/slave.cc@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +89 -59
    Name change SLAVE_% to SLAVE_%_MASK.
    Changes to use new slave_print_sgm().

  sql/slave.h@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +3 -7
    Adding one argument to slave_print_msg()
    Name change and move of SLAVE_(IO|SQL) to rpl_rli.h

  sql/sql_repl.cc@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +1 -1
    Using new names for thread masks.

  sql/sql_yacc.yy@stripped, 2007-01-08 12:52:01+01:00, mats@romeo.(none) +2 -2
    Using new names for thread masks.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mats
# Host:	romeo.(none)
# Root:	/home/bk/b24954-mysql-5.1-new-rpl

--- 1.256/sql/log_event.cc	2007-01-08 12:52:19 +01:00
+++ 1.257/sql/log_event.cc	2007-01-08 12:52:19 +01:00
@@ -162,8 +162,10 @@
 {
   thd->query_error = 0;
   thd->clear_error();
-  *rli->last_slave_error = 0;
-  rli->last_slave_errno = 0;
+  for (my_size_t i = 0 ;
+       i < sizeof(rli->last_error)/sizeof(*rli->last_error) ;
+       ++i)
+    rli->last_error[i].clear();
 }
 
 
@@ -1989,7 +1991,7 @@
         clear_all_errors(thd, rli);        /* Can ignore query */
       else
       {
-        slave_print_msg(ERROR_LEVEL, rli, expected_error, 
+        slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, expected_error, 
                           "\
 Query partially completed on the master (error on master: %d) \
 and was aborted. There is a chance that your master is inconsistent at this \
@@ -2018,7 +2020,7 @@
  	!ignored_error_code(actual_error) &&
  	!ignored_error_code(expected_error))
     {
-      slave_print_msg(ERROR_LEVEL, rli, 0,
+      slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, 0,
                       "\
 Query caused different errors on master and slave.     \
 Error on master: '%s' (%d), Error on slave: '%s' (%d). \
@@ -2044,7 +2046,7 @@
     */
     else if (thd->query_error || thd->is_fatal_error)
     {
-      slave_print_msg(ERROR_LEVEL, rli, actual_error,
+      slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, actual_error,
                       "Error '%s' on query. Default database: '%s'. Query: '%s'",
                       (actual_error ? thd->net.last_error :
                        "unexpected success or fatal error"),
@@ -2524,7 +2526,7 @@
   if (!artificial_event && created && thd->transaction.all.nht)
   {
     /* This is not an error (XA is safe), just an information */
-    slave_print_msg(INFORMATION_LEVEL, rli, 0,
+    slave_print_msg(INFORMATION_LEVEL, SLAVE_SQL_THREAD, rli, 0,
                     "Rolling back unfinished transaction (no COMMIT "
                     "or ROLLBACK in relay log). A probable cause is that "
                     "the master died while writing the transaction to "
@@ -3296,7 +3298,7 @@
       sql_errno=ER_UNKNOWN_ERROR;
       err=ER(sql_errno);       
     }
-    slave_print_msg(ERROR_LEVEL, rli, sql_errno,"\
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, sql_errno,"\
 Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
                     err, (char*)table_name, print_slave_db_safe(remember_db));
     free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
@@ -3306,7 +3308,7 @@
 	    
   if (thd->is_fatal_error)
   {
-    slave_print_msg(ERROR_LEVEL, rli, ER_UNKNOWN_ERROR, "\
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, ER_UNKNOWN_ERROR, "\
 Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'",
                     (char*)table_name, print_slave_db_safe(remember_db));
     return 1;
@@ -4529,7 +4531,8 @@
       init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0,
 		    MYF(MY_WME|MY_NABP)))
   {
-    slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in Create_file event: "
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli,
+                    my_errno, "Error in Create_file event: "
                     "could not open file '%s'", fname_buf);
     goto err;
   }
@@ -4540,7 +4543,7 @@
   if (write_base(&file))
   {
     strmov(ext, ".info"); // to have it right in the error message
-    slave_print_msg(ERROR_LEVEL, rli, my_errno,
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, my_errno,
                     "Error in Create_file event: could not write to file '%s'",
                     fname_buf);
     goto err;
@@ -4554,13 +4557,15 @@
 		     O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
 		     MYF(MY_WME))) < 0)
   {
-    slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in Create_file event: "
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli,
+                    my_errno, "Error in Create_file event: "
                     "could not open file '%s'", fname_buf);
     goto err;
   }
   if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP)))
   {
-    slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in Create_file event: "
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli,
+                    my_errno, "Error in Create_file event: "
                     "write to '%s' failed", fname_buf);
     goto err;
   }
@@ -4700,7 +4705,7 @@
 		       O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
 		       MYF(MY_WME))) < 0)
     {
-      slave_print_msg(ERROR_LEVEL, rli, my_errno,
+      slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, my_errno,
                       "Error in %s event: could not create file '%s'",
                       get_type_str(), fname);
       goto err;
@@ -4709,14 +4714,14 @@
   else if ((fd = my_open(fname, O_WRONLY | O_APPEND | O_BINARY | O_NOFOLLOW,
                          MYF(MY_WME))) < 0)
   {
-    slave_print_msg(ERROR_LEVEL, rli, my_errno,
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, my_errno,
                     "Error in %s event: could not open file '%s'",
                     get_type_str(), fname);
     goto err;
   }
   if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP)))
   {
-    slave_print_msg(ERROR_LEVEL, rli, my_errno,
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, my_errno,
                     "Error in %s event: write to '%s' failed",
                     get_type_str(), fname);
     goto err;
@@ -4926,8 +4931,9 @@
       init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0,
 		    MYF(MY_WME|MY_NABP)))
   {
-    slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in Exec_load event: "
-                    "could not open file '%s'", fname);
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, my_errno,
+                    "Error in Exec_load event: could not open file '%s'",
+                    fname);
     goto err;
   }
   if (!(lev = (Load_log_event*)Log_event::read_log_event(&file,
@@ -4935,8 +4941,9 @@
                                                         
rli->relay_log.description_event_for_exec)) ||
       lev->get_type_code() != NEW_LOAD_EVENT)
   {
-    slave_print_msg(ERROR_LEVEL, rli, 0, "Error in Exec_load event: "
-                    "file '%s' appears corrupted", fname);
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, 0,
+                    "Error in Exec_load event: file '%s' appears corrupted",
+                    fname);
     goto err;
   }
 
@@ -4959,11 +4966,13 @@
       don't want to overwrite it with the filename.
       What we want instead is add the filename to the current error message.
     */
-    char *tmp= my_strdup(rli->last_slave_error,MYF(MY_WME));
+    char *tmp= my_strdup(rli->last_error[SLAVE_SQL_THREAD].message,
+                         MYF(MY_WME));
     if (tmp)
     {
-      slave_print_msg(ERROR_LEVEL, rli,
-                      rli->last_slave_errno, /* ok to re-use error code */
+      slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli,
+                      /* ok to re-use error code */
+                      rli->last_error[SLAVE_SQL_THREAD].number,
                       "%s. Failed executing load from '%s'", 
                       tmp, fname);
       my_free(tmp,MYF(0));
@@ -5172,7 +5181,8 @@
   if (!(buf = my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) +
                         (FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME))))
   {
-    slave_print_msg(ERROR_LEVEL, rli, my_errno, "Not enough memory");
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, my_errno,
+                    "Not enough memory");
     return 1;
   }
 
@@ -5609,7 +5619,7 @@
                         (long) f->ptr));
     if (event_type == WRITE_ROWS_EVENT && (f->flags & mask) == mask)
     {
-      slave_print_msg(ERROR_LEVEL, rli, ER_NO_DEFAULT_FOR_FIELD,
+      slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, ER_NO_DEFAULT_FOR_FIELD,
                       "Field `%s` of table `%s`.`%s` "
                       "has no default value and cannot be NULL",
                       (*field_ptr)->field_name, table->s->db.str,
@@ -5678,7 +5688,7 @@
     {
       if (!need_reopen)
       {
-        slave_print_msg(ERROR_LEVEL, rli, error,
+        slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, error,
                         "Error in %s event: when locking tables",
                         get_type_str());
         rli->clear_tables_to_lock();
@@ -5711,7 +5721,7 @@
             simplifications (we don't honour --slave-skip-errors)
           */
           uint actual_error= thd->net.last_errno;
-          slave_print_msg(ERROR_LEVEL, rli, actual_error,
+          slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, actual_error,
                           "Error '%s' on reopening tables",
                           (actual_error ? thd->net.last_error :
                            "unexpected success or fatal error"));
@@ -5805,7 +5815,7 @@
 	break;
 
       default:
-	slave_print_msg(ERROR_LEVEL, rli, error,
+	slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, error,
                         "Error in %s event: row application failed",
                         get_type_str());
 	thd->query_error= 1;
@@ -5826,7 +5836,7 @@
 
   if (error)
   {                     /* error has occured during the transaction */
-    slave_print_msg(ERROR_LEVEL, rli, error,
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, error,
                     "Error in %s event: error during transaction execution "
                     "on table %s.%s",
                     get_type_str(), table->s->db.str, 
@@ -5904,7 +5914,7 @@
       error= Log_event::exec_event(rli);
     }
     else
-      slave_print_msg(ERROR_LEVEL, rli, error,
+      slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, error,
                       "Error in %s event: commit of row events failed, "
                       "table `%s`.`%s`",
                       get_type_str(), table->s->db.str, 
@@ -6245,7 +6255,7 @@
           simplifications (we don't honour --slave-skip-errors)
         */
         uint actual_error= thd->net.last_errno;
-        slave_print_msg(ERROR_LEVEL, rli, actual_error,
+        slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, actual_error,
                         "Error '%s' on opening table `%s`.`%s`",
                         (actual_error ? thd->net.last_error :
                          "unexpected success or fatal error"),

--- 1.300/sql/slave.cc	2007-01-08 12:52:19 +01:00
+++ 1.301/sql/slave.cc	2007-01-08 12:52:19 +01:00
@@ -99,11 +99,11 @@
   DBUG_ENTER("init_thread_mask");
 
   if (set_io)
-    tmp_mask |= SLAVE_IO;
+    tmp_mask |= SLAVE_IO_MASK;
   if (set_sql)
-    tmp_mask |= SLAVE_SQL;
+    tmp_mask |= SLAVE_SQL_MASK;
   if (inverse)
-    tmp_mask^= (SLAVE_IO | SLAVE_SQL);
+    tmp_mask^= (SLAVE_IO_MASK | SLAVE_SQL_MASK);
   *mask = tmp_mask;
   DBUG_VOID_RETURN;
 }
@@ -169,7 +169,7 @@
   }
 
   if (init_master_info(active_mi,master_info_file,relay_log_info_file,
-                       !master_host, (SLAVE_IO | SLAVE_SQL)))
+                       !master_host, (SLAVE_IO_MASK | SLAVE_SQL_MASK)))
   {
     sql_print_error("Failed to initialize the master info structure");
     goto err;
@@ -187,7 +187,7 @@
                             active_mi,
                             master_info_file,
                             relay_log_info_file,
-                            SLAVE_IO | SLAVE_SQL))
+                            SLAVE_IO_MASK | SLAVE_SQL_MASK))
     {
       sql_print_error("Failed to create slave threads");
       goto err;
@@ -262,7 +262,7 @@
   {
     sql_lock = io_lock = 0;
   }
-  if ((thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)) && mi->slave_running)
+  if ((thread_mask & (SLAVE_IO_MASK|SLAVE_FORCE_ALL)) &&
mi->slave_running)
   {
     DBUG_PRINT("info",("Terminating IO thread"));
     mi->abort_slave=1;
@@ -273,7 +273,7 @@
         !force_all)
       DBUG_RETURN(error);
   }
-  if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)) &&
mi->rli.slave_running)
+  if ((thread_mask & (SLAVE_SQL_MASK|SLAVE_FORCE_ALL)) &&
mi->rli.slave_running)
   {
     DBUG_PRINT("info",("Terminating SQL thread"));
     DBUG_ASSERT(mi->rli.sql_thd != 0) ;
@@ -425,19 +425,19 @@
     lock_cond_sql = &mi->rli.run_lock;
   }
 
-  if (thread_mask & SLAVE_IO)
+  if (thread_mask & SLAVE_IO_MASK)
     error=start_slave_thread(handle_slave_io,lock_io,lock_cond_io,
                              cond_io,
                              &mi->slave_running, &mi->slave_run_id,
                              mi, 1); //high priority, to read the most possible
-  if (!error && (thread_mask & SLAVE_SQL))
+  if (!error && (thread_mask & SLAVE_SQL_MASK))
   {
     error=start_slave_thread(handle_slave_sql,lock_sql,lock_cond_sql,
                              cond_sql,
                              &mi->rli.slave_running, &mi->rli.slave_run_id,
                              mi, 0);
     if (error)
-      terminate_slave_threads(mi, thread_mask & SLAVE_IO, 0);
+      terminate_slave_threads(mi, thread_mask & SLAVE_IO_MASK, 0);
   }
   DBUG_RETURN(error);
 }
@@ -523,7 +523,7 @@
                         "it some grace period"));
     if (difftime(time(0), rli->unsafe_to_stop_at) > 60)
     {
-      slave_print_msg(ERROR_LEVEL, rli, 0,
+      slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, ER_UNKNOWN,
                       "SQL thread had to stop in an unsafe situation, in "
                       "the middle of applying updates to a "
                       "non-transactional table without any primary key. "
@@ -545,7 +545,8 @@
   SYNOPSIS
     slave_print_msg()
     level       The severity level
-    rli
+    thd_id      Slave thread id: either SLAVE_IO_THREAD or SLAVE_SQL_THREAD
+    rli         The relay log info structure
     err_code    The error code
     msg         The message (usually related to the error code, but can
                 contain more information).
@@ -555,8 +556,9 @@
     void
 */
 
-void slave_print_msg(enum loglevel level, RELAY_LOG_INFO* rli,
-                     int err_code, const char* msg, ...)
+void
+slave_print_msg(loglevel level, enum_slave_thread thd_id, RELAY_LOG_INFO* rli,
+                int err_code, const char* msg, ...)
 {
   void (*report_function)(const char *, ...);
   char buff[MAX_SLAVE_ERRMSG], *pbuff= buff;
@@ -565,6 +567,10 @@
   DBUG_ENTER("slave_print_msg");
 
   va_start(args,msg);
+  DBUG_ASSERT(thd_id == SLAVE_IO_THREAD || thd_id == SLAVE_SQL_THREAD);
+
+  const char *const thd_name(thd_id == SLAVE_IO_THREAD ? "I/O" : "SQL");
+
   switch (level)
   {
   case ERROR_LEVEL:
@@ -577,9 +583,9 @@
       It's an error, it must be reported in Last_error and Last_errno in SHOW
       SLAVE STATUS.
     */
-    pbuff= rli->last_slave_error;
-    pbuffsize= sizeof(rli->last_slave_error);
-    rli->last_slave_errno = err_code;
+    pbuff= rli->last_error[thd_id].message;
+    pbuffsize= sizeof(rli->last_error[thd_id].message);
+    rli->last_error[thd_id].number = err_code;
     report_function= sql_print_error;
     break;
   case WARNING_LEVEL:
@@ -594,10 +600,10 @@
   }
   my_vsnprintf(pbuff, pbuffsize, msg, args);
   /* If the msg string ends with '.', do not add a ',' it would be ugly */
-  if (pbuff[0] && (*(strend(pbuff)-1) == '.'))
-    (*report_function)("Slave: %s Error_code: %d", pbuff, err_code);
-  else
-    (*report_function)("Slave: %s, Error_code: %d", pbuff, err_code);
+  report_function("Slave %s: %s%s Error_code: %d",
+                  thd_name, pbuff,
+                  (pbuff[0] && *(strend(pbuff)-1) == '.') ? "" : ",",
+                  err_code);
   DBUG_VOID_RETURN;
 }
 
@@ -768,7 +774,8 @@
   /* as we are here, we tried to allocate the event */
   if (!mi->rli.relay_log.description_event_for_queue)
   {
-    sql_print_error("Slave I/O thread failed to create a default
Format_description_log_event");
+    slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, rli, ER_UNKNOWN,
+                    "failed to create a default Format_description_log_event");
     DBUG_RETURN(1);
   }
 
@@ -1128,18 +1135,19 @@
     {
       ev->server_id= 0; // don't be ignored by slave SQL thread
       if (unlikely(rli->relay_log.append(ev)))
-        sql_print_error("Slave I/O thread failed to write a Rotate event"
-                        " to the relay log, "
-                        "SHOW SLAVE STATUS may be inaccurate");
+        slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, rli, ER_UNKNOWN,
+                        "failed to write a Rotate event"
+                        " to the relay log, SHOW SLAVE STATUS may be"
+                        " inaccurate");
       rli->relay_log.harvest_bytes_written(&rli->log_space_total);
       if (flush_master_info(mi, 1))
         sql_print_error("Failed to flush master info file");
       delete ev;
     }
     else
-      sql_print_error("Slave I/O thread failed to create a Rotate event"
-                      " (out of memory?), "
-                      "SHOW SLAVE STATUS may be inaccurate");
+      slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, rli, ER_UNKNOWN,
+                      "failed to create a Rotate event (out of memory?),"
+                      " SHOW SLAVE STATUS may be inaccurate");
   }
   else
     pthread_mutex_unlock(log_lock);
@@ -1177,9 +1185,8 @@
   if (simple_command(mysql, COM_REGISTER_SLAVE, (char*) buf,
                         (uint) (pos- buf), 0))
   {
-    sql_print_error("Error on COM_REGISTER_SLAVE: %d '%s'",
-                    mysql_errno(mysql),
-                    mysql_error(mysql));
+    slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, rli, mysql_errno(mysql),
+                    "Error on COM_REGISTER_SLAVE: %d '%s'");
     DBUG_RETURN(1);
   }
   DBUG_RETURN(0);
@@ -1247,6 +1254,10 @@
                                              sizeof(mi->ssl_key)));
   field_list.push_back(new Item_return_int("Seconds_Behind_Master", 10,
                                            MYSQL_TYPE_LONGLONG));
+  field_list.push_back(new Item_return_int("Last_IO_Errno", 4, MYSQL_TYPE_LONG));
+  field_list.push_back(new Item_empty_string("Last_IO_Error", 20));
+  field_list.push_back(new Item_return_int("Last_SQL_Errno", 4, MYSQL_TYPE_LONG));
+  field_list.push_back(new Item_empty_string("Last_SQL_Error", 20));
 
   if (protocol->send_fields(&field_list,
                             Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -1295,8 +1306,9 @@
     rpl_filter->get_wild_ignore_table(&tmp);
     protocol->store(&tmp);
 
-    protocol->store((uint32) mi->rli.last_slave_errno);
-    protocol->store(mi->rli.last_slave_error, &my_charset_bin);
+    protocol->store(mi->rli.last_error[SLAVE_SQL_THREAD].number);
+    protocol->store(mi->rli.last_error[SLAVE_SQL_THREAD].message,
+                    &my_charset_bin);
     protocol->store((uint32) mi->rli.slave_skip_counter);
     protocol->store((ulonglong) mi->rli.group_master_log_pos);
     protocol->store((ulonglong) mi->rli.log_space_total);
@@ -1355,6 +1367,17 @@
     else
       protocol->store_null();
 
+    // Last_IO_Errno
+    protocol->store(mi->rli.last_error[SLAVE_IO_THREAD].number);
+    // Last_IO_Error
+    protocol->store(mi->rli.last_error[SLAVE_IO_THREAD].message,
+                    &my_charset_bin);
+    // Last_SQL_Errno
+    protocol->store(mi->rli.last_error[SLAVE_SQL_THREAD].number);
+    // Last_SQL_Error
+    protocol->store(mi->rli.last_error[SLAVE_SQL_THREAD].message,
+                    &my_charset_bin);
+
     pthread_mutex_unlock(&mi->rli.data_lock);
     pthread_mutex_unlock(&mi->data_lock);
 
@@ -1833,7 +1856,7 @@
         */
         if (rli->trans_retries < slave_trans_retries)
         {
-          if (init_master_info(rli->mi, 0, 0, 0, SLAVE_SQL))
+          if (init_master_info(rli->mi, 0, 0, 0, SLAVE_SQL_MASK))
             sql_print_error("Failed to initialize the master info structure");
           else if (init_relay_log_pos(rli,
                                       rli->group_relay_log_name,
@@ -1876,7 +1899,7 @@
     DBUG_RETURN(exec_res);
   }
   pthread_mutex_unlock(&rli->data_lock);
-  slave_print_msg(ERROR_LEVEL, rli, 0, "\
+  slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, ER_UNKNOWN, "\
 Could not parse relay log event entry. The possible reasons are: the master's \
 binary log is corrupted (you can check this by running 'mysqlbinlog' on the \
 binary log), the slave's relay log is corrupted (you can check this by running \
@@ -1943,7 +1966,8 @@
 
   if (!(mi->mysql = mysql = mysql_init(NULL)))
   {
-    sql_print_error("Slave I/O thread: error in mysql_init()");
+    slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, ER_UNKNOWN,
+                    "error in mysql_init()");
     goto err;
   }
 
@@ -2032,8 +2056,10 @@
 
       thd->proc_info = "Reconnecting after a failed binlog dump request";
       if (!suppress_warnings)
-        sql_print_error("Slave I/O thread: failed dump request, \
-reconnecting to try again, log '%s' at postion %s", IO_RPL_LOG_NAME,
+        slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, ER_UNKNOWN,
+                        "failed dump request, reconnecting to try again,"
+                        " log '%s' at postion %s",
+                        IO_RPL_LOG_NAME,
                         llstr(mi->master_log_pos,llbuff));
       if (safe_reconnect(thd, mysql, mi, suppress_warnings) ||
           io_slave_killed(thd,mi))
@@ -2123,7 +2149,8 @@
       if (queue_event(mi,(const char*)mysql->net.read_pos + 1,
                       event_len))
       {
-        sql_print_error("Slave I/O thread could not queue event from master");
+        slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, ER_UNKNOWN,
+                        "could not queue event from master");
         goto err;
       }
       if (flush_master_info(mi, 1))
@@ -2366,18 +2393,22 @@
       if (!sql_slave_killed(thd,rli))
       {
         /*
-          retrieve as much info as possible from the thd and, error codes and warnings
-          and print this to the error log as to allow the user to locate the error
+          retrieve as much info as possible from the thd and, error
+          codes and warnings and print this to the error log as to
+          allow the user to locate the error
         */
+        uint32 const last_errno= rli->last_error[SLAVE_SQL_THREAD].number;
+
         if (thd->net.last_errno != 0)
         {
-          if (rli->last_slave_errno == 0)
+          if (last_errno == 0)
           {
-            slave_print_msg(ERROR_LEVEL, rli, thd->net.last_errno,
+            slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli,
+                            thd->net.last_errno,
                             thd->net.last_error ?
                             thd->net.last_error : "<no message>");
           }
-          else if (rli->last_slave_errno != (int) thd->net.last_errno)
+          else if (last_errno != thd->net.last_errno)
           {
             sql_print_error("Slave (additional info): %s Error_code: %d",
                             thd->net.last_error ?
@@ -2494,8 +2525,8 @@
 
   if (unlikely(net_request_file(net,cev->fname)))
   {
-    sql_print_error("Slave I/O: failed requesting download of '%s'",
-                    cev->fname);
+    slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, ER_UNKNOWN,
+                    "failed requesting download of '%s'", cev->fname);
     goto err;
   }
 
@@ -2530,8 +2561,8 @@
         xev.log_pos = cev->log_pos;
         if (unlikely(mi->rli.relay_log.append(&xev)))
         {
-          sql_print_error("Slave I/O: error writing Exec_load event to \
-relay log");
+          slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, ER_UNKNOWN,
+                          "error writing Exec_load event to relay log");
           goto err;
         }
         mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total);
@@ -2543,8 +2574,8 @@
         cev->block_len = num_bytes;
         if (unlikely(mi->rli.relay_log.append(cev)))
         {
-          sql_print_error("Slave I/O: error writing Create_file event to \
-relay log");
+          slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, ER_UNKNOWN,
+                          "error writing Create_file event to relay log");
           goto err;
         }
         cev_not_written=0;
@@ -2557,8 +2588,8 @@
         aev.log_pos = cev->log_pos;
         if (unlikely(mi->rli.relay_log.append(&aev)))
         {
-          sql_print_error("Slave I/O: error writing Append_block event to \
-relay log");
+          slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, ER_UNKNOWN,
+                          "error writing Append_block event to relay log");
           goto err;
         }
         mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total) ;
@@ -2659,7 +2690,8 @@
   {
     if (unlikely(!(tmp_buf=(char*)my_malloc(event_len+1,MYF(MY_WME)))))
     {
-      sql_print_error("Slave I/O: out of memory for Load event");
+      slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, ER_UNKNOWN,
+                      "out of memory for Load event");
       DBUG_RETURN(1);
     }
     memcpy(tmp_buf,buf,event_len);
@@ -3107,14 +3139,12 @@
     {
       last_errno=mysql_errno(mysql);
       suppress_warnings= 0;
-      sql_print_error("Slave I/O thread: error %s to master "
-                      "'%s@%s:%d':                       \
-Error: '%s'  errno: %d  retry-time: %d  retries: %lu",
+      slave_print_msg(ERROR_LEVEL, SLAVE_IO_THREAD, last_errno,
+                      "error %s to master '%s@%s:%d'"
+                      "- retry-time: %d  retries: %lu",
                       (reconnect ? "reconnecting" : "connecting"),
                       mi->user, mi->host, mi->port,
-                      mysql_error(mysql), last_errno,
-                      mi->connect_retry,
-                      master_retry_count);
+                      mi->connect_retry, master_retry_count);
     }
     /*
       By default we try forever. The reason is that failure will trigger

--- 1.524/sql/sql_yacc.yy	2007-01-08 12:52:19 +01:00
+++ 1.525/sql/sql_yacc.yy	2007-01-08 12:52:19 +01:00
@@ -5284,8 +5284,8 @@
 
 slave_thread_opt:
 	/*empty*/	{}
-	| SQL_THREAD	{ Lex->slave_thd_opt|=SLAVE_SQL; }
-	| RELAY_THREAD 	{ Lex->slave_thd_opt|=SLAVE_IO; }
+	| SQL_THREAD	{ Lex->slave_thd_opt|= SLAVE_SQL_MASK; }
+	| RELAY_THREAD 	{ Lex->slave_thd_opt|= SLAVE_IO_MASK; }
 	;
 
 slave_until:

--- 1.14/mysql-test/r/rpl_openssl.result	2007-01-08 12:52:19 +01:00
+++ 1.15/mysql-test/r/rpl_openssl.result	2007-01-08 12:52:19 +01:00
@@ -19,13 +19,13 @@
 t
 1
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	replssl	MASTER_MYPORT	1	#	#	#	#	#	#	Yes				#			0		0	#	#	None		0	Yes	MYSQL_TEST_DIR/std_data/cacert.pem		MYSQL_TEST_DIR/std_data/client-cert.pem		MYSQL_TEST_DIR/std_data/client-key.pem	#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	replssl	MASTER_MYPORT	1	#	#	#	#	#	#	Yes				#			0		0	#	#	None		0	Yes	MYSQL_TEST_DIR/std_data/cacert.pem		MYSQL_TEST_DIR/std_data/client-cert.pem		MYSQL_TEST_DIR/std_data/client-key.pem	#	0		0	
 stop slave;
 change master to master_user='root',master_password='', master_ssl=0;
 start slave;
 drop user replssl@localhost;
 drop table t1;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	#	#	#	#	#	#	Yes				#			0		0	#	#	None		0	No	MYSQL_TEST_DIR/std_data/cacert.pem		MYSQL_TEST_DIR/std_data/client-cert.pem		MYSQL_TEST_DIR/std_data/client-key.pem	#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_MYPORT	1	#	#	#	#	#	#	Yes				#			0		0	#	#	None		0	No	MYSQL_TEST_DIR/std_data/cacert.pem		MYSQL_TEST_DIR/std_data/client-cert.pem		MYSQL_TEST_DIR/std_data/client-key.pem	#	0		0	

--- 1.20/mysql-test/r/rpl_change_master.result	2007-01-08 12:52:19 +01:00
+++ 1.21/mysql-test/r/rpl_change_master.result	2007-01-08 12:52:19 +01:00
@@ -12,12 +12,12 @@
 insert into t1 values(2);
 stop slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	#	#	#	master-bin.000001	No	No							0		0	187	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	#	#	#	master-bin.000001	No	No							0		0	187	#	None		0	No						#	0		0	
 change master to master_user='root';
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	#	#	#	master-bin.000001	No	No							0		0	187	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	#	#	#	master-bin.000001	No	No							0		0	187	#	None		0	No						#	0		0	
 start slave;
 select * from t1;
 n

--- 1.16/mysql-test/r/rpl_deadlock_innodb.result	2007-01-08 12:52:19 +01:00
+++ 1.17/mysql-test/r/rpl_deadlock_innodb.result	2007-01-08 12:52:19 +01:00
@@ -78,6 +78,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 stop slave;
 delete from t3;
 change master to master_log_pos=544;
@@ -132,6 +136,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 set @my_max_relay_log_size= @@global.max_relay_log_size;
 set global max_relay_log_size=0;
 stop slave;
@@ -191,6 +199,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 drop table t1,t2,t3,t4;
 set global max_relay_log_size= @my_max_relay_log_size;
 End of 5.1 tests

--- 1.11/mysql-test/r/rpl_server_id1.result	2007-01-08 12:52:19 +01:00
+++ 1.12/mysql-test/r/rpl_server_id1.result	2007-01-08 12:52:19 +01:00
@@ -9,8 +9,8 @@
 stop slave;
 change master to master_port=SLAVE_PORT;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No				#		#	0		0	0	102	None		0	No						NULL
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No				#		#	0		0	0	102	None		0	No						NULL	0		0	
 start slave;
 insert into t1 values (1);
 show status like "slave_running";

--- 1.12/mysql-test/r/rpl_server_id2.result	2007-01-08 12:52:19 +01:00
+++ 1.13/mysql-test/r/rpl_server_id2.result	2007-01-08 12:52:19 +01:00
@@ -9,8 +9,8 @@
 stop slave;
 change master to master_port=SLAVE_PORT;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No						#	0		0	0	102	None		0	No						NULL
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No						#	0		0	0	102	None		0	No						NULL	0		0	
 start slave;
 insert into t1 values (1);
 select * from t1;

--- 1.1/mysql-test/r/rpl_extraCol_innodb.result	2007-01-08 12:52:19 +01:00
+++ 1.2/mysql-test/r/rpl_extraCol_innodb.result	2007-01-08 12:52:19 +01:00
@@ -87,6 +87,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 0 type mismatch - received type 252, test.t3 has type 3
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t3  ***
@@ -144,6 +148,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 0 type mismatch - received type 246, test.t4 has type 3
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t4  ***
@@ -201,6 +209,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 5 type mismatch - received type 4, test.t5 has type 246
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t5  ***
@@ -257,6 +269,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 3 type mismatch - received type 16, test.t6 has type 3
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
 *** Drop t6  ***
 DROP TABLE t6;
@@ -364,6 +380,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 2 type mismatch - received type 254, test.t10 has type 5
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t10  ***
@@ -420,6 +440,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 2 type mismatch - received type 15, test.t11 has type 252
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t11  ***
@@ -605,6 +629,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1060
+Last_SQL_Error	Error 'Duplicate column name 'c6'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Try to insert in master ****
@@ -735,6 +763,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 0 type mismatch - received type 8, test.t17 has type 2
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 ** DROP table t17 ***

--- 1.1/mysql-test/r/rpl_extraCol_myisam.result	2007-01-08 12:52:19 +01:00
+++ 1.2/mysql-test/r/rpl_extraCol_myisam.result	2007-01-08 12:52:19 +01:00
@@ -87,6 +87,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 0 type mismatch - received type 252, test.t3 has type 3
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t3  ***
@@ -144,6 +148,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 0 type mismatch - received type 246, test.t4 has type 3
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t4  ***
@@ -201,6 +209,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 5 type mismatch - received type 4, test.t5 has type 246
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t5  ***
@@ -257,6 +269,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 3 type mismatch - received type 16, test.t6 has type 3
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
 *** Drop t6  ***
 DROP TABLE t6;
@@ -364,6 +380,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 2 type mismatch - received type 254, test.t10 has type 5
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t10  ***
@@ -420,6 +440,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 2 type mismatch - received type 15, test.t11 has type 252
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t11  ***
@@ -605,6 +629,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1060
+Last_SQL_Error	Error 'Duplicate column name 'c6'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Try to insert in master ****
@@ -735,6 +763,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 0 type mismatch - received type 8, test.t17 has type 2
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 ** DROP table t17 ***

--- 1.12/mysql-test/r/rpl_row_log_innodb.result	2007-01-08 12:52:19 +01:00
+++ 1.13/mysql-test/r/rpl_row_log_innodb.result	2007-01-08 12:52:19 +01:00
@@ -101,8 +101,8 @@
 slave-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 slave-bin.000002	#	Xid	1	#	COMMIT /* XID */
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000002	400	#	#	master-bin.000002	Yes	Yes				#			0		0	400	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000002	400	#	#	master-bin.000002	Yes	Yes				#			0		0	400	#	None		0	No						#	0		0	
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;

--- 1.1/sql/rpl_mi.cc	2007-01-08 12:52:19 +01:00
+++ 1.2/sql/rpl_mi.cc	2007-01-08 12:52:19 +01:00
@@ -111,7 +111,7 @@
       position is at the beginning of the file, and will read the
       "signature" and then fast-forward to the last position read.
     */
-    if (thread_mask & SLAVE_SQL)
+    if (thread_mask & SLAVE_SQL_MASK)
     {
       my_b_seek(mi->rli.cur_log, (my_off_t) 0);
     }

--- 1.3/sql/rpl_rli.cc	2007-01-08 12:52:19 +01:00
+++ 1.4/sql/rpl_rli.cc	2007-01-08 12:52:19 +01:00
@@ -32,7 +32,7 @@
   :no_storage(FALSE), info_fd(-1), cur_log_fd(-1), save_temporary_tables(0),
    cur_log_old_open_count(0), group_master_log_pos(0), log_space_total(0),
    ignore_log_space_limit(0), last_master_timestamp(0), slave_skip_counter(0),
-   abort_pos_wait(0), slave_run_id(0), sql_thd(0), last_slave_errno(0),
+   abort_pos_wait(0), slave_run_id(0), sql_thd(0),
    inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
    until_log_pos(0), retried_trans(0),
    tables_to_lock(0), tables_to_lock_count(0),
@@ -42,7 +42,7 @@
 
   group_relay_log_name[0]= event_relay_log_name[0]=
     group_master_log_name[0]= 0;
-  last_slave_error[0]= until_log_name[0]= ign_master_log_name_end[0]= 0;
+  until_log_name[0]= ign_master_log_name_end[0]= 0;
   bzero((char*) &info_file, sizeof(info_file));
   bzero((char*) &cache_buf, sizeof(cache_buf));
   cached_charset_invalidate();
@@ -340,8 +340,8 @@
   DBUG_ENTER("clear_slave_error");
 
   /* Clear the errors displayed by SHOW SLAVE STATUS */
-  last_slave_error[0]= 0;
-  last_slave_errno= 0;
+  last_error[SLAVE_SQL_THREAD].clear();
+  last_error[SLAVE_IO_THREAD].clear();
   DBUG_VOID_RETURN;
 }
 

--- 1.15/mysql-test/r/binlog_row_mix_innodb_myisam.result	2007-01-08 12:52:19 +01:00
+++ 1.16/mysql-test/r/binlog_row_mix_innodb_myisam.result	2007-01-08 12:52:19 +01:00
@@ -407,8 +407,8 @@
 is not null
 1
 select
-@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
+@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
 @a not like "%#%error_code=%error_code=%";
-@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%"	@a not like
"%#%error_code=%error_code=%"
+@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%"	@a not
like "%#%error_code=%error_code=%"
 1	1
 drop table t1, t2;

--- 1.2/mysql-test/r/rpl_row_inexist_tbl.result	2007-01-08 12:52:19 +01:00
+++ 1.3/mysql-test/r/rpl_row_inexist_tbl.result	2007-01-08 12:52:19 +01:00
@@ -51,4 +51,8 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1146
+Last_SQL_Error	Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
 drop table t1, t2;

--- 1.12/mysql-test/r/rpl_row_log.result	2007-01-08 12:52:19 +01:00
+++ 1.13/mysql-test/r/rpl_row_log.result	2007-01-08 12:52:19 +01:00
@@ -93,8 +93,8 @@
 slave-bin.000002	#	Table_map	1	#	table_id: # (test.t2)
 slave-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000002	373	#	#	master-bin.000002	Yes	Yes				#			0		0	373	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000002	373	#	#	master-bin.000002	Yes	Yes				#			0		0	373	#	None		0	No						#	0		0	
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;

--- 1.5/mysql-test/r/rpl_row_max_relay_size.result	2007-01-08 12:52:19 +01:00
+++ 1.6/mysql-test/r/rpl_row_max_relay_size.result	2007-01-08 12:52:19 +01:00
@@ -57,6 +57,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 #
 # Test 2
 #
@@ -100,6 +104,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 #
 # Test 3: max_relay_log_size = 0
 #
@@ -143,6 +151,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 #
 # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
 #
@@ -183,6 +195,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 #
 # Test 5
 #
@@ -224,6 +240,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 #
 # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
 #
@@ -263,6 +283,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 flush logs;
 show master status;
 File	master-bin.000002

--- 1.1/mysql-test/r/rpl_row_reset_slave.result	2007-01-08 12:52:19 +01:00
+++ 1.2/mysql-test/r/rpl_row_reset_slave.result	2007-01-08 12:52:19 +01:00
@@ -5,21 +5,21 @@
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	102	#	#	master-bin.000001	Yes	Yes				#			0		0	102	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	102	#	#	master-bin.000001	Yes	Yes				#			0		0	102	#	None		0	No						#	0		0	
 stop slave;
 change master to master_user='test';
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	test	MASTER_PORT	1	master-bin.000001	102	#	#	master-bin.000001	No	No				#			0		0	102	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	test	MASTER_PORT	1	master-bin.000001	102	#	#	master-bin.000001	No	No				#			0		0	102	#	None		0	No						#	0		0	
 reset slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1		4	#	#		No	No				#			0		0	0	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1		4	#	#		No	No				#			0		0	0	#	None		0	No						#	0		0	
 start slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	102	#	#	master-bin.000001	Yes	Yes				#			0		0	102	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	102	#	#	master-bin.000001	Yes	Yes				#			0		0	102	#	None		0	No						#	0		0	
 stop slave;
 reset slave;
 start slave;

--- 1.7/mysql-test/r/rpl_row_tabledefs_2myisam.result	2007-01-08 12:52:19 +01:00
+++ 1.8/mysql-test/r/rpl_row_tabledefs_2myisam.result	2007-01-08 12:52:19 +01:00
@@ -136,6 +136,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1364
+Last_SQL_Error	Error in Write_rows event: error during transaction execution on table
test.t1_nodef
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (2);
@@ -174,6 +178,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Table width mismatch - received 2 columns, test.t2 has 1 columns
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (4);
@@ -212,6 +220,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 0 type mismatch - received type 3, test.t4 has type 4
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (5);
@@ -250,6 +262,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 1 type mismatch - received type 3, test.t5 has type 4
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -288,6 +304,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 2 type mismatch - received type 3, test.t6 has type 4
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -325,6 +345,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
 SELECT * FROM t7 ORDER BY a;

--- 1.1/mysql-test/r/rpl_row_until.result	2007-01-08 12:52:19 +01:00
+++ 1.2/mysql-test/r/rpl_row_until.result	2007-01-08 12:52:19 +01:00
@@ -20,8 +20,8 @@
 3
 4
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	740	slave-relay-bin.000004	#	master-bin.000001	#	No							0		0	311	#	Master	master-bin.000001	311	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	740	slave-relay-bin.000004	#	master-bin.000001	#	No							0		0	311	#	Master	master-bin.000001	311	No						#	0		0	
 start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
 select * from t1;
 n
@@ -30,22 +30,22 @@
 3
 4
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	740	slave-relay-bin.000004	#	master-bin.000001	#	No							0		0	311	#	Master	master-no-such-bin.000001	291	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	740	slave-relay-bin.000004	#	master-bin.000001	#	No							0		0	311	#	Master	master-no-such-bin.000001	291	No						#	0		0	
 start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
 select * from t2;
 n
 1
 2
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	740	slave-relay-bin.000004	#	master-bin.000001	#	No							0		0	586	#	Relay	slave-relay-bin.000004	728	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	740	slave-relay-bin.000004	#	master-bin.000001	#	No							0		0	586	#	Relay	slave-relay-bin.000004	728	No						#	0		0	
 start slave;
 stop slave;
 start slave until master_log_file='master-bin.000001', master_log_pos=740;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	740	slave-relay-bin.000004	#	master-bin.000001	Yes	No							0		0	740	#	Master	master-bin.000001	740	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	740	slave-relay-bin.000004	#	master-bin.000001	Yes	No							0		0	740	#	Master	master-bin.000001	740	No						#	0		0	
 start slave until master_log_file='master-bin', master_log_pos=561;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until master_log_file='master-bin.000001', master_log_pos=561,
relay_log_pos=12;

--- 1.4/mysql-test/t/binlog_row_mix_innodb_myisam.test	2007-01-08 12:52:19 +01:00
+++ 1.5/mysql-test/t/binlog_row_mix_innodb_myisam.test	2007-01-08 12:52:19 +01:00
@@ -24,8 +24,9 @@
 eval select
 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
 is not null;
+
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
 eval select
-@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
+@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
 @a not like "%#%error_code=%error_code=%";
 drop table t1, t2;

--- 1.7/sql/rpl_rli.h	2007-01-08 12:52:19 +01:00
+++ 1.8/sql/rpl_rli.h	2007-01-08 12:52:19 +01:00
@@ -21,6 +21,30 @@
 
 #include "rpl_tblmap.h"
 
+/**
+   Numbers to denote the I/O and the SQL thread.
+
+   @note these shall be numbered from 0 and upward and end with the
+   <code>SLAVE_THREAD_COUNT</code> enumeration constant.
+*/
+enum enum_slave_thread
+{
+  SLAVE_IO_THREAD,                         /**< Slave I/O thread id */
+  SLAVE_SQL_THREAD,                        /**< Slave SQL thread id */
+  SLAVE_THREAD_COUNT /**< Slave thread counter. Shall always be last */
+};
+
+/*
+  Masks for start/stop operations on I/O and SQL slave threads.
+
+  These can be bitwise or:ed together to form a set.
+*/
+enum enum_slave_thread_mask
+{
+  SLAVE_IO_MASK= (1U << SLAVE_IO_THREAD),
+  SLAVE_SQL_MASK= (1U << SLAVE_SQL_THREAD)
+};
+
 
 /****************************************************************************
 
@@ -179,11 +203,34 @@
   pthread_mutex_t log_space_lock;
   pthread_cond_t log_space_cond;
   THD * sql_thd;
-  int last_slave_errno;
 #ifndef DBUG_OFF
   int events_till_abort;
 #endif  
-  char last_slave_error[MAX_SLAVE_ERRMSG];
+
+  /**
+     Error information structure.
+   */
+  struct st_error {
+    st_error() : number(0)
+    {
+      clear();
+    }
+
+    void clear() {
+      number= 0;
+      message[0]= '\0';
+    }
+
+    /** Error code */
+    uint32 number;
+    /** Error message */
+    char message[MAX_SLAVE_ERRMSG];
+  };
+
+  /**
+     Last error produced by the I/O and SQL thread respectively.
+  */
+  st_error last_error[SLAVE_THREAD_COUNT];
 
   /* if not set, the value of other members of the structure are undefined */
   bool inited;

--- 1.4/mysql-test/r/rpl_row_tabledefs_3innodb.result	2007-01-08 12:52:19 +01:00
+++ 1.5/mysql-test/r/rpl_row_tabledefs_3innodb.result	2007-01-08 12:52:19 +01:00
@@ -136,6 +136,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1364
+Last_SQL_Error	Error in Write_rows event: error during transaction execution on table
test.t1_nodef
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (2);
@@ -174,6 +178,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Table width mismatch - received 2 columns, test.t2 has 1 columns
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (4);
@@ -212,6 +220,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 0 type mismatch - received type 3, test.t4 has type 4
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (5);
@@ -250,6 +262,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 1 type mismatch - received type 3, test.t5 has type 4
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -288,6 +304,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1522
+Last_SQL_Error	Column 2 type mismatch - received type 3, test.t6 has type 4
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -325,6 +345,10 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
 SELECT * FROM t7 ORDER BY a;

--- 1.4/sql/rpl_utility.cc	2007-01-08 12:52:19 +01:00
+++ 1.5/sql/rpl_utility.cc	2007-01-08 12:52:19 +01:00
@@ -128,7 +128,7 @@
   {
     DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
     error= 1;
-    slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
+    slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
                     "Table width mismatch - "
                     "received %u columns, %s.%s has %u columns",
                     (uint) size(), tsh->db.str, tsh->table_name.str,
@@ -142,7 +142,8 @@
       DBUG_ASSERT(col < size() && col < tsh->fields);
       DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
       error= 1;
-      slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
+      slave_print_msg(ERROR_LEVEL, SLAVE_SQL_THREAD, rli,
+                      ER_BINLOG_ROW_WRONG_TABLE_DEF,
                       "Column %d type mismatch - "
                       "received type %d, %s.%s has type %d",
                       col, type(col), tsh->db.str, tsh->table_name.str,

--- 1.26/mysql-test/r/rpl_flushlog_loop.result	2007-01-08 12:52:19 +01:00
+++ 1.27/mysql-test/r/rpl_flushlog_loop.result	2007-01-08 12:52:19 +01:00
@@ -51,3 +51,7 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	#
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	

--- 1.14/mysql-test/r/rpl_empty_master_crash.result	2007-01-08 12:52:19 +01:00
+++ 1.15/mysql-test/r/rpl_empty_master_crash.result	2007-01-08 12:52:19 +01:00
@@ -5,7 +5,7 @@
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
 load table t1 from master;
 ERROR 08S01: Error connecting to master: Master is not configured
 load table t1 from master;

--- 1.8/mysql-test/r/rpl_slave_status.result	2007-01-08 12:52:19 +01:00
+++ 1.9/mysql-test/r/rpl_slave_status.result	2007-01-08 12:52:19 +01:00
@@ -52,5 +52,9 @@
 Master_SSL_Cipher	
 Master_SSL_Key	
 Seconds_Behind_Master	NULL
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 drop table t1;
 drop table t1;

--- 1.102/sql/slave.h	2007-01-08 12:52:19 +01:00
+++ 1.103/sql/slave.h	2007-01-08 12:52:19 +01:00
@@ -166,9 +166,9 @@
 const char *print_slave_db_safe(const char *db);
 int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code);
 void skip_load_data_infile(NET* net);
-void slave_print_msg(enum loglevel level, RELAY_LOG_INFO* rli,
-                     int err_code, const char* msg, ...)
-  ATTRIBUTE_FORMAT(printf, 4, 5);
+void slave_print_msg(loglevel level, enum_slave_thread thread_id,
+                     RELAY_LOG_INFO* rli, int err_code, const char* msg, ...)
+  ATTRIBUTE_FORMAT(printf, 5, 6);
 
 void end_slave(); /* clean up */
 void clear_until_condition(RELAY_LOG_INFO* rli);
@@ -209,10 +209,6 @@
 extern I_List<THD> threads;
 
 #endif /* HAVE_REPLICATION */
-
-/* masks for start/stop operations on io and sql slave threads */
-#define SLAVE_IO  1
-#define SLAVE_SQL 2
 
 #endif
 

--- 1.37/mysql-test/r/rpl_replicate_do.result	2007-01-08 12:52:19 +01:00
+++ 1.38/mysql-test/r/rpl_replicate_do.result	2007-01-08 12:52:19 +01:00
@@ -27,8 +27,8 @@
 ERROR 42S02: Table 'test.t11' doesn't exist
 drop table if exists t1,t2,t11;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	#	#	#	master-bin.000001	Yes	Yes			test.t1	#			0		0	#	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	#	#	#	master-bin.000001	Yes	Yes			test.t1	#			0		0	#	#	None		0	No						#	0		0	
 create table t1 (ts timestamp);
 set one_shot time_zone='met';
 insert into t1 values('2005-08-12 00:00:00');

--- 1.44/mysql-test/r/rpl_log_pos.result	2007-01-08 12:52:19 +01:00
+++ 1.45/mysql-test/r/rpl_log_pos.result	2007-01-08 12:52:19 +01:00
@@ -8,26 +8,26 @@
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
 master-bin.000001	102	<Binlog_Ignore_DB>	
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	102	#	#	master-bin.000001	Yes	Yes							0		0	102	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	102	#	#	master-bin.000001	Yes	Yes							0		0	102	#	None		0	No						#	0		0	
 stop slave;
 change master to master_log_pos=74;
 start slave;
 stop slave;
 change master to master_log_pos=74;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	74	#	#	master-bin.000001	No	No							0		0	74	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	74	#	#	master-bin.000001	No	No							0		0	74	#	None		0	No						#	0		0	
 start slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	74	#	#	master-bin.000001	No	Yes							0		0	74	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	74	#	#	master-bin.000001	No	Yes							0		0	74	#	None		0	No						#	0		0	
 stop slave;
 change master to master_log_pos=177;
 start slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	177	#	#	master-bin.000001	No	Yes							0		0	177	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	177	#	#	master-bin.000001	No	Yes							0		0	177	#	None		0	No						#	0		0	
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
 master-bin.000001	102	<Binlog_Ignore_DB>	

--- 1.40/mysql-test/r/rpl_000015.result	2007-01-08 12:52:19 +01:00
+++ 1.41/mysql-test/r/rpl_000015.result	2007-01-08 12:52:19 +01:00
@@ -4,20 +4,20 @@
 master-bin.000001	102		
 reset slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
 change master to master_host='127.0.0.1';
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	test	DEFAULT_MASTER_PORT	7		4	#	#		No	No							0		0	0	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	test	DEFAULT_MASTER_PORT	7		4	#	#		No	No							0		0	0	#	None		0	No						#	0		0	
 change master to master_host='127.0.0.1',master_user='root',
 master_password='',master_port=MASTER_PORT;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	7		4	#	#		No	No							0		0	0	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	7		4	#	#		No	No							0		0	0	#	None		0	No						#	0		0	
 start slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	7	master-bin.000001	102	#	#	master-bin.000001	Yes	Yes							0		0	102	#	None		0	No						#
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	7	master-bin.000001	102	#	#	master-bin.000001	Yes	Yes							0		0	102	#	None		0	No						#	0		0	
 drop table if exists t1;
 create table t1 (n int, PRIMARY KEY(n));
 insert into t1 values (10),(45),(90);

--- 1.16/mysql-test/r/rpl_redirect.result	2007-01-08 12:52:19 +01:00
+++ 1.17/mysql-test/r/rpl_redirect.result	2007-01-08 12:52:19 +01:00
@@ -5,7 +5,7 @@
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
 SHOW SLAVE HOSTS;
 Server_id	Host	Port	Rpl_recovery_rank	Master_id
 2	127.0.0.1	SLAVE_PORT	2	1

--- 1.68/sql/repl_failsafe.cc	2007-01-08 12:52:19 +01:00
+++ 1.69/sql/repl_failsafe.cc	2007-01-08 12:52:19 +01:00
@@ -919,7 +919,7 @@
         int error;
 
         if (init_master_info(active_mi, master_info_file, relay_log_info_file, 
-			     0, (SLAVE_IO | SLAVE_SQL)))
+			     0, (SLAVE_IO_MASK | SLAVE_SQL_MASK)))
           my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0));
 	strmake(active_mi->master_log_name, row[0],
 		sizeof(active_mi->master_log_name));

--- 1.157/sql/sql_repl.cc	2007-01-08 12:52:19 +01:00
+++ 1.158/sql/sql_repl.cc	2007-01-08 12:52:19 +01:00
@@ -789,7 +789,7 @@
         not and they are specified we will ignore them and warn user
         about this fact.
       */
-      if (thread_mask & SLAVE_SQL)
+      if (thread_mask & SLAVE_SQL_MASK)
       {
         pthread_mutex_lock(&mi->rli.data_lock);
 
Thread
bk commit into 5.1 tree (mats:1.2361) BUG#24954Mats Kindahl8 Jan