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.1830 05/03/24 09:47:57 mats@stripped +1 -0
WL#2324: Injector support in MySQL
Missed defining destructor (which frees allocated memory).
Missed doing an actual commit in the commit function.
sql/rpl_injector.cc
1.6 05/03/24 09:47:51 mats@stripped +21 -6
Missed defining destructor (which frees allocated memory).
Missed doing an actual commit in the commit function.
# 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/forndb-mysql-5.1
--- 1.5/sql/rpl_injector.cc 2005-03-21 19:24:56 +01:00
+++ 1.6/sql/rpl_injector.cc 2005-03-24 09:47:51 +01:00
@@ -27,20 +27,35 @@
transaction(MYSQL_LOG* log, THD* thd)
: m_thd(thd)
{
- // Default initialization of m_start_pos. We need to fill it in using the
- // code below.
+ // Default initialization of m_start_pos (which initializes it to garbage).
+ // We need to fill it in using the code below.
LOG_INFO log_info;
log->get_current_log(&log_info);
- // !!!
+ // !!! binlog_pos does not follow RAII !!!
m_start_pos.m_file_name = my_strdup(log_info.log_file_name, MYF(0));
m_start_pos.m_file_pos = log_info.pos;
}
+injector::transaction::
+~transaction()
+{
+ // Needed since my_free expects a 'char*' (instead of 'void*').
+ char* const the_memory = const_cast<char*>(m_start_pos.m_file_name);
+
+ // We set the first character to null just to give all the copies of the
+ // start position a (minimal) chance of seening that the memory is lost.
+ // All assuming the my_free does not step over the memory, of course.
+ *the_memory = '\0';
+
+ my_free(the_memory, MYF(0));
+}
+
int injector::transaction::
commit()
{
DBUG_ENTER("injector::transaction::commit()");
+ ha_commit(m_thd);
DBUG_RETURN(0);
}
@@ -92,11 +107,10 @@
// injector - member definitions
////////////////////////////////////////////////////////////////
-// This constructor is inline since it's called below
+// This constructor is called below
inline injector::
injector()
{
-
}
injector* injector::
@@ -112,7 +126,8 @@
new_trans(THD* thd)
{
DBUG_ENTER("injector::new_trans()");
-
+ // 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));
}
| Thread |
|---|
| • bk commit into 5.1 tree (mats:1.1830) | Mats Kindahl | 24 Mar |