Description:
I am using mysql-5.1.27-ndb-6.3.17 in real service.
recently, shorking accident was occured.
I run "show tables" mysql command.
and thus, Existing tables was dropped suddenly.
How to repeat:
1.
Use this config.ini in testing.([NDBD DEFAULT] part must same this config.ini)
---------------------------------
[NDBD DEFAULT]
NoOfReplicas=2
DataMemory=1000M
IndexMemory=100M
MaxNoOfAttributes=5000
MaxNoOfOrderedIndexes=1000
MaxNoOfUniqueHashIndexes=1000
MaxNoOfTables=500
MaxNoOfTriggers=1000
[NDB_MGMD]
hostname=192.168.1.9
datadir=/var/lib/mysql-cluster5.1.27-ndb6.3.17
ID=1
[NDB_MGMD]
hostname=192.168.1.10
datadir=/var/lib/mysql-cluster5.1.27-ndb6.3.17
ID=2
[NDB_MGMD]
hostname=192.168.1.11
datadir=/var/lib/mysql-cluster5.1.27-ndb6.3.17
ID=3
[NDBD]
hostname=192.168.1.10
datadir=/var/lib/mysql-cluster5.1.27-ndb6.3.17
ID=4
[NDBD]
hostname=192.168.1.11
datadir=/var/lib/mysql-cluster5.1.27-ndb6.3.17
ID=5
[MYSQLD]
hostname=192.168.1.10
[MYSQLD]
hostname=192.168.1.11
---------------------------------
2.
firstly, this script run.
cat create1.sh
---------------------------------
#!/bin/sh
MYSQL_DIR=/usr/local/mysql5.1.27-ndb6.3.17
create(){
SQL="CREATE TABLE a${1} (
c1 int(11) NOT NULL AUTO_INCREMENT,
c2 int(11) NOT NULL DEFAULT '0',
c3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
c4 timestamp NULL DEFAULT NULL,
c5 decimal(38,0) NOT NULL,
c6 int(11) NOT NULL DEFAULT '0',
c7 tinyint(4) NOT NULL,
c8 tinyint(4) NOT NULL,
c9 date DEFAULT NULL,
c10 date DEFAULT NULL,
c11 date DEFAULT NULL,
c12 date DEFAULT NULL,
c13 varchar(10) NOT NULL,
c14 varchar(10) DEFAULT NULL,
c15 varchar(20) DEFAULT NULL,
PRIMARY KEY (c1),
KEY idx1 (c2),
KEY idx2 (c3),
KEY idx3 (c4),
KEY idx4 (c5),
KEY idx5 (c6)
) ENGINE=ndbcluster DEFAULT CHARSET=utf8"
RESULT=`/usr/local/mysql5.1.27-ndb6.3.17/bin/mysql -uroot $2 -e"$SQL" 2>&1`
}
run(){
$MYSQL_DIR/bin/mysql -uroot -e"drop database if exists $1"
$MYSQL_DIR/bin/mysql -uroot -e"create database $1"
echo "creating table of $1"
i=1
while [ $i -lt $2 ]
do
echo $i
create $i $1
if [ -n "$RESULT" ]; then
echo $RESULT
exit
fi
i=`expr $i + 1`
done
}
# don't change dbname. use dbname written in this script
run db_aaaa_aaa 79
run db_bbbb_bbbb 28
run db_cccccc 13
------------------------------------------------
#./create1.sh
and thus, confirm table created.
# mysql -uroot
# use db_bbbb_bbbb;
# show tables;
mysql> show tables;
+------------------------+
| Tables_in_db_core_bill |
+------------------------+
| b1 |
| b10 |
| b11 |
| b12 |
| b13 |
| b14 |
| b15 |
| b16 |
| b17 |
| b18 |
| b19 |
| b2 |
| b20 |
| b21 |
| b22 |
| b23 |
| b24 |
| b25 |
| b26 |
| b27 |
| b3 |
| b4 |
| b5 |
| b6 |
| b7 |
| b8 |
| b9 |
+------------------------+
apparently, table exists, this timing.
3. nextly, run this script.
cat create2.sh
-----------------------------------------------
#!/bin/sh
MYSQL_DIR=/usr/local/mysql5.1.27-ndb6.3.17
create(){
SQL="CREATE TABLE a${1} (
c1 int(11) NOT NULL AUTO_INCREMENT,
c2 int(11) NOT NULL DEFAULT '0',
c3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
c4 timestamp NULL DEFAULT NULL,
c5 decimal(38,0) NOT NULL,
MYSQL_DIR=/usr/local/mysql5.1.27-ndb6.3.17
create(){
SQL="CREATE TABLE a${1} (
c1 int(11) NOT NULL AUTO_INCREMENT,
c2 int(11) NOT NULL DEFAULT '0',
c3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
c4 timestamp NULL DEFAULT NULL,
c5 decimal(38,0) NOT NULL,
c6 int(11) NOT NULL DEFAULT '0',
c7 tinyint(4) NOT NULL,
c8 tinyint(4) NOT NULL,
c9 date DEFAULT NULL,
c10 date DEFAULT NULL,
c11 date DEFAULT NULL,
c12 date DEFAULT NULL,
c13 varchar(10) NOT NULL,
c14 varchar(10) DEFAULT NULL,
c15 varchar(20) DEFAULT NULL,
PRIMARY KEY (c1),
KEY idx1 (c2),
KEY idx2 (c3),
KEY idx3 (c4),
KEY idx4 (c5),
KEY idx5 (c6)
) ENGINE=ndbcluster DEFAULT CHARSET=utf8"
RESULT=`/usr/local/mysql5.1.27-ndb6.3.17/bin/mysql -uroot $2 -e"$SQL" 2>&1`
}
run(){
$MYSQL_DIR/bin/mysql -uroot -e"drop database if exists $1"
$MYSQL_DIR/bin/mysql -uroot -e"create database $1"
echo "creating table of $1"
i=1
while [ $i -lt $2 ]
do
echo $i
create $i $1
if [ -n "$RESULT" ]; then
echo $RESULT
exit
fi
i=`expr $i + 1`
done
}
# don't change dbname. use dbname written in this script
run db_ppp 46
-----------------------------------------------
# ./create2.sh
and thus, check tables created by create1.sh
# mysql -uroot
mysql> use db_bbbb_bbbb;
Database changed
upper query taked long time.
but, shorking problem is next.
mysql> show tables;
Empty set (0.00 sec)
tables created create1.sh, all droped.