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 ...@@ -11,6 +11,7 @@ greg@mysql.com
guilhem@mysql.com guilhem@mysql.com
heikki@donna.mysql.fi heikki@donna.mysql.fi
heikki@hundin.mysql.fi heikki@hundin.mysql.fi
ingo@mysql.com
jani@hynda.mysql.fi jani@hynda.mysql.fi
jorge@linux.jorge.mysql.com jorge@linux.jorge.mysql.com
konstantin@mysql.com konstantin@mysql.com
......
...@@ -220,7 +220,8 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char* fname); ...@@ -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); void reject_dump(const char* record_file, char* buf, int size);
int close_connection(struct st_query* q); 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); int eval_expr(VAR* v, const char* p, const char** p_end);
/* Definitions for replace */ /* Definitions for replace */
...@@ -277,7 +278,7 @@ static void do_eval(DYNAMIC_STRING* query_eval, const char* query) ...@@ -277,7 +278,7 @@ static void do_eval(DYNAMIC_STRING* query_eval, const char* query)
} }
else else
{ {
if(!(v = var_get(p, &p, 0))) if(!(v = var_get(p, &p, 0, 0)))
die("Bad variable in eval"); die("Bad variable in eval");
dynstr_append_mem(query_eval, v->str_val, v->str_val_len); 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, ...@@ -486,7 +487,8 @@ static int check_result(DYNAMIC_STRING* ds, const char* fname,
return error; 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; int digit;
VAR* v; VAR* v;
...@@ -507,7 +509,11 @@ VAR* var_get(const char* var_name, const char** var_name_end, int raw) ...@@ -507,7 +509,11 @@ VAR* var_get(const char* var_name, const char** var_name_end, int raw)
++var_name; ++var_name;
} }
if(var_name == save_var_name) if(var_name == save_var_name)
{
if (ignore_not_existing)
return 0;
die("Empty variable"); 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))) var_name - save_var_name)))
...@@ -629,7 +635,7 @@ int eval_expr(VAR* v, const char* p, const char** p_end) ...@@ -629,7 +635,7 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
VAR* vp; VAR* vp;
if (*p == '$') if (*p == '$')
{ {
if ((vp = var_get(p,p_end,0))) if ((vp = var_get(p,p_end,0, 0)))
{ {
memcpy(v, vp, sizeof(*v)); memcpy(v, vp, sizeof(*v));
return 0; return 0;
...@@ -671,7 +677,7 @@ int do_inc(struct st_query* q) ...@@ -671,7 +677,7 @@ int do_inc(struct st_query* q)
{ {
char* p=q->first_argument; char* p=q->first_argument;
VAR* v; VAR* v;
v = var_get(p, 0, 1); v = var_get(p, 0, 1, 0);
v->int_val++; v->int_val++;
v->int_dirty = 1; v->int_dirty = 1;
return 0; return 0;
...@@ -681,7 +687,7 @@ int do_dec(struct st_query* q) ...@@ -681,7 +687,7 @@ int do_dec(struct st_query* q)
{ {
char* p=q->first_argument; char* p=q->first_argument;
VAR* v; VAR* v;
v = var_get(p, 0, 1); v = var_get(p, 0, 1, 0);
v->int_val--; v->int_val--;
v->int_dirty = 1; v->int_dirty = 1;
return 0; return 0;
...@@ -909,14 +915,16 @@ static void get_ints(uint *to,struct st_query* q) ...@@ -909,14 +915,16 @@ static void get_ints(uint *to,struct st_query* q)
/* /*
Get a string; Return ptr to end of string Get a string; Return ptr to end of string
Strings may be surrounded by " or ' 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, static char *get_string(char **to_ptr, char **from_ptr,
struct st_query* q) struct st_query* q)
{ {
reg1 char c,sep; reg1 char c,sep;
char *to= *to_ptr, *from= *from_ptr; char *to= *to_ptr, *from= *from_ptr, *start=to;
DBUG_ENTER("get_string"); DBUG_ENTER("get_string");
/* Find separator */ /* Find separator */
...@@ -969,6 +977,19 @@ static void get_string(char **to_ptr, char **from_ptr, ...@@ -969,6 +977,19 @@ static void get_string(char **to_ptr, char **from_ptr,
*to++ =0; /* End of string marker */ *to++ =0; /* End of string marker */
*to_ptr= to; *to_ptr= to;
*from_ptr= from; *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) ...@@ -994,13 +1015,12 @@ static void get_replace(struct st_query *q)
start=buff=my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE)); start=buff=my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE));
while (*from) while (*from)
{ {
char *to=buff; char *to;
get_string(&buff, &from, q); to= get_string(&buff, &from, q);
if (!*from) if (!*from)
die("Wrong number of arguments to replace in %s\n", q->query); die("Wrong number of arguments to replace in %s\n", q->query);
insert_pointer_name(&from_array,to); insert_pointer_name(&from_array,to);
to=buff; to= get_string(&buff, &from, q);
get_string(&buff, &from, q);
insert_pointer_name(&to_array,to); insert_pointer_name(&to_array,to);
} }
for (i=1,pos=word_end_chars ; i < 256 ; i++) for (i=1,pos=word_end_chars ; i < 256 ; i++)
......
File Position Binlog_do_db Binlog_ignore_db File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73 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 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 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 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 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 File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73 master-bin.001 73
n n
......
...@@ -3,11 +3,11 @@ master-bin.001 73 ...@@ -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 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 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 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 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 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 n
10 10
45 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 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 s
Could not break slave Could not break slave
Tried hard Tried hard
...@@ -12,7 +12,7 @@ testing temporary tables ...@@ -12,7 +12,7 @@ testing temporary tables
Log_name Log_name
master-bin.003 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 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 m
34 34
65 65
...@@ -29,6 +29,6 @@ master-bin.006 490 ...@@ -29,6 +29,6 @@ master-bin.006 490
a a
testing temporary tables part 2 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 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(*) count(*)
100 100
...@@ -61,7 +61,7 @@ sleep 2; ...@@ -61,7 +61,7 @@ sleep 2;
# The following test can't be done because the result of Pos will differ # The following test can't be done because the result of Pos will differ
# on different computers # on different computers
# --replace_result 9306 9999 3334 9999 3335 9999 # --replace_result $MASTER_MYPORT MASTER_PORT
# show slave status; # show slave status;
set sql_slave_skip_counter=1; set sql_slave_skip_counter=1;
......
...@@ -4,18 +4,18 @@ show master status; ...@@ -4,18 +4,18 @@ show master status;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999 --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
change master to master_log_pos=73; change master to master_log_pos=73;
slave stop; slave stop;
change master to master_log_pos=73; change master to master_log_pos=73;
--replace_result 9306 9999 3334 9999 3335 9999 --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
slave start; slave start;
--replace_result 9306 9999 3334 9999 3335 9999 --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
change master to master_log_pos=173; change master to master_log_pos=173;
--replace_result 9306 9999 3334 9999 3335 9999 --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
connection master; connection master;
show master status; show master status;
......
...@@ -8,15 +8,15 @@ connection slave; ...@@ -8,15 +8,15 @@ connection slave;
reset slave; reset slave;
show slave status; show slave status;
change master to master_host='127.0.0.1'; 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; show slave status;
eval change master to master_host='127.0.0.1',master_user='root', eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT; master_password='',master_port=$MASTER_MYPORT;
--replace_result 9306 9999 3334 9999 3335 9999 --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
slave start; slave start;
sync_with_master; sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999 --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
connection master; connection master;
drop table if exists t1; drop table if exists t1;
......
...@@ -40,7 +40,7 @@ insert into t1 values('Could not break slave'),('Tried hard'); ...@@ -40,7 +40,7 @@ insert into t1 values('Could not break slave'),('Tried hard');
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999 --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
select * from t1; select * from t1;
connection master; connection master;
...@@ -96,7 +96,7 @@ insert into t2 values (65); ...@@ -96,7 +96,7 @@ insert into t2 values (65);
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999 --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
select * from t2; select * from t2;
...@@ -126,7 +126,7 @@ connection slave; ...@@ -126,7 +126,7 @@ connection slave;
sync_with_master; sync_with_master;
select * from t4; select * from t4;
--replace_result 9306 9999 3334 9999 3335 9999 --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
# because of concurrent insert, the table may not be up to date # because of concurrent insert, the table may not be up to date
# if we do not lock # 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