List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:December 22 2005 8:09am
Subject:bk commit into 5.1 tree (stewart:1.1980)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of stewart. When stewart 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
  1.1980 05/12/22 19:09:26 stewart@stripped +7 -0
  Merge mysql.com:/home/stewart/Documents/MySQL/5.1/new
  into  mysql.com:/home/stewart/Documents/MySQL/5.1/dd-new-merge

  sql/share/errmsg.txt
    1.55 05/12/22 19:09:22 stewart@stripped +6 -6
    merge dd with RBR

  sql/sql_yacc.yy
    1.423 05/12/22 19:07:59 stewart@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.484 05/12/22 19:07:59 stewart@stripped +0 -0
    Auto merged

  sql/sql_lex.h
    1.207 05/12/22 19:07:58 stewart@stripped +0 -0
    Auto merged

  sql/mysql_priv.h
    1.345 05/12/22 19:07:58 stewart@stripped +0 -0
    Auto merged

  sql/handler.h
    1.168 05/12/22 19:07:58 stewart@stripped +0 -0
    Auto merged

  sql/Makefile.am
    1.123 05/12/22 19:07:58 stewart@stripped +0 -0
    Auto merged

# 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:	stewart
# Host:	willster.(none)
# Root:	/home/stewart/Documents/MySQL/5.1/dd-new-merge/RESYNC

--- 1.122/sql/Makefile.am	2005-12-22 11:29:10 +11:00
+++ 1.123/sql/Makefile.am	2005-12-22 19:07:58 +11:00
@@ -53,7 +53,7 @@
 			sql_manager.h sql_map.h sql_string.h unireg.h \
 			sql_error.h field.h handler.h mysqld_suffix.h \
 			ha_heap.h ha_myisam.h ha_myisammrg.h ha_partition.h \
-			opt_range.h protocol.h \
+			opt_range.h protocol.h rpl_tblmap.h \
 			sql_select.h structs.h table.h sql_udf.h hash_filo.h\
 			lex.h lex_symbol.h sql_acl.h sql_crypt.h  \
 			log_event.h sql_repl.h slave.h rpl_filter.h \
@@ -87,7 +87,7 @@
 			sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \
 			sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
 			sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
-			slave.cc sql_repl.cc rpl_filter.cc \
+			slave.cc sql_repl.cc rpl_filter.cc rpl_tblmap.cc \
                         sql_union.cc sql_derived.cc \
 			client.c sql_client.cc mini_client_errors.c pack.c\
 			stacktrace.c repl_failsafe.h repl_failsafe.cc \
@@ -96,7 +96,7 @@
                         tztime.cc my_time.c my_decimal.cc\
 			sp_head.cc sp_pcontext.cc  sp_rcontext.cc sp.cc \
 			sp_cache.cc parse_file.cc sql_trigger.cc \
-			sql_plugin.cc\
+			sql_plugin.cc sql_binlog.cc \
 			handlerton.cc sql_tablespace.cc
 EXTRA_mysqld_SOURCES =	ha_innodb.cc ha_berkeley.cc ha_archive.cc \
 			ha_innodb.h  ha_berkeley.h  ha_archive.h \

--- 1.167/sql/handler.h	2005-12-22 11:29:11 +11:00
+++ 1.168/sql/handler.h	2005-12-22 19:07:58 +11:00
@@ -74,6 +74,13 @@
 */
 #define HA_CAN_INSERT_DELAYED  (1 << 14)
 #define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
+/*
+  If HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS is set, it means that the engine can
+  do this: the position of an arbitrary record can be retrieved using
+  position() when the table has a primary key, effectively allowing random
+  access on the table based on a given record.
+*/ 
+#define HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS (1 << 16) 
 #define HA_NOT_DELETE_WITH_CACHE (1 << 18)
 #define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
 #define HA_CAN_FULLTEXT        (1 << 21)
@@ -1130,11 +1137,9 @@
   uint get_index(void) const { return active_index; }
   virtual int open(const char *name, int mode, uint test_if_locked)=0;
   virtual int close(void)=0;
