Commit 66a04036 authored by unknown's avatar unknown
Browse files

BUG#18581 (Creation of system tables recorded in binlog causing slave failure):

Not replicating the mysql database *at all* any more. All changes to
mysql tables are replicated by replicating the statements that do
the changes.


mysql-test/r/rpl_do_grant.result:
  Result change
mysql-test/t/rpl_do_grant.test:
  Deleting grants on both master and server since the mysql
  database is not replicated any more.
sql/handler.cc:
  Removing code that selectively checks what tables in the mysql
  database to ignore. The entire mysql database is not replicated
  any more.
sql/log_event.cc:
  Disabling code to reload grants and access when certain tables are
  touched.
sql/rpl_rli.h:
  Removing unused code.
sql/slave.cc:
  Removing unused code.
sql/sql_class.cc:
  Mysql queries (i.e., queries that affects tables in the mysql database)
  are now replicated by statement instead of replicating the tables in
  the mysql database.
parent fcdee0cd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ password<>_binary''
delete from mysql.user where user=_binary'rpl_do_grant';
delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
delete from mysql.user where user=_binary'rpl_do_grant';
delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
show grants for rpl_do_grant@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost'
+5 −5
Original line number Diff line number Diff line
@@ -39,11 +39,11 @@ connection master;
delete from mysql.user where user=_binary'rpl_do_grant';
delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
save_master_pos;
connection slave;
sync_with_master;
# no need to delete manually, as the DELETEs must have done some real job on
# master (updated binlog)
sync_slave_with_master;
# The mysql database is not replicated, so we have to do the deletes
# manually on the slave as well. 
delete from mysql.user where user=_binary'rpl_do_grant';
delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;

# End of 4.1 tests
+6 −29
Original line number Diff line number Diff line
@@ -3456,38 +3456,15 @@ 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;
  };

  static 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) &&
    {
      int const 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;
                      strcmp("mysql", table->s->db.str) != 0);
      table->s->cached_row_logging_check= check;
    }

    DBUG_ASSERT(table->s->cached_row_logging_check == 0 ||
                table->s->cached_row_logging_check == 1);
+0 −1
Original line number Diff line number Diff line
@@ -5694,7 +5694,6 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
    for (ptr= rli->tables_to_lock ; ptr ; ptr= ptr->next_global)
    {
      rli->m_table_map.set_table(ptr->table_id, ptr->table);
      rli->touching_table(ptr->db, ptr->table_name, ptr->table_id);
    }
#ifdef HAVE_QUERY_CACHE
    query_cache.invalidate_locked_for_write(rli->tables_to_lock);
+0 −16
Original line number Diff line number Diff line
@@ -289,22 +289,6 @@ typedef struct st_relay_log_info
  void cached_charset_invalidate();
  bool cached_charset_compare(char *charset);

  /*
    To reload special tables when they are changes, we introduce a set
    of functions that will mark whenever special functions need to be
    called after modifying tables.  Right now, the tables are either
    ACL tables or grants tables.
  */
  enum enum_reload_flag
  {
    RELOAD_NONE_F   = 0UL,
    RELOAD_GRANT_F  = (1UL << 0), 
    RELOAD_ACCESS_F = (1UL << 1)
  };

  ulong m_reload_flags;

  void touching_table(char const* db, char const* table, ulong table_id);
  void transaction_end(THD*);

  void cleanup_context(THD *, bool);
Loading