Skip to content

Commit f610310

Browse files
committed
Merging from MariaDB repository
2 parents 5c42d86 + 01209de commit f610310

File tree

1,355 files changed

+99816
-20864
lines changed

Some content is hidden

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

1,355 files changed

+99816
-20864
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ extra/comp_err
4646
extra/innochecksum
4747
extra/jemalloc/build/
4848
extra/jemalloc/tmp/
49+
extra/mariabackup/mariabackup
50+
extra/mariabackup/mbstream
4951
extra/my_print_defaults
5052
extra/mysql_waitpid
5153
extra/mysqld_safe_helper
@@ -118,6 +120,7 @@ scripts/mytop
118120
scripts/wsrep_sst_common
119121
scripts/wsrep_sst_mysqldump
120122
scripts/wsrep_sst_rsync
123+
scripts/wsrep_sst_mariabackup
121124
scripts/wsrep_sst_xtrabackup
122125
scripts/wsrep_sst_xtrabackup-v2
123126
scripts/maria_add_gis_sp.sql
@@ -238,6 +241,10 @@ storage/mroonga/vendor/groonga/src/groonga-benchmark
238241
storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset
239242
storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result
240243
storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
244+
xxx/*
245+
yyy/*
246+
zzz/*
247+
241248
# C and C++
242249

243250
# Compiled Object files

CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Copyright (c) 2006, 2014, Oracle and/or its affiliates.
2-
# Copyright (c) 2008, 2014, Monty Program Ab
1+
# Copyright (c) 2006, 2017, Oracle and/or its affiliates.
2+
# Copyright (c) 2008, 2017, MariaDB
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
@@ -223,11 +223,9 @@ IF(SECURITY_HARDENED)
223223
MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO)
224224
ENDIF()
225225

226-
OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON)
227-
IF(ENABLE_DEBUG_SYNC)
228-
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
229-
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
230-
ENDIF()
226+
# Always enable debug sync for debug builds.
227+
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
228+
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
231229

232230
OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
233231
IF (ENABLE_GCOV)

CREDITS

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@ organization registered in the USA.
44
The current main sponsors of the MariaDB Foundation are:
55

66
Alibaba Cloud https://intl.aliyun.com (2017)
7-
Booking.com https://www.booking.com (2013 - 2017)
8-
Development Bank of Singapore https://dbs.com (2016 - 2017)
9-
MariaDB Corporation https://www.mariadb.com (2013 - 2017)
10-
Visma https://visma.com (2015 - 2017)
11-
Acronis http://acronis.com (2016 - 2017)
12-
Nexedi https://www.nexedi.com (2016 - 2017)
13-
Automattic https://automattic.com (2014 - 2017)
14-
Tencent Game DBA http://tencentdba.com/about (2016 - 2017)
15-
Tencent TDSQL http://tdsql.org/ (2016 - 2017)
16-
Verkkokauppa.com https://www.verkkokauppa.com (2015 - 2017)
17-
Virtuozzo https://virtuozzo.com (2016 - 2017)
7+
Booking.com https://www.booking.com (2013)
8+
Tencent Cloud https://cloud.tencent.com (2017)
9+
Development Bank of Singapore https://dbs.com (2016)
10+
IBM https://www.ibm.com (2017)
11+
MariaDB Corporation https://www.mariadb.com (2013)
12+
Visma https://visma.com (2015)
13+
Acronis http://acronis.com (2016)
14+
Nexedi https://www.nexedi.com (2016)
15+
Automattic https://automattic.com (2014)
16+
Tencent Game DBA http://tencentdba.com/about (2016)
17+
Tencent TDSQL http://tdsql.org (2016)
18+
Verkkokauppa.com https://www.verkkokauppa.com (2015)
19+
Virtuozzo https://virtuozzo.com (2016)
1820

1921
For a full list of sponsors, see
2022
https://mariadb.org/about/supporters/

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
MYSQL_VERSION_MAJOR=10
22
MYSQL_VERSION_MINOR=1
3-
MYSQL_VERSION_PATCH=23
3+
MYSQL_VERSION_PATCH=27

client/client_priv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,3 @@ enum options_client
115115
Name of the performance schema database.
116116
*/
117117
#define PERFORMANCE_SCHEMA_DB_NAME "performance_schema"
118-

client/mysql.cc

Lines changed: 84 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
3-
Copyright (c) 2009, 2016, MariaDB
3+
Copyright (c) 2009, 2017, MariaDB
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -149,7 +149,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
149149
default_pager_set= 0, opt_sigint_ignore= 0,
150150
auto_vertical_output= 0,
151151
show_warnings= 0, executing_query= 0,
152-
ignore_spaces= 0, opt_progress_reports;
152+
ignore_spaces= 0, opt_binhex= 0, opt_progress_reports;
153153
static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error;
154154
static my_bool column_types_flag;
155155
static my_bool preserve_comments= 0;
@@ -1492,6 +1492,8 @@ static struct my_option my_long_options[] =
14921492
{"batch", 'B',
14931493
"Don't use history file. Disable interactive behavior. (Enables --silent.)",
14941494
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1495+
{"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex,
1496+
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
14951497
{"character-sets-dir", OPT_CHARSETS_DIR,
14961498
"Directory for character set files.", &charsets_dir,
14971499
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -2319,8 +2321,10 @@ static bool add_line(String &buffer, char *line, ulong line_length,
23192321
continue;
23202322
}
23212323
#endif
2322-
if (!*ml_comment && inchar == '\\' &&
2323-
!(*in_string &&
2324+
if (!*ml_comment && inchar == '\\' && *in_string != '`' &&
2325+
!(*in_string == '"' &&
2326+
(mysql.server_status & SERVER_STATUS_ANSI_QUOTES)) &&
2327+
!(*in_string &&
23242328
(mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)))
23252329
{
23262330
// Found possbile one character command like \c
@@ -3059,7 +3063,6 @@ static int com_server_help(String *buffer __attribute__((unused)),
30593063
{
30603064
unsigned int num_fields= mysql_num_fields(result);
30613065
my_ulonglong num_rows= mysql_num_rows(result);
3062-
mysql_fetch_fields(result);
30633066
if (num_fields==3 && num_rows==1)
30643067
{
30653068
if (!(cur= mysql_fetch_row(result)))
@@ -3313,7 +3316,8 @@ com_go(String *buffer,char *line __attribute__((unused)))
33133316
print_table_data_html(result);
33143317
else if (opt_xml)
33153318
print_table_data_xml(result);
3316-
else if (vertical || (auto_vertical_output && (terminal_width < get_result_width(result))))
3319+
else if (vertical || (auto_vertical_output &&
3320+
(terminal_width < get_result_width(result))))
33173321
print_table_data_vertically(result);
33183322
else if (opt_silent && verbose <= 2 && !output_tables)
33193323
print_tab_data(result);
@@ -3532,6 +3536,41 @@ print_field_types(MYSQL_RES *result)
35323536
}
35333537

35343538

3539+
/* Used to determine if we should invoke print_as_hex for this field */
3540+
3541+
static bool
3542+
is_binary_field(MYSQL_FIELD *field)
3543+
{
3544+
if ((field->charsetnr == 63) &&
3545+
(field->type == MYSQL_TYPE_BIT ||
3546+
field->type == MYSQL_TYPE_BLOB ||
3547+
field->type == MYSQL_TYPE_LONG_BLOB ||
3548+
field->type == MYSQL_TYPE_MEDIUM_BLOB ||
3549+
field->type == MYSQL_TYPE_TINY_BLOB ||
3550+
field->type == MYSQL_TYPE_VAR_STRING ||
3551+
field->type == MYSQL_TYPE_STRING ||
3552+
field->type == MYSQL_TYPE_VARCHAR ||
3553+
field->type == MYSQL_TYPE_GEOMETRY))
3554+
return 1;
3555+
return 0;
3556+
}
3557+
3558+
3559+
/* Print binary value as hex literal (0x ...) */
3560+
3561+
static void
3562+
print_as_hex(FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send)
3563+
{
3564+
const char *ptr= str, *end= ptr+len;
3565+
ulong i;
3566+
fprintf(output_file, "0x");
3567+
for(; ptr < end; ptr++)
3568+
fprintf(output_file, "%02X", *((uchar*)ptr));
3569+
for (i= 2*len+2; i < total_bytes_to_send; i++)
3570+
tee_putc((int)' ', output_file);
3571+
}
3572+
3573+
35353574
static void
35363575
print_table_data(MYSQL_RES *result)
35373576
{
@@ -3558,6 +3597,8 @@ print_table_data(MYSQL_RES *result)
35583597
length= MY_MAX(length,field->max_length);
35593598
if (length < 4 && !IS_NOT_NULL(field->flags))
35603599
length=4; // Room for "NULL"
3600+
if (opt_binhex && is_binary_field(field))
3601+
length= 2 + length * 2;
35613602
field->max_length=length;
35623603
num_flag[mysql_field_tell(result) - 1]= IS_NUM(field->type);
35633604
separator.fill(separator.length()+length+2,'-');
@@ -3625,9 +3666,11 @@ print_table_data(MYSQL_RES *result)
36253666
many extra padding-characters we should send with the printing function.
36263667
*/
36273668
visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
3628-
extra_padding= data_length - visible_length;
3669+
extra_padding= (uint) (data_length - visible_length);
36293670

3630-
if (field_max_length > MAX_COLUMN_LENGTH)
3671+
if (opt_binhex && is_binary_field(field))
3672+
print_as_hex(PAGER, cur[off], lengths[off], field_max_length);
3673+
else if (field_max_length > MAX_COLUMN_LENGTH)
36313674
tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
36323675
else
36333676
{
@@ -3761,11 +3804,15 @@ print_table_data_html(MYSQL_RES *result)
37613804
if (interrupted_query)
37623805
break;
37633806
ulong *lengths=mysql_fetch_lengths(result);
3807+
field= mysql_fetch_fields(result);
37643808
(void) tee_fputs("<TR>", PAGER);
37653809
for (uint i=0; i < mysql_num_fields(result); i++)
37663810
{
37673811
(void) tee_fputs("<TD>", PAGER);
3768-
xmlencode_print(cur[i], lengths[i]);
3812+
if (opt_binhex && is_binary_field(&field[i]))
3813+
print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
3814+
else
3815+
xmlencode_print(cur[i], lengths[i]);
37693816
(void) tee_fputs("</TD>", PAGER);
37703817
}
37713818
(void) tee_fputs("</TR>", PAGER);
@@ -3801,7 +3848,10 @@ print_table_data_xml(MYSQL_RES *result)
38013848
if (cur[i])
38023849
{
38033850
tee_fprintf(PAGER, "\">");
3804-
xmlencode_print(cur[i], lengths[i]);
3851+
if (opt_binhex && is_binary_field(&fields[i]))
3852+
print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
3853+
else
3854+
xmlencode_print(cur[i], lengths[i]);
38053855
tee_fprintf(PAGER, "</field>\n");
38063856
}
38073857
else
@@ -3848,23 +3898,28 @@ print_table_data_vertically(MYSQL_RES *result)
38483898
{
38493899
unsigned int i;
38503900
const char *p;
3851-
3901+
if (opt_binhex && is_binary_field(field))
3902+
fprintf(PAGER, "0x");
38523903
for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1)
38533904
{
3854-
if (*p == '\0')
3855-
tee_putc((int)' ', PAGER);
3905+
if (opt_binhex && is_binary_field(field))
3906+
fprintf(PAGER, "%02X", *((uchar*)p));
38563907
else
3857-
tee_putc((int)*p, PAGER);
3908+
{
3909+
if (*p == '\0')
3910+
tee_putc((int)' ', PAGER);
3911+
else
3912+
tee_putc((int)*p, PAGER);
3913+
}
38583914
}
38593915
tee_putc('\n', PAGER);
38603916
}
3861-
else
3917+
else
38623918
tee_fprintf(PAGER, "NULL\n");
38633919
}
38643920
}
38653921
}
38663922

3867-
38683923
/* print_warnings should be called right after executing a statement */
38693924

38703925
static void print_warnings()
@@ -4001,11 +4056,19 @@ print_tab_data(MYSQL_RES *result)
40014056
while ((cur = mysql_fetch_row(result)))
40024057
{
40034058
lengths=mysql_fetch_lengths(result);
4004-
safe_put_field(cur[0],lengths[0]);
4059+
field= mysql_fetch_fields(result);
4060+
if (opt_binhex && is_binary_field(&field[0]))
4061+
print_as_hex(PAGER, cur[0], lengths[0], lengths[0]);
4062+
else
4063+
safe_put_field(cur[0],lengths[0]);
4064+
40054065
for (uint off=1 ; off < mysql_num_fields(result); off++)
40064066
{
40074067
(void) tee_fputs("\t", PAGER);
4008-
safe_put_field(cur[off], lengths[off]);
4068+
if (opt_binhex && field && is_binary_field(&field[off]))
4069+
print_as_hex(PAGER, cur[off], lengths[off], lengths[off]);
4070+
else
4071+
safe_put_field(cur[off], lengths[off]);
40094072
}
40104073
(void) tee_fputs("\n", PAGER);
40114074
}
@@ -4797,10 +4860,11 @@ com_status(String *buffer __attribute__((unused)),
47974860
tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
47984861
#endif
47994862

4800-
if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
4863+
const char *pos;
4864+
if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0] &&
4865+
(pos= strchr(status_str,' ')))
48014866
{
48024867
ulong sec;
4803-
const char *pos= strchr(status_str,' ');
48044868
/* print label */
48054869
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str);
48064870
if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec)))

client/mysql_upgrade.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2006, 2013, Oracle and/or its affiliates.
3-
Copyright (c) 2010, 2016, MariaDB
3+
Copyright (c) 2010, 2017, MariaDB
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -1130,15 +1130,15 @@ static int check_version_match(void)
11301130

11311131
int main(int argc, char **argv)
11321132
{
1133-
char self_name[FN_REFLEN];
1133+
char self_name[FN_REFLEN + 1];
11341134

11351135
MY_INIT(argv[0]);
11361136

11371137
#if __WIN__
11381138
if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
11391139
#endif
11401140
{
1141-
strncpy(self_name, argv[0], FN_REFLEN);
1141+
strmake_buf(self_name, argv[0]);
11421142
}
11431143

11441144
if (init_dynamic_string(&ds_args, "", 512, 256) ||
@@ -1171,6 +1171,8 @@ int main(int argc, char **argv)
11711171
{
11721172
int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL,
11731173
"mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE));
1174+
if (fd < 0)
1175+
die(NULL);
11741176
my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE));
11751177
my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE));
11761178
my_close(fd, MYF(0));

0 commit comments

Comments
 (0)