Skip to content

Commit 4bfc67f

Browse files
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into bodhi.local:/opt/local/work/mysql-5.0-runtime-merge
2 parents 6cbc44c + 2336834 commit 4bfc67f

61 files changed

Lines changed: 2084 additions & 630 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client/mysqlbinlog.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
/* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */
3737
#include "mysql_priv.h"
3838
#include "log_event.h"
39+
#include "sql_common.h"
3940

4041
#define BIN_LOG_HEADER_SIZE 4
4142
#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
@@ -1077,7 +1078,7 @@ could be out of memory");
10771078
const char *error_msg;
10781079
Log_event *ev;
10791080

1080-
len = net_safe_read(mysql);
1081+
len= cli_safe_read(mysql);
10811082
if (len == packet_error)
10821083
{
10831084
fprintf(stderr, "Got error reading packet from server: %s\n",

include/mysql.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,6 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
848848
#define stmt_command(mysql, command, arg, length, stmt) \
849849
(*(mysql)->methods->advanced_command)(mysql, command, NullS, \
850850
0, arg, length, 1, stmt)
851-
unsigned long net_safe_read(MYSQL* mysql);
852851

853852
#ifdef __NETWARE__
854853
#pragma pack(pop) /* restore alignment */

include/mysql_com.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ enum enum_server_command
140140

141141
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
142142
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
143-
#define SERVER_STATUS_MORE_RESULTS 4 /* More results on server */
144143
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
145144
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
146145
#define SERVER_QUERY_NO_INDEX_USED 32

include/sql_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
3636
const char *header, ulong header_length,
3737
const char *arg, ulong arg_length, my_bool skip_check,
3838
MYSQL_STMT *stmt);
39-
39+
unsigned long cli_safe_read(MYSQL *mysql);
4040
void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
4141
const char *sqlstate);
4242
void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate);

libmysql/libmysql.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd)
645645
NET *net= &mysql->net;
646646
ulong pkt_length;
647647

648-
pkt_length= net_safe_read(mysql);
648+
pkt_length= cli_safe_read(mysql);
649649

650650
if (pkt_length == packet_error)
651651
return 1;
@@ -666,7 +666,7 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd)
666666
return 1;
667667
}
668668
/* Read what server thinks about out new auth message report */
669-
if (net_safe_read(mysql) == packet_error)
669+
if (cli_safe_read(mysql) == packet_error)
670670
return 1;
671671
}
672672
return 0;
@@ -1887,7 +1887,7 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
18871887
DBUG_ENTER("cli_read_prepare_result");
18881888

18891889
mysql= mysql->last_used_con;
1890-
if ((packet_length= net_safe_read(mysql)) == packet_error)
1890+
if ((packet_length= cli_safe_read(mysql)) == packet_error)
18911891
DBUG_RETURN(1);
18921892
mysql->warning_count= 0;
18931893

@@ -2505,7 +2505,8 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
25052505

