Commit 39b73c0f authored by unknown's avatar unknown

Merge work:/home/bk/mysql

into mysql.sashanet.com:/home/sasha/src/bk/mysql

parents 41e7f821 bd6e7063
mwagner@evoq.mwagner.org sasha@mysql.sashanet.com
...@@ -139,7 +139,7 @@ struct connection* cur_con, *next_con, *cons_end; ...@@ -139,7 +139,7 @@ struct connection* cur_con, *next_con, *cons_end;
/* this should really be called command */ /* this should really be called command */
struct st_query struct st_query
{ {
char *query, *first_argument; char *query, *query_buf,*first_argument;
int first_word_len; int first_word_len;
my_bool abort_on_error, require_file; my_bool abort_on_error, require_file;
uint expected_errno[MAX_EXPECTED_ERRORS]; uint expected_errno[MAX_EXPECTED_ERRORS];
...@@ -243,9 +243,14 @@ static void free_used_memory() ...@@ -243,9 +243,14 @@ static void free_used_memory()
for (i=0 ; i < q_lines.elements ; i++) for (i=0 ; i < q_lines.elements ; i++)
{ {
struct st_query **q= dynamic_element(&q_lines, i, struct st_query**); struct st_query **q= dynamic_element(&q_lines, i, struct st_query**);
my_free((gptr) (*q)->query,MYF(MY_ALLOW_ZERO_PTR)); my_free((gptr) (*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR));
my_free((gptr) (*q),MYF(0)); my_free((gptr) (*q),MYF(0));
} }
for(i=0; i < 10; i++)
{
if(var_reg[i].alloced_len)
my_free(var_reg[i].str_val, MYF(MY_WME));
}
delete_dynamic(&q_lines); delete_dynamic(&q_lines);
dynstr_free(&ds_res); dynstr_free(&ds_res);
my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
...@@ -1165,7 +1170,7 @@ int read_query(struct st_query** q_ptr) ...@@ -1165,7 +1170,7 @@ int read_query(struct st_query** q_ptr)
q->abort_on_error = global_expected_errno[0] == 0; q->abort_on_error = global_expected_errno[0] == 0;
bzero((gptr) global_expected_errno,sizeof(global_expected_errno)); bzero((gptr) global_expected_errno,sizeof(global_expected_errno));
q->type = Q_UNKNOWN; q->type = Q_UNKNOWN;
q->query=0; q->query_buf=q->query=0;
if (read_line(read_query_buf, sizeof(read_query_buf))) if (read_line(read_query_buf, sizeof(read_query_buf)))
return 1; return 1;
...@@ -1207,7 +1212,7 @@ int read_query(struct st_query** q_ptr) ...@@ -1207,7 +1212,7 @@ int read_query(struct st_query** q_ptr)
} }
} }
while (*p && isspace(*p)) p++; while (*p && isspace(*p)) p++;
if (!(q->query=my_strdup(p,MYF(MY_WME)))) if (!(q->query_buf=q->query=my_strdup(p,MYF(MY_WME))))
die(NullS); die(NullS);
/* Calculate first word and first argument */ /* Calculate first word and first argument */
...@@ -1391,7 +1396,10 @@ void reject_dump(const char* record_file, char* buf, int size) ...@@ -1391,7 +1396,10 @@ void reject_dump(const char* record_file, char* buf, int size)
str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size); str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size);
} }
/* flags control the phased/stages of query execution to be performed
* if QUERY_SEND bit is on, the query will be sent. If QUERY_REAP is on
* the result will be read - for regular query, both bits must be on
*/
int run_query(MYSQL* mysql, struct st_query* q, int flags) int run_query(MYSQL* mysql, struct st_query* q, int flags)
{ {
MYSQL_RES* res = 0; MYSQL_RES* res = 0;
...@@ -1564,7 +1572,7 @@ int main(int argc, char** argv) ...@@ -1564,7 +1572,7 @@ int main(int argc, char** argv)
{ {
int error = 0; int error = 0;
struct st_query* q; struct st_query* q;
my_bool require_file=0,q_send_flag=0; my_bool require_file=0;
char save_file[FN_REFLEN]; char save_file[FN_REFLEN];
MY_INIT(argv[0]); MY_INIT(argv[0]);
...@@ -1626,14 +1634,11 @@ int main(int argc, char** argv) ...@@ -1626,14 +1634,11 @@ int main(int argc, char** argv)
case Q_QUERY: case Q_QUERY:
case Q_REAP: case Q_REAP:
{ {
int flags = QUERY_REAP; int flags = QUERY_REAP; /* we read the result always regardless
if (q->type == Q_QUERY) * of the mode for both full query and
* read-result only ( reap) */
if (q->type == Q_QUERY) /* for a full query, enable the send stage */
flags |= QUERY_SEND; flags |= QUERY_SEND;
if (q_send_flag)
{
flags=QUERY_SEND;
q_send_flag=0;
}
if (save_file[0]) if (save_file[0])
{ {
strmov(q->record_file,save_file); strmov(q->record_file,save_file);
...@@ -1644,7 +1649,16 @@ int main(int argc, char** argv) ...@@ -1644,7 +1649,16 @@ int main(int argc, char** argv)
break; break;
} }
case Q_SEND: case Q_SEND:
q_send_flag=1; if(q->query == q->query_buf) /* fix up query pointer if this is
* first iteration for this line
*/
q->query += q->first_word_len;
error |= run_query(&cur_con->mysql, q, QUERY_SEND);
/* run query can execute a query partially, depending on the flags
* QUERY_SEND flag without QUERY_REAP tells it to just send the
* query and read the result some time later when reap instruction
* is given on this connection
*/
break; break;
case Q_RESULT: case Q_RESULT:
get_file_name(save_file,q); get_file_name(save_file,q);
......
...@@ -139,9 +139,15 @@ while test $# -gt 0; do ...@@ -139,9 +139,15 @@ while test $# -gt 0; do
fi fi
DO_DDD=1 DO_DDD=1
;; ;;
--skip-*)
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1"
;;
--debug) --debug)
EXTRA_MASTER_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/master.trace EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
EXTRA_SLAVE_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/slave.trace --debug=d:t:O,$MYSQL_TMP_DIR/master.trace"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
--debug=d:t:O,$MYSQL_TMP_DIR/slave.trace"
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug"
;; ;;
-- ) shift; break ;; -- ) shift; break ;;
......
...@@ -2,11 +2,24 @@ connect (con1,localhost,root,,test,0,mysql-master.sock); ...@@ -2,11 +2,24 @@ connect (con1,localhost,root,,test,0,mysql-master.sock);
connect (con2,localhost,root,,test,0,mysql-master.sock); connect (con2,localhost,root,,test,0,mysql-master.sock);
connection con1; connection con1;
drop table if exists t1; drop table if exists t1;
create temporary table t1(n int); create temporary table t1(n int not null primary key);
connection con2; drop table if exists t2;
#send flush tables; create table t2(n int);
insert into t2 values(3);
let $1=100;
while ($1)
{
connection con1;
send replace into t1 select n from t2;
connection con2;
send flush tables;
connection con1;
reap;
connection con2;
reap;
dec $1;
}
connection con1; connection con1;
insert into t1 values(3);
select * from t1; select * from t1;
connection con2; drop table t2;
#reap;
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