List:Commits« Previous MessageNext Message »
From:kent Date:February 28 2006 11:30pm
Subject:bk commit into 5.1 tree (kent:1.2202)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kent. When kent 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.2202 06/02/28 23:29:58 kent@stripped +16 -0
  Merge

  sql/log_event.cc
    1.209 06/02/28 23:29:47 kent@stripped +1 -2

  mysql-test/t/mysqldump.test
    1.90 06/02/28 23:22:05 kent@stripped +0 -0
    SCCS merged

  mysql-test/r/mysqldump.result
    1.99 06/02/28 22:56:52 kent@stripped +0 -30

  client/Makefile.am
    1.64 06/02/28 22:51:48 kent@stripped +7 -5

  sql/sql_table.cc
    1.310 06/02/28 22:46:26 kent@stripped +0 -3
    Auto merged

  sql/sql_partition.cc
    1.43 06/02/28 22:46:25 kent@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.524 06/02/28 22:46:24 kent@stripped +0 -0
    Auto merged

  sql/log_event.h
    1.130 06/02/28 22:46:23 kent@stripped +0 -0
    Auto merged

  sql/field.h
    1.178 06/02/28 22:46:22 kent@stripped +0 -0
    Auto merged

  scripts/mysql_fix_privilege_tables.sql
    1.42 06/02/28 22:46:22 kent@stripped +0 -0
    Auto merged

  mysql-test/t/disabled.def
    1.87 06/02/28 22:46:21 kent@stripped +0 -0
    Auto merged

  mysql-test/t/create.test
    1.78 06/02/28 22:46:21 kent@stripped +0 -8
    Auto merged

  mysql-test/r/create.result
    1.117 06/02/28 22:46:20 kent@stripped +0 -6
    Auto merged

  include/config-win.h
    1.81 06/02/28 22:46:20 kent@stripped +0 -0
    Auto merged

  client/mysqlimport.c
    1.71 06/02/28 22:46:20 kent@stripped +0 -0
    Auto merged

  configure.in
    1.345 06/02/28 22:46:18 kent@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:	kent
# Host:	c-734072d5.010-2112-6f72651.cust.bredbandsbolaget.se
# Root:	/Users/kent/mysql/bk/mysql-5.1-new/RESYNC

--- 1.63/client/Makefile.am	2006-02-20 13:04:34 +01:00
+++ 1.64/client/Makefile.am	2006-02-28 22:51:48 +01:00
@@ -21,17 +21,21 @@
 else
   yassl_dummy_link_fix=
 endif
+
+if THREAD_SAFE_CLIENT
+LIBMYSQLCLIENT_LA =		$(top_builddir)/libmysql_r/libmysqlclient_r.la
+else
+LIBMYSQLCLIENT_LA =		$(top_builddir)/libmysql/libmysqlclient.la
+endif
+
 #AUTOMAKE_OPTIONS =              nostdinc
 INCLUDES =			-I$(top_builddir)/include \
 				-I$(top_srcdir)/include \
 				-I$(top_srcdir)/regex \
-                                $(openssl_includes) $(yassl_includes)
+				$(openssl_includes) $(yassl_includes)
 LIBS =				@CLIENT_LIBS@
 LDADD=				@CLIENT_EXTRA_LDFLAGS@ $(CLIENT_THREAD_LIBS) \
-                                $(top_builddir)/libmysql/libmysqlclient.la
-LDADD_R=			@CLIENT_EXTRA_LDFLAGS@ \
-                                $(CLIENT_THREAD_LIBS) \
-                                $(top_builddir)/libmysql_r/libmysqlclient_r.la
+				$(top_builddir)/libmysql/libmysqlclient.la
 bin_PROGRAMS =			mysql mysqladmin mysqlcheck mysqlshow \
 				mysqldump mysqlimport mysqltest mysqlbinlog \
 				mysqltestmanagerc mysqltestmanager-pwgen \