25062506
if (stmt->param_count)
25072507
{
2508-
NET *net= &stmt->mysql->net;
2508+
MYSQL *mysql= stmt->mysql;
2509+
NET *net= &mysql->net;
25092510
MYSQL_BIND *param, *param_end;
25102511
char *param_data;
25112512
ulong length;
@@ -2517,7 +2518,8 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
25172518
set_stmt_error(stmt, CR_PARAMS_NOT_BOUND, unknown_sqlstate);
25182519
DBUG_RETURN(1);
25192520
}
2520-
if (stmt->mysql->status != MYSQL_STATUS_READY)
2521+
if (mysql->status != MYSQL_STATUS_READY ||
2522+
mysql->server_status & SERVER_MORE_RESULTS_EXISTS)
25212523
{
25222524
set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
25232525
DBUG_RETURN(1);
@@ -4532,7 +4534,7 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
45324534

45334535
int cli_unbuffered_fetch(MYSQL *mysql, char **row)
45344536
{
4535-
if (packet_error == net_safe_read(mysql))
4537+
if (packet_error == cli_safe_read(mysql))
45364538
return 1;
45374539

45384540
*row= ((mysql->net.read_pos[0] == 254) ? NULL :
@@ -4641,7 +4643,7 @@ int cli_read_binary_rows(MYSQL_STMT *stmt)
46414643

46424644
mysql= mysql->last_used_con;
46434645

4644-
while ((pkt_len= net_safe_read(mysql)) != packet_error)
4646+
while ((pkt_len= cli_safe_read(mysql)) != packet_error)
46454647
{
46464648
cp= net->read_pos;
46474649
if (cp[0] != 254 || pkt_len >= 8)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This file is intended to be used in each IM-test. It contains stamements,
2+
# that ensure that starting conditions (environment) for the IM-test are as
3+
# expected.
4+
5+
# Wait for mysqld1 (guarded instance) to start.
6+
7+
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
8+
9+
# Check the running instances.
10+
11+
--connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
12+
13+
--connection mysql1_con
14+
15+
SHOW VARIABLES LIKE 'server_id';
16+
17+
--connection default
18+
19+
# Let IM detect that mysqld1 is online. This delay should be longer than
20+
# monitoring interval.
21+
22+
--sleep 2
23+
24+
# Check that IM understands that mysqld1 is online, while mysqld2 is
25+
# offline.
26+
27+
SHOW INSTANCES;

mysql-test/mysql-test-run.pl

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2898,34 +2898,56 @@ ($)
28982898

28992899
while (1)
29002900
{
2901+
# Check that IM-main died.
2902+
29012903
if (kill (0, $instance_manager->{'pid'}))
29022904
{
29032905
mtr_debug("IM-main is still alive.");
29042906
last;
29052907
}
29062908

2909+
# Check that IM-angel died.
2910+
29072911
if (defined $instance_manager->{'angel_pid'} &&
29082912
kill (0, $instance_manager->{'angel_pid'}))
29092913
{
29102914
mtr_debug("IM-angel is still alive.");
29112915
last;
29122916
}
29132917

2918+
# Check that all guarded mysqld-instances died.
2919+
2920+
my $guarded_mysqlds_dead= 1;
2921+
29142922
foreach my $pid (@mysqld_pids)
29152923
{
29162924
if (kill (0, $pid))
29172925
{
29182926
mtr_debug("Guarded mysqld ($pid) is still alive.");
2927+
$guarded_mysqlds_dead= 0;
29192928
last;
29202929
}
29212930
}
29222931

2932+
last unless $guarded_mysqlds_dead;
2933+
2934+
# Ok, all necessary processes are dead.
2935+
29232936
$clean_shutdown= 1;
29242937
last;
29252938
}
29262939

29272940
# Kill leftovers (the order is important).
29282941

2942+
if ($clean_shutdown)
2943+
{
2944+
mtr_debug("IM-shutdown was clean -- all processed died.");
2945+
}
2946+
else
2947+
{
2948+
mtr_debug("IM failed to shutdown gracefully. We have to clean the mess...");
2949+
}
2950+
29292951
unless ($clean_shutdown)
29302952
{
29312953

@@ -2946,17 +2968,24 @@ ($)
29462968
mtr_kill_processes(\@mysqld_pids);
29472969

29482970
# Complain in error log so that a warning will be shown.
2949-
2950-
my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
2951-
2952-
open (ERRLOG, ">>$errlog") ||
2953-
mtr_error("Can not open error log ($errlog)");
2971+
#
2972+
# TODO: unless BUG#20761 is fixed, we will print the warning
2973+
# to stdout, so that it can be seen on console and does not
2974+
# produce pushbuild error.
2975+
2976+
# my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
2977+
#
2978+
# open (ERRLOG, ">>$errlog") ||
2979+
# mtr_error("Can not open error log ($errlog)");
2980+
#
2981+
# my $ts= localtime();
2982+
# print ERRLOG
2983+
# "Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
2984+
#
2985+
# close ERRLOG;
29542986

29552987
my $ts= localtime();
2956-
print ERRLOG
2957-
"Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
2958-
2959-
close ERRLOG;
2988+
print "Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
29602989
}
29612990

29622991
# That's all.

mysql-test/r/im_daemon_life_cycle.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
Success: the process has been started.
2+
SHOW VARIABLES LIKE 'server_id';
3+
Variable_name Value
4+
server_id 1
25
SHOW INSTANCES;
36
instance_name status
47
mysqld1 online

mysql-test/r/im_life_cycle.result

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
2-
--------------------------------------------------------------------
3-
-- 1.1.1.
4-
--------------------------------------------------------------------
51
Success: the process has been started.
2+
SHOW VARIABLES LIKE 'server_id';
3+
Variable_name Value
4+
server_id 1
65
SHOW INSTANCES;
76
instance_name status
87
mysqld1 online
@@ -40,10 +39,6 @@ ERROR HY000: Bad instance name. Check that the instance with such a name exists
4039
--------------------------------------------------------------------
4140
-- 1.1.6.
4241
--------------------------------------------------------------------
43-
SHOW INSTANCES;
44-
instance_name status
45-
mysqld1 online
46-
mysqld2 offline
4742
Killing the process...
4843
Sleeping...
4944
Success: the process was restarted.

mysql-test/r/im_options_set.result

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
server_id = 1
2-
server_id = 2
1+
Success: the process has been started.
32
SHOW VARIABLES LIKE 'server_id';
43
Variable_name Value
54
server_id 1
5+
SHOW INSTANCES;
6+
instance_name status
7+
mysqld1 online
8+
mysqld2 offline
69
SET mysqld1.server_id = 11;
710
server_id =11
811
server_id = 2

0 commit comments

Comments
 (0)