Skip to content

Commit 14d4576

Browse files
author
Luis Soares
committed
merge: 5.1 -> 5.1-rpl
conflicts: Text conflict in client/mysqltest.cc Text conflict in mysql-test/include/wait_until_connected_again.inc Text conflict in mysql-test/lib/mtr_report.pm Text conflict in mysql-test/mysql-test-run.pl Text conflict in mysql-test/r/events_bugs.result Text conflict in mysql-test/r/log_state.result Text conflict in mysql-test/r/myisam_data_pointer_size_func.result Text conflict in mysql-test/r/mysqlcheck.result Text conflict in mysql-test/r/query_cache.result Text conflict in mysql-test/r/status.result Text conflict in mysql-test/suite/binlog/r/binlog_index.result Text conflict in mysql-test/suite/binlog/r/binlog_innodb.result Text conflict in mysql-test/suite/rpl/r/rpl_packet.result Text conflict in mysql-test/suite/rpl/t/rpl_packet.test Text conflict in mysql-test/t/disabled.def Text conflict in mysql-test/t/events_bugs.test Text conflict in mysql-test/t/log_state.test Text conflict in mysql-test/t/myisam_data_pointer_size_func.test Text conflict in mysql-test/t/mysqlcheck.test Text conflict in mysql-test/t/query_cache.test Text conflict in mysql-test/t/rpl_init_slave_func.test Text conflict in mysql-test/t/status.test
2 parents 37e91ac + 4f0d2f5 commit 14d4576

File tree

265 files changed

+7148
-4062
lines changed

Some content is hidden

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

265 files changed

+7148
-4062
lines changed

.bzr-mysql/default.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[MYSQL]
22
post_commit_to = "commits@lists.mysql.com"
33
post_push_to = "commits@lists.mysql.com"
4-
tree_name = "mysql-5.1"
4+
tree_name = "mysql-5.1-rpl"

CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ IF(CYBOZU)
9898
ADD_DEFINITIONS(-DCYBOZU)
9999
ENDIF(CYBOZU)
100100

101+
IF(EXTRA_DEBUG)
102+
ADD_DEFINITIONS(-D EXTRA_DEBUG)
103+
ENDIF(EXTRA_DEBUG)
104+
101105
# in some places we use DBUG_OFF
102106
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF")
103107
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")

client/mysql.cc

