Commit 7ed7fc7f authored by lars@mysql.com's avatar lars@mysql.com

WL#2472: Addendum: Fixes after Mats review

parent 26787260
......@@ -35,8 +35,6 @@
#include "message.h"
#endif
extern Table_filter *binlog_filter;
MYSQL_LOG mysql_log, mysql_slow_log, mysql_bin_log;
ulong sync_binlog_counter= 0;
......
......@@ -23,7 +23,6 @@
#include "slave.h"
#include "table_filter.h"
#include <my_dir.h>
extern Table_filter *rpl_filter;
#endif /* MYSQL_CLIENT */
#define log_cs &my_charset_latin1
......
......@@ -24,8 +24,6 @@
#include "log_event.h"
#include <mysql.h>
extern Table_filter *rpl_filter;
#define SLAVE_LIST_CHUNK 128
#define SLAVE_ERRMSG_SIZE (FN_REFLEN+64)
......
......@@ -28,8 +28,6 @@
#include <my_dir.h>
#include <sql_common.h>
extern Table_filter *rpl_filter;
bool use_slave_mask = 0;
MY_BITMAP slave_error_mask;
......
......@@ -21,10 +21,14 @@
#include "mysql.h"
#include "my_list.h"
#include "table_filter.h"
#define SLAVE_NET_TIMEOUT 3600
#define MAX_SLAVE_ERRMSG 1024
#define MAX_SLAVE_ERROR 2000
extern Table_filter *rpl_filter;
/*****************************************************************************
MySQL Replication
......
......@@ -27,10 +27,6 @@
#include "mysql_priv.h"
#include "hash_filo.h"
#ifdef HAVE_REPLICATION
#include "table_filter.h" //for tables_ok()
extern Table_filter *rpl_filter;
#endif
#include <m_ctype.h>
#include <stdarg.h>
#include "sp_head.h"
......
......@@ -14,6 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "slave.h" // for tables_ok(), rpl_filter
extern Table_filter *rpl_filter;
#define SELECT_ACL (1L << 0)
#define INSERT_ACL (1L << 1)
#define UPDATE_ACL (1L << 2)
......
......@@ -22,8 +22,6 @@
#include <myisam.h>
#include <my_dir.h>
extern Table_filter *rpl_filter;
#ifdef HAVE_INNOBASE_DB
#include "ha_innodb.h"
#endif
......
......@@ -22,8 +22,6 @@
#include "table_filter.h"
#include <my_dir.h>
extern Table_filter *binlog_filter;
int max_binlog_dump_events = 0; // unlimited
my_bool opt_sporadic_binlog_dump_fail = 0;
static int binlog_dump_count = 0;
......
......@@ -17,6 +17,9 @@
#ifdef HAVE_REPLICATION
#include "slave.h"
extern Table_filter *binlog_filter;
extern Table_filter *rpl_filter;
typedef struct st_slave_info
{
uint32 server_id;
......
......@@ -20,18 +20,13 @@
#define TABLE_RULE_HASH_SIZE 16
#define TABLE_RULE_ARR_SIZE 16
Table_filter::Table_filter()
Table_filter::Table_filter() :
table_rules_on(0), do_table_inited(0), ignore_table_inited(0),
wild_do_table_inited(0), wild_ignore_table_inited(0)
{
do_table_inited= 0;
ignore_table_inited= 0;
wild_do_table_inited= 0;
wild_ignore_table_inited= 0;
do_db.empty();
ignore_db.empty();
rewrite_db.empty();
table_rules_on= 0;
}
......@@ -324,8 +319,8 @@ Table_filter::add_table_rule(HASH* h, const char* table_spec)
e->tbl_name= e->db + (dot - table_spec) + 1;
e->key_len= len;
memcpy(e->db, table_spec, len);
(void)my_hash_insert(h, (byte*)e);
return 0;
return my_hash_insert(h, (byte*)e);
}
......@@ -367,16 +362,20 @@ Table_filter::add_ignore_db(const char* table_spec)
}
static byte* get_table_key(TABLE_RULE_ENT* e, uint* len,
my_bool not_used __attribute__((unused)))
static byte* get_table_key(const byte* a, uint* len,
my_bool __attribute__((unused)))
{
TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a;
*len= e->key_len;
return (byte*)e->db;
}
static void free_table_ent(TABLE_RULE_ENT* e)
static void free_table_ent(void* a)
{
TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a;
my_free((gptr) e, MYF(0));
}
......@@ -385,8 +384,7 @@ void
Table_filter::init_table_rule_hash(HASH* h, bool* h_inited)
{
hash_init(h, system_charset_info,TABLE_RULE_HASH_SIZE,0,0,
(hash_get_key) get_table_key,
(hash_free_key) free_table_ent, 0);
get_table_key, free_table_ent, 0);
*h_inited = 1;
}
......@@ -517,7 +515,7 @@ Table_filter::get_rewrite_db(const char* db, uint32 *new_len)
{
if (!strcmp(tmp->key, db))
{
*new_len= (uint32)strlen(tmp->val);
*new_len= strlen(tmp->val);
return tmp->val;
}
}
......
......@@ -39,7 +39,9 @@ class Table_filter
public:
Table_filter();
~Table_filter();
Table_filter(Table_filter const&);
Table_filter& operator=(Table_filter const&);
/* Checks - returns true if ok to replicate/log */
bool tables_ok(const char* db, TABLE_LIST* tables);
......
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