diff options
author | He Zhenxing <zhenxing.he@sun.com> | 2010-05-08 11:25:33 +0800 |
---|---|---|
committer | He Zhenxing <zhenxing.he@sun.com> | 2010-05-08 11:25:33 +0800 |
commit | df0b6707dabf49ed09e798c6ace1d860320ab11c (patch) | |
tree | 988fc8110d8d9d14f34a21c313061c0b9ebfbc94 /sql | |
parent | 721ec081901b661b9338a47b3144c6c41829165a (diff) | |
download | mariadb-git-df0b6707dabf49ed09e798c6ace1d860320ab11c.tar.gz |
Bug#53189 Table map version unused and can be removed
MYSQL_BIN_LOG m_table_map_version member and it's associated
functions were not used in the logic of binlogging and replication,
this patch removed all related code.
sql/log.cc:
removed unused m_table_map_version variable and functions
sql/log.h:
removed unused m_table_map_version variable and functions
sql/log_event.h:
Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
sql/sql_class.cc:
Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
sql/sql_load.cc:
Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
sql/table.cc:
removed unused table_map_version variable
sql/table.h:
removed unused table_map_version variable
Diffstat (limited to 'sql')
-rw-r--r-- | sql/log.cc | 42 | ||||
-rw-r--r-- | sql/log.h | 10 | ||||
-rw-r--r-- | sql/log_event.h | 6 | ||||
-rw-r--r-- | sql/sql_class.cc | 2 | ||||
-rw-r--r-- | sql/sql_load.cc | 2 | ||||
-rw-r--r-- | sql/table.cc | 12 | ||||
-rw-r--r-- | sql/table.h | 1 |
7 files changed, 6 insertions, 69 deletions
diff --git a/sql/log.cc b/sql/log.cc index e7090a98fd9..7d820b48c43 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1440,11 +1440,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, trx_data->has_incident()); trx_data->reset(); - /* - 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 (trans_log->disk_writes != 0) { @@ -1470,13 +1465,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, } else // ...statement trx_data->truncate(trx_data->before_stmt_pos); - - /* - 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() == NULL); @@ -2437,7 +2425,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name, MYSQL_BIN_LOG::MYSQL_BIN_LOG() :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), is_relay_log(0), description_event_for_exec(0), description_event_for_queue(0) { @@ -4078,7 +4066,6 @@ int THD::binlog_write_table_map(TABLE *table, bool is_trans) DBUG_RETURN(error); binlog_table_maps++; - table->s->table_map_version= mysql_bin_log.table_map_version(); DBUG_RETURN(0); } @@ -4169,10 +4156,8 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd, file= &trx_data->trans_log; /* - If we are writing to the log file directly, we could avoid - locking the log. This does not work since we need to step the - m_table_map_version below, and that change has to be protected - by the LOCK_log mutex. + If we are not writing to the log file directly, we could avoid + locking the log. */ pthread_mutex_lock(&LOCK_log); @@ -4186,24 +4171,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. We do this regardless of - wheather we write to the transaction cache or to directly to the - file. - - In an ideal world, we could avoid stepping the table map version - if we were writing to a transaction cache, since we could then - reuse the table map that was written earlier in the transaction - 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; if (file == &log_file) @@ -4417,9 +4384,6 @@ err: set_write_error(thd); } - if (event_info->flags & LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F) - ++m_table_map_version; - pthread_mutex_unlock(&LOCK_log); DBUG_RETURN(error); } diff --git a/sql/log.h b/sql/log.h index 8b5dfcb3935..5af51e14d80 100644 --- a/sql/log.h +++ b/sql/log.h @@ -272,8 +272,6 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG */ bool no_auto_events; - ulonglong m_table_map_version; - int write_to_file(IO_CACHE *cache); /* This is used to start writing to a new log file. The difference from @@ -314,14 +312,6 @@ public: 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); int remove_pending_rows_event(THD *thd); diff --git a/sql/log_event.h b/sql/log_event.h index 9b7f000648d..e3ca4ca3321 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -463,10 +463,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 diff --git a/sql/sql_class.cc b/sql/sql_class.cc index b639e590bbc..93aa6a8268c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3825,7 +3825,6 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end) 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; } @@ -3953,7 +3952,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, 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 diff --git a/sql/sql_load.cc b/sql/sql_load.cc index e121f69dfdf..6628cc4e8bb 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -511,7 +511,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); } } @@ -691,7 +690,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, errcode); - e.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F; return mysql_bin_log.write(&e); } diff --git a/sql/table.cc b/sql/table.cc index 04d7b3a8d0a..bd6251b5743 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -297,13 +297,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 map id here. Instead we assign a value that is not used @@ -366,11 +359,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; /* diff --git a/sql/table.h b/sql/table.h index 5db7e9ac7cb..bddb0731625 100644 --- a/sql/table.h +++ b/sql/table.h @@ -430,7 +430,6 @@ typedef struct st_table_share bool name_lock, replace_with_name_lock; bool waiting_on_cond; /* Protection against free */ ulong table_map_id; /* for row-based replication */ - ulonglong table_map_version; /* Cache for row-based replication table share checks that does not |