From afe39f259042a5a6dfa558d4b96b214b84be5926 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 19 Oct 2004 22:27:19 +0200 Subject: Optimization: in the replication slave, we can avoid doing one strlen() per event's execution, as we already have db_len in Log_event. Only if rewrite_db() changed the db we need a strlen (so we now do the strlen() in rewrite_db). Plus a test (we had none for --replicate-rewrite-db :( ). sql/log_event.cc: The goal is to get of rid of one strlen() per replication event in slave: we don't need to compute strlen(thd->db) as we already have db_len in the event; only case where we need to do a strlen() is if rewrite_db() changed the db. Note that db_len is always a meaningful value. It's 0 if event's db is 0. sql/slave.cc: rewrite_db now returns the len of the returned db. print_slave_db_safe() needn't call rewrite_db() as rewrite_db() is already called by caller. sql/slave.h: declaration updates for slave.cc --- sql/slave.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/slave.h') diff --git a/sql/slave.h b/sql/slave.h index 20167094453..97f197fb50a 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -510,8 +510,8 @@ int add_table_rule(HASH* h, const char* table_spec); int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec); void init_table_rule_hash(HASH* h, bool* h_inited); void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited); -const char *rewrite_db(const char* db); -const char *print_slave_db_safe(const char* db); +const char *rewrite_db(const char* db, uint *new_db_len); +const char *print_slave_db_safe(const char *db); int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code); void skip_load_data_infile(NET* net); void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...); -- cgit v1.2.1