List:Commits« Previous MessageNext Message »
From:Martin Zaun Date:March 26 2012 11:15pm
Subject:bzr push into mysql-5.1-telco-7.1 branch (martin.zaun:4499 to 4500) Bug#54854
View as plain text  
 4500 Martin Zaun	2012-03-26 [merge]
      Bug#54854 - test merge for CluB X.X

    added:
      mysql-test/suite/rpl/r/rpl_skip_ddl_errors_cli.result
      mysql-test/suite/rpl/t/rpl_skip_ddl_errors_cli-slave.opt
      mysql-test/suite/rpl/t/rpl_skip_ddl_errors_cli.test
    modified:
      sql/mysqld.cc
      sql/slave.cc
      sql/slave.h
 4499 Jonas Oreland	2012-03-24 [merge]
      ndb - merge 70 to 71

    modified:
      sql/ha_ndbcluster.cc
=== added file 'mysql-test/suite/rpl/r/rpl_skip_ddl_errors_cli.result'
--- a/mysql-test/suite/rpl/r/rpl_skip_ddl_errors_cli.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_skip_ddl_errors_cli.result	2012-03-26 20:13:32 +0000
@@ -0,0 +1,8 @@
+include/master-slave.inc
+[connection master]
+Show the effect of the server command line option slave-skip-errors
+being passed the alias ignore_ddl_errors and a numeric error code
+SHOW VARIABLES LIKE 'slave_skip_errors';
+Variable_name	Value
+slave_skip_errors	1003,1007,1008,1050,1051,1054,1060,1061,1068,1091,1146
+include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/t/rpl_skip_ddl_errors_cli-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_skip_ddl_errors_cli-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_skip_ddl_errors_cli-slave.opt	2012-03-26 20:13:32 +0000
@@ -0,0 +1 @@
+--slave-skip-errors=ddl_exist_errors,1003

=== added file 'mysql-test/suite/rpl/t/rpl_skip_ddl_errors_cli.test'
--- a/mysql-test/suite/rpl/t/rpl_skip_ddl_errors_cli.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_skip_ddl_errors_cli.test	2012-03-26 20:13:32 +0000
@@ -0,0 +1,9 @@
+--source include/master-slave.inc
+--source include/have_binlog_format_mixed.inc
+
+--connection slave
+--echo Show the effect of the server command line option slave-skip-errors
+--echo being passed the alias ignore_ddl_errors and a numeric error code
+SHOW VARIABLES LIKE 'slave_skip_errors';
+
+--source include/rpl_end.inc

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2012-02-13 17:20:48 +0000
+++ b/sql/mysqld.cc	2012-03-26 20:13:32 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -4454,6 +4454,14 @@ we force server id to 2, but this MySQL 
   init_status_vars();
   if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
     opt_skip_slave_start= 1;
+
+#ifndef MCP_BUG54854
+#ifdef HAVE_REPLICATION
+  // Make @@slave_skip_errors show the nice human-readable value.
+  print_slave_skip_errors();
+#endif // HAVE_REPLICATION
+#endif // MCP_BUG54854
+
   /*
     init_slave() must be called after the thread keys are created.
     Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and other
@@ -8038,7 +8046,9 @@ mysqld_get_one_option(int optid,
     break;
 #ifdef HAVE_REPLICATION
   case OPT_SLAVE_SKIP_ERRORS:
-    init_slave_skip_errors(argument);
+#ifndef MCP_BUG54854
+    add_slave_skip_errors(argument);
+#endif // MCP_BUG54854
     break;
   case OPT_SLAVE_EXEC_MODE:
     slave_exec_mode_options= find_bit_type_or_exit(argument,

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2012-02-13 16:09:42 +0000
+++ b/sql/slave.cc	2012-03-26 20:13:32 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -131,7 +131,6 @@ static bool wait_for_relay_log_space(Rel
 static inline bool io_slave_killed(THD* thd,Master_info* mi);
 static inline bool sql_slave_killed(THD* thd,Relay_log_info* rli);
 static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type);
-static void print_slave_skip_errors(void);
 static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi);
 static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi,
                           bool suppress_warnings);
@@ -236,15 +235,6 @@ int init_slave()
   active_mi= new Master_info;
 
   /*
-    If --slave-skip-errors=... was not used, the string value for the
-    system variable has not been set up yet. Do it now.
-  */
-  if (!use_slave_mask)
-  {
-    print_slave_skip_errors();
-  }
-
-  /*
     If master_host is not specified, try to read it from the master_info file.
     If master_host is specified, create the master_info file if it doesn't
     exists.
@@ -293,7 +283,9 @@ err:
   Convert slave skip errors bitmap into a printable string.
 */
 