-  virtual int write_row(byte * buf) { return  HA_ERR_WRONG_COMMAND; }
-  virtual int update_row(const byte * old_data, byte * new_data)
-   { return  HA_ERR_WRONG_COMMAND; }
-  virtual int delete_row(const byte * buf)
-   { return  HA_ERR_WRONG_COMMAND; }
+  virtual int ha_write_row(byte * buf);
+  virtual int ha_update_row(const byte * old_data, byte * new_data);
+  virtual int ha_delete_row(const byte * buf);
   /*
     SYNOPSIS
       start_bulk_update()
@@ -1265,6 +1270,26 @@
   virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)
   { return extra(operation); }
   virtual int external_lock(THD *thd, int lock_type) { return 0; }
+  /*
+    In an UPDATE or DELETE, if the row under the cursor was locked by another
+    transaction, and the engine used an optimistic read of the last
+    committed row value under the cursor, then the engine returns 1 from this
+    function. MySQL must NOT try to update this optimistic value. If the
+    optimistic value does not match the WHERE condition, MySQL can decide to
+    skip over this row. Currently only works for InnoDB. This can be used to
+    avoid unnecessary lock waits.
+
+    If this method returns nonzero, it will also signal the storage
+    engine that the next read will be a locking re-read of the row.
+  */
+  virtual bool was_semi_consistent_read() { return 0; }
+  /*
+    Tell the engine whether it should avoid unnecessary lock waits.
+    If yes, in an UPDATE or DELETE, if the row under the cursor was locked
+    by another transaction, the engine may try an optimistic read of
+    the last committed row value under the cursor.
+  */
+  virtual void try_semi_consistent_read(bool) {}
   virtual void unlock_row() {}
   virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;}
   /*
@@ -1483,6 +1508,31 @@
  virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info,
 					 uint table_changes)
  { return COMPATIBLE_DATA_NO; }
+
+private:
+
+  /*
+    Row-level primitives for storage engines. 
+    These should be overridden by the storage engine class. To call
+    these methods, use the corresponding 'ha_*' method above.
+  */
+  friend int ndb_add_binlog_index(THD *, void *);
+
+  virtual int write_row(byte *buf __attribute__((unused))) 
+  { 
+    return HA_ERR_WRONG_COMMAND; 
+  }
+
+  virtual int update_row(const byte *old_data __attribute__((unused)),
+                         byte *new_data __attribute__((unused)))
+  { 
+    return HA_ERR_WRONG_COMMAND; 
+  }
+
+  virtual int delete_row(const byte *buf __attribute__((unused)))
+  { 
+    return HA_ERR_WRONG_COMMAND; 
+  }
 };
 
 	/* Some extern variables used with handlers */

--- 1.344/sql/mysql_priv.h	2005-12-22 11:29:11 +11:00
+++ 1.345/sql/mysql_priv.h	2005-12-22 19:07:58 +11:00
@@ -248,50 +248,50 @@
    TODO: separate three contexts above, move them to separate bitfields.
 */
 
-#define SELECT_DISTINCT         (1L << 0)       // SELECT, user
-#define SELECT_STRAIGHT_JOIN    (1L << 1)       // SELECT, user
-#define SELECT_DESCRIBE         (1L << 2)       // SELECT, user
-#define SELECT_SMALL_RESULT     (1L << 3)       // SELECT, user
-#define SELECT_BIG_RESULT       (1L << 4)       // SELECT, user
-#define OPTION_FOUND_ROWS       (1L << 5)       // SELECT, user
-#define OPTION_TO_QUERY_CACHE   (1L << 6)       // SELECT, user
-#define SELECT_NO_JOIN_CACHE    (1L << 7)       // intern
-#define OPTION_BIG_TABLES       (1L << 8)       // THD, user
-#define OPTION_BIG_SELECTS      (1L << 9)       // THD, user
-#define OPTION_LOG_OFF          (1L << 10)      // THD, user
-#define OPTION_UPDATE_LOG       (1L << 11)      // THD, user, unused
-#define TMP_TABLE_ALL_COLUMNS   (1L << 12)      // SELECT, intern
-#define OPTION_WARNINGS         (1L << 13)      // THD, user
-#define OPTION_AUTO_IS_NULL     (1L << 14)      // THD, user, binlog
-#define OPTION_FOUND_COMMENT    (1L << 15)      // SELECT, intern, parser
-#define OPTION_SAFE_UPDATES     (1L << 16)      // THD, user
-#define OPTION_BUFFER_RESULT    (1L << 17)      // SELECT, user
-#define OPTION_BIN_LOG          (1L << 18)      // THD, user
-#define OPTION_NOT_AUTOCOMMIT   (1L << 19)      // THD, user
-#define OPTION_BEGIN            (1L << 20)      // THD, intern
-#define OPTION_TABLE_LOCK       (1L << 21)      // THD, intern
-#define OPTION_QUICK            (1L << 22)      // SELECT (for DELETE)
-#define OPTION_QUOTE_SHOW_CREATE (1L << 23)     // THD, user
+#define SELECT_DISTINCT         (LL(1) << 0)       // SELECT, user
+#define SELECT_STRAIGHT_JOIN    (LL(1) << 1)       // SELECT, user
+#define SELECT_DESCRIBE         (LL(1) << 2)       // SELECT, user
+#define SELECT_SMALL_RESULT     (LL(1) << 3)       // SELECT, user
+#define SELECT_BIG_RESULT       (LL(1) << 4)       // SELECT, user
+#define OPTION_FOUND_ROWS       (LL(1) << 5)       // SELECT, user
+#define OPTION_TO_QUERY_CACHE   (LL(1) << 6)       // SELECT, user
+#define SELECT_NO_JOIN_CACHE    (LL(1) << 7)       // intern
+#define OPTION_BIG_TABLES       (LL(1) << 8)       // THD, user
+#define OPTION_BIG_SELECTS      (LL(1) << 9)       // THD, user
+#define OPTION_LOG_OFF          (LL(1) << 10)      // THD, user
+#define OPTION_UPDATE_LOG       (LL(1) << 11)      // THD, user, unused
+#define TMP_TABLE_ALL_COLUMNS   (LL(1) << 12)      // SELECT, intern
+#define OPTION_WARNINGS         (LL(1) << 13)      // THD, user
+#define OPTION_AUTO_IS_NULL     (LL(1) << 14)      // THD, user, binlog
+#define OPTION_FOUND_COMMENT    (LL(1) << 15)      // SELECT, intern, parser
+#define OPTION_SAFE_UPDATES     (LL(1) << 16)      // THD, user
+#define OPTION_BUFFER_RESULT    (LL(1) << 17)      // SELECT, user
+#define OPTION_BIN_LOG          (LL(1) << 18)      // THD, user
+#define OPTION_NOT_AUTOCOMMIT   (LL(1) << 19)      // THD, user
+#define OPTION_BEGIN            (LL(1) << 20)      // THD, intern
+#define OPTION_TABLE_LOCK       (LL(1) << 21)      // THD, intern
+#define OPTION_QUICK            (LL(1) << 22)      // SELECT (for DELETE)
+#define OPTION_QUOTE_SHOW_CREATE (LL(1) << 23)     // THD, user
 
 /* Thr following is used to detect a conflict with DISTINCT
    in the user query has requested */
-#define SELECT_ALL              (1L << 24)      // SELECT, user, parser
+#define SELECT_ALL              (LL(1) << 24)      // SELECT, user, parser
 
 /* Set if we are updating a non-transaction safe table */
-#define OPTION_STATUS_NO_TRANS_UPDATE   (1L << 25) // THD, intern
+#define OPTION_STATUS_NO_TRANS_UPDATE   (LL(1) << 25) // THD, intern
 
 /* The following can be set when importing tables in a 'wrong order'
    to suppress foreign key checks */
-#define OPTION_NO_FOREIGN_KEY_CHECKS    (1L << 26) // THD, user, binlog
+#define OPTION_NO_FOREIGN_KEY_CHECKS    (LL(1) << 26) // THD, user, binlog
 /* The following speeds up inserts to InnoDB tables by suppressing unique
    key checks in some cases */
-#define OPTION_RELAXED_UNIQUE_CHECKS    (1L << 27) // THD, user, binlog
-#define SELECT_NO_UNLOCK                (1L << 28) // SELECT, intern
-#define OPTION_SCHEMA_TABLE             (1L << 29) // SELECT, intern
+#define OPTION_RELAXED_UNIQUE_CHECKS    (LL(1) << 27) // THD, user, binlog
+#define SELECT_NO_UNLOCK                (LL(1) << 28) // SELECT, intern
+#define OPTION_SCHEMA_TABLE             (LL(1) << 29) // SELECT, intern
 /* Flag set if setup_tables already done */
-#define OPTION_SETUP_TABLES_DONE        (1L << 30) // intern
+#define OPTION_SETUP_TABLES_DONE        (LL(1) << 30) // intern
 /* If not set then the thread will ignore all warnings with level notes. */
