Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
613c98ce
Commit
613c98ce
authored
Nov 03, 2004
by
guilhem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/mysql_src/mysql-4.1-clean
parents
b9ec6803
42d103b6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
17 deletions
+59
-17
mysql-test/r/rpl_rewrite_db.result
mysql-test/r/rpl_rewrite_db.result
+22
-0
mysql-test/t/rpl_rewrite_db-slave.opt
mysql-test/t/rpl_rewrite_db-slave.opt
+1
-0
mysql-test/t/rpl_rewrite_db.test
mysql-test/t/rpl_rewrite_db.test
+19
-0
sql/log_event.cc
sql/log_event.cc
+10
-13
sql/slave.cc
sql/slave.cc
+5
-2
sql/slave.h
sql/slave.h
+2
-2
No files found.
mysql-test/r/rpl_rewrite_db.result
0 → 100644
View file @
613c98ce
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
create table t1 (a int);
insert into t1 values(9);
select * from mysqltest1.t1;
a
9
show databases like 'mysqltest1';
Database (mysqltest1)
mysqltest1
select * from test.t1;
a
9
drop table t1;
drop database mysqltest1;
mysql-test/t/rpl_rewrite_db-slave.opt
0 → 100644
View file @
613c98ce
"--replicate-rewrite-db=mysqltest1->test"
mysql-test/t/rpl_rewrite_db.test
0 → 100644
View file @
613c98ce
source
include
/
master
-
slave
.
inc
;
--
disable_warnings
drop
database
if
exists
mysqltest1
;
--
enable_warnings
create
database
mysqltest1
;
use
mysqltest1
;
create
table
t1
(
a
int
);
insert
into
t1
values
(
9
);
select
*
from
mysqltest1
.
t1
;
sync_slave_with_master
;
show
databases
like
'mysqltest1'
;
# should be empty
select
*
from
test
.
t1
;
# cleanup
connection
master
;
drop
table
t1
;
drop
database
mysqltest1
;
sync_slave_with_master
;
sql/log_event.cc
View file @
613c98ce
...
...
@@ -977,7 +977,8 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
int
Query_log_event
::
exec_event
(
struct
st_relay_log_info
*
rli
)
{
int
expected_error
,
actual_error
=
0
;
thd
->
db
=
(
char
*
)
rewrite_db
(
db
);
// thd->db_length is set later if needed
thd
->
db_length
=
db_len
;
thd
->
db
=
(
char
*
)
rewrite_db
(
db
,
&
thd
->
db_length
);
/*
InnoDB internally stores the master log position it has processed so far;
...
...
@@ -995,11 +996,6 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
if
(
db_ok
(
thd
->
db
,
replicate_do_db
,
replicate_ignore_db
))
{
thd
->
set_time
((
time_t
)
when
);
/*
We cannot use db_len from event to fill thd->db_length, because
rewrite_db() may have changed db.
*/
thd
->
db_length
=
thd
->
db
?
strlen
(
thd
->
db
)
:
0
;
thd
->
query_length
=
q_len
;
thd
->
query
=
(
char
*
)
query
;
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
...
...
@@ -1057,7 +1053,7 @@ Default database: '%s'. Query: '%s'",
expected_error
,
actual_error
?
thd
->
net
.
last_error
:
"no error"
,
actual_error
,
print_slave_db_safe
(
db
),
query
);
print_slave_db_safe
(
thd
->
db
),
query
);
thd
->
query_error
=
1
;
}
/*
...
...
@@ -1078,7 +1074,7 @@ Default database: '%s'. Query: '%s'",
"Error '%s' on query. Default database: '%s'. Query: '%s'"
,
(
actual_error
?
thd
->
net
.
last_error
:
"unexpected success or fatal error"
),
print_slave_db_safe
(
db
),
query
);
print_slave_db_safe
(
thd
->
db
),
query
);
thd
->
query_error
=
1
;
}
}
/* End of if (db_ok(... */
...
...
@@ -1706,7 +1702,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
bool
use_rli_only_for_errors
)
{
char
*
load_data_query
=
0
;
thd
->
db
=
(
char
*
)
rewrite_db
(
db
);
// thd->db_length is set later if needed
thd
->
db_length
=
db_len
;
thd
->
db
=
(
char
*
)
rewrite_db
(
db
,
&
thd
->
db_length
);
DBUG_ASSERT
(
thd
->
query
==
0
);
thd
->
query_length
=
0
;
// Should not be needed
thd
->
query_error
=
0
;
...
...
@@ -1741,7 +1738,6 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
if
(
db_ok
(
thd
->
db
,
replicate_do_db
,
replicate_ignore_db
))
{
thd
->
set_time
((
time_t
)
when
);
thd
->
db_length
=
thd
->
db
?
strlen
(
thd
->
db
)
:
0
;
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
thd
->
query_id
=
query_id
++
;
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
...
...
@@ -1847,7 +1843,7 @@ Slave: load data infile on table '%s' at log position %s in log \
(
char
*
)
table_name
,
llstr
(
log_pos
,
llbuff
),
RPL_LOG_NAME
,
(
ulong
)
thd
->
cuted_fields
,
print_slave_db_safe
(
db
));
print_slave_db_safe
(
thd
->
db
));
}
if
(
net
)
net
->
pkt_nr
=
thd
->
net
.
pkt_nr
;
...
...
@@ -1865,6 +1861,7 @@ Slave: load data infile on table '%s' at log position %s in log \
}
thd
->
net
.
vio
=
0
;
char
*
save_db
=
thd
->
db
;
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
thd
->
db
=
0
;
thd
->
query
=
0
;
...
...
@@ -1887,7 +1884,7 @@ Slave: load data infile on table '%s' at log position %s in log \
}
slave_print_error
(
rli
,
sql_errno
,
"\
Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'"
,
err
,
(
char
*
)
table_name
,
print_slave_db_safe
(
db
));
err
,
(
char
*
)
table_name
,
print_slave_db_safe
(
save_
db
));
free_root
(
&
thd
->
mem_root
,
MYF
(
MY_KEEP_PREALLOC
));
return
1
;
}
...
...
@@ -1897,7 +1894,7 @@ Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
{
slave_print_error
(
rli
,
ER_UNKNOWN_ERROR
,
"\
Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'"
,
(
char
*
)
table_name
,
print_slave_db_safe
(
db
));
(
char
*
)
table_name
,
print_slave_db_safe
(
save_
db
));
return
1
;
}
...
...
sql/slave.cc
View file @
613c98ce
...
...
@@ -1032,7 +1032,7 @@ bool net_request_file(NET* net, const char* fname)
}
const
char
*
rewrite_db
(
const
char
*
db
)
const
char
*
rewrite_db
(
const
char
*
db
,
uint
*
new_len
)
{
if
(
replicate_rewrite_db
.
is_empty
()
||
!
db
)
return
db
;
...
...
@@ -1042,7 +1042,10 @@ const char *rewrite_db(const char* db)
while
((
tmp
=
it
++
))
{
if
(
!
strcmp
(
tmp
->
key
,
db
))
{
*
new_len
=
strlen
(
tmp
->
val
);
return
tmp
->
val
;
}
}
return
db
;
}
...
...
@@ -1056,7 +1059,7 @@ const char *rewrite_db(const char* db)
const
char
*
print_slave_db_safe
(
const
char
*
db
)
{
return
(
db
?
rewrite_db
(
db
)
:
""
);
return
(
db
?
db
:
""
);
}
/*
...
...
sql/slave.h
View file @
613c98ce
...
...
@@ -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
,
...);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment