Merge branch '5.5' into bb-5.5-serg

This commit is contained in:
Sergei Golubchik 2015-06-05 09:51:17 +02:00
commit 9a3b975da6
27 changed files with 308 additions and 21 deletions

3
.gitattributes vendored
View file

@ -17,6 +17,9 @@
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.frm binary
*.MYD binary
*.MYI binary
*.c diff=cpp
*.h diff=cpp

View file

@ -203,7 +203,7 @@
#cmakedefine HAVE_MADVISE 1
#cmakedefine HAVE_DECL_MADVISE 1
#cmakedefine HAVE_DECL_TGOTO 1
#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA
#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA 1
#cmakedefine HAVE_MALLINFO 1
#cmakedefine HAVE_MEMCPY 1
#cmakedefine HAVE_MEMMOVE 1
@ -396,7 +396,7 @@
#cmakedefine SOCKET_SIZE_TYPE @SOCKET_SIZE_TYPE@
#cmakedefine HAVE_MBSTATE_T
#cmakedefine HAVE_MBSTATE_T 1
#define MAX_INDEXES 64
@ -431,15 +431,15 @@
#cmakedefine HAVE_WCTYPE_H 1
#cmakedefine HAVE_WCHAR_H 1
#cmakedefine HAVE_LANGINFO_H 1
#cmakedefine HAVE_MBRLEN
#cmakedefine HAVE_MBSCMP
#cmakedefine HAVE_MBSRTOWCS
#cmakedefine HAVE_WCRTOMB
#cmakedefine HAVE_MBRTOWC
#cmakedefine HAVE_WCSCOLL
#cmakedefine HAVE_WCSDUP
#cmakedefine HAVE_WCWIDTH
#cmakedefine HAVE_WCTYPE
#cmakedefine HAVE_MBRLEN 1
#cmakedefine HAVE_MBSCMP 1
#cmakedefine HAVE_MBSRTOWCS 1
#cmakedefine HAVE_WCRTOMB 1
#cmakedefine HAVE_MBRTOWC 1
#cmakedefine HAVE_WCSCOLL 1
#cmakedefine HAVE_WCSDUP 1
#cmakedefine HAVE_WCWIDTH 1
#cmakedefine HAVE_WCTYPE 1
#cmakedefine HAVE_ISWLOWER 1
#cmakedefine HAVE_ISWUPPER 1
#cmakedefine HAVE_TOWLOWER 1
@ -453,7 +453,7 @@
#cmakedefine HAVE_STRCASECMP 1
#cmakedefine HAVE_STRNCASECMP 1
#cmakedefine HAVE_STRDUP 1
#cmakedefine HAVE_LANGINFO_CODESET
#cmakedefine HAVE_LANGINFO_CODESET 1
#cmakedefine HAVE_TCGETATTR 1
#cmakedefine HAVE_FLOCKFILE 1

View file

@ -1444,3 +1444,9 @@ column_get(column_create(1, "18446744073709552001" as char), 1 as int)
Warnings:
Warning 1918 Encountered illegal value '18446744073709552001' when converting to INT
Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement
#
# MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes
# mysqld
#
SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,34));
ERROR 42000: Too big scale 34 specified for ''y''. Maximum is 30.

View file

@ -60,3 +60,12 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
#
TRUNCATE TABLE time_zone_leap_second;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
#
# MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
#
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;

View file

@ -0,0 +1,33 @@
SET GLOBAL query_cache_size=1024*1024*8;
CREATE TABLE `test` (
`uniqueId` INT NOT NULL,
`partitionId` INT NOT NULL,
PRIMARY KEY (`uniqueId`,`partitionId`)
) ENGINE=InnoDB PARTITION BY LIST (partitionId) (
PARTITION p01 VALUES IN (1),
PARTITION p02 VALUES IN (2)
);
INSERT INTO `test`(`uniqueId`,`partitionId`) VALUES(407237055, 2);
SELECT * FROM `test`;
uniqueId partitionId
407237055 2
#Confirms 1 row in partition 'p02'
SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
TABLE_NAME PARTITION_NAME TABLE_ROWS
test p01 0
test p02 1
ALTER TABLE `test` TRUNCATE PARTITION `p02`;
#Confirms no more rows in partition 'p02'
SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
TABLE_NAME PARTITION_NAME TABLE_ROWS
test p01 0
test p02 0
#Before the patch, this returned the previously existing values.
SELECT * FROM `test`;
uniqueId partitionId
SELECT SQL_CACHE * FROM `test`;
uniqueId partitionId
SELECT SQL_NO_CACHE * FROM `test`;
uniqueId partitionId
DROP TABLE test;
SET GLOBAL query_cache_size=DEFAULT;

View file

