Description:
After try executing this command bellow I get a MySQL Server has gone away:
UPDATE `Pagamentos` pg
LEFT JOIN `Movimentacoes` mv ON mv.SessaoID = pg.SessaoID AND mv.CaixaID = pg.CaixaID
SET pg.`MovimentacaoID` = mv.`ID`;
ALTER TABLE `Pagamentos` MODIFY `MovimentacaoID` INT NOT NULL;
the log says:
141015 12:28:44 InnoDB: Assertion failure in thread 5744 in file dict0dict.c line 2563
InnoDB: Failing assertion: UT_LIST_GET_LEN(table->referenced_list) == rbt_size(table->referenced_rbt)
and after recovery, my table (`Pagamentos`) has been deleted
Recovery log:
InnoDB: Log scan progressed past the checkpoint lsn 1283804114
141015 12:32:07 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1289046528
InnoDB: Doing recovery: scanned up to log sequence number 1294289408
InnoDB: Doing recovery: scanned up to log sequence number 1299532288
141015 12:32:12 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
InnoDB: Doing recovery: scanned up to log sequence number 1304775168
InnoDB: Doing recovery: scanned up to log sequence number 1310018048
InnoDB: Doing recovery: scanned up to log sequence number 1313688949
InnoDB: 1 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 2 row operations to undo
InnoDB: Trx id counter is BB00
141015 12:32:19 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
141015 12:32:21 InnoDB: Rolling back trx with id B901, 2 rows to undo
InnoDB: Rolling back of trx id B901 completed
I can't create this table anymore and I get:
141015 13:29:18 InnoDB: Assertion failure in thread 3192 in file dict0dict.c line 2552
InnoDB: Failing assertion: UT_LIST_GET_LEN(table->foreign_list) == rbt_size(table->foreign_rbt)
How to repeat:
Create two tables `Movimentacoes` and `Pagamentos`
-- Movimentacoes
CREATE TABLE IF NOT EXISTS `Movimentacoes` (
`ID` INT NOT NULL,
`SessaoID` INT NOT NULL,
`CaixaID` INT NOT NULL,
PRIMARY KEY (`ID`))
ENGINE = InnoDB;
-- Pagamentos
CREATE TABLE IF NOT EXISTS `Pagamentos` (
`ID` INT NOT NULL AUTO_INCREMENT,
`MovimentacaoID` INT NULL DEFAULT NULL,
`SessaoID` INT NOT NULL,
`CaixaID` INT NOT NULL,
PRIMARY KEY (`ID`),
INDEX `FK_Pagamentos_Movimentacoes_MovimentacaoID_idx` (`MovimentacaoID` ASC),
CONSTRAINT `FK_Pagamentos_Movimentacoes_MovimentacaoID`
FOREIGN KEY (`MovimentacaoID`)
REFERENCES `Movimentacoes` (`ID`)
ON DELETE RESTRICT
ON UPDATE CASCADE)
ENGINE = InnoDB;
INSERT many rows one to one on both tables but on `Pagamentos` leave `MovimentacaoID` field as NULL and run SQL command bellow with phpmyadmin:
UPDATE `Pagamentos` pg
LEFT JOIN `Movimentacoes` mv ON mv.SessaoID = pg.SessaoID AND mv.CaixaID = pg.CaixaID
SET pg.`MovimentacaoID` = mv.`ID`;
ALTER TABLE `Pagamentos` MODIFY `MovimentacaoID` INT NOT NULL;
`SessaoID` and `CaixaID` fields have another one to one table association.