Skip to content

Commit b1752d8

Browse files
committed
Merge branch 'mysql-5.6-cluster-7.3' into mysql-5.6-cluster-7.4
(Merge tag 'clone-5.6.37-build' into mysql-5.6-cluster-7.3)
2 parents 0eb8c22 + 4b63ff9 commit b1752d8

File tree

94 files changed

+2113
-351
lines changed

Some content is hidden

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

94 files changed

+2113
-351
lines changed

CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,36 @@ IF (ENABLE_GPROF AND NOT WIN32 AND NOT APPLE)
314314
"${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -pg")
315315
ENDIF()
316316

317+
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
318+
OPTION(REPRODUCIBLE_BUILD "Take extra pains to make build result independent of build location and time" OFF)
319+
ENDIF()
320+
IF(REPRODUCIBLE_BUILD)
321+
SET(DEBUG_PREFIX_FLAGS
322+
"-fdebug-prefix-map=${CMAKE_SOURCE_DIR}/=./ -fdebug-prefix-map=${CMAKE_CURRENT_BINARY_DIR}=./obj")
323+
324+
# See if -fdebug-prefix= commands are included in the debug output,
325+
# making the build unreproducible with switches recorded.
326+
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69821.
327+
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -g3 -x c -S -fdebug-prefix-map=foo=bar -o - -
328+
INPUT_FILE /dev/null OUTPUT_VARIABLE DEBUG_PREFIX_MAP_RESULT)
329+
IF(DEBUG_PREFIX_MAP_RESULT MATCHES "foo=bar")
330+
SET(DEBUG_PREFIX_FLAGS "${DEBUG_PREFIX_FLAGS} -gno-record-gcc-switches")
331+
ENDIF()
332+
333+
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_PREFIX_FLAGS}")
334+
SET(CMAKE_C_FLAGS_RELWITHDEBINFO
335+
"${CMAKE_C_FLAGS_RELWITHDEBINFO} ${DEBUG_PREFIX_FLAGS}")
336+
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_PREFIX_FLAGS}")
337+
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO
338+
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${DEBUG_PREFIX_FLAGS}")
339+
340+
SET(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--build-id=none")
341+
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--build-id=none")
342+
343+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE
344+
"${CMAKE_SOURCE_DIR}/scripts/invoke-with-relative-paths.pl")
345+
ENDIF()
346+
317347
OPTION(ENABLED_LOCAL_INFILE
318348
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
319349
MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
MYSQL_VERSION_MAJOR=5
22
MYSQL_VERSION_MINOR=6
3-
MYSQL_VERSION_PATCH=36
3+
MYSQL_VERSION_PATCH=37
44
MYSQL_VERSION_EXTRA=-ndb-7.4.16

client/mysql.cc

Lines changed: 76 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
151151
default_pager_set= 0, opt_sigint_ignore= 0,
152152
auto_vertical_output= 0,
153153
show_warnings= 0, executing_query= 0, interrupted_query= 0,
154-
ignore_spaces= 0;
154+
ignore_spaces= 0, opt_binhex= 0;
155155
static my_bool debug_info_flag, debug_check_flag;
156156
static my_bool column_types_flag;
157157
static my_bool preserve_comments= 0;
@@ -1567,6 +1567,8 @@ static struct my_option my_long_options[] =
15671567
{"bind-address", 0, "IP address to bind to.",
15681568
(uchar**) &opt_bind_addr, (uchar**) &opt_bind_addr, 0, GET_STR,
15691569
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1570+
{"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex,
1571+
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
15701572
{"character-sets-dir", OPT_CHARSETS_DIR,
15711573
"Directory for character set files.", &charsets_dir,
15721574
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -3690,6 +3692,39 @@ print_field_types(MYSQL_RES *result)
36903692
tee_puts("", PAGER);
36913693
}
36923694

3695+
/* Used to determine if we should invoke print_as_hex for this field */
3696+
3697+
static bool
3698+
is_binary_field(MYSQL_FIELD *field)
3699+
{
3700+
if ((field->charsetnr == 63) &&
3701+
(field->type == MYSQL_TYPE_BIT ||
3702+
field->type == MYSQL_TYPE_BLOB ||
3703+
field->type == MYSQL_TYPE_LONG_BLOB ||
3704+
field->type == MYSQL_TYPE_MEDIUM_BLOB ||
3705+
field->type == MYSQL_TYPE_TINY_BLOB ||
3706+
field->type == MYSQL_TYPE_VAR_STRING ||
3707+
field->type == MYSQL_TYPE_STRING ||
3708+
field->type == MYSQL_TYPE_VARCHAR ||
3709+
field->type == MYSQL_TYPE_GEOMETRY))
3710+
return 1;
3711+
return 0;
3712+
}
3713+
3714+
3715+
/* Print binary value as hex literal (0x ...) */
3716+
3717+
static void
3718+
print_as_hex(FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send)
3719+
{
3720+
const char *ptr= str, *end= ptr+len;
3721+
ulong i;
3722+
fprintf(output_file, "0x");
3723+
for(; ptr < end; ptr++)
3724+
fprintf(output_file, "%02X", *((uchar*)ptr));
3725+
for (i= 2*len+2; i < total_bytes_to_send; i++)
3726+
tee_putc((int)' ', output_file);
3727+
}
36933728

36943729
static void
36953730
print_table_data(MYSQL_RES *result)
@@ -3719,7 +3754,9 @@ print_table_data(MYSQL_RES *result)
37193754
length= max<size_t>(length, field->max_length);
37203755
if (length < 4 && !IS_NOT_NULL(field->flags))
37213756
length=4;// Room for "NULL"
3722-
field->max_length=length;
3757+
if (opt_binhex && is_binary_field(field))
3758+
length= 2 + length * 2;
3759+
field->max_length=(ulong) length;
37233760
separator.fill(separator.length()+length+2,'-');
37243761
separator.append('+');
37253762
}
@@ -3786,9 +3823,11 @@ print_table_data(MYSQL_RES *result)
37863823
many extra padding-characters we should send with the printing function.
37873824
*/
37883825
visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
3789-
extra_padding= data_length - visible_length;
3826+
extra_padding= (uint) (data_length - visible_length);
37903827

3791-
if (field_max_length > MAX_COLUMN_LENGTH)
3828+
if (opt_binhex && is_binary_field(field))
3829+
print_as_hex(PAGER, cur[off], lengths[off], field_max_length);
3830+
else if (field_max_length > MAX_COLUMN_LENGTH)
37923831
tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
37933832
else
37943833
{
@@ -3914,19 +3953,22 @@ print_table_data_html(MYSQL_RES *result)
39143953
if (interrupted_query)
39153954
break;
39163955
ulong *lengths=mysql_fetch_lengths(result);
3956+
field= mysql_fetch_fields(result);
39173957
(void) tee_fputs("<TR>", PAGER);
39183958
for (uint i=0; i < mysql_num_fields(result); i++)
39193959
{
39203960
(void) tee_fputs("<TD>", PAGER);
3921-
xmlencode_print(cur[i], lengths[i]);
3961+
if (opt_binhex && is_binary_field(&field[i]))
3962+
print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
3963+
else
3964+
xmlencode_print(cur[i], lengths[i]);
39223965
(void) tee_fputs("</TD>", PAGER);
39233966
}
39243967
(void) tee_fputs("</TR>", PAGER);
39253968
}
39263969
(void) tee_fputs("</TABLE>", PAGER);
39273970
}
39283971

3929-
39303972
static void
39313973
print_table_data_xml(MYSQL_RES *result)
39323974
{
@@ -3954,7 +3996,10 @@ print_table_data_xml(MYSQL_RES *result)
39543996
if (cur[i])
39553997
{
39563998
tee_fprintf(PAGER, "\">");
3957-
xmlencode_print(cur[i], lengths[i]);
3999+
if (opt_binhex && is_binary_field(&fields[i]))
4000+
print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
4001+
else
4002+
xmlencode_print(cur[i], lengths[i]);
39584003
tee_fprintf(PAGER, "</field>\n");
39594004
}
39604005
else
@@ -3999,7 +4044,10 @@ print_table_data_vertically(MYSQL_RES *result)
39994044
tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
40004045
if (cur[off])
40014046
{
4002-
tee_write(PAGER, cur[off], lengths[off], MY_PRINT_SPS_0 | MY_PRINT_MB);
4047+
if (opt_binhex && is_binary_field(field))
4048+
print_as_hex(PAGER, cur[off], lengths[off], lengths[off]);
4049+
else
4050+
tee_write(PAGER, cur[off], lengths[off], MY_PRINT_SPS_0 | MY_PRINT_MB);
40034051
tee_putc('\n', PAGER);
40044052
}
40054053
else
@@ -4108,11 +4156,21 @@ print_tab_data(MYSQL_RES *result)
41084156
while ((cur = mysql_fetch_row(result)))
41094157
{
41104158
lengths=mysql_fetch_lengths(result);
4111-
safe_put_field(cur[0],lengths[0]);
4159+
4160+
field= mysql_fetch_fields(result);
4161+
if (opt_binhex && is_binary_field(&field[0]))
4162+
print_as_hex(PAGER, cur[0], lengths[0], lengths[0]);
4163+
else
4164+
safe_put_field(cur[0],lengths[0]);
4165+
41124166
for (uint off=1 ; off < mysql_num_fields(result); off++)
41134167
{
41144168
(void) tee_fputs("\t", PAGER);
4115-
safe_put_field(cur[off], lengths[off]);
4169+
4170+
if (opt_binhex && field && is_binary_field(&field[off]))
4171+
print_as_hex(PAGER, cur[off], lengths[off], lengths[off]);
4172+
else
4173+
safe_put_field(cur[off], lengths[off]);
41164174
}
41174175
(void) tee_fputs("\n", PAGER);
41184176
}
@@ -4488,10 +4546,9 @@ com_use(String *buffer MY_ATTRIBUTE((unused)), char *line)
44884546
memset(buff, 0, sizeof(buff));
44894547

44904548
/*
4491-
In case number of quotes exceed 2, we try to get
4492-
the normalized db name.
4549+
In case of quotes used, try to get the normalized db name.
44934550
*/
4494-
if (get_quote_count(line) > 2)
4551+
if (get_quote_count(line) > 0)
44954552
{
44964553
if (normalize_dbname(line, buff, sizeof(buff)))
44974554
return put_error(&mysql);
@@ -4709,11 +4766,13 @@ char *get_arg(char *line, my_bool get_next_arg)
47094766
static int
47104767
get_quote_count(const char *line)
47114768
{
4712-
int quote_count;
4713-
const char *ptr= line;
4769+
int quote_count= 0;
4770+
const char *quote= line;
47144771

4715-
for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`"))
4716-
quote_count ++;
4772+
while ((quote= strpbrk(quote, "'`\"")) != NULL) {
4773+
quote_count++;
4774+
quote++;
4775+
}
47174776

47184777
return quote_count;
47194778
}