@ -994,3 +994,24 @@ GROUP BY t2.col0
WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
1
DROP TABLE t1, t2;
#
# Start of 5.5 tests
#
#
# MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
#
SHOW CREATE TABLE t1dec102;
Table Create Table
t1dec102 CREATE TABLE `t1dec102` (
`a` decimal(10,2)/*old*/ DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW COLUMNS FROM t1dec102;
Field Type Null Key Default Extra
a decimal(10,2)/*old*/ YES NULL
SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
COLUMN_NAME DATA_TYPE COLUMN_TYPE
a decimal decimal(10,2)/*old*/
DROP TABLE t1dec102;
#
# End of 5.5 tests
#

View file

@ -5411,6 +5411,24 @@ create view v2 as select t2.* from (t2 left join v1 using (id));
update t3 left join v2 using (id) set flag=flag+1;
drop view v2, v1;
drop table t1, t2, t3;
#
# MDEV-7207 - ALTER VIEW does not change ALGORITM
#
create table t1 (a int, b int);
create algorithm=temptable view v2 (c) as select b+1 from t1;
show create view v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
alter algorithm=undefined view v2 (c) as select b+1 from t1;
show create view v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
alter algorithm=merge view v2 (c) as select b+1 from t1;
show create view v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
drop view v2;
drop table t1;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------

View file

@ -0,0 +1 @@
<EFBFBD> 123.45<EFBFBD> 123.46<EFBFBD> 123.47

Binary file not shown.

Binary file not shown.

View file

@ -327,6 +327,18 @@ INSERT INTO t2 SET a=1;
INSERT INTO t2 SET b=1;
UPDATE t1, t2 SET t1.a=10, t2.a=20;
DROP TABLE t1,t2;
INSERT INTO t1dec102 VALUES (-999.99);
INSERT INTO t1dec102 VALUES (0);
INSERT INTO t1dec102 VALUES (999.99);
SELECT * FROM t1dec102 ORDER BY a;
a
-999.99
0.00
123.45
123.46
123.47
999.99
DROP TABLE t1dec102;
flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
@ -4131,6 +4143,59 @@ SET TIMESTAMP=1000000000/*!*/;
DROP TABLE `t1`,`t2` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1dec102`
### SET
### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1dec102`
### SET
### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1dec102`
### SET
### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
DROP TABLE `t1dec102` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
DELIMITER ;
# End of log file

View file

@ -438,9 +438,20 @@ INSERT INTO t2 SET b=1;
UPDATE t1, t2 SET t1.a=10, t2.a=20;
DROP TABLE t1,t2;
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
INSERT INTO t1dec102 VALUES (-999.99);
INSERT INTO t1dec102 VALUES (0);
INSERT INTO t1dec102 VALUES (999.99);
SELECT * FROM t1dec102 ORDER BY a;
DROP TABLE t1dec102;
flush logs;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001

View file

@ -643,3 +643,9 @@ SELECT
#
select column_get(column_create(1, "18446744073709552001" as char), 1 as int);
--echo #
--echo # MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes
--echo # mysqld
--echo #
--error ER_TOO_BIG_SCALE
SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,34));

View file

@ -37,3 +37,14 @@
#
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
--echo #
--echo # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
--echo #
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/Factory
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo

View file

@ -0,0 +1,32 @@
--source include/have_innodb.inc
--source include/have_partition.inc
SET GLOBAL query_cache_size=1024*1024*8;
CREATE TABLE `test` (
`uniqueId` INT NOT NULL,
`partitionId` INT NOT NULL,
PRIMARY KEY (`uniqueId`,`partitionId`)
) ENGINE=InnoDB PARTITION BY LIST (partitionId) (
PARTITION p01 VALUES IN (1),
PARTITION p02 VALUES IN (2)
);
INSERT INTO `test`(`uniqueId`,`partitionId`) VALUES(407237055, 2);
SELECT * FROM `test`;
--echo #Confirms 1 row in partition 'p02'
SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
ALTER TABLE `test` TRUNCATE PARTITION `p02`;
--echo #Confirms no more rows in partition 'p02'
SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
--echo #Before the patch, this returned the previously existing values.
SELECT * FROM `test`;
SELECT SQL_CACHE * FROM `test`;
SELECT SQL_NO_CACHE * FROM `test`;
DROP TABLE test;
SET GLOBAL query_cache_size=DEFAULT;

View file

@ -583,3 +583,27 @@ JOIN
WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
DROP TABLE t1, t2;
--echo #
--echo # Start of 5.5 tests
--echo #
--echo #
--echo # MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
--echo #
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
SHOW CREATE TABLE t1dec102;
SHOW COLUMNS FROM t1dec102;
SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
DROP TABLE t1dec102;
--echo #
--echo # End of 5.5 tests
--echo #

View file

@ -5367,6 +5367,19 @@ update t3 left join v2 using (id) set flag=flag+1;
drop view v2, v1;
drop table t1, t2, t3;
--echo #
--echo # MDEV-7207 - ALTER VIEW does not change ALGORITM
--echo #
create table t1 (a int, b int);
create algorithm=temptable view v2 (c) as select b+1 from t1;
show create view v2;
alter algorithm=undefined view v2 (c) as select b+1 from t1;
show create view v2;
alter algorithm=merge view v2 (c) as select b+1 from t1;
show create view v2;
drop view v2;
drop table t1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------

View file

