Comment 4 for bug 1426345

Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote : Re: mysql 5.6. crashes when dropping and creating view from procedure.

Hi,

I downloaded from below link as you suggested and try to reproduce on CentOS 5.9 but again no error. It seems, it has something related to your environment/configurations. From the stacktrace, I can see this.

/home/mysql/lib/mysql/plugin/query_response_time.so[0x2b2555f98b22]

Are you using any plugin? can you provide your my.cnf ?

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.18-348.el5 #1 SMP Tue Jan 8 17:53:53 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#

[root@localhost ~]# lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.9 (Final)
Release: 5.9
Codename: Final
[root@localhost ~]#

[root@localhost ~]# ll Percona-Server-5.6.22-rel71.0-726.Linux.x86_64.tar.gz
-rw-r--r-- 1 root root 109151984 Jan 10 00:56 Percona-Server-5.6.22-rel71.0-726.Linux.x86_64.tar.gz
[root@localhost ~]#

[root@localhost ~]# mysql -uroot -p --socket=/tmp/mysql_sandbox5622.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.22-71.0 Percona Server (GPL), Release 71.0, Revision 726

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> CREATE DATABASE `sample` /*!40100 DEFAULT CHARACTER SET utf8 */;
Query OK, 1 row affected (0.00 sec)

mysql> use sample
Database changed
mysql>
mysql> create table t1 (id int, name varchar(10));
Query OK, 0 rows affected (0.00 sec)

mysql> create table t2 (id int, name varchar(10), city varchar(10));
Query OK, 0 rows affected (0.01 sec)

mysql> create table t3 (id int, phone int, email varchar(25));
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE DATABASE `sample_stats` /*!40100 DEFAULT CHARACTER SET utf8 */;
Query OK, 1 row affected (0.00 sec)

mysql> use sample
Database changed
mysql>
mysql> delimiter //
mysql>
mysql> CREATE DEFINER=`root`@`localhost` PROCEDURE `recreate_views_for_stats`()
    -> begin
    -> declare PROCEDURE_VERSION_INFO varchar(200);
    -> declare p_done int;
    -> declare p_table_name varchar(64);
    -> declare p_stats_schema varchar(64);
    -> declare p_cnt int;
    -> declare p_cnt_view int;
    -> declare p_stmt varchar(400);
    ->
    -> declare view_cursor cursor for select table_name from information_schema.tables v1 where v1.table_schema=concat(database(),'_stats') and v1.table_type='VIEW';
    -> declare table_cursor cursor for select table_name from information_schema.tables v1 where v1.table_schema=database();
    ->
    -> declare continue handler for SQLSTATE '02000' begin set p_done = 1; end;
    ->
    -> set PROCEDURE_VERSION_INFO = 'v 1.11 ';
    ->
    -> select PROCEDURE_VERSION_INFO;
    ->
    -> set p_done = 0;
    -> set p_cnt_view = 0;
    -> set p_stats_schema = concat(database(),'_stats');
    -> open view_cursor;
    -> repeat
    -> fetch view_cursor into p_table_name;
    -> if not p_done then
    -> set @sql = concat('drop view if exists ',p_stats_schema,'.',p_table_name);
    -> prepare p_stmt from @sql;
    -> execute p_stmt;
    -> deallocate prepare p_stmt;
    -> set p_cnt_view = p_cnt_view + 1;
    ->
    -> end if;
    -> until p_done end repeat;
    ->
    -> set p_done = 0;
    -> set p_cnt = 0;
    -> open table_cursor;
    -> repeat
    -> fetch table_cursor into p_table_name;
    -> if not p_done then
    -> set @sql = concat('create view ',p_stats_schema,'.',p_table_name,' as select * from ',p_table_name);
    -> prepare p_stmt from @sql;
    -> execute p_stmt;
    -> deallocate prepare p_stmt;
    -> set p_cnt = p_cnt + 1;
    -> end if;
    -> until p_done end repeat;
    ->
    -> select p_cnt_view as views_dropped, p_cnt as views_created, count(*) as views_total from information_schema.views where table_schema=p_stats_schema;
    -> end
    -> //
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;
mysql>
mysql> call recreate_views_for_stats();
+------------------------+
| PROCEDURE_VERSION_INFO |
+------------------------+
| v 1.11 |
+------------------------+
1 row in set (0.00 sec)

+---------------+---------------+-------------+
| views_dropped | views_created | views_total |
+---------------+---------------+-------------+
| 0 | 3 | 3 |
+---------------+---------------+-------------+
1 row in set (0.01 sec)

Query OK, 0 rows affected (0.01 sec)

mysql>
mysql>
mysql> call recreate_views_for_stats();
+------------------------+
| PROCEDURE_VERSION_INFO |
+------------------------+
| v 1.11 |
+------------------------+
1 row in set (0.00 sec)

+---------------+---------------+-------------+
| views_dropped | views_created | views_total |
+---------------+---------------+-------------+
| 3 | 3 | 3 |
+---------------+---------------+-------------+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> call recreate_views_for_stats();
+------------------------+
| PROCEDURE_VERSION_INFO |
+------------------------+
| v 1.11 |
+------------------------+
1 row in set (0.00 sec)

+---------------+---------------+-------------+
| views_dropped | views_created | views_total |
+---------------+---------------+-------------+
| 3 | 3 | 3 |
+---------------+---------------+-------------+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> call recreate_views_for_stats();
+------------------------+
| PROCEDURE_VERSION_INFO |
+------------------------+
| v 1.11 |
+------------------------+
1 row in set (0.00 sec)

+---------------+---------------+-------------+
| views_dropped | views_created | views_total |
+---------------+---------------+-------------+
| 3 | 3 | 3 |
+---------------+---------------+-------------+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye
[root@localhost ~]#