mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
WL#2472:
Renamed Table_filter to Rpl_filter Eliminated very annoying memory leak
This commit is contained in:
parent
7ed7fc7f58
commit
c6d85289ab
13 changed files with 70 additions and 68 deletions
|
@ -55,10 +55,10 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
|
|||
ha_ndbcluster.h opt_range.h protocol.h \
|
||||
sql_select.h structs.h table.h sql_udf.h hash_filo.h\
|
||||
lex.h lex_symbol.h sql_acl.h sql_crypt.h \
|
||||
log_event.h sql_repl.h slave.h \
|
||||
log_event.h sql_repl.h slave.h rpl_filter.h \
|
||||
stacktrace.h sql_sort.h sql_cache.h set_var.h \
|
||||
spatial.h gstream.h client_settings.h tzfile.h \
|
||||
table_filter.h tztime.h \
|
||||
spatial.h gstream.h client_settings.h tzfile.h
|
||||
tztime.h \
|
||||
sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
|
||||
parse_file.h sql_view.h sql_trigger.h \
|
||||
examples/ha_example.h examples/ha_archive.h \
|
||||
|
@ -90,12 +90,13 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
|
|||
sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \
|
||||
sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
|
||||
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
|
||||
slave.cc sql_repl.cc sql_union.cc sql_derived.cc \
|
||||
slave.cc sql_repl.cc rpl_filter.cc \
|
||||
sql_union.cc sql_derived.cc \
|
||||
client.c sql_client.cc mini_client_errors.c pack.c\
|
||||
stacktrace.c repl_failsafe.h repl_failsafe.cc \
|
||||
sql_olap.cc sql_view.cc \
|
||||
gstream.cc spatial.cc sql_help.cc protocol_cursor.cc \
|
||||
table_filter.cc tztime.cc my_time.c \
|
||||
tztime.cc my_time.c \
|
||||
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \
|
||||
sp_cache.cc parse_file.cc sql_trigger.cc \
|
||||
examples/ha_example.cc examples/ha_archive.cc \
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "mysql_priv.h"
|
||||
#include "sql_repl.h"
|
||||
#include "table_filter.h"
|
||||
#include "rpl_filter.h"
|
||||
#include "ha_innodb.h" // necessary to cut the binlog when crash recovery
|
||||
|
||||
#include <my_dir.h>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#endif
|
||||
#include "mysql_priv.h"
|
||||
#include "slave.h"
|
||||
#include "table_filter.h"
|
||||
#include "rpl_filter.h"
|
||||
#include <my_dir.h>
|
||||
#endif /* MYSQL_CLIENT */
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <my_dir.h>
|
||||
#include "slave.h"
|
||||
#include "sql_repl.h"
|
||||
#include "table_filter.h"
|
||||
#include "rpl_filter.h"
|
||||
#include "repl_failsafe.h"
|
||||
#include "stacktrace.h"
|
||||
#include "mysqld_suffix.h"
|
||||
|
@ -385,8 +385,8 @@ FILE *bootstrap_file;
|
|||
|
||||
I_List<THD> threads,thread_cache;
|
||||
I_List<NAMED_LIST> key_caches;
|
||||
Table_filter* rpl_filter;
|
||||
Table_filter* binlog_filter;
|
||||
Rpl_filter* rpl_filter;
|
||||
Rpl_filter* binlog_filter;
|
||||
|
||||
struct system_variables global_system_variables;
|
||||
struct system_variables max_system_variables;
|
||||
|
@ -994,6 +994,8 @@ void clean_up(bool print_message)
|
|||
#ifdef HAVE_REPLICATION
|
||||
end_slave_list();
|
||||
#endif
|
||||
delete binlog_filter;
|
||||
delete rpl_filter;
|
||||
#ifdef HAVE_OPENSSL
|
||||
if (ssl_acceptor_fd)
|
||||
my_free((gptr) ssl_acceptor_fd, MYF(MY_ALLOW_ZERO_PTR));
|
||||
|
@ -2963,8 +2965,8 @@ int main(int argc, char **argv)
|
|||
{
|
||||
DEBUGGER_OFF;
|
||||
|
||||
rpl_filter= new Table_filter;
|
||||
binlog_filter= new Table_filter;
|
||||
rpl_filter= new Rpl_filter;
|
||||
binlog_filter= new Rpl_filter;
|
||||
if (!rpl_filter || !binlog_filter)
|
||||
{
|
||||
sql_perror("Could not allocate replication and binlog filters");
|
||||
|
@ -3215,9 +3217,6 @@ we force server id to 2, but this MySQL server will not act as a slave.");
|
|||
clean_up_mutexes();
|
||||
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
|
||||
|
||||
delete rpl_filter;
|
||||
delete binlog_filter;
|
||||
|
||||
exit(0);
|
||||
return(0); /* purecov: deadcode */
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "repl_failsafe.h"
|
||||
#include "sql_repl.h"
|
||||
#include "slave.h"
|
||||
#include "table_filter.h"
|
||||
#include "rpl_filter.h"
|
||||
#include "log_event.h"
|
||||
#include <mysql.h>
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include "mysql_priv.h"
|
||||
#include "table_filter.h"
|
||||
#include "rpl_filter.h"
|
||||
|
||||
#define TABLE_RULE_HASH_SIZE 16
|
||||
#define TABLE_RULE_ARR_SIZE 16
|
||||
|
||||
Table_filter::Table_filter() :
|
||||
Rpl_filter::Rpl_filter() :
|
||||
table_rules_on(0), do_table_inited(0), ignore_table_inited(0),
|
||||
wild_do_table_inited(0), wild_ignore_table_inited(0)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ Table_filter::Table_filter() :
|
|||
}
|
||||
|
||||
|
||||
Table_filter::~Table_filter()
|
||||
Rpl_filter::~Rpl_filter()
|
||||
{
|
||||
if (do_table_inited)
|
||||
hash_free(&do_table);
|
||||
|
@ -85,10 +85,10 @@ Table_filter::~Table_filter()
|
|||
*/
|
||||
|
||||
bool
|
||||
Table_filter::tables_ok(const char* db, TABLE_LIST* tables)
|
||||
Rpl_filter::tables_ok(const char* db, TABLE_LIST* tables)
|
||||
{
|
||||
bool some_tables_updating= 0;
|
||||
DBUG_ENTER("Table_filter::tables_ok");
|
||||
DBUG_ENTER("Rpl_filter::tables_ok");
|
||||
|
||||
for (; tables; tables= tables->next_global)
|
||||
{
|
||||
|
@ -144,9 +144,9 @@ Table_filter::tables_ok(const char* db, TABLE_LIST* tables)
|
|||
*/
|
||||
|
||||
bool
|
||||
Table_filter::db_ok(const char* db)
|
||||
Rpl_filter::db_ok(const char* db)
|
||||
{
|
||||
DBUG_ENTER("Table_filter::db_ok");
|
||||
DBUG_ENTER("Rpl_filter::db_ok");
|
||||
|
||||
if (do_db.is_empty() && ignore_db.is_empty())
|
||||
DBUG_RETURN(1); // Ok to replicate if the user puts no constraints
|
||||
|
@ -216,9 +216,9 @@ Table_filter::db_ok(const char* db)
|
|||
*/
|
||||
|
||||
bool
|
||||
Table_filter::db_ok_with_wild_table(const char *db)
|
||||
Rpl_filter::db_ok_with_wild_table(const char *db)
|
||||
{
|
||||
DBUG_ENTER("Table_filter::db_ok_with_wild_table");
|
||||
DBUG_ENTER("Rpl_filter::db_ok_with_wild_table");
|
||||
|
||||
char hash_key[NAME_LEN+2];
|
||||
char *end;
|
||||
|
@ -247,16 +247,16 @@ Table_filter::db_ok_with_wild_table(const char *db)
|
|||
|
||||
|
||||
bool
|
||||
Table_filter::is_on()
|
||||
Rpl_filter::is_on()
|
||||
{
|
||||
return table_rules_on;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Table_filter::add_do_table(const char* table_spec)
|
||||
Rpl_filter::add_do_table(const char* table_spec)
|
||||
{
|
||||
DBUG_ENTER("Table_filter::add_do_table");
|
||||
DBUG_ENTER("Rpl_filter::add_do_table");
|
||||
if (!do_table_inited)
|
||||
init_table_rule_hash(&do_table, &do_table_inited);
|
||||
table_rules_on= 1;
|
||||
|
@ -265,9 +265,9 @@ Table_filter::add_do_table(const char* table_spec)
|
|||
|
||||
|
||||
int
|
||||
Table_filter::add_ignore_table(const char* table_spec)
|
||||
Rpl_filter::add_ignore_table(const char* table_spec)
|
||||
{
|
||||
DBUG_ENTER("Table_filter::add_ignore_table");
|
||||
DBUG_ENTER("Rpl_filter::add_ignore_table");
|
||||
if (!ignore_table_inited)
|
||||
init_table_rule_hash(&ignore_table, &ignore_table_inited);
|
||||
table_rules_on= 1;
|
||||
|
@ -276,9 +276,9 @@ Table_filter::add_ignore_table(const char* table_spec)
|
|||
|
||||
|
||||
int
|
||||
Table_filter::add_wild_do_table(const char* table_spec)
|
||||
Rpl_filter::add_wild_do_table(const char* table_spec)
|
||||
{
|
||||
DBUG_ENTER("Table_filter::add_wild_do_table");
|
||||
DBUG_ENTER("Rpl_filter::add_wild_do_table");
|
||||
if (!wild_do_table_inited)
|
||||
init_table_rule_array(&wild_do_table, &wild_do_table_inited);
|
||||
table_rules_on= 1;
|
||||
|
@ -287,9 +287,9 @@ Table_filter::add_wild_do_table(const char* table_spec)
|
|||
|
||||
|
||||
int
|
||||
Table_filter::add_wild_ignore_table(const char* table_spec)
|
||||
Rpl_filter::add_wild_ignore_table(const char* table_spec)
|
||||
{
|
||||
DBUG_ENTER("Table_filter::add_wild_ignore_table");
|
||||
DBUG_ENTER("Rpl_filter::add_wild_ignore_table");
|
||||
if (!wild_ignore_table_inited)
|
||||
init_table_rule_array(&wild_ignore_table, &wild_ignore_table_inited);
|
||||
table_rules_on= 1;
|
||||
|
@ -298,7 +298,7 @@ Table_filter::add_wild_ignore_table(const char* table_spec)
|
|||
|
||||
|
||||
void
|
||||
Table_filter::add_db_rewrite(const char* from_db, const char* to_db)
|
||||
Rpl_filter::add_db_rewrite(const char* from_db, const char* to_db)
|
||||
{
|
||||
i_string_pair *db_pair = new i_string_pair(from_db, to_db);
|
||||
rewrite_db.push_back(db_pair);
|
||||
|
@ -306,7 +306,7 @@ Table_filter::add_db_rewrite(const char* from_db, const char* to_db)
|
|||
|
||||
|
||||
int
|
||||
Table_filter::add_table_rule(HASH* h, const char* table_spec)
|
||||
Rpl_filter::add_table_rule(HASH* h, const char* table_spec)
|
||||
{
|
||||
const char* dot = strchr(table_spec, '.');
|
||||
if (!dot) return 1;
|
||||
|
@ -329,7 +329,7 @@ Table_filter::add_table_rule(HASH* h, const char* table_spec)
|
|||
*/
|
||||
|
||||
int
|
||||
Table_filter::add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec)
|
||||
Rpl_filter::add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec)
|
||||
{
|
||||
const char* dot = strchr(table_spec, '.');
|
||||
if (!dot) return 1;
|
||||
|
@ -347,16 +347,18 @@ Table_filter::add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec)
|
|||
|
||||
|
||||
void
|
||||
Table_filter::add_do_db(const char* table_spec)
|
||||
Rpl_filter::add_do_db(const char* table_spec)
|
||||
{
|
||||
DBUG_ENTER("Rpl_filter::add_do_db");
|
||||
i_string *db = new i_string(table_spec);
|
||||
do_db.push_back(db);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Table_filter::add_ignore_db(const char* table_spec)
|
||||
Rpl_filter::add_ignore_db(const char* table_spec)
|
||||
{
|
||||
DBUG_ENTER("Rpl_filter::add_ignore_db");
|
||||
i_string *db = new i_string(table_spec);
|
||||
ignore_db.push_back(db);
|
||||
}
|
||||
|
@ -381,7 +383,7 @@ static void free_table_ent(void* a)
|
|||
|
||||
|
||||
void
|
||||
Table_filter::init_table_rule_hash(HASH* h, bool* h_inited)
|
||||
Rpl_filter::init_table_rule_hash(HASH* h, bool* h_inited)
|
||||
{
|
||||
hash_init(h, system_charset_info,TABLE_RULE_HASH_SIZE,0,0,
|
||||
get_table_key, free_table_ent, 0);
|
||||
|
@ -390,7 +392,7 @@ Table_filter::init_table_rule_hash(HASH* h, bool* h_inited)
|
|||
|
||||
|
||||
void
|
||||
Table_filter::init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited)
|
||||
Rpl_filter::init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited)
|
||||
{
|
||||
my_init_dynamic_array(a, sizeof(TABLE_RULE_ENT*), TABLE_RULE_ARR_SIZE,
|
||||
TABLE_RULE_ARR_SIZE);
|
||||
|
@ -399,7 +401,7 @@ Table_filter::init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited)
|
|||
|
||||
|
||||
TABLE_RULE_ENT*
|
||||
Table_filter::find_wild(DYNAMIC_ARRAY *a, const char* key, int len)
|
||||
Rpl_filter::find_wild(DYNAMIC_ARRAY *a, const char* key, int len)
|
||||
{
|
||||
uint i;
|
||||
const char* key_end= key + len;
|
||||
|
@ -420,7 +422,7 @@ Table_filter::find_wild(DYNAMIC_ARRAY *a, const char* key, int len)
|
|||
|
||||
|
||||
void
|
||||
Table_filter::free_string_array(DYNAMIC_ARRAY *a)
|
||||
Rpl_filter::free_string_array(DYNAMIC_ARRAY *a)
|
||||
{
|
||||
uint i;
|
||||
for (i= 0; i < a->elements; i++)
|
||||
|
@ -447,7 +449,7 @@ Table_filter::free_string_array(DYNAMIC_ARRAY *a)
|
|||
*/
|
||||
|
||||
void
|
||||
Table_filter::table_rule_ent_hash_to_str(String* s, HASH* h)
|
||||
Rpl_filter::table_rule_ent_hash_to_str(String* s, HASH* h)
|
||||
{
|
||||
s->length(0);
|
||||
for (uint i= 0; i < h->records; i++)
|
||||
|
@ -461,7 +463,7 @@ Table_filter::table_rule_ent_hash_to_str(String* s, HASH* h)
|
|||
|
||||
|
||||
void
|
||||
Table_filter::table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a)
|
||||
Rpl_filter::table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a)
|
||||
{
|
||||
s->length(0);
|
||||
for (uint i= 0; i < a->elements; i++)
|
||||
|
@ -476,35 +478,35 @@ Table_filter::table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a)
|
|||
|
||||
|
||||
void
|
||||
Table_filter::get_do_table(String* str)
|
||||
Rpl_filter::get_do_table(String* str)
|
||||
{
|
||||
table_rule_ent_hash_to_str(str, &do_table);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Table_filter::get_ignore_table(String* str)
|
||||
Rpl_filter::get_ignore_table(String* str)
|
||||
{
|
||||
table_rule_ent_hash_to_str(str, &ignore_table);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Table_filter::get_wild_do_table(String* str)
|
||||
Rpl_filter::get_wild_do_table(String* str)
|
||||
{
|
||||
table_rule_ent_dynamic_array_to_str(str, &wild_do_table);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Table_filter::get_wild_ignore_table(String* str)
|
||||
Rpl_filter::get_wild_ignore_table(String* str)
|
||||
{
|
||||
table_rule_ent_dynamic_array_to_str(str, &wild_ignore_table);
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
Table_filter::get_rewrite_db(const char* db, uint32 *new_len)
|
||||
Rpl_filter::get_rewrite_db(const char* db, uint32 *new_len)
|
||||
{
|
||||
if (rewrite_db.is_empty() || !db)
|
||||
return db;
|
||||
|
@ -524,14 +526,14 @@ Table_filter::get_rewrite_db(const char* db, uint32 *new_len)
|
|||
|
||||
|
||||
I_List<i_string>*
|
||||
Table_filter::get_do_db()
|
||||
Rpl_filter::get_do_db()
|
||||
{
|
||||
return &do_db;
|
||||
}
|
||||
|
||||
|
||||
I_List<i_string>*
|
||||
Table_filter::get_ignore_db()
|
||||
Rpl_filter::get_ignore_db()
|
||||
{
|
||||
return &ignore_db;
|
||||
}
|
|
@ -14,8 +14,8 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef __TABLE_FILTER_H__
|
||||
#define __TABLE_FILTER_H__
|
||||
#ifndef __RPL_FILTER_H__
|
||||
#define __RPL_FILTER_H__
|
||||
|
||||
#include "mysql.h"
|
||||
#include "my_list.h"
|
||||
|
@ -28,19 +28,19 @@ typedef struct st_table_rule_ent
|
|||
} TABLE_RULE_ENT;
|
||||
|
||||
/*
|
||||
Table_filter
|
||||
Rpl_filter
|
||||
|
||||
Inclusion and exclusion rules of tables and databases.
|
||||
Also handles rewrites of db.
|
||||
Used for replication and binlogging.
|
||||
*/
|
||||
class Table_filter
|
||||
class Rpl_filter
|
||||
{
|
||||
public:
|
||||
Table_filter();
|
||||
~Table_filter();
|
||||
Table_filter(Table_filter const&);
|
||||
Table_filter& operator=(Table_filter const&);
|
||||
Rpl_filter();
|
||||
~Rpl_filter();
|
||||
Rpl_filter(Rpl_filter const&);
|
||||
Rpl_filter& operator=(Rpl_filter const&);
|
||||
|
||||
/* Checks - returns true if ok to replicate/log */
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
#include <myisam.h>
|
||||
#include "slave.h"
|
||||
#include "sql_repl.h"
|
||||
#include "table_filter.h"
|
||||
#include "rpl_filter.h"
|
||||
#include "repl_failsafe.h"
|
||||
#include <thr_alarm.h>
|
||||
#include <my_dir.h>
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
#include "mysql.h"
|
||||
#include "my_list.h"
|
||||
#include "table_filter.h"
|
||||
#include "rpl_filter.h"
|
||||
|
||||
#define SLAVE_NET_TIMEOUT 3600
|
||||
#define MAX_SLAVE_ERRMSG 1024
|
||||
#define MAX_SLAVE_ERROR 2000
|
||||
|
||||
extern Table_filter *rpl_filter;
|
||||
extern Rpl_filter *rpl_filter;
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
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;
|
||||
extern Rpl_filter *rpl_filter;
|
||||
|
||||
#define SELECT_ACL (1L << 0)
|
||||
#define INSERT_ACL (1L << 1)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "mysql_priv.h"
|
||||
#include "sql_repl.h"
|
||||
#include "table_filter.h"
|
||||
#include "rpl_filter.h"
|
||||
#include "repl_failsafe.h"
|
||||
#include <m_ctype.h>
|
||||
#include <myisam.h>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "sql_repl.h"
|
||||
#include "log_event.h"
|
||||
#include "table_filter.h"
|
||||
#include "rpl_filter.h"
|
||||
#include <my_dir.h>
|
||||
|
||||
int max_binlog_dump_events = 0; // unlimited
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#ifdef HAVE_REPLICATION
|
||||
#include "slave.h"
|
||||
|
||||
extern Table_filter *binlog_filter;
|
||||
extern Table_filter *rpl_filter;
|
||||
extern Rpl_filter *binlog_filter;
|
||||
extern Rpl_filter *rpl_filter;
|
||||
|
||||
typedef struct st_slave_info
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue