diff options
author | unknown <mats@mysql.com> | 2006-03-17 18:11:07 +0100 |
---|---|---|
committer | unknown <mats@mysql.com> | 2006-03-17 18:11:07 +0100 |
commit | 604e0535d770d5608a492d04d3b0255bfb929287 (patch) | |
tree | 10f2655ceef6f6a77c1daf4ef95e28fc10c39efe /sql/handler.cc | |
parent | 2d360cd035849ad678253be7f0d0f559ebe1898d (diff) | |
download | mariadb-git-604e0535d770d5608a492d04d3b0255bfb929287.tar.gz |
Bug#18280 (RBR: Extreneous maps when writing to general_log and slow_log):
Filter out replication general_log and slow_log entirely from binary
log. Caching result of table share-specific tests.
mysql-test/r/binlog_row_drop_tmp_tbl.result:
Result change
mysql-test/r/rpl_row_log.result:
Result change
mysql-test/r/rpl_row_log_innodb.result:
Result change
mysql-test/r/rpl_row_max_relay_size.result:
Result change
sql/handler.cc:
Refactoring code to support filtering many tables.
Filtering out mysql.general_log and mysql.slow_log from binary log.
Caching result from table share-specific tests.
sql/sql_class.cc:
Correcting comment
sql/sql_parse.cc:
Using binlog_query() instead of constructing Query_log_events
sql/table.cc:
Adding variable to cache table check parts for row-based logging.
sql/table.h:
Adding variable to cache table check parts for row-based logging.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 76c3ebd3387..7b232f343c0 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3150,16 +3150,47 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) declared static, but it works by putting it into an anonymous namespace. */ namespace { + struct st_table_data { + char const *db; + char const *name; + }; + + int table_name_compare(void const *a, void const *b) + { + st_table_data const *x = (st_table_data const*) a; + st_table_data const *y = (st_table_data const*) b; + + /* Doing lexical compare in order (db,name) */ + int const res= strcmp(x->db, y->db); + return res != 0 ? res : strcmp(x->name, y->name); + } + bool check_table_binlog_row_based(THD *thd, TABLE *table) { + static st_table_data const ignore[] = { + { "mysql", "event" }, + { "mysql", "general_log" }, + { "mysql", "slow_log" } + }; + + my_size_t const ignore_size = sizeof(ignore)/sizeof(*ignore); + st_table_data const item = { table->s->db.str, table->s->table_name.str }; + + if (table->s->cached_row_logging_check == -1) + table->s->cached_row_logging_check= + (table->s->tmp_table == NO_TMP_TABLE) && + binlog_filter->db_ok(table->s->db.str) && + bsearch(&item, ignore, ignore_size, + sizeof(st_table_data), table_name_compare) == NULL; + + DBUG_ASSERT(table->s->cached_row_logging_check == 0 || + table->s->cached_row_logging_check == 1); + return thd->current_stmt_binlog_row_based && thd && (thd->options & OPTION_BIN_LOG) && - (table->s->tmp_table == NO_TMP_TABLE) && mysql_bin_log.is_open() && - binlog_filter->db_ok(table->s->db.str) && - (strcmp(table->s->db.str, "mysql") || - strcmp(table->s->table_name.str, "event")); + table->s->cached_row_logging_check; } } |