client/mysqlbinlog.cc

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -68,6 +68,21 @@ using std::max;
6868

6969
#define CLIENT_CAPABILITIES(CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
7070

71+
/**
72+
The function represents Log_event delete wrapper
73+
to reset possibly active temp_buf member.
74+
It's to be invoked in context where the member is
75+
not bound with dynamically allocated memory and therefore can
76+
be reset as simple as with plain assignment to NULL.
77+
78+
@param ev a pointer to Log_event instance
79+
*/
80+
inline void reset_temp_buf_and_delete(Log_event *ev)
81+
{
82+
ev->temp_buf= NULL;
83+
delete ev;
84+
}
85+
7186
char server_version[SERVER_VERSION_LENGTH];
7287
ulong filter_server_id = 0;
7388
/*
@@ -2408,6 +2423,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
24082423
if ((rev->ident_len != logname_len) ||
24092424
memcmp(rev->new_log_ident, logname, logname_len))
24102425
{
2426+
reset_temp_buf_and_delete(rev);
24112427
DBUG_RETURN(OK_CONTINUE);
24122428
}
24132429
/*
@@ -2416,6 +2432,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
24162432
log. If we are running with to_last_remote_log, we print it,
24172433
because it serves as a useful marker between binlogs then.
24182434
*/
2435+
reset_temp_buf_and_delete(rev);
24192436
continue;
24202437
}
24212438
/*
@@ -2446,6 +2463,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
24462463
MYF(MY_WME))))
24472464
{
24482465
error("Could not create log file '%s'", log_file_name);
2466+
reset_temp_buf_and_delete(ev);
24492467
DBUG_RETURN(ERROR_STOP);
24502468
}
24512469
DBUG_EXECUTE_IF("simulate_result_file_write_error_for_FD_event",
@@ -2454,6 +2472,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
24542472
BIN_LOG_HEADER_SIZE, MYF(MY_NABP)))
24552473
{
24562474
error("Could not write into log file '%s'", log_file_name);
2475+
reset_temp_buf_and_delete(ev);
24572476
DBUG_RETURN(ERROR_STOP);
24582477
}
24592478
/*
@@ -2486,10 +2505,9 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
24862505
retval= ERROR_STOP;
24872506
}
24882507
if (ev)
2489-
{
2490-
ev->temp_buf=0;
2491-
delete ev;
2492-
}
2508+
reset_temp_buf_and_delete(ev);
2509+
/* Flush result_file after every event */
2510+
fflush(result_file);
24932511
}
24942512
else
24952513
{
@@ -2507,7 +2525,10 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
25072525
File file;
25082526

25092527
if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0)
2528+
{
2529+
reset_temp_buf_and_delete(ev);
25102530
DBUG_RETURN(ERROR_STOP);
2531+
}
25112532