-static void print_slave_skip_errors(void)
+#ifndef MCP_BUG54854
+void print_slave_skip_errors()
+#endif // MCP_BUG54854
 {
   /*
     To be safe, we want 10 characters of room in the buffer for a number
@@ -347,21 +339,14 @@ static void print_slave_skip_errors(void
   DBUG_VOID_RETURN;
 }
 
-/*
+#ifndef MCP_BUG54854
+/**
   Init function to set up array for errors that should be skipped for slave
-
-  SYNOPSIS
-    init_slave_skip_errors()
-    arg         List of errors numbers to skip, separated with ','
-
-  NOTES
-    Called from get_options() in mysqld.cc on start-up
 */
-
-void init_slave_skip_errors(const char* arg)
+static void init_slave_skip_errors()
 {
-  const char *p;
   DBUG_ENTER("init_slave_skip_errors");
+  DBUG_ASSERT(!use_slave_mask); // not already initialized
 
   if (bitmap_init(&slave_error_mask,0,MAX_SLAVE_ERROR,0))
   {
@@ -369,14 +354,90 @@ void init_slave_skip_errors(const char* 
     exit(1);
   }
   use_slave_mask = 1;
-  for (;my_isspace(system_charset_info,*arg);++arg)
+  DBUG_VOID_RETURN;
+}
+#endif // MCP_BUG54854
+
+#ifndef MCP_BUG54854
+static void add_slave_skip_errors(const uint* errors, uint n_errors)
+{
+  DBUG_ENTER("add_slave_skip_errors");
+  DBUG_ASSERT(errors);
+  DBUG_ASSERT(use_slave_mask);
+
+  for (uint i = 0; i < n_errors; i++)
+  {
+    const uint err_code = errors[i];
+    if (err_code < MAX_SLAVE_ERROR)
+       bitmap_set_bit(&slave_error_mask, err_code);
+  }
+  DBUG_VOID_RETURN;
+}
+#endif // MCP_BUG54854
+
+#ifndef MCP_BUG54854
+/*
+  Add errors that should be skipped for slave
+
+  SYNOPSIS
+    add_slave_skip_errors()
+    arg         List of errors numbers to be added to skip, separated with ','
+
+  NOTES
+    Called from get_options() in mysqld.cc on start-up
+*/
+
+void add_slave_skip_errors(const char* arg)
+{
+  const char *p= NULL;
+  /*
+    ALL is only valid when nothing else is provided.
+  */
+  const uchar SKIP_ALL[]= "all";
+  size_t SIZE_SKIP_ALL= strlen((const char *) SKIP_ALL) + 1;
+  /*
+    IGNORE_DDL_ERRORS can be combined with other parameters
+    but must be the first one provided.
+  */
+  const uchar SKIP_DDL_ERRORS[]= "ddl_exist_errors";
+  size_t SIZE_SKIP_DDL_ERRORS= strlen((const char *) SKIP_DDL_ERRORS);
+  DBUG_ENTER("add_slave_skip_errors");
+
+  // initialize mask if not done yet
+  if (!use_slave_mask)
+    init_slave_skip_errors();
+
+  for (; my_isspace(system_charset_info,*arg); ++arg)
     /* empty */;
-  if (!my_strnncoll(system_charset_info,(uchar*)arg,4,(const uchar*)"all",4))
+  if (!my_strnncoll(system_charset_info, (uchar*)arg, SIZE_SKIP_ALL,
+                    SKIP_ALL, SIZE_SKIP_ALL))
   {
     bitmap_set_all(&slave_error_mask);
-    print_slave_skip_errors();
     DBUG_VOID_RETURN;
   }
+  if (!my_strnncoll(system_charset_info, (uchar*)arg, SIZE_SKIP_DDL_ERRORS,
+                    SKIP_DDL_ERRORS, SIZE_SKIP_DDL_ERRORS))
+  {
+    // DDL errors to be skipped for relaxed 'exist' handling
+    const uint ddl_errors[] = {
+      // error codes with create/add <schema object>
+      ER_DB_CREATE_EXISTS, ER_TABLE_EXISTS_ERROR, ER_DUP_KEYNAME,
+      ER_MULTIPLE_PRI_KEY,
+      // error codes with change/rename <schema object>
+      ER_BAD_FIELD_ERROR, ER_NO_SUCH_TABLE, ER_DUP_FIELDNAME,
+      // error codes with drop <schema object>
+      ER_DB_DROP_EXISTS, ER_BAD_TABLE_ERROR, ER_CANT_DROP_FIELD_OR_KEY
+    };
+
+    add_slave_skip_errors(ddl_errors,
+                          sizeof(ddl_errors)/sizeof(ddl_errors[0]));
+    /*
+      After processing the SKIP_DDL_ERRORS, the pointer is
+      increased to the position after the comma.
+    */
+    if (strlen(arg) > SIZE_SKIP_DDL_ERRORS + 1)
+      arg+= SIZE_SKIP_DDL_ERRORS + 1;
+  }
   for (p= arg ; *p; )
   {
     long err_code;
@@ -387,10 +448,9 @@ void init_slave_skip_errors(const char* 
     while (!my_isdigit(system_charset_info,*p) && *p)
       p++;
   }
-  /* Convert slave skip errors bitmap into a printable string. */
-  print_slave_skip_errors();
   DBUG_VOID_RETURN;
 }
+#endif // MCP_BUG54854
 
 static void set_thd_in_use_temporary_tables(Relay_log_info *rli)
 {

=== modified file 'sql/slave.h'
--- a/sql/slave.h	2011-09-07 22:50:01 +0000
+++ b/sql/slave.h	2012-03-26 20:13:32 +0000
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -149,7 +149,10 @@ extern ulonglong relay_log_space_limit;
 #define SLAVE_FORCE_ALL 4
 
 int init_slave();
-void init_slave_skip_errors(const char* arg);
+#ifndef MCP_BUG54854
+void add_slave_skip_errors(const char* arg);
+void print_slave_skip_errors();
+#endif // MCP_BUG54854
 bool flush_relay_log_info(Relay_log_info* rli);
 int register_slave_on_master(MYSQL* mysql);
 int terminate_slave_threads(Master_info* mi, int thread_mask,

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.1 branch (martin.zaun:4499 to 4500) Bug#54854Martin Zaun27 Mar