Commit e47ab5a6 authored by Alexey Kopytov's avatar Alexey Kopytov

Manual merge from mysql-5.1-bugteam to mysql-trunk-merge.

Text conflict in sql/log.cc
Text conflict in sql/log.h
Text conflict in sql/sql_class.cc
Text conflict in sql/sql_load.cc
parents ad43230e 455f754e
......@@ -1528,11 +1528,6 @@ binlog_flush_trx_cache(THD *thd, binlog_cache_mngr *cache_mngr,
cache_mngr->trx_cache.has_incident());
cache_mngr->reset_cache(&cache_mngr->trx_cache);
/*
We need to step the table map version after writing the
transaction cache to disk.
*/
mysql_bin_log.update_table_map_version();
statistic_increment(binlog_cache_use, &LOCK_status);
if (cache_log->disk_writes != 0)
{
......@@ -1592,13 +1587,6 @@ binlog_truncate_trx_cache(THD *thd, binlog_cache_mngr *cache_mngr, bool all)
else
cache_mngr->trx_cache.restore_prev_position();
/*
We need to step the table map version on a rollback to ensure that a new
table map event is generated instead of the one that was written to the
thrown-away transaction cache.
*/
mysql_bin_log.update_table_map_version();
DBUG_ASSERT(thd->binlog_get_pending_rows_event(is_transactional) == NULL);
DBUG_RETURN(error);
}
......@@ -1650,11 +1638,6 @@ binlog_flush_stmt_cache(THD *thd, binlog_cache_mngr *cache_mngr)
DBUG_RETURN(error);
cache_mngr->reset_cache(&cache_mngr->stmt_cache);
/*
We need to step the table map version after writing the
transaction cache to disk.
*/
mysql_bin_log.update_table_map_version();
statistic_increment(binlog_cache_use, &LOCK_status);
if (cache_log->disk_writes != 0)
{
......@@ -2662,7 +2645,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name,
MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period)
:bytes_written(0), prepared_xids(0), file_id(1), open_count(1),
need_start_event(TRUE), m_table_map_version(0),
need_start_event(TRUE),
sync_period_ptr(sync_period),
is_relay_log(0), signal_cnt(0),
description_event_for_exec(0), description_event_for_queue(0)
......@@ -4447,7 +4430,6 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional)
DBUG_RETURN(error);
binlog_table_maps++;
table->s->table_map_version= mysql_bin_log.table_map_version();
DBUG_RETURN(0);
}
......@@ -4589,21 +4571,6 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
DBUG_RETURN(1);
}
/*
We step the table map version if we are writing an event
representing the end of a statement.
In an ideal world, we could avoid stepping the table map version,
since we could then reuse the table map that was written earlier
in the cache. This does not work since STMT_END_F implies closing
all table mappings on the slave side.
TODO: Find a solution so that table maps does not have to be
written several times within a transaction.
*/
if (pending->get_flags(Rows_log_event::STMT_END_F))
++m_table_map_version;
delete pending;
}
......@@ -4792,9 +4759,6 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
}
}
if (event_info->flags & LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F)
++m_table_map_version;
DBUG_RETURN(error);
}
......
......@@ -299,8 +299,6 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
*/
bool no_auto_events;
ulonglong m_table_map_version;
/* pointer to the sync period variable, for binlog this will be
sync_binlog_period, for relay log this will be
sync_relay_log_period
......@@ -353,13 +351,6 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
void unlog(ulong cookie, my_xid xid);
int recover(IO_CACHE *log, Format_description_log_event *fdle);
#if !defined(MYSQL_CLIENT)
bool is_table_mapped(TABLE *table) const
{
return table->s->table_map_version == table_map_version();
}
ulonglong table_map_version() const { return m_table_map_version; }
void update_table_map_version() { ++m_table_map_version; }
int flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event,
bool is_transactional);
......
......@@ -469,10 +469,10 @@ struct sql_ex_info
#define LOG_EVENT_SUPPRESS_USE_F 0x8
/*
The table map version internal to the log should be increased after
the event has been written to the binary log.
Note: this is a place holder for the flag
LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F (0x10), which is not used any
more, please do not reused this value for other flags.
*/
#define LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F 0x10
/**
@def LOG_EVENT_ARTIFICIAL_F
......
......@@ -4468,7 +4468,6 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional)
if (stmt_end)
{
pending->set_flags(Rows_log_event::STMT_END_F);
pending->flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
binlog_table_maps= 0;
}
......@@ -4654,7 +4653,6 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
{
Query_log_event qinfo(this, query_arg, query_len, is_trans, direct,
suppress_use, errcode);
qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
/*
Binlog table maps will be irrelevant after a Query_log_event
(they are just removed on the slave side) so after the query
......
......@@ -563,7 +563,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
else
{
Delete_file_log_event d(thd, db, transactional_table);
d.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
(void) mysql_bin_log.write(&d);
}
}
......@@ -744,7 +743,6 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
(duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
(ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),
transactional_table, FALSE, FALSE, errcode);
e.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
return mysql_bin_log.write(&e);
}
......
......@@ -310,13 +310,6 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
share->version= refresh_version;
/*
This constant is used to mark that no table map version has been
assigned. No arithmetic is done on the value: it will be
overwritten with a value taken from MYSQL_BIN_LOG.
*/
share->table_map_version= ~(ulonglong)0;
/*
Since alloc_table_share() can be called without any locking (for
example, ha_create_table... functions), we do not assign a table
......@@ -383,11 +376,6 @@ void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
share->path.length= share->normalized_path.length= strlen(path);
share->frm_version= FRM_VER_TRUE_VARCHAR;
/*
Temporary tables are not replicated, but we set up these fields
anyway to be able to catch errors.
*/
share->table_map_version= ~(ulonglong)0;
share->cached_row_logging_check= -1;
/*
......
......@@ -617,7 +617,6 @@ struct TABLE_SHARE
bool crashed;
bool is_view;
ulong table_map_id; /* for row-based replication */
ulonglong table_map_version;
/*
Cache for row-based replication table share checks that does not
......
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