From c08e6c8867db16245732101ee8603efc0773c7c4 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Sun, 13 Dec 2009 23:29:50 +0300 Subject: Bug #42849: innodb crash with varying time_zone on partitioned timestamp primary key Since TIMESTAMP values are adjusted by the current time zone settings in both numeric and string contexts, using any expressions involving TIMESTAMP values as a (sub)partitioning function leads to undeterministic behavior of partitioned tables. The effect may vary depending on a storage engine, it can be either incorrect data being retrieved or stored, or an assertion failure. The root cause of this is the fact that the calculated partition ID may differ from a previously calculated ID for the same data due to timezone adjustments of the partitioning expression value. Fixed by disabling any expressions involving TIMESTAMP values to be used in partitioning functions with the follwing two exceptions: 1. Creating or altering into a partitioned table that violates the above rule is not allowed, but opening existing such tables results in a warning rather than an error so that such tables could be fixed. 2. UNIX_TIMESTAMP() is the only way to get a timezone-independent value from a TIMESTAMP column, because it returns the internal representation (a time_t value) of a TIMESTAMP argument verbatim. So UNIX_TIMESTAMP(timestamp_column) is allowed and should be used to fix existing tables if one wants to use TIMESTAMP columns with partitioning. mysql-test/r/partition_bug18198.result: Corrected the error. mysql-test/r/partition_error.result: Corrected error texts. Added test cases for bug #42849. mysql-test/t/partition_bug18198.test: Corrected error code. mysql-test/t/partition_error.test: Corrected error codes. Added test cases for bug #42849. sql/item.h: Added is_timezone_dependent_processor() to Item. sql/item_func.h: Added has_timestamp_args() and the implementation of is_timezone_dependent_processor() for Item_func. sql/item_timefunc.h: Added is_timezone_dependent_processor() to Item_func_unix_timestamp. sql/share/errmsg.txt: Renamed ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR to ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR to better reflect the meaning. Adjusted the error message. sql/sql_partition.cc: Modified fix_fields_part_func() to walk through partitioning expression tree with is_timezone_dependent_processor() and issue a warning/error if it depends on the timezone settings. Changed fix_fields_part_func() to a static function since it is not used anywhere except sql_partition.cc sql/sql_partition.h: Removed the unneeded declaration of fix_fields_part_func() since it is now a static function. sql/sql_yacc.yy: ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR -> ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR. --- sql/share/errmsg.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/share') diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 7c92c827c87..cc319667060 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5696,8 +5696,8 @@ ER_PARTITION_WRONG_NO_SUBPART_ERROR eng "Wrong number of subpartitions defined, mismatch with previous setting" ger "Falsche Anzahl von Unterpartitionen definiert, stimmt nicht mit vorherigen Einstellungen überein" swe "Antal subpartitioner definierade och antal subpartitioner är inte lika" -ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR - eng "Constant/Random expression in (sub)partitioning function is not allowed" +ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR + eng "Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed" ger "Konstante oder Random-Ausdrücke in (Unter-)Partitionsfunktionen sind nicht erlaubt" swe "Konstanta uttryck eller slumpmässiga uttryck är inte tillåtna (sub)partitioneringsfunktioner" ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR -- cgit v1.2.1 From 132b46e96eb48b8d9d993583ed7b9ecd87e53674 Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Thu, 21 Jan 2010 09:10:05 +0100 Subject: WL#5154 Remove deprecated 4.1 features Several items said to be deprecated in the 4.1 manual have never been removed. This worklog adds deprecation warnings when these items are used, and warns the user that the items will be removed in MySQL 5.6. A couple of previously deprecation decision have been reversed (see single file comments) client/client_priv.h: Macro similar to the one in the server (mysql_priv.h) for printing a deprecation warning message client/mysql.cc: no-auto-rehash will not be deprecated skip-line-numbers will not be deprecated skip-column-names will not be deprecated no-pager is deprecated set-variable is deprecated no-named-commands is deprecated client/mysqladmin.cc: set-variable is deprecated client/mysqlbinlog.cc: position is deprecated client/mysqldump.c: first-slave is deprecated no-set-names is deprecated set-variable is deprecated mysql-test/r/mysqlbinlog.result: Adding the [Warning] to the test case, just to show that the deprecation works. The test case will be changed in Celosia to use --start-position. mysys/my_getopt.c: set-variable (include -O) is deprecated scripts/mysqld_multi.sh: Warning for mysqld_multi sql/mysqld.cc: default-collation is deprecated log-bin-trust-routine-creators is deprecated set-variable is deprecated default-character-set is deprecated safe-show-database is deprecated sql/share/errmsg.txt: Added version number for sql_log_update deprecation message. --- sql/share/errmsg.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sql/share') diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 6d1b7aaf1ee..06ce848399b 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5138,11 +5138,11 @@ ER_SP_BADSTATEMENT 0A000 eng "%s is not allowed in stored procedures" ger "%s ist in gespeicherten Prozeduren nicht erlaubt" ER_UPDATE_LOG_DEPRECATED_IGNORED 42000 - eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored" - ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert" + eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored. This option will be removed in MySQL 5.6." + ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wird ignoriert. Diese Option wird in MySQL 5.6 entfernt." ER_UPDATE_LOG_DEPRECATED_TRANSLATED 42000 - eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN" - ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt" + eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN. This option will be removed in MySQL 5.6." + ger "Das Update-Log ist veraltet und wurde durch das Binär-Log ersetzt. SET SQL_LOG_UPDATE wurde in SET SQL_LOG_BIN übersetzt. Diese Option wird in MySQL 5.6 entfernt." ER_QUERY_INTERRUPTED 70100 eng "Query execution was interrupted" ger "Ausführung der Abfrage wurde unterbrochen" -- cgit v1.2.1