+17-32
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
20202020
{
20212021
if (!preserve_comments)
20222022
{
2023-
// Skip spaces at the beggining of a statement
2023+
// Skip spaces at the beginning of a statement
20242024
if (my_isspace(charset_info,inchar) && (out == line) &&
20252025
buffer.is_empty())
20262026
continue;
@@ -2103,37 +2103,6 @@ static bool add_line(String &buffer,char *line,char *in_string,
21032103
continue;
21042104
}
21052105
}
2106-
else if (!*ml_comment && !*in_string &&
2107-
(end_of_line - pos) >= 10 &&
2108-
!my_strnncoll(charset_info, (uchar*) pos, 10,
2109-
(const uchar*) "delimiter ", 10))
2110-
{
2111-
// Flush previously accepted characters
2112-
if (out != line)
2113-
{
2114-
buffer.append(line, (uint32) (out - line));
2115-
out= line;
2116-
}
2117-
2118-
// Flush possible comments in the buffer
2119-
if (!buffer.is_empty())
2120-
{
2121-
if (com_go(&buffer, 0) > 0) // < 0 is not fatal
2122-
DBUG_RETURN(1);
2123-
buffer.length(0);
2124-
}
2125-
2126-
/*
2127-
Delimiter wants the get rest of the given line as argument to
2128-
allow one to change ';' to ';;' and back
2129-
*/
2130-
buffer.append(pos);
2131-
if (com_delimiter(&buffer, pos) > 0)
2132-
DBUG_RETURN(1);
2133-
2134-
buffer.length(0);
2135-
break;
2136-
}
21372106
else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter))
21382107
{
21392108
// Found a statement. Continue parsing after the delimiter
@@ -2196,8 +2165,24 @@ static bool add_line(String &buffer,char *line,char *in_string,
21962165

21972166
// comment to end of line
21982167
if (preserve_comments)
2168+
{
2169+
bool started_with_nothing= !buffer.length();
2170+
21992171
buffer.append(pos);
22002172

2173+
/*
2174+
A single-line comment by itself gets sent immediately so that
2175+
client commands (delimiter, status, etc) will be interpreted on
2176+
the next line.
2177+
*/
2178+
if (started_with_nothing)
2179+
{
2180+
if (com_go(&buffer, 0) > 0) // < 0 is not fatal
2181+
DBUG_RETURN(1);
2182+
buffer.length(0);
2183+
}
2184+
}
2185+
22012186
break;
22022187
}
22032188
else if (!*in_string && inchar == '/' && *(pos+1) == '*' &&

client/mysql_upgrade.c

+16-1
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,20 @@ static int run_mysqlcheck_upgrade(void)
620620
}
621621

622622

623+
static int run_mysqlcheck_fixnames(void)
624+
{
625+
verbose("Running 'mysqlcheck'...");
626+
return run_tool(mysqlcheck_path,
627+
NULL, /* Send output from mysqlcheck directly to screen */
628+
"--no-defaults",
629+
ds_args.str,
630+
"--all-databases",
631+
"--fix-db-names",
632+
"--fix-table-names",
633+
NULL);
634+
}
635+
636+
623637
static const char *expected_errors[]=
624638
{
625639
"ERROR 1060", /* Duplicate column name */
@@ -782,7 +796,8 @@ int main(int argc, char **argv)
782796
/*
783797
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
784798
*/
785-
if (run_mysqlcheck_upgrade() ||
799+
if (run_mysqlcheck_fixnames() ||
800+
run_mysqlcheck_upgrade() ||
786801
run_sql_fix_privilege_tables())
787802
{
788803
/*

client/mysqlcheck.c

+17-10
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,13 @@ static uint verbose = 0, opt_mysql_port=0;
4040
static int my_end_arg;
4141
static char * opt_mysql_unix_port = 0;
4242
static char *opt_password = 0, *current_user = 0,
43-
*default_charset = (char *)MYSQL_DEFAULT_CHARSET_NAME,
44-
*current_host = 0;
43+
*default_charset= 0, *current_host= 0;
4544
static int first_error = 0;
4645
DYNAMIC_ARRAY tables4repair;
4746
#ifdef HAVE_SMEM
4847
static char *shared_memory_base_name=0;
4948
#endif
5049
static uint opt_protocol=0;
51-
static CHARSET_INFO *charset_info= &my_charset_latin1;
5250

5351
enum operations { DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE };
5452

@@ -282,12 +280,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
282280
break;
283281
case OPT_FIX_DB_NAMES:
284282
what_to_do= DO_UPGRADE;
285-
default_charset= (char*) "utf8";
286283
opt_databases= 1;
287284
break;
288285
case OPT_FIX_TABLE_NAMES:
289286
what_to_do= DO_UPGRADE;
290-
default_charset= (char*) "utf8";
291287
break;
292288
case 'p':
293289
if (argument)
@@ -367,11 +363,20 @@ static int get_options(int *argc, char ***argv)
367363
what_to_do = DO_CHECK;
368364
}
369365

370-
/* TODO: This variable is not yet used */
371-
if (strcmp(default_charset, charset_info->csname) &&
372-
!(charset_info= get_charset_by_csname(default_charset,
373-
MY_CS_PRIMARY, MYF(MY_WME))))
374-
exit(1);
366+
/*
367+
If there's no --default-character-set option given with
368+
--fix-table-name or --fix-db-name set the default character set to "utf8".
369+
*/
370+
if (!default_charset && (opt_fix_db_names || opt_fix_table_names))
371+
{
372+
default_charset= (char*) "utf8";
373+
}
374+
if (default_charset && !get_charset_by_csname(default_charset, MY_CS_PRIMARY,
375+
MYF(MY_WME)))
376+
{
377+
printf("Unsupported character set: %s\n", default_charset);
378+
return 1;
379+
}
375380
if (*argc > 0 && opt_alldbs)
376381
{
377382
printf("You should give only options, no arguments at all, with option\n");
@@ -779,6 +784,8 @@ static int dbConnect(char *host, char *user, char *passwd)
779784
if (shared_memory_base_name)
780785
mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
781786
#endif
787+
if (default_charset)
788+
mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
782789
if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd,
783790
NULL, opt_mysql_port, opt_mysql_unix_port, 0)))
784791
{

client/mysqltest.cc

+67-21
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,36 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
14411441
}
14421442

14431443

1444+
/*
1445+
Test if diff is present. This is needed on Windows systems
1446+
as the OS returns 1 whether diff is successful or if it is
1447+
not present.
1448+
1449+
We run diff -v and look for output in stdout.
1450+
We don't redirect stderr to stdout to make for a simplified check
1451+
Windows will output '"diff"' is not recognized... to stderr if it is
1452+
not present.
1453+
*/
1454+
1455+
int diff_check()
1456+
{
1457+
char buf[512]= {0};
1458+
FILE *res_file;
1459+
const char *cmd = "diff -v";
1460+
int have_diff = 0;
1461+
1462+
if (!(res_file= popen(cmd, "r")))
1463+
die("popen(\"%s\", \"r\") failed", cmd);
1464+
1465+
/* if diff is not present, nothing will be in stdout to increment have_diff */
1466+
if (fgets(buf, sizeof(buf), res_file))
1467+
{
1468+
have_diff += 1;
1469+
}
1470+
pclose(res_file);
1471+
return have_diff;
1472+
}
1473+
14441474
/*
14451475
Show the diff of two files using the systems builtin diff
14461476
command. If no such diff command exist, just dump the content
@@ -1457,58 +1487,67 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
14571487
void show_diff(DYNAMIC_STRING* ds,
14581488
const char* filename1, const char* filename2)
14591489
{
1460-
1461-
const char* diff_failed= 0;
14621490
DYNAMIC_STRING ds_tmp;
1491+
int have_diff = 0;
14631492

14641493
if (init_dynamic_string(&ds_tmp, "", 256, 256))
14651494
die("Out of memory");
14661495

1467-
/* First try with unified diff */
1468-
if (run_tool("diff",
1469-
&ds_tmp, /* Get output from diff in ds_tmp */
1470-
"-u",
1471-
filename1,
1472-
filename2,
1473-
"2>&1",
1474-
NULL) > 1) /* Most "diff" tools return >1 if error */
1475-
{
1476-
dynstr_set(&ds_tmp, "");
1496+
/* determine if we have diff on Windows
1497+
needs special processing due to return values
1498+
on that OS
1499+
*/
1500+
#ifdef __WIN__
1501+
have_diff = diff_check();
1502+
#else
1503+
have_diff = 1;
1504+
#endif
14771505

1478-
/* Fallback to context diff with "diff -c" */
1506+
if (have_diff)
1507+
{
1508+
/* First try with unified diff */
14791509
if (run_tool("diff",
14801510
&ds_tmp, /* Get output from diff in ds_tmp */
1481-
"-c",
1511+
"-u",
14821512
filename1,
14831513
filename2,
14841514
"2>&1",
14851515
NULL) > 1) /* Most "diff" tools return >1 if error */
14861516
{
14871517
dynstr_set(&ds_tmp, "");
14881518

1489-
/* Fallback to plain "diff" */
1519+
/* Fallback to context diff with "diff -c" */
14901520
if (run_tool("diff",
14911521
&ds_tmp, /* Get output from diff in ds_tmp */
1522+
"-c",
14921523
filename1,
14931524
filename2,
14941525
"2>&1",
14951526
NULL) > 1) /* Most "diff" tools return >1 if error */
14961527
{
1497-
dynstr_set(&ds_tmp, "");
1498-
1499-
diff_failed= "Could not execute 'diff -u', 'diff -c' or 'diff'";
1528+
dynstr_set(&ds_tmp, "");
1529+
1530+
/* Fallback to simple diff with "diff" */
1531+
if (run_tool("diff",
1532+
&ds_tmp, /* Get output from diff in ds_tmp */
1533+
filename1,
1534+
filename2,
1535+
"2>&1",
1536+
NULL) > 1) /* Most "diff" tools return >1 if error */
1537+
{
1538+
have_diff= 0;
1539+
}
15001540
}
15011541
}
1502-
}
1542+
}
15031543

1504-
if (diff_failed)
1544+
if (! have_diff)
15051545
{
15061546
/*
15071547
Fallback to dump both files to result file and inform
15081548
about installing "diff"
15091549
*/
15101550
dynstr_append(&ds_tmp, "\n");
1511-
dynstr_append(&ds_tmp, diff_failed);
15121551
dynstr_append(&ds_tmp,
15131552
"\n"
15141553
"The two files differ but it was not possible to execute 'diff' in\n"
@@ -7326,6 +7365,13 @@ static sig_handler signal_handler(int sig)
73267365
{
73277366
fprintf(stderr, "mysqltest got " SIGNAL_FMT "\n", sig);
73287367
dump_backtrace();
7368+
7369+
fprintf(stderr, "Writing a core file...\n");
7370+
fflush(stderr);
7371+
my_write_core(sig);
7372+
#ifndef __WIN__
7373+
exit(1); // Shouldn't get here but just in case
7374+
#endif
73297375
}
73307376

73317377
#ifdef __WIN__

configure.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
1010
#
1111
# When changing major version number please also check switch statement
1212
# in mysqlbinlog::check_master_version().
13-
AM_INIT_AUTOMAKE(mysql, 5.1.31)
13+
AM_INIT_AUTOMAKE(mysql, 5.1.32)
1414
AM_CONFIG_HEADER([include/config.h:config.h.in])
1515

1616
PROTOCOL_VERSION=10

extra/resolve_stack_dump.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ static void do_resolve()
290290
char buf[1024], *p;
291291
while (fgets(buf, sizeof(buf), fp_dump))
292292
{
293-
p = buf;
293+
/* skip bracket */
294+
p= (p= strchr(buf, '[')) ? p+1 : buf;
294295
/* skip space */
295296
while (my_isspace(&my_charset_latin1,*p))
296297
++p;

extra/yassl/include/openssl/ssl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ SSL_CTX* SSL_CTX_new(SSL_METHOD*);
203203
SSL* SSL_new(SSL_CTX*);
204204
int SSL_set_fd (SSL*, YASSL_SOCKET_T);
205205
YASSL_SOCKET_T SSL_get_fd(const SSL*);
206-
int SSL_connect(SSL*); // if you get an error from connect
207-
// see note at top of REAMDE
206+
int SSL_connect(SSL*); /* if you get an error from connect
207+
see note at top of REAMDE */
208208
int SSL_write(SSL*, const void*, int);
209209
int SSL_read(SSL*, void*, int);
210210
int SSL_accept(SSL*);

include/config-win.h

+9
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ inline double ulonglong2double(ulonglong value)
250250
#define my_off_t2double(A) ulonglong2double(A)
251251
#endif /* _WIN64 */
252252

253+
inline ulonglong double2ulonglong(double d)
254+
{
255+
double t= d - (double) 0x8000000000000000ULL;
256+
257+
if (t >= 0)
258+
return ((ulonglong) t) + 0x8000000000000000ULL;
259+
return (ulonglong) d;
260+
}
261+
253262
#if SIZEOF_OFF_T > 4
254263
#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
255264
#define tell(A) _telli64(A)

include/m_ctype.h

+1
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, size_t len);
472472
uint my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong len);
473473
my_bool my_charset_is_ascii_based(CHARSET_INFO *cs);
474474
my_bool my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs);
475+
uint my_charset_repertoire(CHARSET_INFO *cs);
475476

476477

477478
#define _MY_U 01 /* Upper case */

include/my_global.h

+3
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,9 @@ typedef SOCKET_SIZE_TYPE size_socket;
789789
#define ulonglong2double(A) ((double) (ulonglong) (A))
790790
#define my_off_t2double(A) ((double) (my_off_t) (A))
791791
#endif
792+
#ifndef double2ulonglong
793+
#define double2ulonglong(A) ((ulonglong) (double) (A))
794+
#endif
792795
#endif
793796

794797
#ifndef offsetof

mysql-test/extra/binlog_tests/database.test

+2
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ enable_warnings;
2828
insert into t1 values (1);
2929
drop table tt1, t1;
3030
source include/show_binlog_events.inc;
31+
32+
FLUSH STATUS;

0 commit comments

Comments
 (0)