Bug #36235 Server crash, if delete row of table associated with views , followed by backup
Submitted: 21 Apr 2008 20:05 Modified: 22 Apr 2008 7:09
Reporter: Hema Sridharan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:mysql-6.0-backup OS:Linux
Assigned to: CPU Architecture:Any

[21 Apr 2008 20:05] Hema Sridharan
Description:
1) I create database and tables t1 and t3 in the Database
2) I create view depending on both the tables.
3) I delete a row from table t1 and perform Backup. Backup and Restore opeartion works fine.
4) I delete a row from table t2 and perform Backup, the server crashes during backup and loses the connectivity.

How to repeat:
mysql> create database try;
Query OK, 1 row affected (0.00 sec)

mysql> use try;
Database changed
mysql> CREATE TABLE t1(id int , name char(10),city varchar(10));
Query OK, 0 rows affected (0.04 sec)

mysql> INSERT INTO t1 VALUES (1,'aa1','RR1'),(2,'aa2','RR2'),(3,'aa3','RR3'),(4,'aa4','RR4'),(5,'aa5','RR5'),(6,'aa6','RR6'),(7,'aa7','RR7'),(8,'aa8','RR8');
Query OK, 8 rows affected (0.01 sec)
Records: 8  Duplicates: 0  Warnings: 0

mysql> CREATE TABLE t3(ccode int, District char(20), scode int);
Query OK, 0 rows affected (0.04 sec)

mysql> INSERT INTO t3 VALUES(234, 'zuloa',1),(321,'yyy',2),(765,'iug',3),(124,'LKJ',4),(235,'uth',6);
Query OK, 5 rows affected (0.00 sec)
Records: 5  Duplicates: 0  Warnings: 0

mysql> CREATE VIEW vcomb AS SELECT name, city, ccode FROM t1, t3 WHERE id=scode;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from vcomb;
+------+------+-------+
| name | city | ccode |
+------+------+-------+
| aa1  | RR1  |   234 |
| aa2  | RR2  |   321 |
| aa3  | RR3  |   765 |
| aa4  | RR4  |   124 |
| aa6  | RR6  |   235 |
+------+------+-------+
5 rows in set (0.00 sec)

mysql> backup database try to '/tmp/try1';
+-----------+
| backup_id |
+-----------+
| 1         |
+-----------+
1 row in set (0.09 sec)

mysql> delete from t1 where id=6;
Query OK, 1 row affected (0.00 sec)

mysql> select * from vcomb;
+------+------+-------+
| name | city | ccode |
+------+------+-------+
| aa1  | RR1  |   234 |
| aa2  | RR2  |   321 |
| aa3  | RR3  |   765 |
| aa4  | RR4  |   124 |
+------+------+-------+
4 rows in set (0.00 sec)

mysql> backup database try to '/tmp/try2';
+-----------+
| backup_id |
+-----------+
| 2         |
+-----------+
1 row in set (0.09 sec)

mysql> restore from '/tmp/try2';
+-----------+
| backup_id |
+-----------+
| 3         |
+-----------+
1 row in set (0.11 sec)

mysql> show tables from try;
+---------------+
| Tables_in_try |
+---------------+
| t1            |
| t3            |
| vcomb         |
+---------------+
3 rows in set (0.00 sec)

mysql> select * from vcomb;
+------+------+-------+
| name | city | ccode |
+------+------+-------+
| aa1  | RR1  |   234 |
| aa2  | RR2  |   321 |
| aa3  | RR3  |   765 |
| aa4  | RR4  |   124 |
+------+------+-------+
4 rows in set (0.00 sec)

mysql> delete from t3 where scode=1;
Query OK, 1 row affected (0.00 sec)

mysql> select * from vcomb;
+------+------+-------+
| name | city | ccode |
+------+------+-------+
| aa2  | RR2  |   321 |
| aa3  | RR3  |   765 |
| aa4  | RR4  |   124 |
+------+------+-------+
3 rows in set (0.00 sec)

mysql> backup database try to '/tmp/try3';
ERROR 2013 (HY000): Lost connection to MySQL server during query

Here if a row is deleted from table t3, BACKUP DATABASE crashes .

Error Log
==========

080421 20:58:34 [ERROR] Backup: Error when polling Default backup driver for its image data
mysqld: sql_base.cc:1418: bool close_thread_table(THD*, TABLE**): Assertion `!table->file || table->file->inited == handler::NONE' failed.
080421 20:58:34 - mysqld got signal 6;

Stack Trace
===========
/space/hema/mysql-6.0-backup/extra> ./resolve_stack_dump -s /tmp/mysqld.sym -n mysqld.stack
0x1ea4c08 _end + 10613792
0x87a67a safe_print_str + 278
0x87a6c1 print_stacktrace + 21
0x6dbfb1 handle_segfault + 573
0x3d6a30c430 _end + 1760062536
0x3d69a2e21d _end + 1750764085
0x3d69a2fa1e _end + 1750770230
0x3d69a27ae1 _end + 1750737657
0x72d28f _Z18close_thread_tableP3THDPP8st_table + 171
0x72ce2f _Z30close_cached_connection_tablesP3THDbP19st_mysql_lex_stringb + 1219
0x72d178 _Z19close_thread_tablesP3THD + 726
0xcb515d backup_thread_for_locking + 991
0x3d6a30610a _end + 1760037154
0x3d69ac68b3 _end + 1751388363
[21 Apr 2008 21:08] MySQL Verification Team
Thank you for the bug report. Verified as described.

mysql> delete from t3 where scode=1;
Query OK, 1 row affected (0.01 sec)

mysql> select * from vcomb;
+------+------+-------+
| name | city | ccode |
+------+------+-------+
| aa2  | RR2  |   321 | 
| aa3  | RR3  |   765 | 
| aa4  | RR4  |   124 | 
+------+------+-------+
3 rows in set (0.00 sec)

mysql> backup database try to '/tmp/try3';
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[22 Apr 2008 7:09] Rafal Somla
This is a duplicate of BUG#35249. Even when no view is used, the same failure can be repeated, if a row is deleted from a table being backed up.