25122533
retval= process_event(print_event_info, ev, old_off, logname);
25132534
if (retval != OK_CONTINUE)

include/byte_order_generic_x86.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -27,17 +27,9 @@
2727
((uint32) (uchar) (A)[0])))
2828
#define sint4korr(A) (*((long *) (A)))
2929
#define uint2korr(A) (*((uint16 *) (A)))
30-
/*
31-
Attention: Please, note, uint3korr reads 4 bytes (not 3)!
32-
It means, that you have to provide enough allocated space.
33-
*/
34-
#if defined(HAVE_purify) && !defined(_WIN32)
3530
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
3631
(((uint32) ((uchar) (A)[1])) << 8) +\
3732
(((uint32) ((uchar) (A)[2])) << 16))
38-
#else
39-
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
40-
#endif
4133
#define uint4korr(A) (*((uint32 *) (A)))
4234
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
4335
(((uint32) ((uchar) (A)[1])) << 8) +\

include/byte_order_generic_x86_64.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -27,17 +27,9 @@
2727
((uint32) (uchar) (A)[0])))
2828
#define sint4korr(A) (int32) (*((int32 *) (A)))
2929
#define uint2korr(A) (uint16) (*((uint16 *) (A)))
30-
/*
31-
Attention: Please, note, uint3korr reads 4 bytes (not 3)!
32-
It means, that you have to provide enough allocated space.
33-
*/
34-
#if defined(HAVE_purify) && !defined(_WIN32)
3530
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
3631
(((uint32) ((uchar) (A)[1])) << 8) +\
3732
(((uint32) ((uchar) (A)[2])) << 16))
38-
#else
39-
#define uint3korr(A) (uint32) (*((unsigned int *) (A)) & 0xFFFFFF)
40-
#endif
4133
#define uint4korr(A) (uint32) (*((uint32 *) (A)))
4234
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
4335
(((uint32) ((uchar) (A)[1])) << 8) +\

0 commit comments

Comments
 (0)