-#define OPTION_SQL_NOTES                (1UL << 31) // THD, user
+#define OPTION_SQL_NOTES                (LL(1) << 31) // THD, user
 /* 
   Force the used temporary table to be a MyISAM table (because we will use
   fulltext functions when reading from it.
@@ -600,6 +600,7 @@
 bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
 bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
 void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags);
+void mysql_client_binlog_statement(THD *thd);
 bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
                     my_bool drop_temporary);
 int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
@@ -1199,6 +1200,13 @@
 extern ulong query_buff_size, thread_stack;
 extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit;
 extern ulong max_binlog_size, max_relay_log_size;
+extern const char *opt_binlog_format;
+#ifdef HAVE_ROW_BASED_REPLICATION
+extern my_bool binlog_row_based;
+extern ulong opt_binlog_rows_event_max_size;
+#else
+extern const my_bool binlog_row_based;
+#endif
 extern ulong rpl_recovery_rank, thread_cache_size;
 extern ulong back_log;
 extern ulong specialflag, current_pid;
@@ -1339,6 +1347,7 @@
 extern handlerton heap_hton;
 
 extern SHOW_COMP_OPTION have_isam;
+extern SHOW_COMP_OPTION have_row_based_replication;
 extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink;
 extern SHOW_COMP_OPTION have_query_cache;
 extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;

--- 1.206/sql/sql_lex.h	2005-12-22 12:19:02 +11:00
+++ 1.207/sql/sql_lex.h	2005-12-22 19:07:58 +11:00
@@ -95,7 +95,8 @@
   SQLCOM_SHOW_PROC_CODE, SQLCOM_SHOW_FUNC_CODE,
   SQLCOM_ALTER_TABLESPACE,
   SQLCOM_INSTALL_PLUGIN, SQLCOM_UNINSTALL_PLUGIN,
-  SQLCOM_SHOW_AUTHORS, SQLCOM_SHOW_PLUGINS,
+  SQLCOM_SHOW_AUTHORS, SQLCOM_BINLOG_BASE64_EVENT,
+  SQLCOM_SHOW_PLUGINS,
   /* This should be the last !!! */
 
   SQLCOM_END

--- 1.483/sql/sql_parse.cc	2005-12-22 11:29:11 +11:00
+++ 1.484/sql/sql_parse.cc	2005-12-22 19:07:59 +11:00
@@ -3712,8 +3712,8 @@
     {
       if (mysql_bin_log.is_open())
       {
-        Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
-        mysql_bin_log.write(&qinfo);
+        thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+                          thd->query, thd->query_length, FALSE, FALSE);
       }
       send_ok(thd);
     }
@@ -3730,8 +3730,8 @@
     {
       if (mysql_bin_log.is_open())
       {
-        Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
-        mysql_bin_log.write(&qinfo);
+        thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+                          thd->query, thd->query_length, FALSE, FALSE);
       }
       send_ok(thd);
     }
@@ -3748,8 +3748,8 @@
     {
       if (mysql_bin_log.is_open())
       {
-        Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
-        mysql_bin_log.write(&qinfo);
+        thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+                          thd->query, thd->query_length, FALSE, FALSE);
       }
       send_ok(thd);
     }
@@ -3764,8 +3764,8 @@
     {
       if (mysql_bin_log.is_open())
       {
-	Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
-	mysql_bin_log.write(&qinfo);
+        thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+                          thd->query, thd->query_length, FALSE, FALSE);
       }
       send_ok(thd);
     }
@@ -3844,8 +3844,8 @@
       if (!res && mysql_bin_log.is_open())
       {
         thd->clear_error();
-        Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
-        mysql_bin_log.write(&qinfo);
+        thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+                          thd->query, thd->query_length, FALSE, FALSE);
       }
     }
     else
@@ -3864,8 +3864,8 @@
 	if (mysql_bin_log.is_open())
 	{
           thd->clear_error();
-	  Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
-	  mysql_bin_log.write(&qinfo);
+          thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+                            thd->query, thd->query_length, FALSE, FALSE);
 	}
 	if (lex->sql_command == SQLCOM_GRANT)
 	{
@@ -4161,12 +4161,12 @@
       			       db, name,
                                lex->sql_command == SQLCOM_CREATE_PROCEDURE, 1))
       {
-        close_thread_tables(thd);
         if (sp_grant_privileges(thd, db, name, 
                                 lex->sql_command == SQLCOM_CREATE_PROCEDURE))
           push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 
 	  	       ER_PROC_AUTO_GRANT_FAIL,
 		       ER(ER_PROC_AUTO_GRANT_FAIL));
