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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b98307f3
Commit
b98307f3
authored
Sep 12, 2003
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mashka.mysql.fi:/home/my/mysql-4.0
parents
62103fff
64a679c9
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
170 additions
and
45 deletions
+170
-45
client/mysqlbinlog.cc
client/mysqlbinlog.cc
+2
-2
configure.in
configure.in
+1
-1
innobase/row/row0sel.c
innobase/row/row0sel.c
+15
-18
libmysqld/examples/Makefile.am
libmysqld/examples/Makefile.am
+2
-0
mysql-test/r/rpl000009.result
mysql-test/r/rpl000009.result
+48
-0
mysql-test/t/rpl000009.test
mysql-test/t/rpl000009.test
+53
-3
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+9
-5
sql/slave.cc
sql/slave.cc
+33
-12
sql/slave.h
sql/slave.h
+2
-2
sql/sql_parse.cc
sql/sql_parse.cc
+5
-2
No files found.
client/mysqlbinlog.cc
View file @
b98307f3
...
@@ -49,10 +49,10 @@ static bool force_opt= 0;
...
@@ -49,10 +49,10 @@ static bool force_opt= 0;
static
const
char
*
database
;
static
const
char
*
database
;
static
bool
short_form
=
0
;
static
bool
short_form
=
0
;
static
ulonglong
offset
=
0
;
static
ulonglong
offset
=
0
;
static
const
char
*
host
=
"localhost"
;
static
const
char
*
host
=
0
;
static
int
port
=
MYSQL_PORT
;
static
int
port
=
MYSQL_PORT
;
static
const
char
*
sock
=
MYSQL_UNIX_ADDR
;
static
const
char
*
sock
=
MYSQL_UNIX_ADDR
;
static
const
char
*
user
=
"test"
;
static
const
char
*
user
=
0
;
static
const
char
*
pass
=
""
;
static
const
char
*
pass
=
""
;
static
ulonglong
position
=
0
;
static
ulonglong
position
=
0
;
static
bool
use_remote
=
0
;
static
bool
use_remote
=
0
;
...
...
configure.in
View file @
b98307f3
...
@@ -1017,7 +1017,7 @@ case $SYSTEM_TYPE in
...
@@ -1017,7 +1017,7 @@ case $SYSTEM_TYPE in
*
darwin6
*
)
*
darwin6
*
)
if
test
"
$ac_cv_prog_gcc
"
=
"yes"
if
test
"
$ac_cv_prog_gcc
"
=
"yes"
then
then
FLAGS
=
"-
traditional-cpp -
DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DFN_NO_CASE_SENCE"
FLAGS
=
"-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DFN_NO_CASE_SENCE"
CFLAGS
=
"
$CFLAGS
$FLAGS
"
CFLAGS
=
"
$CFLAGS
$FLAGS
"
CXXFLAGS
=
"
$CXXFLAGS
$FLAGS
"
CXXFLAGS
=
"
$CXXFLAGS
$FLAGS
"
MAX_C_OPTIMIZE
=
"-O"
MAX_C_OPTIMIZE
=
"-O"
...
...
innobase/row/row0sel.c
View file @
b98307f3
...
@@ -2810,23 +2810,6 @@ row_search_for_mysql(
...
@@ -2810,23 +2810,6 @@ row_search_for_mysql(
mode
=
pcur
->
search_mode
;
mode
=
pcur
->
search_mode
;
}
}
if
((
direction
==
ROW_SEL_NEXT
||
direction
==
ROW_SEL_PREV
)
&&
pcur
->
old_stored
!=
BTR_PCUR_OLD_STORED
)
{
/* MySQL sometimes seems to do fetch next or fetch prev even
if the search condition is unique; this can, for example,
happen with the HANDLER commands; we do not always store the
pcur position in this case, so we cannot restore cursor
position, and must return immediately */
/* printf("%s record not found 1\n", index->name); */
trx
->
op_info
=
(
char
*
)
""
;
return
(
DB_RECORD_NOT_FOUND
);
}
mtr_start
(
&
mtr
);
/* In a search where at most one record in the index may match, we
/* In a search where at most one record in the index may match, we
can use a LOCK_REC_NOT_GAP type record lock when locking a non-delete-
can use a LOCK_REC_NOT_GAP type record lock when locking a non-delete-
marked matching record.
marked matching record.
...
@@ -2841,8 +2824,21 @@ row_search_for_mysql(
...
@@ -2841,8 +2824,21 @@ row_search_for_mysql(
&&
dtuple_get_n_fields
(
search_tuple
)
&&
dtuple_get_n_fields
(
search_tuple
)
==
dict_index_get_n_unique
(
index
))
{
==
dict_index_get_n_unique
(
index
))
{
unique_search
=
TRUE
;
unique_search
=
TRUE
;
/* Even if the condition is unique, MySQL seems to try to
retrieve also a second row if a primary key contains more than
1 column. Return immediately if this is not a HANDLER
command. */
if
(
direction
!=
0
&&
!
prebuilt
->
used_in_HANDLER
)
{
trx
->
op_info
=
(
char
*
)
""
;
return
(
DB_RECORD_NOT_FOUND
);
}
}
}
mtr_start
(
&
mtr
);
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
/* PHASE 2: Try fast adaptive hash index search if possible */
/* PHASE 2: Try fast adaptive hash index search if possible */
...
@@ -2852,8 +2848,9 @@ row_search_for_mysql(
...
@@ -2852,8 +2848,9 @@ row_search_for_mysql(
cannot use the adaptive hash index in a search in the case the row
cannot use the adaptive hash index in a search in the case the row
may be long and there may be externally stored fields */
may be long and there may be externally stored fields */
if
(
unique_search
if
(
unique_search
&&
index
->
type
&
DICT_CLUSTERED
&&
index
->
type
&
DICT_CLUSTERED
&&
direction
==
0
&&
!
prebuilt
->
templ_contains_blob
&&
!
prebuilt
->
templ_contains_blob
&&
!
prebuilt
->
used_in_HANDLER
&&
!
prebuilt
->
used_in_HANDLER
&&
(
prebuilt
->
mysql_row_len
<
UNIV_PAGE_SIZE
/
8
))
{
&&
(
prebuilt
->
mysql_row_len
<
UNIV_PAGE_SIZE
/
8
))
{
...
...
libmysqld/examples/Makefile.am
View file @
b98307f3
...
@@ -13,6 +13,8 @@ INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \
...
@@ -13,6 +13,8 @@ INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \
LIBS
=
@LIBS@ @WRAPLIBS@
LIBS
=
@LIBS@ @WRAPLIBS@
LDADD
=
@CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @LIBDL@
$(CXXLDFLAGS)
LDADD
=
@CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @LIBDL@
$(CXXLDFLAGS)
mysqltest_LINK
=
$(CXXLINK)
mysqltest_SOURCES
=
mysqltest.c
mysqltest_SOURCES
=
mysqltest.c
mysql_SOURCES
=
mysql.cc readline.cc completion_hash.cc
\
mysql_SOURCES
=
mysql.cc readline.cc completion_hash.cc
\
...
...
mysql-test/r/rpl000009.result
View file @
b98307f3
...
@@ -49,21 +49,48 @@ show databases;
...
@@ -49,21 +49,48 @@ show databases;
Database
Database
mysql
mysql
test
test
create database foo;
create table foo.t1(n int, s char(20));
insert into foo.t1 values (1, 'original foo.t1');
create table foo.t3(n int, s char(20));
insert into foo.t3 values (1, 'original foo.t3');
create database foo2;
create table foo2.t1(n int, s char(20));
insert into foo2.t1 values (1, 'original foo2.t1');
create database bar;
create table bar.t1(n int, s char(20));
insert into bar.t1 values (1, 'original bar.t1');
create table bar.t3(n int, s char(20));
insert into bar.t3 values (1, 'original bar.t3');
load data from master;
load data from master;
show databases;
show databases;
Database
Database
bar
bar
foo
foo
foo2
mysql
mysql
test
test
use foo;
use foo;
show tables;
show tables;
Tables_in_foo
Tables_in_foo
t1
t3
select * from t1;
n s
1 original foo.t1
use foo2;
show tables;
Tables_in_foo2
t1
select * from t1;
n s
1 original foo2.t1
use bar;
use bar;
show tables;
show tables;
Tables_in_bar
Tables_in_bar
t1
t1
t2
t2
t3
select * from bar.t1;
select * from bar.t1;
n s
n s
1 one bar
1 one bar
...
@@ -74,6 +101,9 @@ n s
...
@@ -74,6 +101,9 @@ n s
11 eleven bar
11 eleven bar
12 twelve bar
12 twelve bar
13 thirteen bar
13 thirteen bar
select * from bar.t3;
n s
1 original bar.t3
insert into bar.t1 values (4, 'four bar');
insert into bar.t1 values (4, 'four bar');
select * from bar.t1;
select * from bar.t1;
n s
n s
...
@@ -81,5 +111,23 @@ n s
...
@@ -81,5 +111,23 @@ n s
2 two bar
2 two bar
3 three bar
3 three bar
4 four bar
4 four bar
insert into bar.t1 values(10, 'should be there');
flush tables;
load data from master;
Error on delete of './bar/t1.MYI' (Errcode: 13)
select * from bar.t1;
n s
1 one bar
2 two bar
3 three bar
4 four bar
10 should be there
load table bar.t1 from master;
Table 't1' already exists
drop table bar.t1;
load table bar.t1 from master;
start slave;
drop database bar;
drop database bar;
drop database foo;
drop database foo;
drop database foo;
drop database foo2;
mysql-test/t/rpl000009.test
View file @
b98307f3
...
@@ -60,16 +60,45 @@ sync_with_master;
...
@@ -60,16 +60,45 @@ sync_with_master;
# This should show that the slave is empty at this point
# This should show that the slave is empty at this point
show
databases
;
show
databases
;
# Create foo and foo2 on slave; we expect that LOAD DATA FROM MASTER will
# neither touch database foo nor foo2.
create
database
foo
;
create
table
foo
.
t1
(
n
int
,
s
char
(
20
));
insert
into
foo
.
t1
values
(
1
,
'original foo.t1'
);
create
table
foo
.
t3
(
n
int
,
s
char
(
20
));
insert
into
foo
.
t3
values
(
1
,
'original foo.t3'
);
create
database
foo2
;
create
table
foo2
.
t1
(
n
int
,
s
char
(
20
));
insert
into
foo2
.
t1
values
(
1
,
'original foo2.t1'
);
# Create bar, and bar.t1, to check that it gets replaced,
# and bar.t3 to check that it is not touched (there is no bar.t3 on master)
create
database
bar
;
create
table
bar
.
t1
(
n
int
,
s
char
(
20
));
insert
into
bar
.
t1
values
(
1
,
'original bar.t1'
);
create
table
bar
.
t3
(
n
int
,
s
char
(
20
));
insert
into
bar
.
t3
values
(
1
,
'original bar.t3'
);
load
data
from
master
;
load
data
from
master
;
# Now let's check if we have the right tables and the right data in them
# Now let's check if we have the right tables and the right data in them
show
databases
;
show
databases
;
use
foo
;
use
foo
;
show
tables
;
# LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which databases
# have to be copied. So it thinks "foo" has to be copied. Before 4.0.16 it would
# first drop "foo", then create "foo". This "drop" is a bug; in that case t3
# would disappear.
# So here the effect of this bug (BUG#1248) would be to leave an empty "foo" on
# the slave.
show
tables
;
# should be t1 & t3
select
*
from
t1
;
# should be slave's original
use
foo2
;
show
tables
;
# should be t1
select
*
from
t1
;
# should be slave's original
use
bar
;
use
bar
;
show
tables
;
show
tables
;
# should contain master's copied t1&t2, slave's original t3
select
*
from
bar
.
t1
;
select
*
from
bar
.
t1
;
select
*
from
bar
.
t2
;
select
*
from
bar
.
t2
;
select
*
from
bar
.
t3
;
# Now let's see if replication works
# Now let's see if replication works
connection
master
;
connection
master
;
...
@@ -79,6 +108,26 @@ connection slave;
...
@@ -79,6 +108,26 @@ connection slave;
sync_with_master
;
sync_with_master
;
select
*
from
bar
.
t1
;
select
*
from
bar
.
t1
;
# Check that LOAD DATA FROM MASTER reports the error if it can't drop a
# table to be overwritten.
insert
into
bar
.
t1
values
(
10
,
'should be there'
);
flush
tables
;
system
chmod
500
var
/
slave
-
data
/
bar
/
;
--
error
6
load
data
from
master
;
# should fail (errno 13)
system
chmod
700
var
/
slave
-
data
/
bar
/
;
select
*
from
bar
.
t1
;
# should contain the row (10, ...)
# Check that LOAD TABLE FROM MASTER fails if the table exists on slave
--
error
1050
load
table
bar
.
t1
from
master
;
drop
table
bar
.
t1
;
load
table
bar
.
t1
from
master
;
# as LOAD DATA FROM MASTER failed it did not restart slave threads
start
slave
;
# Now time for cleanup
# Now time for cleanup
connection
master
;
connection
master
;
drop
database
bar
;
drop
database
bar
;
...
@@ -86,4 +135,5 @@ drop database foo;
...
@@ -86,4 +135,5 @@ drop database foo;
save_master_pos
;
save_master_pos
;
connection
slave
;
connection
slave
;
sync_with_master
;
sync_with_master
;
drop
database
foo
;
drop
database
foo2
;
sql/repl_failsafe.cc
View file @
b98307f3
...
@@ -717,7 +717,8 @@ static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db,
...
@@ -717,7 +717,8 @@ static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db,
if
(
!
tables_ok
(
thd
,
&
table
))
if
(
!
tables_ok
(
thd
,
&
table
))
continue
;
continue
;
}
}
if
((
error
=
fetch_master_table
(
thd
,
db
,
table_name
,
mi
,
mysql
)))
/* download master's table and overwrite slave's table */
if
((
error
=
fetch_master_table
(
thd
,
db
,
table_name
,
mi
,
mysql
,
1
)))
return
error
;
return
error
;
}
}
return
0
;
return
0
;
...
@@ -819,8 +820,11 @@ int load_master_data(THD* thd)
...
@@ -819,8 +820,11 @@ int load_master_data(THD* thd)
char
*
db
=
row
[
0
];
char
*
db
=
row
[
0
];
/*
/*
Do not replicate databases excluded by rules
Do not replicate databases excluded by rules. We also test
also skip mysql database - in most cases the user will
replicate_wild_*_table rules (replicate_wild_ignore_table='db1.%' will
be considered as "ignore the 'db1' database as a whole, as it already
works for CREATE DATABASE and DROP DATABASE).
Also skip 'mysql' database - in most cases the user will
mess up and not exclude mysql database with the rules when
mess up and not exclude mysql database with the rules when
he actually means to - in this case, he is up for a surprise if
he actually means to - in this case, he is up for a surprise if
his priv tables get dropped and downloaded from master
his priv tables get dropped and downloaded from master
...
@@ -830,14 +834,14 @@ int load_master_data(THD* thd)
...
@@ -830,14 +834,14 @@ int load_master_data(THD* thd)
*/
*/
if
(
!
db_ok
(
db
,
replicate_do_db
,
replicate_ignore_db
)
||
if
(
!
db_ok
(
db
,
replicate_do_db
,
replicate_ignore_db
)
||
!
db_ok_with_wild_table
(
db
)
||
!
strcmp
(
db
,
"mysql"
))
!
strcmp
(
db
,
"mysql"
))
{
{
*
cur_table_res
=
0
;
*
cur_table_res
=
0
;
continue
;
continue
;
}
}
if
(
mysql_rm_db
(
thd
,
db
,
1
,
1
)
||
if
(
mysql_create_db
(
thd
,
db
,
HA_LEX_CREATE_IF_NOT_EXISTS
,
1
))
mysql_create_db
(
thd
,
db
,
0
,
1
))
{
{
send_error
(
&
thd
->
net
,
0
,
0
);
send_error
(
&
thd
->
net
,
0
,
0
);
cleanup_mysql_results
(
db_res
,
cur_table_res
-
1
,
table_res
);
cleanup_mysql_results
(
db_res
,
cur_table_res
-
1
,
table_res
);
...
...
sql/slave.cc
View file @
b98307f3
...
@@ -72,7 +72,7 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
...
@@ -72,7 +72,7 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
void
*
thread_killed_arg
);
void
*
thread_killed_arg
);
static
int
request_table_dump
(
MYSQL
*
mysql
,
const
char
*
db
,
const
char
*
table
);
static
int
request_table_dump
(
MYSQL
*
mysql
,
const
char
*
db
,
const
char
*
table
);
static
int
create_table_from_dump
(
THD
*
thd
,
NET
*
net
,
const
char
*
db
,
static
int
create_table_from_dump
(
THD
*
thd
,
NET
*
net
,
const
char
*
db
,
const
char
*
table_name
);
const
char
*
table_name
,
bool
overwrite
);
static
int
check_master_version
(
MYSQL
*
mysql
,
MASTER_INFO
*
mi
);
static
int
check_master_version
(
MYSQL
*
mysql
,
MASTER_INFO
*
mi
);
...
@@ -1033,12 +1033,22 @@ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi)
...
@@ -1033,12 +1033,22 @@ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi)
return
0
;
return
0
;
}
}
/*
Used by fetch_master_table (used by LOAD TABLE tblname FROM MASTER and LOAD
DATA FROM MASTER). Drops the table (if 'overwrite' is true) and recreates it
from the dump. Honours replication inclusion/exclusion rules.
RETURN VALUES
0 success
1 error
*/
static
int
create_table_from_dump
(
THD
*
thd
,
NET
*
net
,
const
char
*
db
,
static
int
create_table_from_dump
(
THD
*
thd
,
NET
*
net
,
const
char
*
db
,
const
char
*
table_name
)
const
char
*
table_name
,
bool
overwrite
)
{
{
ulong
packet_len
=
my_net_read
(
net
);
// read create table statement
ulong
packet_len
=
my_net_read
(
net
);
// read create table statement
char
*
query
;
char
*
query
;
char
*
save_db
;
Vio
*
save_vio
;
Vio
*
save_vio
;
HA_CHECK_OPT
check_opt
;
HA_CHECK_OPT
check_opt
;
TABLE_LIST
tables
;
TABLE_LIST
tables
;
...
@@ -1078,13 +1088,24 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
...
@@ -1078,13 +1088,24 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
thd
->
current_tablenr
=
0
;
thd
->
current_tablenr
=
0
;
thd
->
query_error
=
0
;
thd
->
query_error
=
0
;
thd
->
net
.
no_send_ok
=
1
;
thd
->
net
.
no_send_ok
=
1
;
bzero
((
char
*
)
&
tables
,
sizeof
(
tables
));
tables
.
db
=
(
char
*
)
db
;
tables
.
alias
=
tables
.
real_name
=
(
char
*
)
table_name
;
/* Drop the table if 'overwrite' is true */
if
(
overwrite
&&
mysql_rm_table
(
thd
,
&
tables
,
1
))
/* drop if exists */
{
send_error
(
&
thd
->
net
);
sql_print_error
(
"create_table_from_dump: failed to drop the table"
);
goto
err
;
}
/*
we do not want to log create table
statement */
/*
Create the table. We do not want to log the "create table"
statement */
save_options
=
thd
->
options
;
save_options
=
thd
->
options
;
thd
->
options
&=
~
(
ulong
)
(
OPTION_BIN_LOG
);
thd
->
options
&=
~
(
ulong
)
(
OPTION_BIN_LOG
);
thd
->
proc_info
=
"Creating table from master dump"
;
thd
->
proc_info
=
"Creating table from master dump"
;
// save old db in case we are creating in a different database
// save old db in case we are creating in a different database
char
*
save_db
=
thd
->
db
;
save_db
=
thd
->
db
;
thd
->
db
=
(
char
*
)
db
;
thd
->
db
=
(
char
*
)
db
;
mysql_parse
(
thd
,
thd
->
query
,
packet_len
);
// run create table
mysql_parse
(
thd
,
thd
->
query
,
packet_len
);
// run create table
thd
->
db
=
save_db
;
// leave things the way the were before
thd
->
db
=
save_db
;
// leave things the way the were before
...
@@ -1093,11 +1114,8 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
...
@@ -1093,11 +1114,8 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
if
(
thd
->
query_error
)
if
(
thd
->
query_error
)
goto
err
;
// mysql_parse took care of the error send
goto
err
;
// mysql_parse took care of the error send
bzero
((
char
*
)
&
tables
,
sizeof
(
tables
));
tables
.
db
=
(
char
*
)
db
;
tables
.
alias
=
tables
.
real_name
=
(
char
*
)
table_name
;
tables
.
lock_type
=
TL_WRITE
;
thd
->
proc_info
=
"Opening master dump table"
;
thd
->
proc_info
=
"Opening master dump table"
;
tables
.
lock_type
=
TL_WRITE
;
if
(
!
open_ltable
(
thd
,
&
tables
,
TL_WRITE
))
if
(
!
open_ltable
(
thd
,
&
tables
,
TL_WRITE
))
{
{
send_error
(
&
thd
->
net
,
0
,
0
);
// Send error from open_ltable
send_error
(
&
thd
->
net
,
0
,
0
);
// Send error from open_ltable
...
@@ -1107,10 +1125,11 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
...
@@ -1107,10 +1125,11 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
file
=
tables
.
table
->
file
;
file
=
tables
.
table
->
file
;
thd
->
proc_info
=
"Reading master dump table data"
;
thd
->
proc_info
=
"Reading master dump table data"
;
/* Copy the data file */
if
(
file
->
net_read_dump
(
net
))
if
(
file
->
net_read_dump
(
net
))
{
{
net_printf
(
&
thd
->
net
,
ER_MASTER_NET_READ
);
net_printf
(
&
thd
->
net
,
ER_MASTER_NET_READ
);
sql_print_error
(
"create_table_from_dump:
:
failed in\
sql_print_error
(
"create_table_from_dump:
failed in\
handler::net_read_dump()"
);
handler::net_read_dump()"
);
goto
err
;
goto
err
;
}
}
...
@@ -1125,6 +1144,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
...
@@ -1125,6 +1144,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
*/
*/
save_vio
=
thd
->
net
.
vio
;
save_vio
=
thd
->
net
.
vio
;
thd
->
net
.
vio
=
0
;
thd
->
net
.
vio
=
0
;
/* Rebuild the index file from the copied data file (with REPAIR) */
error
=
file
->
repair
(
thd
,
&
check_opt
)
!=
0
;
error
=
file
->
repair
(
thd
,
&
check_opt
)
!=
0
;
thd
->
net
.
vio
=
save_vio
;
thd
->
net
.
vio
=
save_vio
;
if
(
error
)
if
(
error
)
...
@@ -1137,7 +1157,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
...
@@ -1137,7 +1157,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
}
}
int
fetch_master_table
(
THD
*
thd
,
const
char
*
db_name
,
const
char
*
table_name
,
int
fetch_master_table
(
THD
*
thd
,
const
char
*
db_name
,
const
char
*
table_name
,
MASTER_INFO
*
mi
,
MYSQL
*
mysql
)
MASTER_INFO
*
mi
,
MYSQL
*
mysql
,
bool
overwrite
)
{
{
int
error
=
1
;
int
error
=
1
;
const
char
*
errmsg
=
0
;
const
char
*
errmsg
=
0
;
...
@@ -1169,9 +1189,10 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
...
@@ -1169,9 +1189,10 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
errmsg
=
"Failed on table dump request"
;
errmsg
=
"Failed on table dump request"
;
goto
err
;
goto
err
;
}
}
if
(
create_table_from_dump
(
thd
,
&
mysql
->
net
,
db_name
,
if
(
create_table_from_dump
(
thd
,
&
mysql
->
net
,
db_name
,
table_name
))
table_name
,
overwrite
))
goto
err
;
// create_table_from_dump will have sent the
error already
goto
err
;
// create_table_from_dump will have send_
error already
error
=
0
;
error
=
0
;
err:
err:
...
...
sql/slave.h
View file @
b98307f3
...
@@ -384,9 +384,9 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock,
...
@@ -384,9 +384,9 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock,
int
mysql_table_dump
(
THD
*
thd
,
const
char
*
db
,
int
mysql_table_dump
(
THD
*
thd
,
const
char
*
db
,
const
char
*
tbl_name
,
int
fd
=
-
1
);
const
char
*
tbl_name
,
int
fd
=
-
1
);
/* retrieve
non-exitent table from master
*/
/* retrieve
table from master and copy to slave
*/
int
fetch_master_table
(
THD
*
thd
,
const
char
*
db_name
,
const
char
*
table_name
,
int
fetch_master_table
(
THD
*
thd
,
const
char
*
db_name
,
const
char
*
table_name
,
MASTER_INFO
*
mi
,
MYSQL
*
mysql
);
MASTER_INFO
*
mi
,
MYSQL
*
mysql
,
bool
overwrite
);
int
show_master_info
(
THD
*
thd
,
MASTER_INFO
*
mi
);
int
show_master_info
(
THD
*
thd
,
MASTER_INFO
*
mi
);
int
show_binlog_info
(
THD
*
thd
);
int
show_binlog_info
(
THD
*
thd
);
...
...
sql/sql_parse.cc
View file @
b98307f3
...
@@ -1568,9 +1568,12 @@ mysql_execute_command(void)
...
@@ -1568,9 +1568,12 @@ mysql_execute_command(void)
goto
error
;
goto
error
;
}
}
LOCK_ACTIVE_MI
;
LOCK_ACTIVE_MI
;
// fetch_master_table will send the error to the client on failure
/*
fetch_master_table will send the error to the client on failure.
Give error if the table already exists.
*/
if
(
!
fetch_master_table
(
thd
,
tables
->
db
,
tables
->
real_name
,
if
(
!
fetch_master_table
(
thd
,
tables
->
db
,
tables
->
real_name
,
active_mi
,
0
))
active_mi
,
0
,
0
))
{
{
send_ok
(
&
thd
->
net
);
send_ok
(
&
thd
->
net
);
}
}
...
...
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