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
ae686937
Commit
ae686937
authored
Nov 17, 2001
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0
into mysql.sashanet.com:/home/sasha/src/bk/mysql-4.0
parents
024f2e33
4bcb4f4d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
45 deletions
+106
-45
client/mysqltest.c
client/mysqltest.c
+25
-4
mysql-test/include/master-slave.inc
mysql-test/include/master-slave.inc
+4
-4
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+8
-1
sql/log_event.cc
sql/log_event.cc
+60
-34
sql/log_event.h
sql/log_event.h
+2
-1
sql/slave.cc
sql/slave.cc
+7
-1
No files found.
client/mysqltest.c
View file @
ae686937
...
...
@@ -1280,6 +1280,7 @@ int do_connect(struct st_query* q)
char
buff
[
FN_REFLEN
];
int
con_port
;
int
con_error
;
int
free_con_sock
=
0
;
DBUG_ENTER
(
"do_connect"
);
DBUG_PRINT
(
"enter"
,(
"connect: %s"
,
p
));
...
...
@@ -1299,10 +1300,29 @@ int do_connect(struct st_query* q)
}
else
{
VAR
*
var_port
,
*
var_sock
;
p
=
safe_get_param
(
p
,
&
con_port_str
,
"missing connection port"
);
con_port
=
atoi
(
con_port_str
);
if
(
*
con_port_str
==
'$'
)
{
if
(
!
(
var_port
=
var_get
(
con_port_str
,
0
,
0
)))
die
(
"Unknown variable '%s'"
,
con_port_str
+
1
);
con_port
=
var_port
->
int_val
;
}
else
con_port
=
atoi
(
con_port_str
);
p
=
safe_get_param
(
p
,
&
con_sock
,
"missing connection socket"
);
if
(
*
con_sock
==
'$'
)
{
if
(
!
(
var_sock
=
var_get
(
con_sock
,
0
,
0
)))
die
(
"Unknown variable '%s'"
,
con_sock
+
1
);
if
(
!
(
con_sock
=
(
char
*
)
my_malloc
(
var_sock
->
str_val_len
+
1
,
MYF
(
0
))))
die
(
"Out of memory"
);
free_con_sock
=
1
;
memcpy
(
con_sock
,
var_sock
->
str_val
,
var_sock
->
str_val_len
);
con_sock
[
var_sock
->
str_val_len
]
=
0
;
}
}
if
(
next_con
==
cons_end
)
die
(
"Connection limit exhausted - increase MAX_CONS in mysqltest.c"
);
...
...
@@ -1310,20 +1330,21 @@ int do_connect(struct st_query* q)
die
(
"Failed on mysql_init()"
);
if
(
opt_compress
)
mysql_options
(
&
next_con
->
mysql
,
MYSQL_OPT_COMPRESS
,
NullS
);
if
(
con_sock
)
if
(
con_sock
&&
!
free_con_sock
&&
*
con_sock
&&
*
con_sock
!=
FN_LIBCHAR
)
con_sock
=
fn_format
(
buff
,
con_sock
,
TMPDIR
,
""
,
0
);
if
(
!
con_db
[
0
])
con_db
=
db
;
if
((
con_error
=
safe_connect
(
&
next_con
->
mysql
,
con_host
,
con_user
,
con_pass
,
con_db
,
con_port
,
con_sock
)))
con_db
,
con_port
,
*
con_sock
?
con_sock
:
0
)))
die
(
"Could not open connection '%s': %s"
,
con_name
,
mysql_error
(
&
next_con
->
mysql
));
if
(
!
(
next_con
->
name
=
my_strdup
(
con_name
,
MYF
(
MY_WME
))))
die
(
NullS
);
cur_con
=
next_con
++
;
if
(
free_con_sock
)
my_free
(
con_sock
,
MYF
(
MY_WME
));
DBUG_RETURN
(
0
);
}
...
...
mysql-test/include/master-slave.inc
View file @
ae686937
connect
(
master
,
localhost
,
root
,,
test
,
0
,
master
.
sock
);
connect
(
master1
,
localhost
,
root
,,
test
,
0
,
master
.
sock
);
connect
(
slave
,
localhost
,
root
,,
test
,
0
,
slave
.
sock
);
connect
(
slave1
,
localhost
,
root
,,
test
,
0
,
slave
.
sock
);
connect
(
master
,
127.0
.
0.1
,
root
,,
test
,
$MASTER_MYPORT
,
);
connect
(
master1
,
127.0
.
0.1
,
root
,,
test
,
$MASTER_MYPORT
,
);
connect
(
slave
,
127.0
.
0.1
,
root
,,
test
,
$SLAVE_MYPORT
,
);
connect
(
slave1
,
127.0
.
0.1
,
root
,,
test
,
$SLAVE_MYPORT
,
);
connection
slave
;
--
error
0
,
1199
!
slave
stop
;
...
...
mysql-test/mysql-test-run.sh
View file @
ae686937
...
...
@@ -151,6 +151,11 @@ while test $# -gt 0; do
--verbose-manager
)
MANAGER_QUIET_OPT
=
""
;;
--local
)
USE_RUNNING_SERVER
=
""
;;
--tmpdir
=
*
)
MYSQL_TMP_DIR
=
`
$ECHO
"
$1
"
|
$SED
-e
"s;--tmpdir=;;"
`
;;
--local-master
)
MASTER_MYPORT
=
3306
;
EXTRA_MYSQL_TEST_OPT
=
"
$EXTRA_MYSQL_TEST_OPT
--host=127.0.0.1
\
--port=
$MYSQL_MYPORT
"
LOCAL_MASTER
=
1
;;
--master_port
=
*
)
MASTER_MYPORT
=
`
$ECHO
"
$1
"
|
$SED
-e
"s;--master_port=;;"
`
;;
--slave_port
=
*
)
SLAVE_MYPORT
=
`
$ECHO
"
$1
"
|
$SED
-e
"s;--slave_port=;;"
`
;;
--manager-port
=
*
)
MYSQL_MANAGER_PORT
=
`
$ECHO
"
$1
"
|
$SED
-e
"s;--manager_port=;;"
`
;;
...
...
@@ -639,7 +644,9 @@ EOF
start_master
()
{
[
x
$MASTER_RUNNING
=
1
]
&&
return
if
[
x
$MASTER_RUNNING
=
x1
]
||
[
x
$LOCAL_MASTER
=
x1
]
;
then
return
fi
# Remove old berkeley db log files that can confuse the server
$RM
-f
$MASTER_MYDDIR
/log.
*
# Remove stale binary logs
...
...
sql/log_event.cc
View file @
ae686937
...
...
@@ -467,8 +467,10 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, bool old_format)
#endif
{
char
head
[
LOG_EVENT_HEADER_LEN
];
uint
header_size
=
old_format
?
OLD_HEADER_LEN
:
LOG_EVENT_HEADER_LEN
;
LOCK_MUTEX
;
if
(
my_b_read
(
file
,
(
byte
*
)
head
,
sizeof
(
head
)
))
if
(
my_b_read
(
file
,
(
byte
*
)
head
,
header_size
))
{
UNLOCK_MUTEX
;
return
0
;
...
...
@@ -485,7 +487,7 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, bool old_format)
goto
err
;
}
if
(
data_len
<
LOG_EVENT_HEADER_LEN
)
if
(
data_len
<
header_size
)
{
error
=
"Event too small"
;
goto
err
;
...
...
@@ -498,9 +500,9 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, bool old_format)
goto
err
;
}
buf
[
data_len
]
=
0
;
memcpy
(
buf
,
head
,
LOG_EVENT_HEADER_LEN
);
if
(
my_b_read
(
file
,
(
byte
*
)
buf
+
LOG_EVENT_HEADER_LEN
,
data_len
-
LOG_EVENT_HEADER_LEN
))
memcpy
(
buf
,
head
,
header_size
);
if
(
my_b_read
(
file
,
(
byte
*
)
buf
+
header_size
,
data_len
-
header_size
))
{
error
=
"read error"
;
goto
err
;
...
...
@@ -653,11 +655,11 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db)
Start_log_event
::
Start_log_event
(
const
char
*
buf
,
bool
old_format
)
:
Log_event
(
buf
,
old_format
)
{
b
inlog_version
=
uint2korr
(
buf
+
LOG_EVENT_HEADER_LEN
+
ST_BINLOG_VER_OFFSET
);
memcpy
(
server_version
,
buf
+
ST_SERVER_VER_OFFSET
+
LOG_EVENT_HEADER_LEN
,
b
uf
+=
(
old_format
)
?
OLD_HEADER_LEN
:
LOG_EVENT_HEADER_LEN
;
binlog_version
=
uint2korr
(
buf
+
ST_BINLOG_VER_OFFSET
);
memcpy
(
server_version
,
buf
+
ST_SERVER_VER_OFFSET
,
ST_SERVER_VER_LEN
);
created
=
uint4korr
(
buf
+
ST_CREATED_OFFSET
+
LOG_EVENT_HEADER_LEN
);
created
=
uint4korr
(
buf
+
ST_CREATED_OFFSET
);
}
int
Start_log_event
::
write_data
(
IO_CACHE
*
file
)
...
...
@@ -675,13 +677,24 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len,
{
// the caller will ensure that event_len is what we have at
// EVENT_LEN_OFFSET
if
(
event_len
<
ROTATE_EVENT_OVERHEAD
)
int
header_size
=
(
old_format
)
?
OLD_HEADER_LEN
:
LOG_EVENT_HEADER_LEN
;
uint
ident_offset
;
if
(
event_len
<
header_size
)
return
;
pos
=
uint8korr
(
buf
+
R_POS_OFFSET
+
LOG_EVENT_HEADER_LEN
);
ident_len
=
(
uchar
)(
event_len
-
ROTATE_EVENT_OVERHEAD
);
if
(
!
(
new_log_ident
=
(
char
*
)
my_memdup
((
byte
*
)
buf
+
R_IDENT_OFFSET
+
LOG_EVENT_HEADER_LEN
,
buf
+=
header_size
;
if
(
old_format
)
{
ident_len
=
(
uchar
)(
event_len
-
OLD_HEADER_LEN
);
pos
=
4
;
ident_offset
=
0
;
}
else
{
ident_len
=
(
uchar
)(
event_len
-
ROTATE_EVENT_OVERHEAD
);
pos
=
uint8korr
(
buf
+
R_POS_OFFSET
);
ident_offset
=
ROTATE_HEADER_LEN
;
}
if
(
!
(
new_log_ident
=
(
char
*
)
my_memdup
((
byte
*
)
buf
+
ident_offset
,
(
uint
)
ident_len
,
MYF
(
MY_WME
))))
return
;
...
...
@@ -717,22 +730,32 @@ Query_log_event::Query_log_event(const char* buf, int event_len,
bool
old_format
)
:
Log_event
(
buf
,
old_format
),
data_buf
(
0
),
query
(
NULL
),
db
(
NULL
)
{
if
((
uint
)
event_len
<
QUERY_EVENT_OVERHEAD
)
return
;
ulong
data_len
;
data_len
=
event_len
-
QUERY_EVENT_OVERHEAD
;
if
(
old_format
)
{
if
((
uint
)
event_len
<
OLD_HEADER_LEN
+
QUERY_HEADER_LEN
)
return
;
data_len
=
event_len
-
(
QUERY_HEADER_LEN
+
OLD_HEADER_LEN
);
buf
+=
OLD_HEADER_LEN
;
}
else
{
if
((
uint
)
event_len
<
QUERY_EVENT_OVERHEAD
)
return
;
data_len
=
event_len
-
QUERY_EVENT_OVERHEAD
;
buf
+=
LOG_EVENT_HEADER_LEN
;
}
exec_time
=
uint4korr
(
buf
+
LOG_EVENT_HEADER_LEN
+
Q_EXEC_TIME_OFFSET
);
error_code
=
uint2korr
(
buf
+
LOG_EVENT_HEADER_LEN
+
Q_ERR_CODE_OFFSET
);
exec_time
=
uint4korr
(
buf
+
Q_EXEC_TIME_OFFSET
);
error_code
=
uint2korr
(
buf
+
Q_ERR_CODE_OFFSET
);
if
(
!
(
data_buf
=
(
char
*
)
my_malloc
(
data_len
+
1
,
MYF
(
MY_WME
))))
return
;
memcpy
(
data_buf
,
buf
+
LOG_EVENT_HEADER_LEN
+
Q_DATA_OFFSET
,
data_len
);
thread_id
=
uint4korr
(
buf
+
LOG_EVENT_HEADER_LEN
+
Q_THREAD_ID_OFFSET
);
memcpy
(
data_buf
,
buf
+
Q_DATA_OFFSET
,
data_len
);
thread_id
=
uint4korr
(
buf
+
Q_THREAD_ID_OFFSET
);
db
=
data_buf
;
db_len
=
(
uint
)
buf
[
LOG_EVENT_HEADER_LEN
+
Q_DB_LEN_OFFSET
];
db_len
=
(
uint
)
buf
[
Q_DB_LEN_OFFSET
];
query
=
data_buf
+
db_len
+
1
;
q_len
=
data_len
-
1
-
db_len
;
*
((
char
*
)
query
+
q_len
)
=
0
;
...
...
@@ -788,7 +811,7 @@ int Query_log_event::write_data(IO_CACHE* file)
Intvar_log_event
::
Intvar_log_event
(
const
char
*
buf
,
bool
old_format
)
:
Log_event
(
buf
,
old_format
)
{
buf
+=
LOG_EVENT_HEADER_LEN
;
buf
+=
(
old_format
)
?
OLD_HEADER_LEN
:
LOG_EVENT_HEADER_LEN
;
type
=
buf
[
I_TYPE_OFFSET
];
val
=
uint8korr
(
buf
+
I_VAL_OFFSET
);
}
...
...
@@ -1031,19 +1054,22 @@ Load_log_event::Load_log_event(const char* buf, int event_len,
{
if
(
!
event_len
)
// derived class, will call copy_log_event() itself
return
;
copy_log_event
(
buf
,
event_len
);
copy_log_event
(
buf
,
event_len
,
old_format
);
}
int
Load_log_event
::
copy_log_event
(
const
char
*
buf
,
ulong
event_len
)
int
Load_log_event
::
copy_log_event
(
const
char
*
buf
,
ulong
event_len
,
bool
old_format
)
{
uint
data_len
;
char
*
buf_end
=
(
char
*
)
buf
+
event_len
;
thread_id
=
uint4korr
(
buf
+
L_THREAD_ID_OFFSET
+
LOG_EVENT_HEADER_LEN
);
exec_time
=
uint4korr
(
buf
+
L_EXEC_TIME_OFFSET
+
LOG_EVENT_HEADER_LEN
);
skip_lines
=
uint4korr
(
buf
+
L_SKIP_LINES_OFFSET
+
LOG_EVENT_HEADER_LEN
);
table_name_len
=
(
uint
)
buf
[
L_TBL_LEN_OFFSET
+
LOG_EVENT_HEADER_LEN
];
db_len
=
(
uint
)
buf
[
L_DB_LEN_OFFSET
+
LOG_EVENT_HEADER_LEN
];
num_fields
=
uint4korr
(
buf
+
L_NUM_FIELDS_OFFSET
+
LOG_EVENT_HEADER_LEN
);
const
char
*
data_head
=
buf
+
((
old_format
)
?
OLD_HEADER_LEN
:
LOG_EVENT_HEADER_LEN
);
thread_id
=
uint4korr
(
data_head
+
L_THREAD_ID_OFFSET
);
exec_time
=
uint4korr
(
data_head
+
L_EXEC_TIME_OFFSET
);
skip_lines
=
uint4korr
(
data_head
+
L_SKIP_LINES_OFFSET
);
table_name_len
=
(
uint
)
data_head
[
L_TBL_LEN_OFFSET
];
db_len
=
(
uint
)
data_head
[
L_DB_LEN_OFFSET
];
num_fields
=
uint4korr
(
data_head
+
L_NUM_FIELDS_OFFSET
);
int
body_offset
=
get_data_body_offset
();
if
((
int
)
event_len
<
body_offset
)
...
...
@@ -1315,7 +1341,7 @@ Create_file_log_event::Create_file_log_event(const char* buf, int len):
Load_log_event
(
buf
,
0
,
0
),
fake_base
(
0
),
block
(
0
)
{
int
block_offset
;
if
(
copy_log_event
(
buf
,
len
))
if
(
copy_log_event
(
buf
,
len
,
0
))
return
;
file_id
=
uint4korr
(
buf
+
LOG_EVENT_HEADER_LEN
+
+
LOAD_HEADER_LEN
+
CF_FILE_ID_OFFSET
);
...
...
sql/log_event.h
View file @
ae686937
...
...
@@ -105,6 +105,7 @@ struct sql_ex_info
/* event-specific post-header sizes */
#define LOG_EVENT_HEADER_LEN 19
#define OLD_HEADER_LEN 13
#define QUERY_HEADER_LEN (4 + 4 + 1 + 2)
#define LOAD_HEADER_LEN (4 + 4 + 4 + 1 +1 + 4)
#define START_HEADER_LEN (2 + ST_SERVER_VER_LEN + 4)
...
...
@@ -378,7 +379,7 @@ public:
class
Load_log_event
:
public
Log_event
{
protected:
int
copy_log_event
(
const
char
*
buf
,
ulong
event_len
);
int
copy_log_event
(
const
char
*
buf
,
ulong
event_len
,
bool
old_format
);
public:
ulong
thread_id
;
...
...
sql/slave.cc
View file @
ae686937
...
...
@@ -393,6 +393,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
TABLE_LIST
tables
;
int
error
=
1
;
handler
*
file
;
uint
save_options
;
if
(
packet_len
==
packet_error
)
{
...
...
@@ -418,12 +419,17 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
thd
->
current_tablenr
=
0
;
thd
->
query_error
=
0
;
thd
->
net
.
no_send_ok
=
1
;
/* we do not want to log create table statement */
save_options
=
thd
->
options
;
thd
->
options
&=
~
OPTION_BIN_LOG
;
thd
->
proc_info
=
"Creating table from master dump"
;
// save old db in case we are creating in a different database
char
*
save_db
=
thd
->
db
;
thd
->
db
=
(
char
*
)
db
;
mysql_parse
(
thd
,
thd
->
query
,
packet_len
);
// run create table
thd
->
db
=
save_db
;
// leave things the way the were before
thd
->
options
=
save_options
;
if
(
thd
->
query_error
)
goto
err
;
// mysql_parse took care of the error send
...
...
@@ -1000,7 +1006,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
int
type_code
=
ev
->
get_type_code
();
int
exec_res
;
if
(
ev
->
server_id
==
::
server_id
||
(
slave_skip_counter
&&
ev
->
get_type_code
()
!=
ROTATE_EVENT
))
(
slave_skip_counter
&&
type_code
!=
ROTATE_EVENT
))
{
if
(
type_code
==
LOAD_EVENT
)
skip_load_data_infile
(
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