From 77ab3b28a7ab7f0c7b65ae877f4697d0efe7e00f Mon Sep 17 00:00:00 2001 From: "svoj@may.pils.ru" <> Date: Thu, 1 Jun 2006 18:08:57 +0500 Subject: [PATCH 1/3] BUG#19192 - CHECK TABLE EXTENDED / REPAIR TABLE show no errors. ALTER TABLE crashes Executing fast alter table (one that doesn't need to copy data) on tables created by mysql versions prior to 4.0.25 could result in posterior server crash when accessing these tables. There was a bug prior to mysql-4.0.25. Number of null fields was calculated incorrectly. As a result frm and data files gets out of sync after fast alter table. There is no way to determine by which mysql version (in 4.0 and 4.1 branches) table was created, thus we disable fast alter table for all tables created by mysql versions prior to 5.0 branch. See BUG#6236. --- sql/sql_table.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9ec8e8db1fb..275cfbaa088 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3614,12 +3614,21 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, their layout. See Field_string::type() for details. Thus, if the table is too old we may have to rebuild the data to update the layout. + + There was a bug prior to mysql-4.0.25. Number of null fields was + calculated incorrectly. As a result frm and data files gets out of + sync after fast alter table. There is no way to determine by which + mysql version (in 4.0 and 4.1 branches) table was created, thus we + disable fast alter table for all tables created by mysql versions + prior to 5.0 branch. + See BUG#6236. */ need_copy_table= (alter_info->flags & ~(ALTER_CHANGE_COLUMN_DEFAULT|ALTER_OPTIONS) || (create_info->used_fields & ~(HA_CREATE_USED_COMMENT|HA_CREATE_USED_PASSWORD)) || table->s->tmp_table || + !table->s->mysql_version || (table->s->frm_version < FRM_VER_TRUE_VARCHAR && varchar)); create_info->frm_only= !need_copy_table; From e4d3341d350c034f005d82ec83cdad1642dc36e8 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 7 Jun 2006 14:46:10 +0200 Subject: [PATCH 2/3] Import from yaSSL to fix bild problems on AIX(already fixed but was lost during last import) --- extra/yassl/taocrypt/include/runtime.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp index 3a5cf62865a..88559cb0ca0 100644 --- a/extra/yassl/taocrypt/include/runtime.hpp +++ b/extra/yassl/taocrypt/include/runtime.hpp @@ -28,6 +28,9 @@ #ifndef yaSSL_NEW_HPP #define yaSSL_NEW_HPP +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #ifdef __sun From 5d4b5deae10abddabfd10b8271d0c1d221433d98 Mon Sep 17 00:00:00 2001 From: "svoj@may.pils.ru" <> Date: Wed, 14 Jun 2006 16:45:29 +0500 Subject: [PATCH 3/3] After merge fix. --- sql/sql_table.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index a49b7a2cc42..e5e671cabf1 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4709,6 +4709,14 @@ static uint compare_tables(TABLE *table, List *create_list, At the moment we can't handle altering temporary tables without a copy. We also test if OPTIMIZE TABLE was given and was mapped to alter table. In that case we always do full copy. + + There was a bug prior to mysql-4.0.25. Number of null fields was + calculated incorrectly. As a result frm and data files gets out of + sync after fast alter table. There is no way to determine by which + mysql version (in 4.0 and 4.1 branches) table was created, thus we + disable fast alter table for all tables created by mysql versions + prior to 5.0 branch. + See BUG#6236. */ if (table->s->fields != create_list->elements || table->s->db_type != create_info->db_type || @@ -4718,6 +4726,7 @@ static uint compare_tables(TABLE *table, List *create_list, create_info->used_fields & HA_CREATE_USED_DEFAULT_CHARSET || (alter_info->flags & (ALTER_RECREATE | ALTER_FOREIGN_KEY)) || order_num || + !table->s->mysql_version || (table->s->frm_version < FRM_VER_TRUE_VARCHAR && varchar)) DBUG_RETURN(ALTER_TABLE_DATA_CHANGED);