List:Internals« Previous MessageNext Message »
From:Mats Kindahl Date:April 5 2005 1:30pm
Subject:bk commit into 5.1 tree (mats:1.1840)
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
  1.1840 05/04/05 15:30:16 mats@stripped +3 -0
  WL#2324: MySQL Injector
    Changed usage of injector::transaction::table.

  sql/rpl_injector.h
    1.7 05/04/05 15:30:11 mats@stripped +11 -8
    Changed usage of injector::transaction::table.

  sql/rpl_injector.cc
    1.9 05/04/05 15:30:11 mats@stripped +3 -6
    Changed usage of injector::transaction::table.

  sql/ha_ndbcluster.cc
    1.192 05/04/05 15:30:11 mats@stripped +3 -6
    Changed to using new injector::transaction::table interface.
    Minor changes in usage (e.g., fixed a memory leak).

# 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.kindahl.net
# Root:	/home/bk/w2324-mysql-5.1

--- 1.191/sql/ha_ndbcluster.cc	2005-04-05 12:00:44 +02:00
+++ 1.192/sql/ha_ndbcluster.cc	2005-04-05 15:30:11 +02:00
@@ -7428,7 +7428,6 @@
   longlong last_gci_in_binlog_index= 0;
 #ifndef DISABLE_INJECTOR
   injector *inj= injector::instance();
-  injector::transaction::table *tbl;
 #endif
   bitvector *b;
 
@@ -7670,11 +7669,9 @@
 	case NdbDictionary::Event::TE_INSERT:
 	  DBUG_PRINT("info",("INSERT INTO %s (%s)",table->getName(),col_names.c_ptr()));
 #ifndef DISABLE_INJECTOR
-	  tbl= new injector::transaction::table(share->table->s->db,table->getName());
-	  b= new bitvector(i);
-	  b->set_all();
-	  trans.write_row(::server_id, *tbl, *b,row_buf);
-	  delete b;
+	  injector::transaction::table tbl(share->table);
+	  bitvector cols(i,true);
+	  trans.write_row(::server_id, tbl, cols, row_buf);
 #endif
 	  break;
 	case NdbDictionary::Event::TE_DELETE:

--- 1.8/sql/rpl_injector.cc	2005-04-04 10:50:29 +02:00
+++ 1.9/sql/rpl_injector.cc	2005-04-05 15:30:11 +02:00
@@ -69,9 +69,8 @@
 	   bitvector const& cols, record_type record)
 {
    DBUG_ENTER("injector::transaction::write_row(...)");
-   TABLE* table = get_table(m_thd, tbl);
    m_thd->set_server_id(sid);
-   m_thd->write_row(table, cols, record);
+   m_thd->write_row(tbl.get_table(), cols, record);
    DBUG_RETURN(0);
 }
 
@@ -81,9 +80,8 @@
 	   bitvector const& cols, record_type record)
 {
    DBUG_ENTER("injector::transaction::delete_row(...)");
-   TABLE* table = get_table(m_thd, tbl);
    m_thd->set_server_id(sid);
-   m_thd->delete_row(table, cols, record);
+   m_thd->delete_row(tbl.get_table(), cols, record);
    DBUG_RETURN(0);
 }
 
@@ -93,9 +91,8 @@
 	   bitvector const& cols, record_type before, record_type after)
 {
    DBUG_ENTER("injector::transaction::update_row(...)");
-   TABLE* table = get_table(m_thd, tbl);
    m_thd->set_server_id(sid);
-   m_thd->update_row(table, cols, before, after);
+   m_thd->update_row(tbl.get_table(), cols, before, after);
    DBUG_RETURN(0);
 }
 

--- 1.6/sql/rpl_injector.h	2005-04-04 10:50:29 +02:00
+++ 1.7/sql/rpl_injector.h	2005-04-05 15:30:11 +02:00
@@ -26,6 +26,9 @@
 // Forward declarations
 class handler;
 class MYSQL_LOG;
+class st_table;
+
+typedef st_table TABLE;
 
 /*
   The injector class is used to notify the MySQL server of new rows that have
@@ -77,7 +80,7 @@
 	  construct objects of this type using 'new'; instead construct an
 	  object, possibly a temporary object.  For example:
 
-	    injector::transaction::table tbl("my_db", "foo");
+	    injector::transaction::table tbl(share->table);
 	    bitvector cols(i, true);
 	    inj->write_row(::server_id, tbl, cols, row_data);
 
@@ -85,7 +88,7 @@
 
 	    bitvector cols(i, true);
 	    inj->write_row(::server_id, 
-	                   injector::transaction::table("my_db", "foo"), 
+	                   injector::transaction::table(share->table), 
 			   cols, row_data);
 
           This will work, be more efficient, and have greater chance of
@@ -100,17 +103,17 @@
       class table 
       {
       public:
-	table(char const* db_name, char const* table_name) 
-	  : m_db_name(db_name), m_table_name(table_name)
+	table(TABLE* table) 
+	    : m_table(table)
 	{ 
 	}
 
-	char const* db_name() const { return m_db_name; }
-	char const* table_name() const { return m_table_name; }
+	char const* db_name() const { return m_table->s->db; }
+	char const* table_name() const { return m_table->s->table_name; }
+	TABLE* get_table() const { return m_table; }
 
       private:
-	char const* m_db_name;
-	char const* m_table_name;
+	  TABLE* m_table;
       };
 
       /*
Thread
bk commit into 5.1 tree (mats:1.1840)Mats Kindahl5 Apr