Commit 4286a0ad authored by unknown's avatar unknown

WL#3023 (Use locks in a statement-like manner):

Changes according to review comments.


sql/log.cc:
  Moving a comment.
sql/log_event.cc:
  Adding a note that the solution is a temporary solution.
sql/log_event.h:
  Removing dead code.
sql/sql_class.cc:
  Removing dead code. Adding a TODO comment.
parent b59f3f58
...@@ -2607,6 +2607,13 @@ int THD::binlog_setup_trx_data() ...@@ -2607,6 +2607,13 @@ int THD::binlog_setup_trx_data()
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/*
Write a table map to the binary log.
This function is called from ha_external_lock() after the storage
engine has registered for the transaction.
*/
int THD::binlog_write_table_map(TABLE *table, bool is_trans) int THD::binlog_write_table_map(TABLE *table, bool is_trans)
{ {
DBUG_ENTER("THD::binlog_write_table_map"); DBUG_ENTER("THD::binlog_write_table_map");
...@@ -2623,10 +2630,6 @@ int THD::binlog_write_table_map(TABLE *table, bool is_trans) ...@@ -2623,10 +2630,6 @@ int THD::binlog_write_table_map(TABLE *table, bool is_trans)
Table_map_log_event Table_map_log_event
the_event(this, table, table->s->table_map_id, is_trans, flags); the_event(this, table, table->s->table_map_id, is_trans, flags);
/*
This function is called from ha_external_lock() after the storage
engine has registered for the transaction.
*/
if (is_trans) if (is_trans)
trans_register_ha(this, options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN), trans_register_ha(this, options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN),
&binlog_hton); &binlog_hton);
......
...@@ -5073,7 +5073,9 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, ...@@ -5073,7 +5073,9 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
{ {
/* /*
We allow a special form of dummy event when the table, and cols We allow a special form of dummy event when the table, and cols
are null and the table id is ULONG_MAX. are null and the table id is ULONG_MAX. This is a temporary
solution, to be able to terminate a started statement in the
binary log: the extreneous events will be removed in the future.
*/ */
DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ULONG_MAX || DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ULONG_MAX ||
!tbl_arg && !cols && tid == ULONG_MAX); !tbl_arg && !cols && tid == ULONG_MAX);
......
...@@ -1833,36 +1833,6 @@ public: ...@@ -1833,36 +1833,6 @@ public:
return m_rows_buf && m_cols.bitmap; return m_rows_buf && m_cols.bitmap;
} }
/*
If there is no table map active for the event, write one to the
binary log.
LOCK_log has to be aquired before calling this function.
PARAMETERS
thd - Thread to use when writing the table map
RETURN VALUE
Error code, or zero if write succeeded.
*/
#if !defined(MYSQL_CLIENT) && defined(HAVE_ROW_BASED_REPLICATION)
#if 0
int maybe_write_table_map(THD *thd, IO_CACHE *file, MYSQL_LOG *log) const
{
/*
N.B., get_cache_stmt() returns the value of 'using_trans' that
was provided to the constructor, i.e., get_cache_stmt() == true
if and only if the table is transactional.
*/
int result= 0;
if (!log->is_table_mapped(m_table))
result= log->write_table_map(thd, file, m_table, get_cache_stmt());
return result;
}
#endif
#endif
uint m_row_count; /* The number of rows added to the event */ uint m_row_count; /* The number of rows added to the event */
protected: protected:
......
...@@ -2532,12 +2532,14 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end) ...@@ -2532,12 +2532,14 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end)
table maps written this far will be included in the table maps table maps written this far will be included in the table maps
for the following statement. for the following statement.
See if we can replace this with a dummy, maybe constant, event. TODO: Remove the need for a dummy event altogether. It can be
fixed if we can write table maps to a memory buffer before
writing the first binrow event. We can then flush and clear the
memory buffer with table map events before writing the first
binrow event. In the event of a crash, nothing is lost since
the table maps are only needed if there are binrow events.
*/ */
#if 0
static unsigned char memory[sizeof(Write_rows_log_event)];
void *const ptr= &memory;
#endif
Rows_log_event *ev= Rows_log_event *ev=
new Write_rows_log_event(this, 0, ULONG_MAX, 0, FALSE); new Write_rows_log_event(this, 0, ULONG_MAX, 0, FALSE);
ev->set_flags(Rows_log_event::STMT_END_F); ev->set_flags(Rows_log_event::STMT_END_F);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment