List:Internals« Previous MessageNext Message »
From:Mats Kindahl Date:April 19 2005 1:31pm
Subject:bk commit into 5.1 tree (mats:1.1810)
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.1810 05/04/19 15:31:07 mats@stripped +2 -0
  WL#2325: Added overload of new_trans() with placement syntax.

  sql/rpl_injector.h
    1.9 05/04/19 15:31:01 mats@stripped +19 -3
    New overload of new_trans() that have placement semantics.
    Added default constructor to create uninitialized instance.
    Added methods to "clear" instance and check if instance is uninitialized/cleared.

  sql/rpl_injector.cc
    1.12 05/04/19 15:31:01 mats@stripped +15 -1
    New overload of new_trans() that have placement semantics.

# 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/w2325-mysql-5.1

--- 1.11/sql/rpl_injector.cc	2005-04-19 09:41:42 +02:00
+++ 1.12/sql/rpl_injector.cc	2005-04-19 15:31:01 +02:00
@@ -113,10 +113,24 @@
 injector::transaction injector::
 new_trans(THD* thd)
 {
-   DBUG_ENTER("injector::new_trans()");
+   DBUG_ENTER("injector::new_trans(THD*)");
    // Currently, there is no alternative to using 'mysql_bin_log' since that
    // is hardcoded into the way the handler is using the binary log.
    DBUG_RETURN(transaction(&mysql_bin_log, thd));
+}
+
+void injector::
+new_trans(THD* thd, injector::transaction* ptr)
+{
+   DBUG_ENTER("injector::new_trans(THD*, transaction*)");
+   // Currently, there is no alternative to using 'mysql_bin_log' since that
+   // is hardcoded into the way the handler is using the binary log.  This
+   // version uses placement new to construct the object at a specific memory
+   // address.
+   transaction trans(&mysql_bin_log, thd);
+   ptr->swap(trans);
+
+   DBUG_VOID_RETURN;
 }
 
 

--- 1.8/sql/rpl_injector.h	2005-04-12 13:44:44 +02:00
+++ 1.9/sql/rpl_injector.h	2005-04-19 15:31:01 +02:00
@@ -140,9 +140,16 @@
 	my_off_t m_file_pos;
       };
 
+      transaction() : m_thd(NULL) { }
       transaction(transaction const&);
       ~transaction();
 
+      // Clear transaction, i.e., make calls to 'good()' return false.
+      void clear() { m_thd = NULL; }
+
+      // Is the transaction in a good state?
+      bool good() const { return m_thd != NULL; }
+
       // Default assignment operator: standard implementation
       transaction& operator=(transaction t) {
 	swap(t);
@@ -211,11 +218,20 @@
     };
 
     /* 
-       Create a new transaction. 
-       This member function will prepare for a sequence of *_row calls by,
-       for example, reserving resources and locking files. 
+       Create a new transaction.  This member function will prepare for a
+       sequence of *_row calls by, for example, reserving resources and
+       locking files. There are two overloaded alternatives: one returning a
+       transaction by value and one using placement semantics. The following
+       two calls are equivalent, with the exception that the latter will
+       overwrite the transaction.
+
+         injector::transaction trans1 = inj->new_trans(thd);
+
+         injector::transaction trans2;
+	 inj->new_trans(thd, &trans);
      */
     transaction new_trans(THD*);
+    void        new_trans(THD*, transaction*);
 
 private:
     explicit injector();
Thread
bk commit into 5.1 tree (mats:1.1810)Mats Kindahl19 Apr