Commit c6979413 authored by ingo@mysql.com's avatar ingo@mysql.com

Enabled mysqltest for MASTER_PORT replacement.

Replaced fixed port numbers by MASTER_PORT replacement.
This allows for a set of ports per tree and hence
parallel testing on multiple trees.
parent ca351277
......@@ -11,6 +11,7 @@ greg@mysql.com
guilhem@mysql.com
heikki@donna.mysql.fi
heikki@hundin.mysql.fi
ingo@mysql.com
jani@hynda.mysql.fi
jorge@linux.jorge.mysql.com
konstantin@mysql.com
......
......@@ -220,7 +220,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, int raw,
my_bool ignore_not_existing);
int eval_expr(VAR* v, const char* p, const char** p_end);
/* Definitions for replace */
......@@ -277,7 +278,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);
}
......@@ -486,7 +487,8 @@ 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, int raw,
my_bool ignore_not_existing)
{
int digit;
VAR* v;
......@@ -507,7 +509,11 @@ VAR* var_get(const char* var_name, const char** var_name_end, int raw)
++var_name;
}
if(var_name == save_var_name)
{
if (ignore_not_existing)
return 0;
die("Empty variable");
}
if(!(v = (VAR*)hash_search(&var_hash, save_var_name,
var_name - save_var_name)))
......@@ -629,7 +635,7 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
VAR* vp;
if (*p == '$')
{
if ((vp = var_get(p,p_end,0)))
if ((vp = var_get(p,p_end,0, 0)))
{
memcpy(v, vp, sizeof(*v));
return 0;
......@@ -671,7 +677,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;
......@@ -681,7 +687,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;
......@@ -909,14 +915,16 @@ static void 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 */
......@@ -969,6 +977,19 @@ static void get_string(char **to_ptr, char **from_ptr,
*to++ =0; /* End of string marker */
*to_ptr= to;
*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",("get_string: '%s' -> '%s'", start, var->str_val));
DBUG_RETURN(var->str_val); /* return found variable value */
}
}
DBUG_RETURN(start);
}
......@@ -994,13 +1015,12 @@ static void get_replace(struct st_query *q)
start=buff=my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE));
while (*from)
{
char *to=buff;
get_string(&buff, &from, q);
char *to;
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++)
......
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73
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
127.0.0.1 root 9999 1 master-bin.001 73 Yes 0 0
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 Yes 0 0
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
127.0.0.1 root 9999 1 master-bin.001 73 No 0 0
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 No 0 0
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
127.0.0.1 root 9999 1 master-bin.001 73 Yes 0 0
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 Yes 0 0
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
127.0.0.1 root 9999 1 master-bin.001 173 Yes 0 0
127.0.0.1 root MASTER_PORT 1 master-bin.001 173 Yes 0 0
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73
n
......
......@@ -3,11 +3,11 @@ master-bin.001 73
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
0 0 0 No 0 0
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
127.0.0.1 test 9998 60 4 No 0 0
127.0.0.1 test MASTER_PORT 60 4 No 0 0
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
127.0.0.1 root 9999 60 4 No 0 0
127.0.0.1 root MASTER_PORT 60 4 No 0 0
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
127.0.0.1 root 9999 60 master-bin.001 73 Yes 0 0
127.0.0.1 root MASTER_PORT 60 master-bin.001 73 Yes 0 0
n
10
45
......
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
127.0.0.1 root 9999 60 master-bin.001 387 Yes 0 0
127.0.0.1 root MASTER_PORT 60 master-bin.001 387 Yes 0 0
s
Could not break slave
Tried hard
......@@ -12,7 +12,7 @@ testing temporary tables
Log_name
master-bin.003
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
127.0.0.1 root 9999 60 master-bin.003 329 Yes 0 0
127.0.0.1 root MASTER_PORT 60 master-bin.003 329 Yes 0 0
m
34
65
......@@ -29,6 +29,6 @@ master-bin.006 490
a
testing temporary tables part 2
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
127.0.0.1 root 9999 60 master-bin.006 490 Yes 0 0
127.0.0.1 root MASTER_PORT 60 master-bin.006 490 Yes 0 0
count(*)
100
......@@ -61,7 +61,7 @@ sleep 2;
# The following test can't be done because the result of Pos will differ
# on different computers
# --replace_result 9306 9999 3334 9999 3335 9999
# --replace_result $MASTER_MYPORT MASTER_PORT
# show slave status;
set sql_slave_skip_counter=1;
......
......@@ -4,18 +4,18 @@ show master status;
save_master_pos;
connection slave;
sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
change master to master_log_pos=73;
slave stop;
change master to master_log_pos=73;
--replace_result 9306 9999 3334 9999 3335 9999
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
slave start;
--replace_result 9306 9999 3334 9999 3335 9999
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
change master to master_log_pos=173;
--replace_result 9306 9999 3334 9999 3335 9999
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
connection master;
show master status;
......
......@@ -8,15 +8,15 @@ connection slave;
reset slave;
show slave status;
change master to master_host='127.0.0.1';
--replace_result 3306 9998 9306 9999 3334 9999 3335 9999
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT
show slave status;
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
--replace_result 9306 9999 3334 9999 3335 9999
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
slave start;
sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
connection master;
drop table if exists t1;
......
......@@ -40,7 +40,7 @@ insert into t1 values('Could not break slave'),('Tried hard');
save_master_pos;
connection slave;
sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
select * from t1;
connection master;
......@@ -96,7 +96,7 @@ insert into t2 values (65);
save_master_pos;
connection slave;
sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
select * from t2;
......@@ -126,7 +126,7 @@ connection slave;
sync_with_master;
select * from t4;
--replace_result 9306 9999 3334 9999 3335 9999
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
# because of concurrent insert, the table may not be up to date
# if we do not lock
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment