1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Merge remote-tracking branch 'mysql/5.5' into 5.5

This commit is contained in:
Sergei Golubchik
2017-07-18 14:59:10 +02:00
35 changed files with 530 additions and 112 deletions

View File

@ -149,7 +149,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
default_pager_set= 0, opt_sigint_ignore= 0, default_pager_set= 0, opt_sigint_ignore= 0,
auto_vertical_output= 0, auto_vertical_output= 0,
show_warnings= 0, executing_query= 0, show_warnings= 0, executing_query= 0,
ignore_spaces= 0, opt_progress_reports; ignore_spaces= 0, opt_binhex= 0, opt_progress_reports;
static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error; static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error;
static my_bool column_types_flag; static my_bool column_types_flag;
static my_bool preserve_comments= 0; static my_bool preserve_comments= 0;
@ -1460,6 +1460,8 @@ static struct my_option my_long_options[] =
{"batch", 'B', {"batch", 'B',
"Don't use history file. Disable interactive behavior. (Enables --silent.)", "Don't use history file. Disable interactive behavior. (Enables --silent.)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR, {"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", &charsets_dir, "Directory for character set files.", &charsets_dir,
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -3285,7 +3287,8 @@ com_go(String *buffer,char *line __attribute__((unused)))
print_table_data_html(result); print_table_data_html(result);
else if (opt_xml) else if (opt_xml)
print_table_data_xml(result); print_table_data_xml(result);
else if (vertical || (auto_vertical_output && (terminal_width < get_result_width(result)))) else if (vertical || (auto_vertical_output &&
(terminal_width < get_result_width(result))))
print_table_data_vertically(result); print_table_data_vertically(result);
else if (opt_silent && verbose <= 2 && !output_tables) else if (opt_silent && verbose <= 2 && !output_tables)
print_tab_data(result); print_tab_data(result);
@ -3504,6 +3507,41 @@ print_field_types(MYSQL_RES *result)
} }
/* Used to determine if we should invoke print_as_hex for this field */
static bool
is_binary_field(MYSQL_FIELD *field)
{
if ((field->charsetnr == 63) &&
(field->type == MYSQL_TYPE_BIT ||
field->type == MYSQL_TYPE_BLOB ||
field->type == MYSQL_TYPE_LONG_BLOB ||
field->type == MYSQL_TYPE_MEDIUM_BLOB ||
field->type == MYSQL_TYPE_TINY_BLOB ||
field->type == MYSQL_TYPE_VAR_STRING ||
field->type == MYSQL_TYPE_STRING ||
field->type == MYSQL_TYPE_VARCHAR ||
field->type == MYSQL_TYPE_GEOMETRY))
return 1;
return 0;
}
/* Print binary value as hex literal (0x ...) */
static void
print_as_hex(FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send)
{
const char *ptr= str, *end= ptr+len;
ulong i;
fprintf(output_file, "0x");
for(; ptr < end; ptr++)
fprintf(output_file, "%02X", *((uchar*)ptr));
for (i= 2*len+2; i < total_bytes_to_send; i++)
tee_putc((int)' ', output_file);
}
static void static void
print_table_data(MYSQL_RES *result) print_table_data(MYSQL_RES *result)
{ {
@ -3530,6 +3568,8 @@ print_table_data(MYSQL_RES *result)
length=max(length,field->max_length); length=max(length,field->max_length);
if (length < 4 && !IS_NOT_NULL(field->flags)) if (length < 4 && !IS_NOT_NULL(field->flags))
length=4; // Room for "NULL" length=4; // Room for "NULL"
if (opt_binhex && is_binary_field(field))
length= 2 + length * 2;
field->max_length=length; field->max_length=length;
num_flag[mysql_field_tell(result) - 1]= IS_NUM(field->type); num_flag[mysql_field_tell(result) - 1]= IS_NUM(field->type);
separator.fill(separator.length()+length+2,'-'); separator.fill(separator.length()+length+2,'-');
@ -3597,9 +3637,11 @@ print_table_data(MYSQL_RES *result)
many extra padding-characters we should send with the printing function. many extra padding-characters we should send with the printing function.
*/ */
visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length); visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
extra_padding= data_length - visible_length; extra_padding= (uint) (data_length - visible_length);
if (field_max_length > MAX_COLUMN_LENGTH) if (opt_binhex && is_binary_field(field))
print_as_hex(PAGER, cur[off], lengths[off], field_max_length);
else if (field_max_length > MAX_COLUMN_LENGTH)
tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE); tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
else else
{ {
@ -3732,11 +3774,15 @@ print_table_data_html(MYSQL_RES *result)
if (interrupted_query) if (interrupted_query)
break; break;
ulong *lengths=mysql_fetch_lengths(result); ulong *lengths=mysql_fetch_lengths(result);
field= mysql_fetch_fields(result);
(void) tee_fputs("<TR>", PAGER); (void) tee_fputs("<TR>", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++) for (uint i=0; i < mysql_num_fields(result); i++)
{ {
(void) tee_fputs("<TD>", PAGER); (void) tee_fputs("<TD>", PAGER);
xmlencode_print(cur[i], lengths[i]); if (opt_binhex && is_binary_field(&field[i]))
print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
else
xmlencode_print(cur[i], lengths[i]);
(void) tee_fputs("</TD>", PAGER); (void) tee_fputs("</TD>", PAGER);
} }
(void) tee_fputs("</TR>", PAGER); (void) tee_fputs("</TR>", PAGER);
@ -3772,7 +3818,10 @@ print_table_data_xml(MYSQL_RES *result)
if (cur[i]) if (cur[i])
{ {
tee_fprintf(PAGER, "\">"); tee_fprintf(PAGER, "\">");
xmlencode_print(cur[i], lengths[i]); if (opt_binhex && is_binary_field(&fields[i]))
print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
else
xmlencode_print(cur[i], lengths[i]);
tee_fprintf(PAGER, "</field>\n"); tee_fprintf(PAGER, "</field>\n");
} }
else else
@ -3819,23 +3868,28 @@ print_table_data_vertically(MYSQL_RES *result)
{ {
unsigned int i; unsigned int i;
const char *p; const char *p;
if (opt_binhex && is_binary_field(field))
fprintf(PAGER, "0x");
for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1) for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1)
{ {
if (*p == '\0') if (opt_binhex && is_binary_field(field))
tee_putc((int)' ', PAGER); fprintf(PAGER, "%02X", *((uchar*)p));
else else
tee_putc((int)*p, PAGER); {
if (*p == '\0')
tee_putc((int)' ', PAGER);
else
tee_putc((int)*p, PAGER);
}
} }
tee_putc('\n', PAGER); tee_putc('\n', PAGER);
} }
else else
tee_fprintf(PAGER, "NULL\n"); tee_fprintf(PAGER, "NULL\n");
} }
} }
} }
/* print_warnings should be called right after executing a statement */ /* print_warnings should be called right after executing a statement */
static void print_warnings() static void print_warnings()
@ -3972,11 +4026,19 @@ print_tab_data(MYSQL_RES *result)
while ((cur = mysql_fetch_row(result))) while ((cur = mysql_fetch_row(result)))
{ {
lengths=mysql_fetch_lengths(result); lengths=mysql_fetch_lengths(result);
safe_put_field(cur[0],lengths[0]); field= mysql_fetch_fields(result);
if (opt_binhex && is_binary_field(&field[0]))
print_as_hex(PAGER, cur[0], lengths[0], lengths[0]);
else
safe_put_field(cur[0],lengths[0]);
for (uint off=1 ; off < mysql_num_fields(result); off++) for (uint off=1 ; off < mysql_num_fields(result); off++)
{ {
(void) tee_fputs("\t", PAGER); (void) tee_fputs("\t", PAGER);
safe_put_field(cur[off], lengths[off]); if (opt_binhex && field && is_binary_field(&field[off]))
print_as_hex(PAGER, cur[off], lengths[off], lengths[off]);
else
safe_put_field(cur[off], lengths[off]);
} }
(void) tee_fputs("\n", PAGER); (void) tee_fputs("\n", PAGER);
} }

