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
3b95f257
Commit
3b95f257
authored
Dec 15, 2001
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--replace_result in mysqltest can now use variables
parent
6ef31fd4
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
137 additions
and
84 deletions
+137
-84
client/mysqltest.c
client/mysqltest.c
+86
-58
mysql-test/r/rpl000014.result
mysql-test/r/rpl000014.result
+4
-4
mysql-test/r/rpl000015.result
mysql-test/r/rpl000015.result
+4
-4
mysql-test/r/rpl000016.result
mysql-test/r/rpl000016.result
+5
-5
mysql-test/r/rpl_log.result
mysql-test/r/rpl_log.result
+6
-6
mysql-test/t/join.test
mysql-test/t/join.test
+1
-1
mysql-test/t/rpl000014.test
mysql-test/t/rpl000014.test
+4
-1
mysql-test/t/rpl000015.test
mysql-test/t/rpl000015.test
+6
-1
mysql-test/t/rpl000016.test
mysql-test/t/rpl000016.test
+5
-1
mysql-test/t/rpl_log.test
mysql-test/t/rpl_log.test
+6
-3
readline/rltty.c
readline/rltty.c
+10
-0
No files found.
client/mysqltest.c
View file @
3b95f257
...
...
@@ -43,7 +43,7 @@
**********************************************************************/
#define MTEST_VERSION "1.1
2
"
#define MTEST_VERSION "1.1
3
"
#include <my_global.h>
#include <mysql_embed.h>
...
...
@@ -243,7 +243,8 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname);
void
reject_dump
(
const
char
*
record_file
,
char
*
buf
,
int
size
);
int
close_connection
(
struct
st_query
*
q
);
VAR
*
var_get
(
const
char
*
var_name
,
const
char
**
var_name_end
,
int
raw
);
VAR
*
var_get
(
const
char
*
var_name
,
const
char
**
var_name_end
,
my_bool
raw
,
my_bool
ignore_not_existing
);
int
eval_expr
(
VAR
*
v
,
const
char
*
p
,
const
char
**
p_end
);
static
int
read_server_arguments
(
const
char
*
name
);
...
...
@@ -261,6 +262,7 @@ struct st_replace *init_replace(my_string *from, my_string *to, uint count,
my_string
word_end_chars
);
uint
replace_strings
(
struct
st_replace
*
rep
,
my_string
*
start
,
uint
*
max_length
,
my_string
from
);
void
free_replace
();
static
int
insert_pointer_name
(
reg1
POINTER_ARRAY
*
pa
,
my_string
name
);
void
free_pointer_array
(
POINTER_ARRAY
*
pa
);
static
int
initialize_replace_buffer
(
void
);
...
...
@@ -314,7 +316,7 @@ static void do_eval(DYNAMIC_STRING* query_eval, const char* query)
}
else
{
if
(
!
(
v
=
var_get
(
p
,
&
p
,
0
)))
if
(
!
(
v
=
var_get
(
p
,
&
p
,
0
,
0
)))
die
(
"Bad variable in eval"
);
dynstr_append_mem
(
query_eval
,
v
->
str_val
,
v
->
str_val_len
);
}
...
...
@@ -545,40 +547,43 @@ static int check_result(DYNAMIC_STRING* ds, const char* fname,
return
error
;
}
VAR
*
var_get
(
const
char
*
var_name
,
const
char
**
var_name_end
,
int
raw
)
VAR
*
var_get
(
const
char
*
var_name
,
const
char
**
var_name_end
,
my_bool
raw
,
my_bool
ignore_not_existing
)
{
int
digit
;
VAR
*
v
;
if
(
*
var_name
++
!=
'$'
)
{
--
var_name
;
DBUG_ENTER
(
"var_get"
);
DBUG_PRINT
(
"enter"
,(
"var_name: %s"
,
var_name
));
if
(
*
var_name
!=
'$'
)
goto
err
;
}
digit
=
*
var_name
-
'0'
;
digit
=
*++
var_name
-
'0'
;
if
(
!
(
digit
<
10
&&
digit
>=
0
))
{
const
char
*
save_var_name
=
var_name
,
*
end
;
end
=
(
var_name_end
)
?
*
var_name_end
:
0
;
while
(
isvar
(
*
var_name
))
{
if
(
end
&&
var_name
==
end
)
break
;
while
(
isvar
(
*
var_name
)
&&
var_name
!=
end
)
++
var_name
;
}
if
(
var_name
==
save_var_name
)
if
(
var_name
==
save_var_name
)
{
if
(
ignore_not_existing
)
DBUG_RETURN
(
0
);
die
(
"Empty variable"
);
}
if
(
!
(
v
=
(
VAR
*
)
hash_search
(
&
var_hash
,
save_var_name
,
if
(
!
(
v
=
(
VAR
*
)
hash_search
(
&
var_hash
,
save_var_name
,
var_name
-
save_var_name
)))
{
if
(
end
)
*
(
char
*
)
end
=
0
;
die
(
"Variable '%s' used uninitialized"
,
save_var_name
);
}
--
var_name
;
{
if
(
ignore_not_existing
)
DBUG_RETURN
(
0
);
if
(
end
)
*
(
char
*
)
end
=
0
;
die
(
"Variable '%s' used uninitialized"
,
save_var_name
);
}
--
var_name
;
/* Point at last character */
}
else
v
=
var_reg
+
digit
;
v
=
var_reg
+
digit
;
if
(
!
raw
&&
v
->
int_dirty
)
{
...
...
@@ -586,14 +591,14 @@ VAR* var_get(const char* var_name, const char** var_name_end, int raw)
v
->
int_dirty
=
0
;
v
->
str_val_len
=
strlen
(
v
->
str_val
);
}
if
(
var_name_end
)
if
(
var_name_end
)
*
var_name_end
=
var_name
;
return
v
;
DBUG_RETURN
(
v
)
;
err:
if
(
var_name_end
)
*
var_name_end
=
0
;
die
(
"Unsupported variable name: %s"
,
var_name
);
return
0
;
DBUG_RETURN
(
0
)
;
}
static
VAR
*
var_obtain
(
char
*
name
,
int
len
)
...
...
@@ -747,24 +752,24 @@ void var_copy(VAR* dest, VAR* src)
dest
->
int_val
=
src
->
int_val
;
dest
->
int_dirty
=
src
->
int_dirty
;
if
(
dest
->
alloced_len
<
src
->
alloced_len
&&
!
(
dest
->
str_val
=
my_realloc
(
dest
->
str_val
,
src
->
alloced_len
,
!
(
dest
->
str_val
=
my_realloc
(
dest
->
str_val
,
src
->
alloced_len
+
1
,
MYF
(
MY_WME
))))
die
(
"Out of memory"
);
dest
->
str_val_len
=
src
->
str_val_len
;
memcpy
(
dest
->
str_val
,
src
->
str_val
,
src
->
str_val_len
);
memcpy
(
dest
->
str_val
,
src
->
str_val
,
src
->
str_val_len
+
1
);
}
int
eval_expr
(
VAR
*
v
,
const
char
*
p
,
const
char
**
p_end
)
{
VAR
*
vp
;
if
(
*
p
==
'$'
)
{
if
((
vp
=
var_get
(
p
,
p_end
,
0
,
0
)))
{
if
((
vp
=
var_get
(
p
,
p_end
,
0
)))
{
var_copy
(
v
,
vp
);
return
0
;
}
var_copy
(
v
,
vp
);
return
0
;
}
}
else
if
(
*
p
==
'`'
)
{
return
var_query_set
(
v
,
p
,
p_end
);
...
...
@@ -778,9 +783,9 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
v
->
alloced_len
=
(
new_val_len
<
MIN_VAR_ALLOC
-
1
)
?
MIN_VAR_ALLOC
:
new_val_len
+
1
;
if
(
!
(
v
->
str_val
=
v
->
str_val
?
my_realloc
(
v
->
str_val
,
v
->
alloced_len
,
v
->
str_val
?
my_realloc
(
v
->
str_val
,
v
->
alloced_len
+
1
,
MYF
(
MY_WME
))
:
my_malloc
(
v
->
alloced_len
,
MYF
(
MY_WME
))))
my_malloc
(
v
->
alloced_len
+
1
,
MYF
(
MY_WME
))))
die
(
"Out of memory"
);
}
v
->
str_val_len
=
new_val_len
;
...
...
@@ -801,7 +806,7 @@ int do_inc(struct st_query* q)
{
char
*
p
=
q
->
first_argument
;
VAR
*
v
;
v
=
var_get
(
p
,
0
,
1
);
v
=
var_get
(
p
,
0
,
1
,
0
);
v
->
int_val
++
;
v
->
int_dirty
=
1
;
return
0
;
...
...
@@ -811,7 +816,7 @@ int do_dec(struct st_query* q)
{
char
*
p
=
q
->
first_argument
;
VAR
*
v
;
v
=
var_get
(
p
,
0
,
1
);
v
=
var_get
(
p
,
0
,
1
,
0
);
v
->
int_val
--
;
v
->
int_dirty
=
1
;
return
0
;
...
...
@@ -1042,14 +1047,16 @@ static uint get_ints(uint *to,struct st_query* q)
/*
Get a string; Return ptr to end of string
Strings may be surrounded by " or '
If string is a '$variable', return the value of the variable.
*/
static
void
get_string
(
char
**
to_ptr
,
char
**
from_ptr
,
struct
st_query
*
q
)
static
char
*
get_string
(
char
**
to_ptr
,
char
**
from_ptr
,
struct
st_query
*
q
)
{
reg1
char
c
,
sep
;
char
*
to
=
*
to_ptr
,
*
from
=
*
from_ptr
;
char
*
to
=
*
to_ptr
,
*
from
=
*
from_ptr
,
*
start
=
to
;
DBUG_ENTER
(
"get_string"
);
/* Find separator */
...
...
@@ -1099,9 +1106,22 @@ static void get_string(char **to_ptr, char **from_ptr,
while
(
isspace
(
*
from
))
/* Point to next string */
from
++
;
*
to
++
=
0
;
/* End of string marker */
*
to_ptr
=
to
;
*
to
=
0
;
/* End of string marker */
*
to_ptr
=
to
+
1
;
/* Store pointer to end */
*
from_ptr
=
from
;
/* Check if this was a variable */
if
(
*
start
==
'$'
)
{
const
char
*
end
=
to
;
VAR
*
var
=
var_get
(
start
,
&
end
,
0
,
1
);
if
(
var
&&
to
==
(
char
*
)
end
+
1
)
{
DBUG_PRINT
(
"info"
,(
"var: %s -> %s"
,
start
,
var
->
str_val
));
DBUG_RETURN
(
var
->
str_val
);
/* return found variable value */
}
}
DBUG_RETURN
(
start
);
}
...
...
@@ -1109,6 +1129,8 @@ static void get_string(char **to_ptr, char **from_ptr,
Get arguments for replace. The syntax is:
replace from to [from to ...]
Where each argument may be quoted with ' or "
A argument may also be a variable, in which case the value of the
variable is replaced.
*/
static
void
get_replace
(
struct
st_query
*
q
)
...
...
@@ -1120,6 +1142,9 @@ static void get_replace(struct st_query *q)
POINTER_ARRAY
to_array
,
from_array
;
DBUG_ENTER
(
"get_replace"
);
if
(
glob_replace
)
free_replace
();
bzero
((
char
*
)
&
to_array
,
sizeof
(
to_array
));
bzero
((
char
*
)
&
from_array
,
sizeof
(
from_array
));
if
(
!*
from
)
...
...
@@ -1128,12 +1153,11 @@ static void get_replace(struct st_query *q)
while
(
*
from
)
{
char
*
to
=
buff
;
get_string
(
&
buff
,
&
from
,
q
);
to
=
get_string
(
&
buff
,
&
from
,
q
);
if
(
!*
from
)
die
(
"Wrong number of arguments to replace in %s
\n
"
,
q
->
query
);
insert_pointer_name
(
&
from_array
,
to
);
to
=
buff
;
get_string
(
&
buff
,
&
from
,
q
);
to
=
get_string
(
&
buff
,
&
from
,
q
);
insert_pointer_name
(
&
to_array
,
to
);
}
for
(
i
=
1
,
pos
=
word_end_chars
;
i
<
256
;
i
++
)
...
...
@@ -1149,6 +1173,7 @@ static void get_replace(struct st_query *q)
free_pointer_array
(
&
from_array
);
free_pointer_array
(
&
to_array
);
my_free
(
start
,
MYF
(
0
));
DBUG_VOID_RETURN
;
}
void
free_replace
()
...
...
@@ -1310,7 +1335,7 @@ int do_connect(struct st_query* q)
p
=
safe_get_param
(
p
,
&
con_port_str
,
"missing connection port"
);
if
(
*
con_port_str
==
'$'
)
{
if
(
!
(
var_port
=
var_get
(
con_port_str
,
0
,
0
)))
if
(
!
(
var_port
=
var_get
(
con_port_str
,
0
,
0
,
0
)))
die
(
"Unknown variable '%s'"
,
con_port_str
+
1
);
con_port
=
var_port
->
int_val
;
}
...
...
@@ -1319,7 +1344,7 @@ int do_connect(struct st_query* q)
p
=
safe_get_param
(
p
,
&
con_sock
,
"missing connection socket"
);
if
(
*
con_sock
==
'$'
)
{
if
(
!
(
var_sock
=
var_get
(
con_sock
,
0
,
0
)))
if
(
!
(
var_sock
=
var_get
(
con_sock
,
0
,
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"
);
...
...
@@ -1993,7 +2018,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
mysql_errno
(
mysql
),
errno
);
if
((
flags
&
QUERY_SEND
)
&&
!
disable_query_log
)
{
dynstr_append_mem
(
ds
,
query
,
query_len
);
replace_dynstr_append_mem
(
ds
,
query
,
query_len
);
dynstr_append_mem
(
ds
,
";
\n
"
,
2
);
}
if
(
!
(
flags
&
QUERY_REAP
))
...
...
@@ -2163,24 +2188,27 @@ static VAR* var_init(VAR* v, const char* name, int name_len, const char* val,
{
int
val_alloc_len
;
VAR
*
tmp_var
;
if
(
!
name_len
&&
name
)
if
(
!
name_len
&&
name
)
name_len
=
strlen
(
name
);
if
(
!
val_len
&&
val
)
if
(
!
val_len
&&
val
)
val_len
=
strlen
(
val
)
;
val_alloc_len
=
val_len
+
16
;
/* room to grow */
if
(
!
(
tmp_var
=
v
)
&&
!
(
tmp_var
=
(
VAR
*
)
my_malloc
(
sizeof
(
*
tmp_var
)
+
name_len
,
MYF
(
MY_WME
))))
if
(
!
(
tmp_var
=
v
)
&&
!
(
tmp_var
=
(
VAR
*
)
my_malloc
(
sizeof
(
*
tmp_var
)
+
name_len
,
MYF
(
MY_WME
))))
die
(
"Out of memory"
);
tmp_var
->
name
=
(
name
)
?
(
char
*
)
tmp_var
+
sizeof
(
*
tmp_var
)
:
0
;
tmp_var
->
name
=
(
name
)
?
(
char
*
)
tmp_var
+
sizeof
(
*
tmp_var
)
:
0
;
tmp_var
->
alloced
=
(
v
==
0
);
if
(
!
(
tmp_var
->
str_val
=
my_malloc
(
val_alloc_len
,
MYF
(
MY_WME
))))
if
(
!
(
tmp_var
->
str_val
=
my_malloc
(
val_alloc_len
+
1
,
MYF
(
MY_WME
))))
die
(
"Out of memory"
);
memcpy
(
tmp_var
->
name
,
name
,
name_len
);
if
(
val
)
memcpy
(
tmp_var
->
str_val
,
val
,
val_len
+
1
);
if
(
val
)
{
memcpy
(
tmp_var
->
str_val
,
val
,
val_len
);
tmp_var
->
str_val
[
val_len
]
=
0
;
}
tmp_var
->
name_len
=
name_len
;
tmp_var
->
str_val_len
=
val_len
;
tmp_var
->
alloced_len
=
val_alloc_len
;
...
...
@@ -2201,7 +2229,7 @@ static void var_from_env(const char* name, const char* def_val)
{
const
char
*
tmp
;
VAR
*
v
;
if
(
!
(
tmp
=
getenv
(
name
)))
if
(
!
(
tmp
=
getenv
(
name
)))
tmp
=
def_val
;
v
=
var_init
(
0
,
name
,
0
,
tmp
,
0
);
...
...
@@ -2407,7 +2435,7 @@ int main(int argc, char** argv)
dynstr_free
(
&
ds_res
);
if
(
!
silent
)
{
if
(
error
)
if
(
error
)
printf
(
"not ok
\n
"
);
else
printf
(
"ok
\n
"
);
...
...
mysql-test/r/rpl000014.result
View file @
3b95f257
...
...
@@ -8,21 +8,21 @@ File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root
$MASTER_MY
PORT 1 master-bin.001 79 Yes 0 0 1
127.0.0.1 root
MASTER_
PORT 1 master-bin.001 79 Yes 0 0 1
change master to master_log_pos=73;
slave stop;
change master to master_log_pos=73;
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root
$MASTER_MY
PORT 1 master-bin.001 73 No 0 0 1
127.0.0.1 root
MASTER_
PORT 1 master-bin.001 73 No 0 0 1
slave start;
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root
$MASTER_MY
PORT 1 master-bin.001 73 Yes 0 0 1
127.0.0.1 root
MASTER_
PORT 1 master-bin.001 73 Yes 0 0 1
change master to master_log_pos=173;
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root
$MASTER_MY
PORT 1 master-bin.001 173 Yes 0 0 1
127.0.0.1 root
MASTER_
PORT 1 master-bin.001 173 Yes 0 0 1
show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79
...
...
mysql-test/r/rpl000015.result
View file @
3b95f257
...
...
@@ -9,16 +9,16 @@ Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Rep
change master to master_host='127.0.0.1';
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 test
3306
60 4 No 0 0 0
127.0.0.1 test
MASTER_PORT
60 4 No 0 0 0
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=
9306
;
master_password='',master_port=
MASTER_PORT
;
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root
9306
60 4 No 0 0 0
127.0.0.1 root
MASTER_PORT
60 4 No 0 0 0
slave start;
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root
9306
60 master-bin.001 79 Yes 0 0 1
127.0.0.1 root
MASTER_PORT
60 master-bin.001 79 Yes 0 0 1
drop table if exists t1;
create table t1 (n int);
insert into t1 values (10),(45),(90);
...
...
mysql-test/r/rpl000016.result
View file @
3b95f257
...
...
@@ -2,11 +2,11 @@ slave start;
Could not initialize master info structure, check permisions on master.info
slave start;
Could not initialize master info structure, check permisions on master.info
change master to master_host='127.0.0.1',master_port=
9306
,
change master to master_host='127.0.0.1',master_port=
MASTER_PORT
,
master_user='root';
Could not initialize master info
reset slave;
change master to master_host='127.0.0.1',master_port=
9306
,
change master to master_host='127.0.0.1',master_port=
MASTER_PORT
,
master_user='root';
reset master;
slave start;
...
...
@@ -15,7 +15,7 @@ create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root
9306
60 master-bin.001 234 Yes 0 0 3
127.0.0.1 root
MASTER_PORT
60 master-bin.001 234 Yes 0 0 3
select * from t1;
s
Could not break slave
...
...
@@ -43,7 +43,7 @@ master-bin.003
insert into t2 values (65);
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root
9306
60 master-bin.003 155 Yes 0 0 3
127.0.0.1 root
MASTER_PORT
60 master-bin.003 155 Yes 0 0 3
select * from t2;
m
34
...
...
@@ -66,7 +66,7 @@ slave stop;
slave start;
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root
9306
60 master-bin.006 445 Yes 0 0 7
127.0.0.1 root
MASTER_PORT
60 master-bin.006 445 Yes 0 0 7
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
...
...
mysql-test/r/rpl_log.result
View file @
3b95f257
...
...
@@ -16,7 +16,7 @@ load data infile '../../std_data/words.dat' into table t1;
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id Log_seq Info
master-bin.001 4 Start 1 1 Server ver:
$
VERSION, Binlog ver: 2
master-bin.001 4 Start 1 1 Server ver: VERSION, Binlog ver: 2
master-bin.001 79 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
master-bin.001 172 Intvar 1 3 INSERT_ID=1
master-bin.001 200 Query 1 4 use test; insert into t1 values (NULL)
...
...
@@ -41,7 +41,7 @@ insert into t1 values (1);
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id Log_seq Info
master-bin.001 4 Start 1 1 Server ver:
$
VERSION, Binlog ver: 2
master-bin.001 4 Start 1 1 Server ver: VERSION, Binlog ver: 2
master-bin.001 79 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
master-bin.001 172 Intvar 1 3 INSERT_ID=1
master-bin.001 200 Query 1 4 use test; insert into t1 values (NULL)
...
...
@@ -68,8 +68,8 @@ slave-bin.001
slave-bin.002
show binlog events in 'slave-bin.001' from 4;
Log_name Pos Event_type Server_id Log_seq Info
slave-bin.001 4 Start 2 1 Server ver:
$
VERSION, Binlog ver: 2
slave-bin.001 79 Slave 2 3 host=127.0.0.1,port=
$MASTER_MY
PORT,log=master-bin.001,pos=4
slave-bin.001 4 Start 2 1 Server ver: VERSION, Binlog ver: 2
slave-bin.001 79 Slave 2 3 host=127.0.0.1,port=
MASTER_
PORT,log=master-bin.001,pos=4
slave-bin.001 132 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
slave-bin.001 225 Intvar 1 3 INSERT_ID=1
slave-bin.001 253 Query 1 4 use test; insert into t1 values (NULL)
...
...
@@ -82,13 +82,13 @@ slave-bin.001 689 Rotate 1 4 slave-bin.002;pos=4; forced by master
slave-bin.001 729 Stop 2 5
show binlog events in 'slave-bin.002' from 4;
Log_name Pos Event_type Server_id Log_seq Info
slave-bin.002 4 Slave 2 10 host=127.0.0.1,port=
$MASTER_MY
PORT,log=master-bin.002,pos=4
slave-bin.002 4 Slave 2 10 host=127.0.0.1,port=
MASTER_
PORT,log=master-bin.002,pos=4
slave-bin.002 57 Query 1 1 use test; create table t1 (n int)
slave-bin.002 115 Query 1 2 use test; insert into t1 values (1)
slave-bin.002 175 Query 1 3 use test; drop table t1
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root
$MASTER_MY
PORT 1 master-bin.002 170 Yes 0 0 3
127.0.0.1 root
MASTER_
PORT 1 master-bin.002 170 Yes 0 0 3
show new master for slave with master_log_file='master-bin.001' and
master_log_pos=4 and master_log_seq=1 and master_server_id=1;
Log_name Log_pos
...
...
mysql-test/t/join.test
View file @
3b95f257
...
...
@@ -85,7 +85,7 @@ drop table t1, t2;
create
table
t1
(
a
int
primary
key
);
insert
into
t1
values
(
1
),(
2
);
select
t1
.
a
from
t1
as
t1
left
join
t1
as
t2
using
(
a
)
left
join
t1
as
t3
using
(
a
)
left
join
t1
as
t4
using
(
a
)
left
join
t1
as
t5
using
(
a
)
left
join
t1
as
t6
using
(
a
)
left
join
t1
as
t7
using
(
a
)
left
join
t1
as
t8
using
(
a
)
left
join
t1
as
t9
using
(
a
)
left
join
t1
as
t10
using
(
a
)
left
join
t1
as
t11
using
(
a
)
left
join
t1
as
t12
using
(
a
)
left
join
t1
as
t13
using
(
a
)
left
join
t1
as
t14
using
(
a
)
left
join
t1
as
t15
using
(
a
)
left
join
t1
as
t16
using
(
a
)
left
join
t1
as
t17
using
(
a
)
left
join
t1
as
t18
using
(
a
)
left
join
t1
as
t19
using
(
a
)
left
join
t1
as
t20
using
(
a
)
left
join
t1
as
t21
using
(
a
)
left
join
t1
as
t22
using
(
a
)
left
join
t1
as
t23
using
(
a
)
left
join
t1
as
t24
using
(
a
)
left
join
t1
as
t25
using
(
a
)
left
join
t1
as
t26
using
(
a
)
left
join
t1
as
t27
using
(
a
)
left
join
t1
as
t28
using
(
a
)
left
join
t1
as
t29
using
(
a
)
left
join
t1
as
t30
using
(
a
)
left
join
t1
as
t31
using
(
a
);
--
replace_result
31
XX
63
XX
--
replace_result
"31 tables"
"XX tables"
"63 tables"
"XX tables"
--
error
1116
select
t1
.
a
from
t1
as
t1
left
join
t1
as
t2
using
(
a
)
left
join
t1
as
t3
using
(
a
)
left
join
t1
as
t4
using
(
a
)
left
join
t1
as
t5
using
(
a
)
left
join
t1
as
t6
using
(
a
)
left
join
t1
as
t7
using
(
a
)
left
join
t1
as
t8
using
(
a
)
left
join
t1
as
t9
using
(
a
)
left
join
t1
as
t10
using
(
a
)
left
join
t1
as
t11
using
(
a
)
left
join
t1
as
t12
using
(
a
)
left
join
t1
as
t13
using
(
a
)
left
join
t1
as
t14
using
(
a
)
left
join
t1
as
t15
using
(
a
)
left
join
t1
as
t16
using
(
a
)
left
join
t1
as
t17
using
(
a
)
left
join
t1
as
t18
using
(
a
)
left
join
t1
as
t19
using
(
a
)
left
join
t1
as
t20
using
(
a
)
left
join
t1
as
t21
using
(
a
)
left
join
t1
as
t22
using
(
a
)
left
join
t1
as
t23
using
(
a
)
left
join
t1
as
t24
using
(
a
)
left
join
t1
as
t25
using
(
a
)
left
join
t1
as
t26
using
(
a
)
left
join
t1
as
t27
using
(
a
)
left
join
t1
as
t28
using
(
a
)
left
join
t1
as
t29
using
(
a
)
left
join
t1
as
t30
using
(
a
)
left
join
t1
as
t31
using
(
a
)
left
join
t1
as
t32
using
(
a
)
left
join
t1
as
t33
using
(
a
)
left
join
t1
as
t34
using
(
a
)
left
join
t1
as
t35
using
(
a
)
left
join
t1
as
t36
using
(
a
)
left
join
t1
as
t37
using
(
a
)
left
join
t1
as
t38
using
(
a
)
left
join
t1
as
t39
using
(
a
)
left
join
t1
as
t40
using
(
a
)
left
join
t1
as
t41
using
(
a
)
left
join
t1
as
t42
using
(
a
)
left
join
t1
as
t43
using
(
a
)
left
join
t1
as
t44
using
(
a
)
left
join
t1
as
t45
using
(
a
)
left
join
t1
as
t46
using
(
a
)
left
join
t1
as
t47
using
(
a
)
left
join
t1
as
t48
using
(
a
)
left
join
t1
as
t49
using
(
a
)
left
join
t1
as
t50
using
(
a
)
left
join
t1
as
t51
using
(
a
)
left
join
t1
as
t52
using
(
a
)
left
join
t1
as
t53
using
(
a
)
left
join
t1
as
t54
using
(
a
)
left
join
t1
as
t55
using
(
a
)
left
join
t1
as
t56
using
(
a
)
left
join
t1
as
t57
using
(
a
)
left
join
t1
as
t58
using
(
a
)
left
join
t1
as
t59
using
(
a
)
left
join
t1
as
t60
using
(
a
)
left
join
t1
as
t61
using
(
a
)
left
join
t1
as
t62
using
(
a
)
left
join
t1
as
t63
using
(
a
)
left
join
t1
as
t64
using
(
a
)
left
join
t1
as
t65
using
(
a
);
drop
table
t1
;
...
...
mysql-test/t/rpl000014.test
View file @
3b95f257
eval_result
;
source
include
/
master
-
slave
.
inc
;
connection
master
;
show
master
status
;
save_master_pos
;
connection
slave
;
sync_with_master
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
show
slave
status
;
change
master
to
master_log_pos
=
73
;
slave
stop
;
change
master
to
master_log_pos
=
73
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
show
slave
status
;
slave
start
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
show
slave
status
;
change
master
to
master_log_pos
=
173
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
show
slave
status
;
connection
master
;
show
master
status
;
...
...
mysql-test/t/rpl000015.test
View file @
3b95f257
connect
(
master
,
localhost
,
root
,,
test
,
0
,
master
.
sock
);
connect
(
slave
,
localhost
,
root
,,
test
,
0
,
slave
.
sock
);
eval_result
;
connection
master
;
reset
master
;
show
master
status
;
save_master_pos
;
connection
slave
;
reset
slave
;
--
replace_result
$MASTER_MYPORT
MASTER_PORT
show
slave
status
;
change
master
to
master_host
=
'127.0.0.1'
;
# The following needs to be cleaned up when change master is fixed
--
replace_result
$MASTER_MYPORT
MASTER_PORT
3306
MASTER_PORT
3334
MASTER_PORT
show
slave
status
;
--
replace_result
$MASTER_MYPORT
MASTER_PORT
eval
change
master
to
master_host
=
'127.0.0.1'
,
master_user
=
'root'
,
master_password
=
''
,
master_port
=
$MASTER_MYPORT
;
--
replace_result
$MASTER_MYPORT
MASTER_PORT
show
slave
status
;
slave
start
;
sync_with_master
;
--
replace_result
$MASTER_MYPORT
MASTER_PORT
show
slave
status
;
connection
master
;
drop
table
if
exists
t1
;
...
...
mysql-test/t/rpl000016.test
View file @
3b95f257
connect
(
master
,
localhost
,
root
,,
test
,
0
,
master
.
sock
);
connect
(
slave
,
localhost
,
root
,,
test
,
0
,
slave
.
sock
);
eval_result
;
system
cat
/
dev
/
null
>
var
/
slave
-
data
/
master
.
info
;
system
chmod
000
var
/
slave
-
data
/
master
.
info
;
connection
slave
;
!
slave
start
;
system
chmod
600
var
/
slave
-
data
/
master
.
info
;
!
slave
start
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
!
eval
change
master
to
master_host
=
'127.0.0.1'
,
master_port
=
$MASTER_MYPORT
,
master_user
=
'root'
;
reset
slave
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
eval
change
master
to
master_host
=
'127.0.0.1'
,
master_port
=
$MASTER_MYPORT
,
master_user
=
'root'
;
connection
master
;
...
...
@@ -23,6 +24,7 @@ insert into t1 values('Could not break slave'),('Tried hard');
save_master_pos
;
connection
slave
;
sync_with_master
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
show
slave
status
;
select
*
from
t1
;
connection
master
;
...
...
@@ -70,6 +72,7 @@ insert into t2 values (65);
save_master_pos
;
connection
slave
;
sync_with_master
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
show
slave
status
;
select
*
from
t2
;
connection
master
;
...
...
@@ -91,6 +94,7 @@ connection slave;
slave
stop
;
slave
start
;
sync_with_master
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
show
slave
status
;
# because of concurrent insert, the table may not be up to date
# if we do not lock
...
...
mysql-test/t/rpl_log.test
View file @
3b95f257
source
include
/
master
-
slave
.
inc
;
eval_result
;
#result depends on some server specific params
#clean up slave binlogs
connection
slave
;
slave
stop
;
reset
master
;
reset
slave
;
let
$VERSION
=
`select version()`
;
connection
master
;
reset
master
;
...
...
@@ -16,6 +16,7 @@ drop table t1;
create
table
t1
(
word
char
(
20
)
not
null
);
load
data
infile
'../../std_data/words.dat'
into
table
t1
;
drop
table
t1
;
--
replace_result
$VERSION
VERSION
show
binlog
events
;
show
binlog
events
from
79
limit
1
;
show
binlog
events
from
79
limit
2
;
...
...
@@ -24,17 +25,20 @@ flush logs;
create
table
t1
(
n
int
);
insert
into
t1
values
(
1
);
drop
table
t1
;
--
replace_result
$VERSION
VERSION
show
binlog
events
;
show
binlog
events
in
'master-bin.002'
;
show
master
logs
;
save_master_pos
;
connection
slave
;
let
$VERSION
=
`select version()`
;
slave
start
;
sync_with_master
;
show
master
logs
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
$VERSION
VERSION
show
binlog
events
in
'slave-bin.001'
from
4
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
$VERSION
VERSION
show
binlog
events
in
'slave-bin.002'
from
4
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
show
slave
status
;
show
new
master
for
slave
with
master_log_file
=
'master-bin.001'
and
master_log_pos
=
4
and
master_log_seq
=
1
and
master_server_id
=
1
;
...
...
@@ -46,4 +50,3 @@ show new master for slave with master_log_file='master-bin.002' and
master_log_pos
=
4
and
master_log_seq
=
1
and
master_server_id
=
1
;
show
new
master
for
slave
with
master_log_file
=
'master-bin.002'
and
master_log_pos
=
137
and
master_log_seq
=
3
and
master_server_id
=
1
;
readline/rltty.c
View file @
3b95f257
...
...
@@ -368,6 +368,16 @@ static TIOTYPE otio;
# define OUTPUT_BEING_FLUSHED(tp) 0
#endif
#if defined (_AIX) || (defined (FLUSHO) && defined (_AIX41))
static
void
rltty_warning
(
msg
)
char
*
msg
;
{
fprintf
(
stderr
,
"readline: warning: %s
\n
"
,
msg
);
}
#endif
#if defined (_AIX)
void
setopost
(
tp
)
...
...
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