Skip to content

Commit

Permalink
Merge branch 'mysql/5.5' into 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Oct 23, 2018
2 parents 55fc3fb + bac287c commit f9e5195
Show file tree
Hide file tree
Showing 89 changed files with 14,043 additions and 3,427 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ storage/mroonga/vendor/groonga/src/grnslap
storage/mroonga/vendor/groonga/src/groonga
storage/mroonga/vendor/groonga/src/groonga-benchmark
storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset
zlib/zconf.h

# macOS garbage
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2006, 2017, Oracle and/or its affiliates.
# Copyright (c) 2008, 2017, MariaDB
# Copyright (c) 2008, 2018, MariaDB Corporation
#
# 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
Expand Down
1 change: 1 addition & 0 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2008, 2018, MariaDB Corporation
#
# 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
Expand Down
6 changes: 3 additions & 3 deletions client/mysql.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB Corporation
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
Expand Down Expand Up @@ -1459,7 +1459,7 @@ static struct my_option my_long_options[] =
{"batch", 'B',
"Don't use history file. Disable interactive behavior. (Enables --silent.)",
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,
{"binary-as-hex", 0, "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,
"Directory for character set files.", &charsets_dir,
Expand Down
3 changes: 2 additions & 1 deletion cmake/plugin.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2018, Oracle and/or its affiliates.
# Copyright (c) 2011, 2018, MariaDB Corporation
#
# 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
Expand Down
18 changes: 5 additions & 13 deletions cmake/zlib.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
#
# 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
Expand All @@ -14,15 +14,12 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

MACRO (MYSQL_USE_BUNDLED_ZLIB)
SET(ZLIB_LIBRARY zlib)
SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib)
SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib)
SET(BUILD_BUNDLED_ZLIB 1)
SET(ZLIB_LIBRARY zlib CACHE INTERNAL "Bundled zlib library")
SET(ZLIB_FOUND TRUE)
SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled zlib")
ADD_SUBDIRECTORY(zlib)
GET_TARGET_PROPERTY(src zlib SOURCES)
FOREACH(file ${src})
SET(ZLIB_SOURCES ${ZLIB_SOURCES} ${CMAKE_SOURCE_DIR}/zlib/${file})
ENDFOREACH()
ENDMACRO()

# MYSQL_CHECK_ZLIB_WITH_COMPRESS
Expand All @@ -37,15 +34,10 @@ ENDMACRO()

MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)

