You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.5 KiB

Bug#42438: Crash ha_partition::change_table_ptr There was two problems: The first was the symptom, caused by bad error handling in ha_partition. It did not handle print_error etc. when having no partitions (when used by dummy handler). The second was the real problem that when dropping tables it reused the table type (storage engine) from when the lock was asked for, not the table type that it had when gaining the exclusive name lock. So that it tried to delete tables from wrong storage engines. Solutions for the first problem was to accept some handler calls to the partitioning handler even if it was not setup with any partitions, and also if possible fallback to use the base handler's default functions. Solution for the second problem was to remove the optimization to reuse the definition from the cache, instead always check the frm-file when holding the LOCK_open mutex (updated with a fix for a debug print crash and better comments as required by reviewer, and removed optimization to avoid reading the frm-file). mysql-test/r/partition_debug_sync.result: Bug#42438: Crash ha_partition::change_table_ptr New result file using DEBUG_SYNC for deterministic results. mysql-test/t/partition_debug_sync.test: Bug#42438: Crash ha_partition::change_table_ptr New test file using DEBUG_SYNC for deterministic results. sql/ha_partition.cc: Bug#42438: Crash ha_partition::change_table_ptr allow some handler calls, used by error handling, even when no partitions are setup. Fallback to default handling if possible. sql/sql_base.cc: Bug#42438: Crash ha_partition::change_table_ptr Added DEBUG_SYNC point for deterministic test cases. sql/sql_table.cc: Bug#42438: Crash ha_partition::change_table_ptr Always use the table type written in the .frm-file (i.e. the current table type) when deleting a table. Moved the check for log-table to not depend of the cache. Added DEBUG_SYNC points for deterministic test cases.
16 years ago
  1. #--disable_abort_on_error
  2. #
  3. # Test for the partition storage engine which require DEBUG_SYNC feature to
  4. # Created by Mattias Jonsson
  5. #
  6. --source include/have_partition.inc
  7. --source include/have_debug_sync.inc
  8. --disable_warnings
  9. DROP TABLE IF EXISTS t1, t2;
  10. SET DEBUG_SYNC= 'RESET';
  11. --enable_warnings
  12. --echo #
  13. --echo # Bug#42438: Crash ha_partition::change_table_ptr
  14. --echo # Test when remove partitioning is done while drop table is waiting
  15. --echo # for the table.
  16. connect(con1, localhost, root,,);
  17. --echo # Con 1
  18. SET DEBUG_SYNC= 'RESET';
  19. CREATE TABLE t1
  20. (a INTEGER,
  21. b INTEGER NOT NULL,
  22. KEY (b))
  23. ENGINE = MYISAM
  24. /*!50100 PARTITION BY RANGE (a)
  25. (PARTITION p0 VALUES LESS THAN (2),
  26. PARTITION p1 VALUES LESS THAN (20),
  27. PARTITION p2 VALUES LESS THAN (100),
  28. PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
  29. SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter';
  30. SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL partitioning_removed';
  31. --send ALTER TABLE t1 REMOVE PARTITIONING
  32. connection default;
  33. --echo # Con default
  34. SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
  35. SET DEBUG_SYNC= 'waiting_for_table SIGNAL waiting_for_alter';
  36. SET DEBUG_SYNC= 'rm_table_part2_before_delete_table WAIT_FOR partitioning_removed';
  37. DROP TABLE IF EXISTS t1;
  38. --echo # Con 1
  39. connection con1;
  40. --reap
  41. connection default;
  42. SET DEBUG_SYNC= 'RESET';
  43. connection con1;
  44. SET DEBUG_SYNC= 'RESET';
  45. --echo #
  46. --echo # Bug#42438: Crash ha_partition::change_table_ptr
  47. --echo # Test when remove partitioning is failing due to drop table is already
  48. --echo # in progress.
  49. CREATE TABLE t2
  50. (a INTEGER,
  51. b INTEGER NOT NULL,
  52. KEY (b))
  53. ENGINE = MYISAM
  54. /*!50100 PARTITION BY RANGE (a)
  55. (PARTITION p0 VALUES LESS THAN (2),
  56. PARTITION p1 VALUES LESS THAN (20),
  57. PARTITION p2 VALUES LESS THAN (100),
  58. PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
  59. SET DEBUG_SYNC= 'before_lock_tables_takes_lock SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
  60. SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
  61. --send ALTER TABLE t2 REMOVE PARTITIONING
  62. connection default;
  63. --echo # Con default
  64. SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
  65. SET DEBUG_SYNC= 'waiting_for_table SIGNAL waiting_for_alter';
  66. SET DEBUG_SYNC= 'rm_table_part2_before_binlog SIGNAL delete_done';
  67. DROP TABLE IF EXISTS t2;
  68. --echo # Con 1
  69. connection con1;
  70. --error ER_NO_SUCH_TABLE
  71. --reap
  72. SET DEBUG_SYNC= 'RESET';
  73. disconnect con1;
  74. connection default;
  75. --echo # Con default
  76. SET DEBUG_SYNC= 'RESET';
  77. --echo End of 5.1 tests