List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:August 29 1999 2:04am
Subject:BUG REPORT: 3.23.02 Alter table type=isam
View as plain text  
>>>>> "Mike" == Mike Gohlke <mike@stripped> writes:

Mike> Monty, Sisna and others,
Mike> After having to revert back to mysql 3.22.25 because of major corruption 
Mike> problems, etc with 3.23.02 I found a major bug in the alter table code of 
Mike> 3.23.02.  Namely, when doing a "Alter table tbl type=isam" all blob types 
Mike> in tbl become NULL.  However, the file size remains the same.

Mike> Mike...

Hi!

Things are not that bad as it sounds:

mysql> create table t1 (a int, b blob);
Query OK, 0 rows affected (0.15 sec)

mysql> insert into t1 values (1,"one"),(2,"two");
Query OK, 2 rows affected (0.15 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select * from t1;
+------+------+
| a    | b    |
+------+------+
|    1 | one  |
|    2 | two  |
+------+------+
2 rows in set (0.02 sec)

mysql> ALTER TABLE t1 type=isam;
Query OK, 2 rows affected (0.02 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select * from t1;
+------+------+
| a    | b    |
+------+------+
|    1 | one  |
|    2 | two  |
+------+------+
2 rows in set (0.01 sec)

The problem is that if we restart mysqld 3.22:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.22.26-debug

Type 'help' for help.

mysql> select * from t1;
+------+------+
| a    | b    |
+------+------+
|    1 | NULL |
|    2 | NULL |
+------+------+
2 rows in set (0.00 sec)

All your data in your table is still there!

You can access these by applying the following patch to your 3.22
version:

*** /my/monty/master/mysql-3.22.24/sql/dfunc.cc	Sat Jul  3 20:29:52 1999
--- ./dfunc.cc	Sun Aug 29 05:02:17 1999
***************
*** 267,273 ****
    if (null_field_first)
    {
      outparam->null_flags=null_pos= (uchar*) record+1;
!     null_bit= (outparam->db_create_options & HA_PACK_RECORD) ? 1 : 2;
    }
    else
    {
--- 267,273 ----
    if (null_field_first)
    {
      outparam->null_flags=null_pos= (uchar*) record+1;
!     null_bit= (outparam->db_create_options & HA_OPTION_PACK_RECORD) ? 1 : 2;
    }
    else
    {

Regards,
Monty
Thread
BUG REPORT: 3.23.02 Alter table type=isamMike Gohlke25 Aug
  • BUG REPORT: 3.23.02 Alter table type=isamsinisa26 Aug
  • about the Perl Module Msql-Mysqlphilippe26 Aug
  • BUG REPORT: 3.23.02 Alter table type=isamMichael Widenius29 Aug