IF(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR
CMAKE_SYSTEM_NAME STREQUAL "AIX" OR
CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Use bundled zlib on some platforms by default (system one is too
# old or not existent)
# For NDBCLUSTER: Use bundled zlib by default
IF (NOT WITH_ZLIB)
SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
ENDIF()
ENDIF()

IF(WITH_ZLIB STREQUAL "bundled")
MYSQL_USE_BUNDLED_ZLIB()
Expand Down
2 changes: 1 addition & 1 deletion libmysqld/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2006, 2011, Oracle and/or its affiliates.
# Copyright (c) 2009, 2018, MariaDB Corporation
#
# 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
Expand Down Expand Up @@ -183,4 +184,3 @@ IF(NOT DISABLE_SHARED)
ENDIF()
ENDIF()
ENDIF()

50 changes: 50 additions & 0 deletions mysql-test/r/alter_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -1392,3 +1392,53 @@ t1 CREATE TABLE `t1` (
`consultant_id` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
DROP TABLE t1;
#
# BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATA LOSS
#
SET GLOBAL max_allowed_packet=17825792;
CREATE TABLE t1 (t1_fld1 TEXT);
CREATE TABLE t2 (t2_fld1 MEDIUMTEXT);
CREATE TABLE t3 (t3_fld1 LONGTEXT);
INSERT INTO t1 VALUES (REPEAT('a',300));
INSERT INTO t2 VALUES (REPEAT('b',65680));
INSERT INTO t3 VALUES (REPEAT('c',16777300));
SELECT LENGTH(t1_fld1) FROM t1;
LENGTH(t1_fld1)
300
SELECT LENGTH(t2_fld1) FROM t2;
LENGTH(t2_fld1)
65680
SELECT LENGTH(t3_fld1) FROM t3;
LENGTH(t3_fld1)
16777300
# With strict mode
SET SQL_MODE='STRICT_ALL_TABLES';
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
ERROR 22001: Data too long for column 'my_t1_fld1' at row 1
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
ERROR 22001: Data too long for column 'my_t2_fld1' at row 1
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
ERROR 22001: Data too long for column 'my_t3_fld1' at row 1
# With non-strict mode
SET SQL_MODE='';
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
Warnings:
Warning 1265 Data truncated for column 'my_t1_fld1' at row 1
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
Warnings:
Warning 1265 Data truncated for column 'my_t2_fld1' at row 1
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
Warnings:
Warning 1265 Data truncated for column 'my_t3_fld1' at row 1
SELECT LENGTH(my_t1_fld1) FROM t1;
LENGTH(my_t1_fld1)
255
SELECT LENGTH(my_t2_fld1) FROM t2;
LENGTH(my_t2_fld1)
65535
SELECT LENGTH(my_t3_fld1) FROM t3;
LENGTH(my_t3_fld1)
16777215
DROP TABLE t1, t2, t3;
SET SQL_MODE=default;
SET GLOBAL max_allowed_packet=default;
12 changes: 6 additions & 6 deletions mysql-test/suite/perfschema/r/relaylog.result
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ from performance_schema.file_summary_by_instance
where file_name like "%master-%" order by file_name;
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
master-bin.000001 wait/io/file/sql/binlog MANY MANY MANY MANY
master-bin.index wait/io/file/sql/binlog_index NONE MANY NONE MANY
master-bin.index wait/io/file/sql/binlog_index MANY MANY MANY MANY
select * from performance_schema.file_summary_by_instance
where file_name like "%slave-%" order by file_name;
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
Expand All @@ -36,7 +36,7 @@ from performance_schema.file_summary_by_instance
where event_name like "%binlog%" order by file_name;
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
master-bin.000001 wait/io/file/sql/binlog MANY MANY MANY MANY
master-bin.index wait/io/file/sql/binlog_index NONE MANY NONE MANY
master-bin.index wait/io/file/sql/binlog_index MANY MANY MANY MANY
select
EVENT_NAME,
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
Expand All @@ -47,7 +47,7 @@ from performance_schema.file_summary_by_event_name
where event_name like "%binlog%" order by event_name;
EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
wait/io/file/sql/binlog MANY MANY MANY MANY
wait/io/file/sql/binlog_index NONE MANY NONE MANY
wait/io/file/sql/binlog_index MANY MANY MANY MANY
select
EVENT_NAME,
if (count_star > 0, "MANY", "NONE") as COUNT_STAR
Expand Down Expand Up @@ -95,7 +95,7 @@ where file_name like "%slave-%"
order by file_name;
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
slave-bin.000001 wait/io/file/sql/binlog MANY MANY MANY MANY
slave-bin.index wait/io/file/sql/binlog_index NONE MANY NONE MANY
slave-bin.index wait/io/file/sql/binlog_index MANY MANY MANY MANY
slave-relay-bin.000001 wait/io/file/sql/relaylog MANY MANY MANY MANY
slave-relay-bin.000002 wait/io/file/sql/relaylog MANY MANY MANY MANY
slave-relay-bin.index wait/io/file/sql/relaylog_index MANY MANY MANY MANY
Expand All @@ -111,7 +111,7 @@ from performance_schema.file_summary_by_instance
where event_name like "%binlog%" order by file_name;
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
slave-bin.000001 wait/io/file/sql/binlog MANY MANY MANY MANY
slave-bin.index wait/io/file/sql/binlog_index NONE MANY NONE MANY
slave-bin.index wait/io/file/sql/binlog_index MANY MANY MANY MANY
select
EVENT_NAME,
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
Expand All @@ -122,7 +122,7 @@ from performance_schema.file_summary_by_event_name
where event_name like "%binlog%" order by event_name;
EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
wait/io/file/sql/binlog MANY MANY MANY MANY
wait/io/file/sql/binlog_index NONE MANY NONE MANY
wait/io/file/sql/binlog_index MANY MANY MANY MANY
select
EVENT_NAME,
if (count_star > 0, "MANY", "NONE") as COUNT_STAR
Expand Down
50 changes: 50 additions & 0 deletions mysql-test/t/alter_table.test
Original file line number Diff line number Diff line change
Expand Up @@ -1272,3 +1272,53 @@ ALTER COLUMN `consultant_id` DROP DEFAULT,
MODIFY COLUMN `consultant_id` BIGINT;
SHOW CREATE TABLE t1;
DROP TABLE t1;

--echo #
--echo # BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATA LOSS
--echo #

SET GLOBAL max_allowed_packet=17825792;

--connect(con1, localhost, root,,)
CREATE TABLE t1 (t1_fld1 TEXT);
CREATE TABLE t2 (t2_fld1 MEDIUMTEXT);
CREATE TABLE t3 (t3_fld1 LONGTEXT);

INSERT INTO t1 VALUES (REPEAT('a',300));
INSERT INTO t2 VALUES (REPEAT('b',65680));
INSERT INTO t3 VALUES (REPEAT('c',16777300));

SELECT LENGTH(t1_fld1) FROM t1;
SELECT LENGTH(t2_fld1) FROM t2;
SELECT LENGTH(t3_fld1) FROM t3;

--echo # With strict mode
SET SQL_MODE='STRICT_ALL_TABLES';

--error ER_DATA_TOO_LONG
ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
--error ER_DATA_TOO_LONG
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
--error ER_DATA_TOO_LONG
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;

--echo # With non-strict mode
SET SQL_MODE='';

ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;

SELECT LENGTH(my_t1_fld1) FROM t1;
SELECT LENGTH(my_t2_fld1) FROM t2;
SELECT LENGTH(my_t3_fld1) FROM t3;

# Cleanup
--disconnect con1
--source include/wait_until_disconnected.inc

--connection default
DROP TABLE t1, t2, t3;

SET SQL_MODE=default;
SET GLOBAL max_allowed_packet=default;
1 change: 1 addition & 0 deletions mysys/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates
# Copyright (c) 2009, 2018, MariaDB Corporation
#
# 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
Expand Down
17 changes: 9 additions & 8 deletions mysys/mf_iocache2.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB Corporation
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
Expand Down Expand Up @@ -102,14 +103,14 @@ my_off_t my_b_append_tell(IO_CACHE* info)
*/
{
volatile my_off_t save_pos;
save_pos = my_tell(info->file,MYF(0));
my_seek(info->file,(my_off_t)0,MY_SEEK_END,MYF(0));
save_pos = mysql_file_tell(info->file,MYF(0));
mysql_file_seek(info->file,(my_off_t)0,MY_SEEK_END,MYF(0));
/*
Save the value of my_tell in res so we can see it when studying coredump
*/
DBUG_ASSERT(info->end_of_file - (info->append_read_pos-info->write_buffer)
== (res=my_tell(info->file,MYF(0))));
my_seek(info->file,save_pos,MY_SEEK_SET,MYF(0));
== (res=mysql_file_tell(info->file,MYF(0))));
mysql_file_seek(info->file,save_pos,MY_SEEK_SET,MYF(0));
}
#endif
res = info->end_of_file + (info->write_pos-info->append_read_pos);
Expand Down Expand Up @@ -203,7 +204,7 @@ size_t my_b_fill(IO_CACHE *info)

if (info->seek_not_done)
{ /* File touched, do seek */
if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) ==
if (mysql_file_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) ==
MY_FILEPOS_ERROR)
{
info->error= 0;
Expand All @@ -223,7 +224,7 @@ size_t my_b_fill(IO_CACHE *info)
}
DBUG_EXECUTE_IF ("simulate_my_b_fill_error",
{DBUG_SET("+d,simulate_file_read_error");});
if ((length= my_read(info->file,info->buffer,max_length,
if ((length= mysql_file_read(info->file,info->buffer,max_length,
info->myflags)) == (size_t) -1)
{
info->error= -1;
Expand Down Expand Up @@ -287,7 +288,7 @@ my_off_t my_b_filelength(IO_CACHE *info)
return my_b_tell(info);

info->seek_not_done= 1;
return my_seek(info->file, 0L, MY_SEEK_END, MYF(0));
return mysql_file_seek(info->file, 0L, MY_SEEK_END, MYF(0));
}


Expand Down
2 changes: 1 addition & 1 deletion sql/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates.
# Copyright (c) 2010, 2018, MariaDB
# Copyright (c) 2010, 2018, MariaDB Corporation
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion sql/field_conv.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
Copyright (c) 2010, 2018, MariaDB Corporation
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
Expand Down
22 changes: 18 additions & 4 deletions storage/heap/hp_create.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, SkySQL Ab.
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2010, 2018, MariaDB Corporation
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
Expand Down Expand Up @@ -98,7 +98,14 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
/* fall through */
case HA_KEYTYPE_VARTEXT1:
keyinfo->flag|= HA_VAR_LENGTH_KEY;
length+= 2;
/*
For BTREE algorithm, key length, greater than or equal
to 255, is packed on 3 bytes.
*/
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
length+= size_to_store_key_length(keyinfo->seg[j].length);
else
length+= 2;
/* Save number of bytes used to store length */
keyinfo->seg[j].bit_start= 1;
break;
Expand All @@ -107,7 +114,14 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
/* fall_through */
case HA_KEYTYPE_VARTEXT2:
keyinfo->flag|= HA_VAR_LENGTH_KEY;
length+= 2;
/*
For BTREE algorithm, key length, greater than or equal
to 255, is packed on 3 bytes.
*/
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
length+= size_to_store_key_length(keyinfo->seg[j].length);
else
length+= 2;
/* Save number of bytes used to store length */
keyinfo->seg[j].bit_start= 2;
/*
Expand Down
Loading

0 comments on commit f9e5195

Please sign in to comment.