@ -2483,7 +2483,7 @@ void Field_decimal::sql_type(String &res) const
if (dec)
tmp--;
res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
"decimal(%d,%d)",tmp,dec));
"decimal(%d,%d)/*old*/",tmp,dec));
add_zerofill_and_unsigned(res);
}

View file

@ -4467,6 +4467,16 @@ null:
void Item_dyncol_get::print(String *str, enum_query_type query_type)
{
/*
Parent cast doesn't exist yet, only print dynamic column name. This happens
when called from create_func_cast() / wrong_precision_error().
*/
if (!str->length())
{
args[1]->print(str, query_type);
return;
}
/* see create_func_dyncol_get */
DBUG_ASSERT(str->length() >= 5);
DBUG_ASSERT(strncmp(str->ptr() + str->length() - 5, "cast(", 5) == 0);

View file

@ -2192,6 +2192,12 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
my_snprintf(typestr, typestr_length, "STRING(%d)", length);
return my_b_write_quoted_with_length(file, ptr, length);
case MYSQL_TYPE_DECIMAL:
my_b_printf(file,
"!! Old DECIMAL (mysql-4.1 or earlier). "
"Not enough metadata to display the value. ");
break;
default:
{
char tmp[5];

View file

@ -174,9 +174,16 @@ bool Alter_table_truncate_partition_statement::execute(THD *thd)
log. The exception is a unimplemented truncate method or failure
before any call to handler::truncate() is done.
Also, it is logged in statement format, regardless of the binlog format.
Since we've changed data within the table, we also have to invalidate
the query cache for it.
*/
if (error != HA_ERR_WRONG_COMMAND && binlog_stmt)
error|= write_bin_log(thd, !error, thd->query(), thd->query_length());
if (error != HA_ERR_WRONG_COMMAND)
{
query_cache_invalidate3(thd, first_table, FALSE);
if (binlog_stmt)
error|= write_bin_log(thd, !error, thd->query(), thd->query_length());
}
/*
A locked table ticket was upgraded to a exclusive lock. After the

View file

@ -228,7 +228,7 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
view->definer.user= decoy.definer.user;
lex->definer= &view->definer;
}
if (lex->create_view_algorithm == DTYPE_ALGORITHM_UNDEFINED)
if (lex->create_view_algorithm == VIEW_ALGORITHM_INHERIT)
lex->create_view_algorithm= (uint8) decoy.algorithm;
if (lex->create_view_suid == VIEW_SUID_DEFAULT)
lex->create_view_suid= decoy.view_suid ?

View file

@ -6552,7 +6552,7 @@ alter:
my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
MYSQL_YYABORT;
}
lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED;
lex->create_view_algorithm= VIEW_ALGORITHM_INHERIT;
lex->create_view_mode= VIEW_ALTER;
}
view_tail

View file

@ -1446,6 +1446,8 @@ typedef struct st_schema_table
#define DT_PHASES_MATERIALIZE (DT_COMMON | DT_MATERIALIZE)
#define VIEW_ALGORITHM_UNDEFINED 0
/* Special value for ALTER VIEW: inherit original algorithm. */
#define VIEW_ALGORITHM_INHERIT DTYPE_VIEW
#define VIEW_ALGORITHM_MERGE (DTYPE_VIEW | DTYPE_MERGE)
#define VIEW_ALGORITHM_TMPTABLE (DTYPE_VIEW | DTYPE_MATERIALIZE)

View file

@ -2521,7 +2521,8 @@ scan_tz_dir(char * name_end, uint symlink_recursion_level, uint verbose)
for (i= 0; i < cur_dir->number_off_files; i++)
{
if (cur_dir->dir_entry[i].name[0] != '.')
if (cur_dir->dir_entry[i].name[0] != '.' &&
strcmp(cur_dir->dir_entry[i].name, "Factory"))
{
name_end_tmp= strmake(name_end, cur_dir->dir_entry[i].name,
FN_REFLEN - (name_end - fullname));

View file

@ -93,7 +93,6 @@ extern "C" {
#include "ibuf0ibuf.h"
enum_tx_isolation thd_get_trx_isolation(const THD* thd);
}
#include "ha_innodb.h"
@ -6299,6 +6298,11 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
/* If transaction is not startted do not continue, instead return a error code. */
if(!(prebuilt->sql_stat_start || (prebuilt->trx && prebuilt->trx->conc_state == 1))) {
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
ut_a(prebuilt->trx == thd_to_trx(user_thd));
innodb_srv_conc_enter_innodb(prebuilt->trx);

View file

@ -102,7 +102,6 @@ extern "C" {
#include "ibuf0ibuf.h"
enum_tx_isolation thd_get_trx_isolation(const THD* thd);
}
#include "ha_innodb.h"
@ -7327,6 +7326,11 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
/* If transaction is not startted do not continue, instead return a error code. */
if(!(prebuilt->sql_stat_start || (prebuilt->trx && prebuilt->trx->state == 1))) {
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
srv_pass_corrupt_table <= 1)) {
DBUG_RETURN(HA_ERR_CRASHED);