@@ -41,8 +45,8 @@
 mysql_SOURCES =			mysql.cc readline.cc sql_string.cc completion_hash.cc
 mysqladmin_SOURCES =		mysqladmin.cc
 mysql_LDADD =			@readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS)
-mysqltest_SOURCES=              mysqltest.c $(top_srcdir)/mysys/my_getsystime.c \
-                                $(yassl_dummy_link_fix)
+mysqltest_SOURCES=		mysqltest.c $(top_srcdir)/mysys/my_getsystime.c \
+				$(yassl_dummy_link_fix)
 mysqltest_LDADD =		$(top_builddir)/regex/libregex.a $(LDADD)
 mysqlbinlog_SOURCES =		mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c \
 				$(top_srcdir)/mysys/my_new.cc \
@@ -51,18 +55,22 @@
 				$(top_srcdir)/mysys/my_vle.c \
 				$(top_srcdir)/mysys/base64.c
 mysqlbinlog_LDADD =		$(LDADD) $(CXXLDFLAGS)
-mysqlslap_LDADD =		$(CXXLDFLAGS) $(LDADD_R) \
-				$(top_builddir)/mysys/libmysys.a
-mysqlimport_LDADD =		$(CXXLDFLAGS) $(LDADD_R) \
-				$(top_builddir)/mysys/libmysys.a
-mysqltestmanager_pwgen_SOURCES =   mysqlmanager-pwgen.c
-mysqltestmanagerc_SOURCES=      mysqlmanagerc.c $(yassl_dummy_link_fix)
-mysqlcheck_SOURCES=             mysqlcheck.c $(yassl_dummy_link_fix)
-mysqlshow_SOURCES=              mysqlshow.c $(yassl_dummy_link_fix)
-mysqlslap_SOURCES=              mysqlslap.c \
+mysqlslap_LDADD =		$(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
+				@CLIENT_EXTRA_LDFLAGS@ \
+				$(LIBMYSQLCLIENT_LA) \
+				$(top_builddir)/mysys/libmysys.a 
+mysqlimport_LDADD =		$(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
+				@CLIENT_EXTRA_LDFLAGS@ \
+				$(LIBMYSQLCLIENT_LA) \
+				$(top_builddir)/mysys/libmysys.a 
+mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c 
+mysqltestmanagerc_SOURCES=	mysqlmanagerc.c $(yassl_dummy_link_fix)
+mysqlcheck_SOURCES=		 mysqlcheck.c $(yassl_dummy_link_fix)
+mysqlshow_SOURCES=		mysqlshow.c $(yassl_dummy_link_fix)
+mysqlslap_SOURCES=		mysqlslap.c \
 				$(yassl_dummy_link_fix)
-mysqldump_SOURCES=              mysqldump.c my_user.c $(yassl_dummy_link_fix)
-mysqlimport_SOURCES=            mysqlimport.c \
+mysqldump_SOURCES=		mysqldump.c my_user.c $(yassl_dummy_link_fix)
+mysqlimport_SOURCES=		mysqlimport.c \
 				$(yassl_dummy_link_fix)
 sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
 strings_src=decimal.c

--- 1.344/configure.in	2006-02-25 19:35:06 +01:00
+++ 1.345/configure.in	2006-02-28 22:46:18 +01:00
@@ -592,10 +592,10 @@
 
 # Make thread safe client
 AC_ARG_ENABLE(thread-safe-client,
-    [  --enable-thread-safe-client   
-                          Compile the client with threads.],
+    [  --disable-thread-safe-client   
+                          Compile the client without threads.],
     [ THREAD_SAFE_CLIENT=$enableval ],
-    [ THREAD_SAFE_CLIENT=no ]
+    [ THREAD_SAFE_CLIENT=yes ]
     )
 
 # compile with strings functions in assembler
@@ -1567,7 +1567,8 @@
 fi
 
 AC_ARG_WITH(debug,
-    [  --without-debug         Build a production version without debugging code],
+    [  --with-debug            Add debug code
+  --with-debug=full       Add debug code (adds memory checker, very slow)],
     [with_debug=$withval],
     [with_debug=no])
 if test "$with_debug" = "yes"
@@ -2474,6 +2475,8 @@
 dnl client is just using plain-old libs.
 sql_client_dirs="strings regex mysys libmysql client"
 linked_client_targets="linked_libmysql_sources"
+
+AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no")
 
 if test "$THREAD_SAFE_CLIENT" != "no"
 then

--- 1.80/include/config-win.h	2006-02-17 12:08:47 +01:00
+++ 1.81/include/config-win.h	2006-02-28 22:46:20 +01:00
@@ -427,6 +427,7 @@
 
 #define HAVE_SPATIAL 1
 #define HAVE_RTREE_KEYS 1
+#define HAVE_ROW_BASED_REPLICATION 1
 
 /* #undef HAVE_OPENSSL */
 /* #undef HAVE_YASSL */

--- 1.177/sql/field.h	2006-02-24 15:38:12 +01:00
+++ 1.178/sql/field.h	2006-02-28 22:46:22 +01:00
@@ -1427,9 +1427,10 @@
   */
   ulong length;
   /*
-    The value of 'length' before a call to create_length_to_internal_length
+    The value of `length' as set by parser: is the number of characters
+    for most of the types, or of bytes for BLOBs or numeric types.
   */
-  uint32 chars_length;
+  uint32 char_length;
   uint  decimals, flags, pack_length, key_length;
   Field::utype unireg_check;
   TYPELIB *interval;			// Which interval to use

--- 1.208/sql/log_event.cc	2006-02-28 12:50:16 +01:00
+++ 1.209/sql/log_event.cc	2006-02-28 23:29:47 +01:00
@@ -5601,7 +5601,7 @@
   char sbuf[sizeof(m_width)];
   my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf;
 
-  char *const sbuf_end= net_store_length(sbuf, (uint) m_width);
+  char *const sbuf_end= net_store_length((char*) sbuf, (uint) m_width);
   DBUG_ASSERT(static_cast<my_size_t>(sbuf_end - sbuf) <= sizeof(sbuf));
 
   return (my_b_safe_write(file, reinterpret_cast<byte*>(sbuf),
@@ -6050,7 +6050,7 @@
   byte const tbuf[]= { m_tbllen };
 
   char cbuf[sizeof(m_colcnt)];
-  char *const cbuf_end= net_store_length(cbuf, (uint) m_colcnt);
+  char *const cbuf_end= net_store_length((char*) cbuf, (uint) m_colcnt);
   DBUG_ASSERT(static_cast<my_size_t>(cbuf_end - cbuf) <= sizeof(cbuf));
 
   return (my_b_safe_write(file, dbuf,      sizeof(dbuf)) ||
@@ -6058,7 +6058,7 @@
           my_b_safe_write(file, tbuf,      sizeof(tbuf)) ||
           my_b_safe_write(file, (const byte*)m_tblnam,  m_tbllen+1) ||
           my_b_safe_write(file, reinterpret_cast<byte*>(cbuf),
-                          cbuf_end - cbuf) ||
+                          cbuf_end - (char*) cbuf) ||
           my_b_safe_write(file, reinterpret_cast<byte*>(m_coltype), m_colcnt));
  }
 #endif
@@ -6365,18 +6365,27 @@
 **************************************************************************/
 
 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-static int record_compare(TABLE *table, char const *a, char const *b)
+/*
+  Compares table->record[0] and table->record[1]
+
+  Returns TRUE if different.
+*/
+static bool record_compare(TABLE *table)
 {
-  for (my_size_t i= 0 ; i < table->s->fields ; ++i)
+  if (table->s->blob_fields + table->s->varchar_fields == 0)
+    return cmp_record(table,record[1]);
+  /* Compare null bits */
+  if (memcmp(table->null_flags,
+	     table->null_flags+table->s->rec_buff_length,
+	     table->s->null_bytes))
+    return TRUE;				// Diff in NULL value
+  /* Compare updated fields */
+  for (Field **ptr=table->field ; *ptr ; ptr++)
   {
-    uint const off= table->field[i]->offset();
-    uint const res= table->field[i]->cmp_binary(a + off, 
-                                                b + off);
-    if (res != 0) {
-      return res;
-    }
+    if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length))
+      return TRUE;
   }
-  return 0;
+  return FALSE;
 }
 
 