View File

@ -1,4 +1,5 @@
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2009, 2012, Oracle and/or its affiliates.
# Copyright (c) 2011, 2017, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -11,7 +12,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MACRO (CHANGE_SSL_SETTINGS string) MACRO (CHANGE_SSL_SETTINGS string)
SET(WITH_SSL ${string} CACHE STRING "Options are: no bundled yes(prefer os library if present otherwise use bundled) system(use os library)" FORCE) SET(WITH_SSL ${string} CACHE STRING "Options are: no bundled yes(prefer os library if present otherwise use bundled) system(use os library)" FORCE)
@ -87,7 +88,7 @@ MACRO (MYSQL_CHECK_SSL)
CHANGE_SSL_SETTINGS("system") CHANGE_SSL_SETTINGS("system")
ELSE() ELSE()
IF(WITH_SSL STREQUAL "system") IF(WITH_SSL STREQUAL "system")
MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support") MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support")
ENDIF() ENDIF()
MYSQL_USE_BUNDLED_SSL() MYSQL_USE_BUNDLED_SSL()
ENDIF() ENDIF()

View File

@ -1,5 +1,6 @@
/* /*
Copyright (c) 2001, 2013, Oracle and/or its affiliates. Copyright (c) 2001, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, Monty Program Ab. Copyright (c) 2010, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates /* Copyright (c) 2000, 2014, Oracle and/or its affiliates
Copyright (c) 2009, 2014, Monty Program Ab Copyright (c) 2009, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -4913,4 +4913,3 @@ ulong STDCALL mysql_net_field_length(uchar **packet)
{ {
return net_field_length(packet); return net_field_length(packet);
} }

View File

@ -2,7 +2,7 @@
# -*- cperl -*- # -*- cperl -*-
# Copyright (c) 2004, 2014, Oracle and/or its affiliates. # Copyright (c) 2004, 2014, Oracle and/or its affiliates.
# Copyright (c) 2009, 2014, Monty Program Ab # Copyright (c) 2009, 2017, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -0,0 +1,117 @@
USE test;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (c1 TINYBLOB,
c2 BLOB,
c3 MEDIUMBLOB,
c4 LONGBLOB,
c5 TEXT,
c6 BIT(1),
c7 CHAR,
c8 VARCHAR(10),
c9 GEOMETRY) CHARACTER SET = binary;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyblob,
`c2` blob,
`c3` mediumblob,
`c4` longblob,
`c5` blob,
`c6` bit(1) DEFAULT NULL,
`c7` binary(1) DEFAULT NULL,
`c8` varbinary(10) DEFAULT NULL,
`c9` geometry DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=binary
INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable',
'mediumblob-text readable', 'longblob-text readable',
'text readable', b'1', 'c', 'variable',
POINT(1, 1));
CREATE TABLE t2(id int, `col1` binary(10),`col2` blob);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) DEFAULT NULL,
`col1` binary(10) DEFAULT NULL,
`col2` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF');
#Print the table contents when binary-as-hex option is off.
SELECT * FROM t1;
c1 c2 c3 c4 c5 c6 c7 c8 c9
tinyblob-text readable blob-text readable mediumblob-text readable longblob-text readable text readable # c variable #
SELECT * FROM t2;
id col1 col2
1 # #
2 # #
#Print the table contents after turning on the binary-as-hex option
#Print the table contents in tab format
c1 c2 c3 c4 c5 c6 c7 c8 c9
0x74696E79626C6F622D74657874207265616461626C65 0x626C6F622D74657874207265616461626C65 0x6D656469756D626C6F622D74657874207265616461626C65 0x6C6F6E67626C6F622D74657874207265616461626C65 0x74657874207265616461626C65 0x01 0x63 0x7661726961626C65 0x000000000101000000000000000000F03F000000000000F03F
id col1 col2
1 0xAB123400000000000000 0x123ABC
2 0xDE123400000000000000 0x123DEF
#Print the table contents in table format
+------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+
| c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 | c9 |
+------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+
| 0x74696E79626C6F622D74657874207265616461626C65 | 0x626C6F622D74657874207265616461626C65 | 0x6D656469756D626C6F622D74657874207265616461626C65 | 0x6C6F6E67626C6F622D74657874207265616461626C65 | 0x74657874207265616461626C65 | 0x01 | 0x63 | 0x7661726961626C65 | 0x000000000101000000000000000000F03F000000000000F03F |
+------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+
+------+------------------------+------------+
| id | col1 | col2 |
+------+------------------------+------------+
| 1 | 0xAB123400000000000000 | 0x123ABC |
+------+------------------------+------------+
#Print the table contents vertically
*************************** 1. row ***************************
c1: 0x74696E79626C6F622D74657874207265616461626C65
c2: 0x626C6F622D74657874207265616461626C65
c3: 0x6D656469756D626C6F622D74657874207265616461626C65
c4: 0x6C6F6E67626C6F622D74657874207265616461626C65
c5: 0x74657874207265616461626C65
c6: 0x01
c7: 0x63
c8: 0x7661726961626C65
c9: 0x000000000101000000000000000000F03F000000000000F03F
#Print the table contents in xml format
<?xml version="1.0"?>
<resultset statement="SELECT * FROM t1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="c1">0x74696E79626C6F622D74657874207265616461626C65</field>
<field name="c2">0x626C6F622D74657874207265616461626C65</field>
<field name="c3">0x6D656469756D626C6F622D74657874207265616461626C65</field>
<field name="c4">0x6C6F6E67626C6F622D74657874207265616461626C65</field>
<field name="c5">0x74657874207265616461626C65</field>
<field name="c6">0x01</field>
<field name="c7">0x63</field>
<field name="c8">0x7661726961626C65</field>
<field name="c9">0x000000000101000000000000000000F03F000000000000F03F</field>
</row>
</resultset>
<?xml version="1.0"?>
<resultset statement="SELECT * FROM t2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="id">1</field>
<field name="col1">0xAB123400000000000000</field>
<field name="col2">0x123ABC</field>
</row>
<row>
<field name="id">2</field>
<field name="col1">0xDE123400000000000000</field>
<field name="col2">0x123DEF</field>
</row>
</resultset>
#Print the table contents in html format
<TABLE BORDER=1><TR><TH>c1</TH><TH>c2</TH><TH>c3</TH><TH>c4</TH><TH>c5</TH><TH>c6</TH><TH>c7</TH><TH>c8</TH><TH>c9</TH></TR><TR><TD>0x74696E79626C6F622D74657874207265616461626C65</TD><TD>0x626C6F622D74657874207265616461626C65</TD><TD>0x6D656469756D626C6F622D74657874207265616461626C65</TD><TD>0x6C6F6E67626C6F622D74657874207265616461626C65</TD><TD>0x74657874207265616461626C65</TD><TD>0x01</TD><TD>0x63</TD><TD>0x7661726961626C65</TD><TD>0x000000000101000000000000000000F03F000000000000F03F</TD></TR></TABLE><TABLE BORDER=1><TR><TH>id</TH><TH>col1</TH><TH>col2</TH></TR><TR><TD>1</TD><TD>0xAB123400000000000000</TD><TD>0x123ABC</TD></TR><TR><TD>2</TD><TD>0xDE123400000000000000</TD><TD>0x123DEF</TD></TR></TABLE>DROP TABLE t1, t2;

View File

@ -0,0 +1,29 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 (c1) VALUES (1);
include/stop_slave_sql.inc
FLUSH LOGS;
FLUSH LOGS;
INSERT INTO t1 (c1) VALUES (2);
include/sync_slave_io_with_master.inc
call mtr.add_suppression("File '.*slave-relay-bin.");
call mtr.add_suppression("Could not open log file");
call mtr.add_suppression("Failed to open the relay log");
call mtr.add_suppression("Failed to initialize the master info structure");
include/rpl_stop_server.inc [server_number=2]
# Removing file(s)
include/rpl_start_server.inc [server_number=2]
START SLAVE;
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MariaDB error log
START SLAVE;
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MariaDB error log
RESET SLAVE;
DROP TABLE t1;
START SLAVE UNTIL MASTER_LOG_FILE= 'MASTER_LOG_FILE', MASTER_LOG_POS= MASTER_LOG_POS;;
include/wait_for_slave_sql_to_stop.inc
include/stop_slave_io.inc
include/start_slave.inc
include/diff_tables.inc [master:t1, slave:t1]
DROP TABLE t1;
include/rpl_end.inc

View File

@ -0,0 +1,91 @@
###############################################################################
# Bug#24901077: RESET SLAVE ALL DOES NOT ALWAYS RESET SLAVE
#
# Problem:
# =======
# If you have a relay log index file that has ended up with
# some relay log files that do not exists, then RESET SLAVE
# ALL is not enough to get back to a clean state.
###############################################################################
# Remove all slave-relay-bin.0* files (do not remove slave-relay-bin.index)
# During server restart rli initialization will fail as there are no
# relay logs. In case of bug RESET SLAVE will not do the required clean up
# as rli is not inited and subsequent START SLAVE will fail.
# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found"
# because it is different on Unix and Windows systems.
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
--connection master
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 (c1) VALUES (1);
--sync_slave_with_master
--connection slave
--source include/stop_slave_sql.inc
--let $MYSQLD_SLAVE_DATADIR= `select @@datadir`
--connection master
# Generate more relay logs on slave.
FLUSH LOGS;
FLUSH LOGS;
INSERT INTO t1 (c1) VALUES (2);
--source include/sync_slave_io_with_master.inc
call mtr.add_suppression("File '.*slave-relay-bin.");
call mtr.add_suppression("Could not open log file");
call mtr.add_suppression("Failed to open the relay log");
call mtr.add_suppression("Failed to initialize the master info structure");
# Stop slave
--let $rpl_server_number= 2
--source include/rpl_stop_server.inc
# Delete file(s)
--echo # Removing $remove_pattern file(s)
--let $remove_pattern= slave-relay-bin.0*
--remove_files_wildcard $MYSQLD_SLAVE_DATADIR $remove_pattern
# Start slave
--let $rpl_server_number= 2
--source include/rpl_start_server.inc
# Start slave must fail because of the removed file(s).
--error ER_MASTER_INFO
START SLAVE;
# Try a second time, it must fail again.
--error ER_MASTER_INFO
START SLAVE;
# Retrieve master executed position before reset slave.
--let $master_exec_file= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1)
--let $master_exec_pos= query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1)
# Reset slave.
# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found"
# because it is different on Unix and Windows systems.
--disable_warnings
RESET SLAVE;
--enable_warnings
DROP TABLE t1;
--replace_result $master_exec_file MASTER_LOG_FILE $master_exec_pos MASTER_LOG_POS
--eval START SLAVE UNTIL MASTER_LOG_FILE= '$master_exec_file', MASTER_LOG_POS= $master_exec_pos;
--source include/wait_for_slave_sql_to_stop.inc
--source include/stop_slave_io.inc
# Start slave.
--source include/start_slave.inc
--connection master
--sync_slave_with_master
# Check consistency.
--let $diff_tables= master:t1, slave:t1
--source include/diff_tables.inc
# Cleanup
--connection master
DROP TABLE t1;
--sync_slave_with_master
--source include/rpl_end.inc

View File

@ -0,0 +1,76 @@
# === Purpose ===
# The purpose of this test case is to make
# sure that the binary data in tables is printed
# as hex when the option binary-as-hex is enabled.
#
# === Related bugs and/or worklogs ===
# Bug #25340722 - PRINT BINARY DATA AS HEX IN THE MYSQL
# CLIENT (CONTRIBUTION)
#
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--source include/not_embedded.inc
USE test;
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (c1 TINYBLOB,
c2 BLOB,
c3 MEDIUMBLOB,
c4 LONGBLOB,
c5 TEXT,
c6 BIT(1),
c7 CHAR,
c8 VARCHAR(10),
c9 GEOMETRY) CHARACTER SET = binary;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable',
'mediumblob-text readable', 'longblob-text readable',
'text readable', b'1', 'c', 'variable',
POINT(1, 1));
CREATE TABLE t2(id int, `col1` binary(10),`col2` blob);
SHOW CREATE TABLE t2;
INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF');
--echo #Print the table contents when binary-as-hex option is off.
--replace_column 6 # 9 #
SELECT * FROM t1;
--replace_column 2 # 3 #
SELECT * FROM t2;
--echo #Print the table contents after turning on the binary-as-hex option
--echo
--echo #Print the table contents in tab format
--echo
--exec $MYSQL test --binary-as-hex -e "SELECT * FROM t1; SELECT * FROM t2;"
--echo
--echo #Print the table contents in table format
--echo
--exec $MYSQL test --binary-as-hex --table -e "SELECT * FROM t1; SELECT * FROM t2 WHERE col2=0x123ABC;"
--echo
--echo #Print the table contents vertically
--echo
--exec $MYSQL test --binary-as-hex --vertical -e "SELECT * FROM t1;"
--echo
--echo #Print the table contents in xml format
--echo
--exec $MYSQL test --binary-as-hex --xml -e "SELECT * FROM t1; SELECT * FROM t2;"
--echo
--echo #Print the table contents in html format
--echo
--exec $MYSQL test --binary-as-hex --html -e "SELECT * FROM t1; SELECT * FROM t2;"
#Cleanup
DROP TABLE t1, t2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,4 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2017, Oracle and/or its affiliates.
# Copyright (c) 2011, 2017, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -95,6 +96,13 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
ENDFOREACH() ENDFOREACH()
ENDIF() ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
SET (PERL_PATH "/usr/local/bin/perl")
ELSE()
SET (PERL_PATH "/usr/bin/perl")
ENDIF()
IF(UNIX) IF(UNIX)
# FIND_PROC and CHECK_PID are used by mysqld_safe # FIND_PROC and CHECK_PID are used by mysqld_safe
IF(CMAKE_SYSTEM_NAME MATCHES "Linux") IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
@ -379,4 +387,3 @@ IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_FLAGS MATCHES "-static")
COMPONENT Development) COMPONENT Development)
ENDIF() ENDIF()
ENDIF() ENDIF()

8
scripts/dheadgen.pl Executable file → Normal file
View File

@ -1,10 +1,4 @@
#!/usr/bin/perl -w # Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
#
# Copyright (c) 2008, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl #!@PERL_PATH@
# -*- cperl -*- # -*- cperl -*-
# #
# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,5 @@
#!/usr/bin/perl #!@PERL_PATH@
# Copyright (c) 2000-2002, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc. # Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
# Use is subject to license terms.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,5 @@
#!/usr/bin/perl #!@PERL_PATH@
# Copyright (c) 2000, 2004, 2006 MySQL AB, 2009 Sun Microsystems, Inc. # Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
# Use is subject to license terms.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,6 @@
#!/usr/bin/perl #!@PERL_PATH@
# Copyright (c) 2001 MySQL AB, 2009 Sun Microsystems, Inc. # Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
# Use is subject to license terms.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl #!@PERL_PATH@
# -*- cperl -*- # -*- cperl -*-
# #
# Copyright (c) 2007, 2013, Oracle and/or its affiliates. # Copyright (c) 2007, 2017, Oracle and/or its affiliates.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl #!@PERL_PATH@
# -*- cperl -*- # -*- cperl -*-
# #
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. # Copyright (c) 2007, 2017, Oracle and/or its affiliates.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -388,6 +388,3 @@ Thanks for using MySQL!
HERE HERE

View File

@ -1,8 +1,7 @@
#!/usr/bin/perl #!@PERL_PATH@
## Emacs, this is -*- perl -*- mode? :-) ## Emacs, this is -*- perl -*- mode? :-)
# Copyright (c) 2000, 2007 MySQL AB, 2009 Sun Microsystems, Inc. # Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
# Use is subject to license terms.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public

View File

@ -1,6 +1,5 @@
#!/usr/bin/perl #!@PERL_PATH@
# Copyright (c) 2000-2002, 2004, 2006 MySQL AB, 2009 Sun Microsystems, Inc. # Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
# Use is subject to license terms.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl #!@PERL_PATH@
# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public
@ -477,15 +477,22 @@ MySQLaccess::Report::Print_Header();
# ***************************** # *****************************
# Read configuration-file # Read configuration-file
MySQLaccess::Debug::Print(1, "Reading configuration file..."); MySQLaccess::Debug::Print(1, "Reading configuration file...");
if (-f "./$script_conf") { if (-f "@sysconfdir@/$script_conf") {
require "./$script_conf"; print "Configuration file '$script_conf' is found in '@sysconfdir@/'\n";
}
elsif (-f "@sysconfdir@/$script_conf") {
require "@sysconfdir@/$script_conf"; require "@sysconfdir@/$script_conf";
} }
elsif (-f "/etc/$script_conf") { elsif (-f "/etc/$script_conf") {
print "Configuration file '$script_conf' is found in '/etc/'\n";
require "/etc/$script_conf"; require "/etc/$script_conf";
} }
elsif (-f "./$script_conf") {
print "\nERROR! Configuration file '$script_conf' is found in the current ";
print "directory.\nThe permissible locations for this file are either ";
print "@sysconfdir@/ or /etc/\n";
print "Please move it to one of these locations and retry.\n\n";
exit 0;
}
# **************************** # ****************************
# Read in all parameters # Read in all parameters

View File

@ -1,23 +1,7 @@
#!/usr/bin/perl #!@PERL_PATH@
# Copyright (c) 2000, 2010, Oracle and/or its affiliates.
# Copyright (c) 2000-2011 Monty Program Ab, Jani Tolonen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; version 2
# of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA
# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2000, 2017, Oracle and/or its affiliates.
# Copyright (c) 2010, 2017, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public

View File

@ -1,7 +1,6 @@
#!/usr/bin/perl #!@PERL_PATH@
# Copyright (c) 2000-2002, 2005-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc. # Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
# Use is subject to license terms.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl #!@PERL_PATH@
# Copyright (c) 2000, 2010, Oracle and/or its affiliates # Copyright (c) 2000, 2017, Oracle and/or its affiliates.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2012, 2016, MariaDB Copyright (c) 2012, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,6 @@
/* /*
Copyright (c) 2000, 2010, Oracle and/or its affiliates. Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2012, Oracle and/or its affiliates. /* Copyright (c) 2006, 2017, Oracle and/or its affiliates.
Copyright (c) 2010, 2011, Monty Program Ab Copyright (c) 2010, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -548,7 +548,6 @@ void end_master_info(Master_info* mi)
if (!mi->inited) if (!mi->inited)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
end_relay_log_info(&mi->rli);
if (mi->fd >= 0) if (mi->fd >= 0)
{ {
end_io_cache(&mi->file); end_io_cache(&mi->file);

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. /* Copyright (c) 2006, 2017, Oracle and/or its affiliates.
Copyright (c) 2011, 2013, Monty Program Ab Copyright (c) 2011, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -42,7 +42,8 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id), no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id),
info_fd(-1), cur_log_fd(-1), relay_log(&sync_relaylog_period), info_fd(-1), cur_log_fd(-1), relay_log(&sync_relaylog_period),
sync_counter(0), is_relay_log_recovery(is_slave_recovery), sync_counter(0), is_relay_log_recovery(is_slave_recovery),
save_temporary_tables(0), cur_log_old_open_count(0), group_relay_log_pos(0), save_temporary_tables(0), cur_log_old_open_count(0),
error_on_rli_init_info(false), group_relay_log_pos(0),
event_relay_log_pos(0), event_relay_log_pos(0),
#if HAVE_valgrind #if HAVE_valgrind
is_fake(FALSE), is_fake(FALSE),
@ -112,7 +113,7 @@ int init_relay_log_info(Relay_log_info* rli,
const char* info_fname) const char* info_fname)
{ {
char fname[FN_REFLEN+128]; char fname[FN_REFLEN+128];
int info_fd; int info_fd= -1;
const char* msg = 0; const char* msg = 0;
int error = 0; int error = 0;
DBUG_ENTER("init_relay_log_info"); DBUG_ENTER("init_relay_log_info");
@ -122,6 +123,8 @@ int init_relay_log_info(Relay_log_info* rli,
DBUG_RETURN(0); DBUG_RETURN(0);
fn_format(fname, info_fname, mysql_data_home, "", 4+32); fn_format(fname, info_fname, mysql_data_home, "", 4+32);
mysql_mutex_lock(&rli->data_lock); mysql_mutex_lock(&rli->data_lock);
if (rli->error_on_rli_init_info)
goto err;
info_fd = rli->info_fd; info_fd = rli->info_fd;
rli->cur_log_fd = -1; rli->cur_log_fd = -1;
rli->slave_skip_counter=0; rli->slave_skip_counter=0;
@ -358,11 +361,14 @@ Failed to open the existing relay log info file '%s' (errno %d)",
goto err; goto err;
} }
rli->inited= 1; rli->inited= 1;
rli->error_on_rli_init_info= false;
mysql_mutex_unlock(&rli->data_lock); mysql_mutex_unlock(&rli->data_lock);
DBUG_RETURN(error); DBUG_RETURN(error);
err: err:
sql_print_error("%s", msg); rli->error_on_rli_init_info= true;
if (msg)
sql_print_error("%s", msg);
end_io_cache(&rli->info_file); end_io_cache(&rli->info_file);
if (info_fd >= 0) if (info_fd >= 0)
mysql_file_close(info_fd, MYF(0)); mysql_file_close(info_fd, MYF(0));
@ -947,6 +953,8 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
const char** errmsg) const char** errmsg)
{ {
int error=0; int error=0;
const char *ln;
char name_buf[FN_REFLEN];
DBUG_ENTER("purge_relay_logs"); DBUG_ENTER("purge_relay_logs");
/* /*
@ -973,12 +981,34 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
if (!rli->inited) if (!rli->inited)
{ {
DBUG_PRINT("info", ("rli->inited == 0")); DBUG_PRINT("info", ("rli->inited == 0"));
DBUG_RETURN(0); if (rli->error_on_rli_init_info)
{
ln= rli->relay_log.generate_name(opt_relay_logname, "-relay-bin",
1, name_buf);
if (rli->relay_log.open_index_file(opt_relaylog_index_name, ln, TRUE))
{
sql_print_error("Unable to purge relay log files. Failed to open relay "
"log index file:%s.", rli->relay_log.get_index_fname());
DBUG_RETURN(1);
}
if (rli->relay_log.open(ln, LOG_BIN, 0, SEQ_READ_APPEND, 0,
(max_relay_log_size ? max_relay_log_size :
max_binlog_size), 1, TRUE))
{
sql_print_error("Unable to purge relay log files. Failed to open relay "
"log file:%s.", rli->relay_log.get_log_fname());
DBUG_RETURN(1);
}
}
else
DBUG_RETURN(0);
}
else
{
DBUG_ASSERT(rli->slave_running == 0);
DBUG_ASSERT(rli->mi->slave_running == 0);
} }
DBUG_ASSERT(rli->slave_running == 0);
DBUG_ASSERT(rli->mi->slave_running == 0);
rli->slave_skip_counter=0; rli->slave_skip_counter=0;
mysql_mutex_lock(&rli->data_lock); mysql_mutex_lock(&rli->data_lock);
@ -1016,6 +1046,8 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
rli->group_relay_log_pos, rli->group_relay_log_pos,
0 /* do not need data lock */, errmsg, 0); 0 /* do not need data lock */, errmsg, 0);
if (!rli->inited && rli->error_on_rli_init_info)
rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
err: err:
#ifndef DBUG_OFF #ifndef DBUG_OFF
char buf[22]; char buf[22];

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2005, 2012, Oracle and/or its affiliates. /* Copyright (c) 2005, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -154,7 +155,14 @@ public:
a different log under our feet a different log under our feet
*/ */
uint32 cur_log_old_open_count; uint32 cur_log_old_open_count;
/*
If on init_info() call error_on_rli_init_info is true that means
that previous call to init_info() terminated with an error, RESET
SLAVE must be executed and the problem fixed manually.
*/
bool error_on_rli_init_info;
/* /*
Let's call a group (of events) : Let's call a group (of events) :
- a transaction - a transaction

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -880,6 +880,7 @@ void close_active_mi()
if (active_mi) if (active_mi)
{ {
end_master_info(active_mi); end_master_info(active_mi);
end_relay_log_info(&active_mi->rli);
delete active_mi; delete active_mi;
active_mi= 0; active_mi= 0;
} }
@ -4600,6 +4601,7 @@ void end_relay_log_info(Relay_log_info* rli)
{ {
DBUG_ENTER("end_relay_log_info"); DBUG_ENTER("end_relay_log_info");
rli->error_on_rli_init_info= false;
if (!rli->inited) if (!rli->inited)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
if (rli->info_fd >= 0) if (rli->info_fd >= 0)

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -839,14 +839,18 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
(lex->sql_command == SQLCOM_CREATE_TABLE) && (lex->sql_command == SQLCOM_CREATE_TABLE) &&
(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE); (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE);
const my_bool create_real_tables=
(lex->sql_command == SQLCOM_CREATE_TABLE) &&
!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE);
const my_bool drop_temp_tables= const my_bool drop_temp_tables=
(lex->sql_command == SQLCOM_DROP_TABLE) && (lex->sql_command == SQLCOM_DROP_TABLE) &&
lex->drop_temporary; lex->drop_temporary;
const my_bool update_real_tables= const my_bool update_real_tables=
some_non_temp_table_to_be_updated(thd, all_tables) && ((create_real_tables ||
!(create_temp_tables || drop_temp_tables); some_non_temp_table_to_be_updated(thd, all_tables)) &&
!(create_temp_tables || drop_temp_tables));
const my_bool create_or_drop_databases= const my_bool create_or_drop_databases=
(lex->sql_command == SQLCOM_CREATE_DB) || (lex->sql_command == SQLCOM_CREATE_DB) ||

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2014, SkySQL Ab. Copyright (c) 2008, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -1487,6 +1487,7 @@ int reset_slave(THD *thd, Master_info* mi)
// close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0 // close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0
end_master_info(mi); end_master_info(mi);
end_relay_log_info(&mi->rli);
// and delete these two files // and delete these two files
fn_format(fname, master_info_file, mysql_data_home, "", 4+32); fn_format(fname, master_info_file, mysql_data_home, "", 4+32);
if (mysql_file_stat(key_file_master_info, fname, &stat_area, MYF(0)) && if (mysql_file_stat(key_file_master_info, fname, &stat_area, MYF(0)) &&

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, SkySQL Ab. Copyright (c) 2010, 2017, Corporation
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -362,6 +362,19 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
Item *item_tmp; Item *item_tmp;
while ((item_tmp= it++)) while ((item_tmp= it++))
{ {
/*
If the outer query has a GROUP BY clause, an outer reference to this
query block may have been wrapped in a Item_outer_ref, which has not
been fixed yet. An Item_type_holder must be created based on a fixed
Item, so use the inner Item instead.
*/
DBUG_ASSERT(item_tmp->fixed ||
(item_tmp->type() == Item::REF_ITEM &&
((Item_ref *)(item_tmp))->ref_type() ==
Item_ref::OUTER_REF));
if (!item_tmp->fixed)
item_tmp= item_tmp->real_item();
/* Error's in 'new' will be detected after loop */ /* Error's in 'new' will be detected after loop */
types.push_back(new Item_type_holder(thd_arg, item_tmp)); types.push_back(new Item_type_holder(thd_arg, item_tmp));
} }
@ -1070,4 +1083,3 @@ void st_select_lex_unit::set_unique_exclude()
} }
} }
} }