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
7a02bd9c
Commit
7a02bd9c
authored
Sep 07, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
parents
bb88f4fb
32db5b4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
8 deletions
+28
-8
sql/log_event.cc
sql/log_event.cc
+10
-4
sql/slave.cc
sql/slave.cc
+9
-4
sql/sql_db.cc
sql/sql_db.cc
+9
-0
No files found.
sql/log_event.cc
View file @
7a02bd9c
...
...
@@ -1806,7 +1806,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
{
int
expected_error
,
actual_error
=
0
;
init_sql_alloc
(
&
thd
->
mem_root
,
thd
->
variables
.
query_alloc_block_size
,
0
);
thd
->
db
=
(
char
*
)
rewrite_db
(
db
);
thd
->
db
=
(
char
*
)
rewrite_db
(
db
);
// thd->db_length is set later if needed
/*
InnoDB internally stores the master log position it has processed so far;
...
...
@@ -1836,6 +1836,11 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
{
thd
->
set_time
((
time_t
)
when
);
thd
->
current_tablenr
=
0
;
/*
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
));
...
...
@@ -1930,7 +1935,7 @@ end:
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
thd
->
db
=
0
;
// prevent db from being freed
thd
->
query
=
0
;
// just to be sure
thd
->
query_length
=
0
;
thd
->
query_length
=
thd
->
db_length
=
0
;
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
close_thread_tables
(
thd
);
free_root
(
&
thd
->
mem_root
,
MYF
(
MY_KEEP_PREALLOC
));
...
...
@@ -1968,7 +1973,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
{
char
*
load_data_query
=
0
;
init_sql_alloc
(
&
thd
->
mem_root
,
thd
->
variables
.
query_alloc_block_size
,
0
);
thd
->
db
=
(
char
*
)
rewrite_db
(
db
);
thd
->
db
=
(
char
*
)
rewrite_db
(
db
);
// thd->db_length is set later if needed
DBUG_ASSERT
(
thd
->
query
==
0
);
clear_all_errors
(
thd
,
rli
);
...
...
@@ -2001,6 +2006,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
{
thd
->
set_time
((
time_t
)
when
);
thd
->
current_tablenr
=
0
;
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
));
...
...
@@ -2117,7 +2123,7 @@ Slave: load data infile on table '%s' at log position %s in log \
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
thd
->
db
=
0
;
thd
->
query
=
0
;
thd
->
query_length
=
0
;
thd
->
query_length
=
thd
->
db_length
=
0
;
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
close_thread_tables
(
thd
);
if
(
load_data_query
)
...
...
sql/slave.cc
View file @
7a02bd9c
...
...
@@ -1124,6 +1124,7 @@ slaves can't replicate a 5.0 or newer master.";
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.
db must be non-zero (guarded by assertion).
RETURN VALUES
0 success
...
...
@@ -1134,8 +1135,8 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
const
char
*
table_name
,
bool
overwrite
)
{
ulong
packet_len
=
my_net_read
(
net
);
// read create table statement
char
*
query
;
char
*
save_db
;
char
*
query
,
*
save_db
;
uint32
save_db_length
;
Vio
*
save_vio
;
HA_CHECK_OPT
check_opt
;
TABLE_LIST
tables
;
...
...
@@ -1193,9 +1194,13 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
thd
->
proc_info
=
"Creating table from master dump"
;
// save old db in case we are creating in a different database
save_db
=
thd
->
db
;
save_db_length
=
thd
->
db_length
;
thd
->
db
=
(
char
*
)
db
;
DBUG_ASSERT
(
thd
->
db
);
thd
->
db_length
=
strlen
(
thd
->
db
);
mysql_parse
(
thd
,
thd
->
query
,
packet_len
);
// run create table
thd
->
db
=
save_db
;
// leave things the way the were before
thd
->
db_length
=
save_db_length
;
thd
->
options
=
save_options
;
if
(
thd
->
query_error
)
...
...
@@ -2689,7 +2694,7 @@ err:
IO_RPL_LOG_NAME
,
llstr
(
mi
->
master_log_pos
,
llbuff
));
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
thd
->
query
=
thd
->
db
=
0
;
// extra safety
thd
->
query_length
=
0
;
thd
->
query_length
=
thd
->
db_length
=
0
;
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
if
(
mysql
)
{
...
...
@@ -2838,7 +2843,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
err:
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
thd
->
query
=
thd
->
db
=
0
;
// extra safety
thd
->
query_length
=
0
;
thd
->
query_length
=
thd
->
db_length
=
0
;
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
thd
->
proc_info
=
"Waiting for slave mutex on exit"
;
pthread_mutex_lock
(
&
rli
->
run_lock
);
...
...
sql/sql_db.cc
View file @
7a02bd9c
...
...
@@ -385,6 +385,15 @@ err:
}
/*
Changes the current database.
NOTES
Do as little as possible in this function, as it is not called for the
replication slave SQL thread (for that thread, setting of thd->db is done
in ::exec_event() methods of log_event.cc).
*/
bool
mysql_change_db
(
THD
*
thd
,
const
char
*
name
)
{
int
length
,
db_length
;
...
...
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