+        close_thread_tables(thd);
       }
 #endif
       send_ok(thd);
@@ -4394,8 +4394,8 @@
         if (mysql_bin_log.is_open())
         {
           thd->clear_error();
-          Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
-          mysql_bin_log.write(&qinfo);
+          thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+                            thd->query, thd->query_length, FALSE, FALSE);
         }
 	send_ok(thd);
 	break;
@@ -4483,8 +4483,8 @@
         if (mysql_bin_log.is_open())
         {
           thd->clear_error();
-          Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
-          mysql_bin_log.write(&qinfo);
+          thd->binlog_query(THD::MYSQL_QUERY_TYPE,
+                            thd->query, thd->query_length, FALSE, FALSE);
         }
 	send_ok(thd);
 	break;
@@ -4608,8 +4608,8 @@
         buff.append(STRING_WITH_LEN(" AS "));
         buff.append(first_table->source.str, first_table->source.length);
 
-        Query_log_event qinfo(thd, buff.ptr(), buff.length(), 0, FALSE);
-        mysql_bin_log.write(&qinfo);
+        thd->binlog_query(THD::STMT_QUERY_TYPE,
+                          buff.ptr(), buff.length(), FALSE, FALSE);
       }
       break;
     }
@@ -4622,8 +4622,8 @@
           mysql_bin_log.is_open())
       {
         thd->clear_error();
-        Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
-        mysql_bin_log.write(&qinfo);
+        thd->binlog_query(THD::STMT_QUERY_TYPE,
+                          thd->query, thd->query_length, FALSE, FALSE);
       }
       break;
     }
@@ -4832,15 +4832,24 @@
     if (! (res= mysql_uninstall_plugin(thd, &thd->lex->comment)))
       send_ok(thd);
     break;
+  case SQLCOM_BINLOG_BASE64_EVENT:
+  {
+#ifndef EMBEDDED_LIBRARY
+    mysql_client_binlog_statement(thd);
+#else /* EMBEDDED_LIBRARY */
+    my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "embedded");
+#endif /* EMBEDDED_LIBRARY */
+    break;
+  }
   default:
     DBUG_ASSERT(0);                             /* Impossible */
     send_ok(thd);
     break;
   }
   thd->proc_info="query end";
-  /* Two binlog-related cleanups: */
 
   /*
+    Binlog-related cleanup:
     Reset system variables temporarily modified by SET ONE SHOT.
 
     Exception: If this is a SET, do nothing. This is to allow
@@ -5576,7 +5585,6 @@
   lex->query_tables= 0;
   lex->query_tables_last= &lex->query_tables;
 }
-
 
 /*
   When you modify mysql_parse(), you may need to mofify

--- 1.422/sql/sql_yacc.yy	2005-12-22 12:19:02 +11:00
+++ 1.423/sql/sql_yacc.yy	2005-12-22 19:07:59 +11:00
@@ -914,6 +914,7 @@
 	  alter
 	| analyze
 	| backup
+	| binlog_base64_event
 	| call
 	| change
 	| check
@@ -4825,6 +4826,13 @@
 	table_list opt_mi_check_type
 	{}
 	;
+
+binlog_base64_event:
+        BINLOG_SYM TEXT_STRING_sys
+        {
+           Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT;
+           Lex->comment= $2;
+        }
 
 check:
 	CHECK_SYM table_or_tables

--- 1.54/sql/share/errmsg.txt	2005-12-22 12:19:02 +11:00
+++ 1.55/sql/share/errmsg.txt	2005-12-22 19:09:22 +11:00
@@ -5741,3 +5741,9 @@
         eng "The size number was correct but we don't allow the digit part to be more than 2 billion"
 ER_ALTER_TABLESPACE_FAILED
         eng "Failed to alter: %s"
+ER_BINLOG_ROW_LOGGING_FAILED
+	eng "Writing one row to the row-based binary log failed"
+ER_BINLOG_ROW_WRONG_TABLE_DEF
+	eng "Table definition on master and slave does not match"
+ER_BINLOG_ROW_RBR_TO_SBR
+	eng "Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events"
Thread
bk commit into 5.1 tree (stewart:1.1980)Stewart Smith22 Dec