Bug #46125 | Foreign keys: reorganizing partitions causes dangling reference | ||
---|---|---|---|
Submitted: | 10 Jul 2009 23:49 | Modified: | 29 Jul 2009 13:17 |
Reporter: | Peter Gulutzan | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 6.1.0-alpha-debug | OS: | Linux (SUSE 11.1 64-bit) |
Assigned to: | Dmitry Lenev | CPU Architecture: | Any |
[10 Jul 2009 23:49]
Peter Gulutzan
[12 Jul 2009 0:54]
MySQL Verification Team
Thank you for the bug report. Verified as described.
[16 Jul 2009 13:42]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/78858 2741 Dmitry Lenev 2009-07-16 Fix for bug #46125 "Foreign keys: reorganizing partitions causes dangling reference". In --foreign-key-all-engines=1 mode ALTER TABLE ... REORGANIZE PARTITION might have caused dangling references if table which was reorganized was a parent in some foreign key relationship and this reorganization removed some rows from this table. New foreign key implementation simply didn't take into account that ALTER TABLE ... REORGANIZE PARTITION might delete some rows from table being reorganized. So nothing was done to prevent deletion of parent rows with existing child rows. This fix solves this problem by checking if ALTER TABLE REORGANIZE PARTITION on table which serves as parent in a foreign key has deleted any rows, rolling back effect of such reorganization and emitting appropriate error message. Question for reviewer is marked by QQ. @ mysql-test/r/foreign_key_all_engines_2.result Added test for bug #46125 "Foreign keys: reorganizing partitions causes dangling reference". @ mysql-test/t/foreign_key_all_engines_2.test Added test for bug #46125 "Foreign keys: reorganizing partitions causes dangling reference". @ sql/sql_partition.cc Check if ALTER TABLE REORGANIZE PARTITION which changes parent table deletes any rows and if yes emit an appropriate error and rollback changes which were done.
[29 Jul 2009 13:05]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/79523 2762 Dmitry Lenev 2009-07-29 Fix for bug #46125 "Foreign keys: reorganizing partitions causes dangling reference". In --foreign-key-all-engines=1 mode ALTER TABLE ... REORGANIZE PARTITION might have caused dangling references if table which was reorganized was a parent in some foreign key relationship and this reorganization removed some rows from this table. New foreign key implementation simply didn't take into account that ALTER TABLE ... REORGANIZE PARTITION might delete some rows from table being reorganized. So nothing was done to prevent deletion of parent rows with existing child rows. This fix solves this problem by checking if ALTER TABLE REORGANIZE PARTITION on table which serves as parent in a foreign key has deleted any rows, rolling back effect of such reorganization and emitting appropriate error message. @ mysql-test/r/foreign_key_all_engines_2.result Added test for bug #46125 "Foreign keys: reorganizing partitions causes dangling reference". @ mysql-test/t/foreign_key_all_engines_2.test Added test for bug #46125 "Foreign keys: reorganizing partitions causes dangling reference". @ sql/sql_partition.cc Check if ALTER TABLE REORGANIZE PARTITION which changes parent table deletes any rows and if yes emit an appropriate error and rollback changes which were done. Since the above is not possible for one-phase partition changes disable them for parent tables.
[29 Jul 2009 13:16]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/79524 2764 Dmitry Lenev 2009-07-29 Fix for bug #46125 "Foreign keys: reorganizing partitions causes dangling reference". In --foreign-key-all-engines=1 mode ALTER TABLE ... REORGANIZE PARTITION might have caused dangling references if table which was reorganized was a parent in some foreign key relationship and this reorganization removed some rows from this table. New foreign key implementation simply didn't take into account that ALTER TABLE ... REORGANIZE PARTITION might delete some rows from table being reorganized. So nothing was done to prevent deletion of parent rows with existing child rows. This fix solves this problem by checking if ALTER TABLE REORGANIZE PARTITION on table which serves as parent in a foreign key has deleted any rows, rolling back effect of such reorganization and emitting appropriate error message. @ mysql-test/r/foreign_key_all_engines_2.result Added test for bug #46125 "Foreign keys: reorganizing partitions causes dangling reference". @ mysql-test/t/foreign_key_all_engines_2.test Added test for bug #46125 "Foreign keys: reorganizing partitions causes dangling reference". @ sql/sql_partition.cc Check if ALTER TABLE REORGANIZE PARTITION which changes parent table deletes any rows and if yes emit an appropriate error and rollback changes which were done. Since the above is not possible for one-phase partition changes disable them for parent tables.
[29 Jul 2009 13:17]
Dmitry Lenev
Fix for this bug was pushed into mysql-6.1-fk-stage tree. Since this problem was reported against tree which is not publicly available yet I am simply closing this bug-report.