List:Commits« Previous MessageNext Message »
From:guilhem Date:December 14 2005 9:45pm
Subject:bk commit into 5.1 tree (guilhem:1.1964)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of guilhem. When guilhem 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.1964 05/12/14 22:45:08 guilhem@stripped +2 -0
  WL#1012 "row-based replication":
  get_db() is not called by mysqlbinlog, and is behind #ifndef MYSQL_CLIENT for some
  of the old *log_event classes, but the some less old ones didn't use the #ifndef: correcting this.
  Rows_log_event needn't have m_dbnam, m_dblen, m_tblnam, m_tbllen (32 bytes saved if 64-bit CPU :),
  it didn't use these members except in get_db() where it can be replaced by m_table.

  sql/log_event.h
    1.147 05/12/14 22:45:04 guilhem@stripped +7 -10
    get_db() is not called by mysqlbinlog, and is behind #ifndef MYSQL_CLIENT for some
    of the old *log_event classes, but the some less old ones didn't use the #ifndef: correcting this.
    Rows_log_event needn't have m_dbnam, m_dblen, m_tblnam, m_tbllen (32 bytes saved if 64-bit CPU :),
    it didn't use these members except in get_db() where it can be replaced by m_table.

  sql/log_event.cc
    1.203 05/12/14 22:45:04 guilhem@stripped +12 -11
    assert that db and table_name in TABLE_SHARE are 0-terminated.

# 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:	guilhem
# Host:	gbichot3.local
# Root:	/home/mysql_src/mysql-5.1-wl1012-v3

--- 1.202/sql/log_event.cc	2005-12-14 22:13:50 +01:00
+++ 1.203/sql/log_event.cc	2005-12-14 22:45:04 +01:00
@@ -4998,22 +4998,11 @@
 	Rows_log_event member functions
 **************************************************************************/
 
-/*
-  In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in
-  table.cc / alloc_table_share():
-    Use the fact the key is db/0/table_name/0
-  We rely on this to be sure the m_dbnam and m_tblnam members of
-  Rows_log_event and Table_map_log_event are 0-terminated.
-*/
-
 #ifndef MYSQL_CLIENT
 Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
                                MY_BITMAP const *cols, bool is_transactional)
   : Log_event(thd_arg, 0, is_transactional),
-    m_dbnam(tbl_arg->s->db.str), m_dblen(m_dbnam ? tbl_arg->s->db.length : 0),
     m_table(tbl_arg),
-    m_tblnam(tbl_arg->s->table_name.str),
-    m_tbllen(tbl_arg->s->table_name.length), //m_tbl should be LEX_STRING*
     m_table_id(tid),
     m_width(tbl_arg->s->fields),
     m_rows_buf(my_malloc(opt_binlog_rows_event_max_size * sizeof(*m_rows_buf), MYF(MY_WME))),
@@ -5490,6 +5479,7 @@
 }
 #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
 
+#ifndef MYSQL_CLIENT
 bool Rows_log_event::write_data_header(IO_CACHE *file)
 {
   DBUG_ASSERT(m_table_id != ULONG_MAX);
@@ -5516,6 +5506,7 @@
                           no_bytes_in_map(&m_cols)) ||
           my_b_safe_write(file, m_rows_buf, data_size));
 }
+#endif
 
 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) && defined(DBUG_RBR)
 void Rows_log_event::pack_info(Protocol *protocol)
@@ -5553,6 +5544,16 @@
     m_flags(flags)
 {
   DBUG_ASSERT(m_table_id != ULONG_MAX);
+  /*
+    In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in
+    table.cc / alloc_table_share():
+      Use the fact the key is db/0/table_name/0
+    As we rely on this let's assert it.
+  */
+  DBUG_ASSERT((tbl->s->db.str == 0) ||
+              (tbl->s->db.str[tbl->s->db.length] == 0));
+  DBUG_ASSERT(tbl->s->table_name.str[tbl->s->table_name.length] == 0);
+
 
   m_data_size=  TABLE_MAP_HEADER_LEN;
   m_data_size+= m_dblen + 2;	// Include length and terminating \0

--- 1.146/sql/log_event.h	2005-12-14 22:13:50 +01:00
+++ 1.147/sql/log_event.h	2005-12-14 22:45:04 +01:00
@@ -1455,8 +1455,8 @@
   bool is_valid() const { return block != 0; }
 #ifndef MYSQL_CLIENT
   bool write(IO_CACHE* file);
-#endif
   const char* get_db() { return db; }
+#endif
 };
 
 
@@ -1491,8 +1491,8 @@
   bool is_valid() const { return file_id != 0; }
 #ifndef MYSQL_CLIENT
   bool write(IO_CACHE* file);
-#endif
   const char* get_db() { return db; }
+#endif
 };
 
 
@@ -1526,8 +1526,8 @@
   bool is_valid() const { return file_id != 0; }
 #ifndef MYSQL_CLIENT
   bool write(IO_CACHE* file);
-#endif
   const char* get_db() { return db; }
+#endif
 };
 
 
@@ -1705,8 +1705,8 @@
 #ifndef MYSQL_CLIENT
   virtual bool write_data_header(IO_CACHE *file);
   virtual bool write_data_body(IO_CACHE *file);
-#endif
   virtual const char *get_db() { return m_dbnam; }
+#endif
 
 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
   virtual int exec_event(struct st_relay_log_info *rli);
@@ -1818,9 +1818,11 @@
   my_size_t get_width() const       { return m_width; }
   ulong get_table_id() const        { return m_table_id; }
 
+#ifndef MYSQL_CLIENT
   virtual bool write_data_header(IO_CACHE *file);
   virtual bool write_data_body(IO_CACHE *file);
-  virtual const char *get_db() { return m_dbnam; }
+  virtual const char *get_db() { return m_table->s->db.str; }
+#endif
   virtual bool is_valid() const
   {
     /* that's how we check malloc() succeeded */
@@ -1872,14 +1874,9 @@
   virtual int do_add_row_data(byte *data, my_size_t length);
 #endif
 
-  char const *m_dbnam;		/* Database name */
-  my_size_t m_dblen;		/* Length of database name in bytes */
-
 #ifndef MYSQL_CLIENT
   TABLE *m_table;		/* The table the rows belong to */
 #endif
-  char const *m_tblnam;
-  my_size_t   m_tbllen;
   ulong       m_table_id;	/* Table ID */
   MY_BITMAP   m_cols;		/* Bitmap denoting columns available */
   ulong       m_width;          /* The width of the columns bitmap */
Thread
bk commit into 5.1 tree (guilhem:1.1964)guilhem14 Dec