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.

85 lines
2.2 KiB

Fix for Bug #37007 Maria: different checksum for MyISAM table depending on CHECKSUM=0|1 This also adds a check that MyISAM tables with incompatible checksums are detected by CHECK TABLE ... [FOR UPGRADE] and thus also by mysql_upgrade. The tables that are incomatible are MyISAM tables with ROW_FORMAT=fixed and has VARCHAR fields and have CHECKSUM enabled. Before these tables gave different checksum if you used CHECK TABLE with or without EXTENDED mysql-test/r/old-mode.result: Now we get same results with and without EXTENDED mysql-test/r/row-checksum-old.result: Initial results mysql-test/r/row-checksum.result: Initial results mysql-test/t/old-mode.test: Added test with QUICK to show that the live checksum is not used when running with --old mysql-test/t/row-checksum-old-master.opt: Start mysqld with --old mode to enable old checksum code mysql-test/t/row-checksum-old.test: Run row-checksum test under mysqld --old mysql-test/t/row-checksum.test: Verify that checksum are calculated the same way with and without EXTENDED We run this with several storage engines to ensure results are the same over storage engines sql/ha_partition.cc: Use new HA_HAS_xxx_CHECKSUM flags sql/handler.cc: Use new HA_HAS_xxx_CHECKSUM flags sql/handler.h: Split HA_HAS_CHECKSUM into HA_HAS_NEW_CHECKSUM and HA_HAS_OLD_CHECKSUM flags. This is a safe API change as only MyISAM and Maria should use these handler flags. sql/sql_show.cc: Use new HA_HAS_xxx_CHECKSUM flags sql/sql_table.cc: Use file->checksum() for live checksums if the life checksum method corresponds to the mysqld --old flag storage/maria/ha_maria.cc: Use new HA_HAS_xxx_CHECKSUM flags storage/myisam/ha_myisam.cc: Set HA_HAS_OLD_CHECKSUM and/or HA_HAS_NEW_CHECKSUM flags depending on if this is a new myisam or old myisam file Add method check_for_upgrade() to detect if the table is of old version with a checksum that is incompatible with CHECK TABLE ... EXTENDED storage/myisam/ha_myisam.h: Added check_for_upgrade() storage/myisam/mi_open.c: Removed not neede cast Initialize share->has_null_fields and share->has_varchar_fields variables storage/myisam/myisamdef.h: Added share->has_null_fields and share->has_varchar_fields
18 years ago
  1. drop table if exists t1;
  2. create table t1 (a int null, v varchar(100)) engine=myisam checksum=0;
  3. insert into t1 values(null, null), (1, "hello");
  4. checksum table t1;
  5. Table Checksum
  6. test.t1 229851577
  7. checksum table t1 quick;
  8. Table Checksum
  9. test.t1 NULL
  10. checksum table t1 extended;
  11. Table Checksum
  12. test.t1 229851577
  13. drop table if exists t1;
  14. create table t1 (a int null, v varchar(100)) engine=myisam checksum=1;
  15. insert into t1 values(null, null), (1, "hello");
  16. checksum table t1;
  17. Table Checksum
  18. test.t1 229851577
  19. checksum table t1 quick;
  20. Table Checksum
  21. test.t1 229851577
  22. checksum table t1 extended;
  23. Table Checksum
  24. test.t1 229851577
  25. drop table if exists t1;
  26. create table t1 (a int null, v varchar(100)) engine=innodb checksum=0;
  27. insert into t1 values(null, null), (1, "hello");
  28. checksum table t1;
  29. Table Checksum
  30. test.t1 229851577
  31. checksum table t1 quick;
  32. Table Checksum
  33. test.t1 NULL
  34. checksum table t1 extended;
  35. Table Checksum
  36. test.t1 229851577
  37. drop table t1;
  38. create table t1 (a int null, v varchar(100)) engine=maria checksum=0;
  39. insert into t1 values(null, null), (1, "hello");
  40. checksum table t1;
  41. Table Checksum
  42. test.t1 229851577
  43. checksum table t1 quick;
  44. Table Checksum
  45. test.t1 NULL
  46. checksum table t1 extended;
  47. Table Checksum
  48. test.t1 229851577
  49. drop table t1;
  50. create table t1 (a int null, v varchar(100)) engine=maria checksum=1;
  51. insert into t1 values(null, null), (1, "hello");
  52. checksum table t1;
  53. Table Checksum
  54. test.t1 229851577
  55. checksum table t1 quick;
  56. Table Checksum
  57. test.t1 229851577
  58. checksum table t1 extended;
  59. Table Checksum
  60. test.t1 229851577
  61. drop table t1;
  62. create table t1 (a int null, v varchar(100)) engine=myisam checksum=1 row_format=fixed;
  63. insert into t1 values(null, null), (1, "hello");
  64. checksum table t1;
  65. Table Checksum
  66. test.t1 3885665021
  67. checksum table t1 quick;
  68. Table Checksum
  69. test.t1 3885665021
  70. checksum table t1 extended;
  71. Table Checksum
  72. test.t1 3885665021
  73. drop table if exists t1;
  74. create table t1 (a int null, v varchar(100)) engine=innodb checksum=0 row_format=fixed;
  75. insert into t1 values(null, null), (1, "hello");
  76. checksum table t1;
  77. Table Checksum
  78. test.t1 3885665021
  79. checksum table t1 quick;
  80. Table Checksum
  81. test.t1 NULL
  82. checksum table t1 extended;
  83. Table Checksum
  84. test.t1 3885665021
  85. drop table t1;