2012-08-06 57 views
0

我执行了涉及(除其他外)两个链接表的模式更改。将InnoDB表合并到MyISAM中:不存在的表抱怨

DROP TABLE `Bump`; # this used to have a foreign key to Place 

ALTER TABLE `Place` 
    ... 
    DROP PRIMARY KEY, #it used to be a composite key from two decmals 
    ADD PRIMARY KEY (`id`) USING BTREE; 

在那之后,我试图改变发动机的表

ALTER TABLE `Place` ENGINE = MyISAM; 

但它给我:

mysql> ALTER TABLE `mydb`.`Place` ENGINE = MyISAM; 
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails 

这一贯的发生都是有全新的表。下面是跟踪。但是在一张空桌子里,它什么也没说。

但是对于先前填充的Place,它已经提到Bump表的名称。为什么这发生在我身上,当父表没有其以前的主键并且子表不存在?

我将转换为MyISAM以避免大量插入的事务开销。

mysql> show engine innodb status; 
+--------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 
| Type | Name | Status                                                                                                                                                                                                                                                               | 
+--------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 
| InnoDB |  | 
===================================== 
120806 18:49:20 INNODB MONITOR OUTPUT 
===================================== 
Per second averages calculated from the last 28 seconds 
----------------- 
BACKGROUND THREAD 
----------------- 
srv_master_thread loops: 1 1_second, 1 sleeps, 0 10_second, 1 background, 1 flush 
srv_master_thread log flush and writes: 1 
---------- 
SEMAPHORES 
---------- 
OS WAIT ARRAY INFO: reservation count 3, signal count 3 
Mutex spin waits 1, rounds 30, OS waits 1 
RW-shared spins 2, rounds 60, OS waits 2 
RW-excl spins 0, rounds 0, OS waits 0 
Spin rounds per wait: 30.00 mutex, 30.00 RW-shared, 0.00 RW-excl 
------------ 
TRANSACTIONS 
------------ 
Trx id counter 2D00 
Purge done for trx's n:o < 2BB0 undo n:o < 0 
History list length 2467 
LIST OF TRANSACTIONS FOR EACH SESSION: 
---TRANSACTION 0, not started 
MySQL thread id 37, OS thread handle 0xa6affb40, query id 182 localhost root 
show engine innodb status 
---TRANSACTION 0, not started 
MySQL thread id 36, OS thread handle 0xb625ab40, query id 177 localhost 127.0.0.1 root 
-------- 
FILE I/O 
-------- 
I/O thread 0 state: waiting for i/o request (insert buffer thread) 
I/O thread 1 state: waiting for i/o request (log thread) 
I/O thread 2 state: waiting for i/o request (read thread) 
I/O thread 3 state: waiting for i/o request (read thread) 
I/O thread 4 state: waiting for i/o request (read thread) 
I/O thread 5 state: waiting for i/o request (read thread) 
I/O thread 6 state: waiting for i/o request (write thread) 
I/O thread 7 state: waiting for i/o request (write thread) 
I/O thread 8 state: waiting for i/o request (write thread) 
I/O thread 9 state: waiting for i/o request (write thread) 
Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] , 
ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 
Pending flushes (fsync) log: 0; buffer pool: 0 
671 OS file reads, 3 OS file writes, 3 OS fsyncs 
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s 
------------------------------------- 
INSERT BUFFER AND ADAPTIVE HASH INDEX 
------------------------------------- 
Ibuf: size 1, free list len 0, seg size 2, 0 merges 
merged operations: 
insert 0, delete mark 0, delete 0 
discarded operations: 
insert 0, delete mark 0, delete 0 
Hash table size 553193, node heap has 2 buffer(s) 
0.00 hash searches/s, 0.00 non-hash searches/s 
--- 
LOG 
--- 
Log sequence number 10825171 
Log flushed up to 10825171 
Last checkpoint at 10825171 
0 pending log writes, 0 pending chkp writes 
8 log i/o's done, 0.00 log i/o's/second 
---------------------- 
BUFFER POOL AND MEMORY 
---------------------- 
Total memory allocated 135987200; in additional pool allocated 0 
Dictionary memory allocated 358285 
Buffer pool size 8191 
Free buffers  7529 
Database pages  660 
Old database pages 263 
Modified db pages 0 
Pending reads 0 
Pending writes: LRU 0, flush list 0, single page 0 
Pages made young 0, not young 0 
0.00 youngs/s, 0.00 non-youngs/s 
Pages read 660, created 0, written 0 
0.00 reads/s, 0.00 creates/s, 0.00 writes/s 
No buffer pool page gets since the last printout 
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s 
LRU len: 660, unzip_LRU len: 0 
I/O sum[0]:cur[0], unzip sum[0]:cur[0] 
-------------- 
ROW OPERATIONS 
-------------- 
0 queries inside InnoDB, 0 queries in queue 
1 read views open inside InnoDB 
Main thread process no. 26970, id 2791775040, state: waiting for server activity 
Number of rows inserted 0, updated 0, deleted 0, read 0 
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s 
---------------------------- 
END OF INNODB MONITOR OUTPUT 
============================ 
| 
+--------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 
1 row in set (0.00 sec) 

回答

0

似乎在表上必须有另外的外键(或者链接到表)。

你从'show create table mydb.Place'回来了什么?