@@ -6384,15 +6393,12 @@
   Find the row given by 'key', if the table has keys, or else use a table scan
   to find (and fetch) the row.  If the engine allows random access of the
   records, a combination of position() and rnd_pos() will be used.
-
-  The 'record_buf' will be used as buffer for records while locating the
-  correct row.
  */
-static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf)
+static int find_and_fetch_row(TABLE *table, byte *key)
 {
   DBUG_ENTER("find_and_fetch_row(TABLE *table, byte *key, byte *record)");
   DBUG_PRINT("enter", ("table=%p, key=%p, record=%p",
-		       table, key, record_buf));
+		       table, key, table->record[1]));
 
   DBUG_ASSERT(table->in_use != NULL);
 
@@ -6410,7 +6416,7 @@
     DBUG_RETURN(table->file->rnd_pos(table->record[0], table->file->ref));
   }
 
-  DBUG_ASSERT(record_buf);
+  DBUG_ASSERT(table->record[1]);
 
   /* We need to retrieve all fields */
   table->file->ha_set_all_bits_in_read_set();
@@ -6418,7 +6424,7 @@
   if (table->s->keys > 0)
   {
     int error;
-    if ((error= table->file->index_read_idx(record_buf, 0, key,
+    if ((error= table->file->index_read_idx(table->record[1], 0, key,
                                             table->key_info->key_length,
                                             HA_READ_KEY_EXACT)))
     {
@@ -6443,10 +6449,10 @@
     if (table->key_info->flags & HA_NOSAME)
       DBUG_RETURN(0);
 
-    while (record_compare(table, (const char*)table->record[0], (const
char*)record_buf) != 0)
+    while (record_compare(table))
     {
       int error;
-      if ((error= table->file->index_next(record_buf)))
+      if ((error= table->file->index_next(table->record[1])))
       {
 	table->file->print_error(error, MYF(0));
 	DBUG_RETURN(error);
@@ -6460,7 +6466,7 @@
     int error= 0;
     do
     {
-      error= table->file->rnd_next(record_buf);
+      error= table->file->rnd_next(table->record[1]);
       switch (error)
       {
       case 0:
@@ -6477,9 +6483,7 @@
 	DBUG_RETURN(error);
       }
     }
-    while (restart_count < 2 &&
-           record_compare(table, (const char*)table->record[0], 
-                          (const char*)record_buf) != 0);
+    while (restart_count < 2 && record_compare(table));
 
     DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == 0);
     DBUG_RETURN(error);
@@ -6499,7 +6503,7 @@
                                              bool is_transactional)
   : Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional)
 #ifdef HAVE_REPLICATION
-  ,m_memory(NULL), m_key(NULL), m_search_record(NULL)
+  ,m_memory(NULL), m_key(NULL), m_after_image(NULL)
 #endif
 {
 }
@@ -6516,7 +6520,7 @@
   : Rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event)
 #else
   : Rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event),
-    m_memory(NULL), m_key(NULL), m_search_record(NULL)
+    m_memory(NULL), m_key(NULL), m_after_image(NULL)
 #endif
 {
 }
@@ -6531,7 +6535,7 @@
       table->s->primary_key < MAX_KEY)
   {
     /*
-      We don't need to allocate any memory for m_search_record and
+      We don't need to allocate any memory for m_after_image and
       m_key since they are not used.
     */
     return 0;
@@ -6543,14 +6547,14 @@
   {
     m_memory=
       my_multi_malloc(MYF(MY_WME),
-		      &m_search_record, table->s->reclength,
+		      &m_after_image, table->s->reclength,
 		      &m_key, table->key_info->key_length,
 		      NULL);
   }
   else
   {
-    m_search_record= (byte*)my_malloc(table->s->reclength, MYF(MY_WME));
-    m_memory= (gptr)m_search_record;
+    m_after_image= (byte*)my_malloc(table->s->reclength, MYF(MY_WME));
+    m_memory= (gptr)m_after_image;
     m_key= NULL;
   }
   if (!m_memory)
@@ -6577,7 +6581,7 @@
   table->file->ha_index_or_rnd_end();
   my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc
   m_memory= NULL;
-  m_search_record= NULL;
+  m_after_image= NULL;
   m_key= NULL;
 
   return error;
@@ -6615,7 +6619,7 @@
 {
   DBUG_ASSERT(table != NULL);
 
-  int error= find_and_fetch_row(table, m_key, m_search_record);
+  int error= find_and_fetch_row(table, m_key);
   if (error)
     return error;
 
@@ -6687,30 +6691,20 @@
 {
   DBUG_ASSERT(m_memory == NULL);
 
-  if ((table->file->table_flags() & HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS)
&&
-      table->s->primary_key < MAX_KEY)
-  {
-    /*
-      We don't need to allocate any memory for m_search_record and
-      m_key since they are not used.
-    */
-    return 0;
-  }
-
   int error= 0;
 
   if (table->s->keys > 0)
   {
     m_memory=
       my_multi_malloc(MYF(MY_WME),
-		      &m_search_record, table->s->reclength,
+		      &m_after_image, table->s->reclength,
 		      &m_key, table->key_info->key_length,
 		      NULL);
   }
   else
   {
-    m_search_record= (byte*)my_malloc(table->s->reclength, MYF(MY_WME));
-    m_memory= (gptr)m_search_record;
+    m_after_image= (byte*)my_malloc(table->s->reclength, MYF(MY_WME));
+    m_memory= (gptr)m_after_image;
     m_key= NULL;
   }
   if (!m_memory)
@@ -6738,7 +6732,7 @@
   table->file->ha_index_or_rnd_end();
   my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR));
   m_memory= NULL;
-  m_search_record= NULL;
+  m_after_image= NULL;
   m_key= NULL;
 
   return error;
@@ -6758,8 +6752,8 @@
   /* record[0] is the before image for the update */
   ptr= unpack_row(table, table->record[0], ptr, &m_cols);
   DBUG_ASSERT(ptr != NULL);
-  /* record[1] is the after image for the update */
-  ptr= unpack_row(table, table->record[1], ptr, &m_cols);
+  /* m_after_image is the after image for the update */
+  ptr= unpack_row(table, m_after_image, ptr, &m_cols);
 
   /*
     If we will access rows using the random access method, m_key will
@@ -6779,9 +6773,18 @@
 {
   DBUG_ASSERT(table != NULL);
 
-  int error= find_and_fetch_row(table, m_key, m_search_record);
+  int error= find_and_fetch_row(table, m_key);
   if (error)
     return error;
+
+  /*
+    This is only a precaution to make sure that the call to
+    ha_update_row is using record[1].
+
+    If this is not needed/required, then we could use m_after_image in
+    that call instead.
+  */
+  bmove_align(table->record[1], m_after_image,(size_t) table->s->reclength);
 
   /*
     Now we should have the right row to update.  The record that has

--- 1.129/sql/log_event.h	2006-02-24 15:38:13 +01:00
+++ 1.130/sql/log_event.h	2006-02-28 22:46:23 +01:00
@@ -28,14 +28,6 @@
 
 #include <my_bitmap.h>
 
-#if !defined(MYSQL_CLIENT)
-#ifdef HAVE_ROW_BASED_REPLICATION
-extern my_bool binlog_row_based;
-#else
-extern const my_bool binlog_row_based;
-#endif
-#endif
-
 #define LOG_READ_EOF    -1
 #define LOG_READ_BOGUS  -2
 #define LOG_READ_IO     -3
@@ -131,6 +123,7 @@
  ****************************************************************************/
 struct sql_ex_info
 {
+  sql_ex_info() {}                            /* Remove gcc warning */
   char* field_term;
   char* enclosed;
   char* line_term;

--- 1.523/sql/sql_parse.cc	2006-02-24 05:20:20 +01:00
+++ 1.524/sql/sql_parse.cc	2006-02-28 22:46:24 +01:00
@@ -4972,7 +4972,9 @@
     break;
   }
   default:
+#ifndef EMBEDDED_LIBRARY
     DBUG_ASSERT(0);                             /* Impossible */
+#endif
     send_ok(thd);
     break;
   }
@@ -4990,6 +4992,7 @@
   */
   if (thd->one_shot_set && lex->sql_command != SQLCOM_SET_OPTION)
     reset_one_shot_variables(thd);
+  thd->reset_current_stmt_binlog_row_based();
 
   /*
     The return value for ROW_COUNT() is "implementation dependent" if the
@@ -6149,10 +6152,11 @@
     /*
       table_list.next points to the last inserted TABLE_LIST->next_local'
       element
+      We don't use the offsetof() macro here to avoid warnings from gcc
     */
-    previous_table_ref= (TABLE_LIST*) (table_list.next -
-                                       offsetof(TABLE_LIST, next_local));
-    DBUG_ASSERT(previous_table_ref);
+    previous_table_ref= (TABLE_LIST*) ((char*) table_list.next -
+                                       ((char*) &(ptr->next_local) -
+                                        (char*) ptr));
     /*
       Set next_name_resolution_table of the previous table reference to point
       to the current table reference. In effect the list

--- 1.309/sql/sql_table.cc	2006-02-24 21:29:48 +01:00
+++ 1.310/sql/sql_table.cc	2006-02-28 22:46:26 +01:00
@@ -565,7 +565,7 @@
   String built_query;
   DBUG_ENTER("mysql_rm_table_part2");
 
-  if (binlog_row_based && !dont_log_query)
+  if (thd->current_stmt_binlog_row_based && !dont_log_query)
   {
     built_query.set_charset(system_charset_info);
     if (if_exists)
@@ -612,7 +612,7 @@
       being built.  The string always end in a comma and the comma
       will be chopped off before being written to the binary log.
       */
-    if (binlog_row_based && !dont_log_query)
+    if (thd->current_stmt_binlog_row_based && !dont_log_query)
     {
       ++non_temp_tables_count;
       /*
@@ -722,7 +722,7 @@
     query_cache_invalidate3(thd, tables, 0);
     if (!dont_log_query)
     {
-      if (!binlog_row_based ||
+      if (!thd->current_stmt_binlog_row_based ||
           non_temp_tables_count > 0 && !tmp_table_deleted)
       {
         /*
@@ -734,7 +734,7 @@
          */
         write_bin_log(thd, !error, thd->query, thd->query_length);
       }
-      else if (binlog_row_based &&
+      else if (thd->current_stmt_binlog_row_based &&
                non_temp_tables_count > 0 &&
                tmp_table_deleted)
       {
@@ -1127,6 +1127,12 @@
   {
     CHARSET_INFO *save_cs;
 
+    /*
+      Initialize length from its original value (number of characters),
+      which was set in the parser. This is necessary if we're
+      executing a prepared statement for the second time.
+    */
+    sql_field->length= sql_field->char_length;
     if (!sql_field->charset)
       sql_field->charset= create_info->default_table_charset;
     /*
@@ -1311,7 +1317,7 @@
 	  sql_field->charset=		(dup_field->charset ?
 					 dup_field->charset :
 					 create_info->default_table_charset);
-	  sql_field->length=		dup_field->chars_length;
+	  sql_field->length=		dup_field->char_length;
           sql_field->pack_length=	dup_field->pack_length;
           sql_field->key_length=	dup_field->key_length;
 	  sql_field->create_length_to_internal_length();
@@ -2250,8 +2256,8 @@
     Otherwise, the statement shall be binlogged.
    */
   if (!internal_tmp_table &&
-      (!binlog_row_based ||
-       (binlog_row_based &&
+      (!thd->current_stmt_binlog_row_based ||
+       (thd->current_stmt_binlog_row_based &&
         !(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
     write_bin_log(thd, TRUE, thd->query, thd->query_length);
   error= FALSE;
@@ -3477,7 +3483,7 @@
   /*
     We have to write the query before we unlock the tables.
   */
-  if (binlog_row_based)
+  if (thd->current_stmt_binlog_row_based)
   {
     /*
        Since temporary tables are not replicated under row-based
@@ -4031,6 +4037,13 @@
 	close_cached_table(thd, table);
 	if (mysql_rename_table(old_db_type,db,table_name,new_db,new_alias))
 	  error= -1;
+        else if (Table_triggers_list::change_table_name(thd, db, table_name,
+                                                        new_db, new_alias))
+        {
+          VOID(mysql_rename_table(old_db_type, new_db, new_alias, db,
+                                  table_name));
+          error= -1;
+        }
       }
       VOID(pthread_mutex_unlock(&LOCK_open));
     }
@@ -4863,7 +4876,7 @@
       goto err;
     }
     /* We don't replicate alter table statement on temporary tables */
-    if (!binlog_row_based)
+    if (!thd->current_stmt_binlog_row_based)
       write_bin_log(thd, TRUE, thd->query, thd->query_length);
     goto end_temporary;
   }
@@ -4933,7 +4946,11 @@
     VOID(quick_rm_table(new_db_type,new_db,tmp_name));
   }
   else if (mysql_rename_table(new_db_type,new_db,tmp_name,new_db,
-			      new_alias))
+			      new_alias) ||
+           (new_name != table_name || new_db != db) && // we also do rename
+           Table_triggers_list::change_table_name(thd, db, table_name,
+                                                  new_db, new_alias))
+       
   {						// Try to get everything back
     error=1;
     VOID(quick_rm_table(new_db_type,new_db,new_alias));
@@ -5033,7 +5050,7 @@
                       thd->query, thd->query_length,
                       db, table_name);
 
-  DBUG_ASSERT(!(mysql_bin_log.is_open() && binlog_row_based &&
+  DBUG_ASSERT(!(mysql_bin_log.is_open() && thd->current_stmt_binlog_row_based
&&
                 (create_info->options & HA_LEX_CREATE_TMP_TABLE)));
   write_bin_log(thd, TRUE, thd->query, thd->query_length);
   /*

--- 1.86/mysql-test/t/disabled.def	2006-02-27 15:07:05 +01:00
+++ 1.87/mysql-test/t/disabled.def	2006-02-28 22:46:21 +01:00
@@ -20,7 +20,7 @@
 ndb_load                : Bug#17233
 partition_03ndb         : Bug#16385
 ps_7ndb                 : dbug assert in RBR mode when executing test suite
-rpl_bit_npk             : Bug#13418
+#rpl_bit_npk             : Bug#13418
 rpl_ddl                 : Bug#15963 SBR does not show "Definer" correctly
 rpl_ndb_2innodb         : Bugs#17400, 17687, 17701
 rpl_ndb_2myisam         : Bugs#17400, 17687, 17701

--- 1.41/scripts/mysql_fix_privilege_tables.sql	2006-02-24 00:29:31 +01:00
+++ 1.42/scripts/mysql_fix_privilege_tables.sql	2006-02-28 22:46:22 +01:00
@@ -685,3 +685,9 @@
 ALTER TABLE tables_priv MODIFY Table_priv
set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create
View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
 
 UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0;
+
+# Activate the new, possible modified privilege tables
+# This should not be needed, but gives us some extra testing that the above
+# changes was correct
+
+flush privileges;

--- 1.42/sql/sql_partition.cc	2006-02-28 12:29:44 +01:00
+++ 1.43/sql/sql_partition.cc	2006-02-28 22:46:25 +01:00
@@ -2342,6 +2342,29 @@
 
 
 /*
+  A function to handle correct handling of NULL values in partition
+  functions.
+  SYNOPSIS
+    part_val_int()
+    item_expr                 The item expression to evaluate
+  RETURN VALUES
+    The value of the partition function, LONGLONG_MIN if any null value
+    in function
+*/
+
+static
+inline
+longlong
+part_val_int(Item *item_expr)
+{
+  longlong value= item_expr->val_int();
+  if (item_expr->null_value)
+    value= LONGLONG_MIN;
+  return value;
+}
+
+
+/*
   The next set of functions are used to calculate the partition identity.
   A handler sets up a variable that corresponds to one of these functions
   to be able to quickly call it whenever the partition id needs to calculated
@@ -2437,7 +2460,7 @@
                                longlong *func_value)
 {
   DBUG_ENTER("get_part_id_hash");
-  *func_value= part_expr->val_int();
+  *func_value= part_val_int(part_expr);
   longlong int_hash_id= *func_value % no_parts;
   DBUG_RETURN(int_hash_id < 0 ? -int_hash_id : int_hash_id);
 }
@@ -2466,7 +2489,7 @@
 {
   DBUG_ENTER("get_part_id_linear_hash");
 
-  *func_value= part_expr->val_int();
+  *func_value= part_val_int(part_expr);
   DBUG_RETURN(get_part_id_from_linear_hash(*func_value,
                                            part_info->linear_hash_mask,
                                            no_parts));
@@ -2604,7 +2627,7 @@
   longlong list_value;
   int min_list_index= 0;
   int max_list_index= part_info->no_list_values - 1;
-  longlong part_func_value= part_info->part_expr->val_int();
+  longlong part_func_value= part_val_int(part_info->part_expr);
   DBUG_ENTER("get_partition_id_list");
 
   *func_value= part_func_value;
@@ -2680,7 +2703,7 @@
   longlong list_value;
   uint min_list_index= 0, max_list_index= part_info->no_list_values - 1;
   /* Get the partitioning function value for the endpoint */
-  longlong part_func_value= part_info->part_expr->val_int();
+  longlong part_func_value= part_val_int(part_info->part_expr);
   while (max_list_index >= min_list_index)
   {
     list_index= (max_list_index + min_list_index) >> 1;
@@ -2714,7 +2737,7 @@
   uint min_part_id= 0;
   uint max_part_id= max_partition;
   uint loc_part_id;
-  longlong part_func_value= part_info->part_expr->val_int();
+  longlong part_func_value= part_val_int(part_info->part_expr);
   DBUG_ENTER("get_partition_id_int_range");
 
   while (max_part_id > min_part_id)
@@ -2789,7 +2812,7 @@
   uint max_partition= part_info->no_parts - 1;
   uint min_part_id= 0, max_part_id= max_partition, loc_part_id;
   /* Get the partitioning function value for the endpoint */
-  longlong part_func_value= part_info->part_expr->val_int();
+  longlong part_func_value= part_val_int(part_info->part_expr);
   while (max_part_id > min_part_id)
   {
     loc_part_id= (max_part_id + min_part_id + 1) >> 1;
Thread
bk commit into 5.1 tree (kent:1.2202)kent28 Feb