Bug #5284 Key in wrong position - corrupt table
Submitted: 28 Aug 2004 22:08 Modified: 30 Aug 2004 15:57
Reporter: Philip Day Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.3b/4.1.4 OS:Windows (win2k and FC2 linux)
Assigned to: Sergei Golubchik CPU Architecture:Any

[28 Aug 2004 22:08] Philip Day
Description:
Using the sql below I always get a corrupt table (key in wrong position, corrupt).

All three rows are required to produce a corrupt table, any two together do not cause a problem. I've tried it on both win2k and fedora core 2 with MySQL 4.1.2 and 4.1.3b with the same results.

How to repeat:
-- run this then check the resulting table

DROP TABLE IF EXISTS `tb_broken`;
CREATE TABLE `tb_broken` (
  `id` int(11) NOT NULL auto_increment,
  `fd_ili_url` varchar(240) NOT NULL default '',
  `fd_url` varchar(180) NOT NULL default '',
  `fd_org_name` varchar(230) NOT NULL default '',
  `fd_org_type` varchar(50) NOT NULL default '',
  `fd_org_issue` varchar(70) NOT NULL default '',
  `fd_org_mission` text,
  `fd_org_run_by` varchar(20) NOT NULL default '',
  `fd_staff_count` int(3) NOT NULL default '0',
  `fd_non_profit` varchar(100) NOT NULL default '',
  `fd_membership_count` int(11) NOT NULL default '0',
  `fd_disability_policy_url` varchar(180) NOT NULL default '',
  `fd_disability_policy` varchar(40) NOT NULL default '',
  `fd_internships` varchar(150) NOT NULL default '',
  `fd_accessible` varchar(150) NOT NULL default '',
  `fd_accomodation` varchar(150) NOT NULL default '',
  `fd_description` text,
  `fd_coop` text,
  `fd_expertise` text,
  `fd_org_funded_by` text,
  `fd_ili_comments` text,
  `fd_address` text,
  `fd_city` varchar(100) NOT NULL default '',
  `fd_state` varchar(100) NOT NULL default '',
  `fd_land_iso` varchar(4) NOT NULL default '',
  `fd_land` varchar(100) NOT NULL default '',
  `fd_language` varchar(20) NOT NULL default 'english',
  `fd_email` varchar(200) NOT NULL default '',
  `fd_email_name` varchar(100) NOT NULL default '',
  `fd_phone` varchar(50) NOT NULL default '',
  `fd_fax` varchar(50) NOT NULL default '',
  `fd_ili_link` varchar(20) NOT NULL default '',
  `fd_editor` int(11) unsigned NOT NULL default '0',
  `fd_date_mail_sent` datetime NOT NULL default '0000-00-00 00:00:00',
  `fd_mail_count` int(10) unsigned NOT NULL default '0',
  `fd_scan_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `fd_scan_log` varchar(255) NOT NULL default '',
  `fd_page_last_mod` datetime NOT NULL default '0000-00-00 00:00:00',
  `fd_md5` varchar(200) NOT NULL default '',
  `fd_check_ok` tinyint(1) NOT NULL default '3',
  `fd_scan_result` int(1) NOT NULL default '0',
  `fd_show` tinyint(1) unsigned NOT NULL default '0',
  `fd_traffic_rank` int(7) unsigned NOT NULL default '0',
  `fd_log` text,
  `fd_date_added` datetime NOT NULL default '0000-00-00 00:00:00',
  `fd_date_changed` timestamp NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`id`),
  KEY `idx_acces` (`fd_accessible`),
  KEY `idx_accom` (`fd_accomodation`)
) ENGINE=MyISAM;

  
  

INSERT INTO `tb_broken` (`id`, `fd_ili_url`, `fd_url`, `fd_org_name`, `fd_org_type`, `fd_org_issue`, `fd_org_mission`, `fd_org_run_by`, `fd_staff_count`, `fd_non_profit`, `fd_membership_count`, `fd_disability_policy_url`, `fd_disability_policy`, `fd_internships`, `fd_accessible`, `fd_accomodation`, `fd_description`, `fd_coop`, `fd_expertise`, `fd_org_funded_by`, `fd_ili_comments`, `fd_address`, `fd_city`, `fd_state`, `fd_land_iso`, `fd_land`, `fd_language`, `fd_email`, `fd_email_name`, `fd_phone`, `fd_fax`, `fd_ili_link`, `fd_editor`, `fd_date_mail_sent`, `fd_mail_count`, `fd_scan_date`, `fd_scan_log`, `fd_page_last_mod`, `fd_md5`, `fd_check_ok`, `fd_scan_result`, `fd_show`, `fd_traffic_rank`, `fd_log`, `fd_date_added`, `fd_date_changed`) VALUES (176,'176_vsa_arts.html','http://www.vsarts.org','VSA arts (formerly Very Special Arts)','international','humanitarian','We support the power of the arts in the lives of people with disabilities. Our programs emcompass all of the arts, including visual, performing, and written, and serve all of the disabilities. This is accomplished mainly through educational and vocational programs implemented through our 43 states and 86 international affiliates network. We also serve visual artists directly through means of an artist\'s registry, an online virtual gallery, online exhibits, and many resources. We plan many enhancements to our Internet resources in the near future, with more opportunities for interaction.','to some degree',0,'',0,'','0','can \r\nWe are interested in providing internships to people with disabilities with a wide range of backgrounds and skills in support of our organizatio','can \r\nWe are interested in providing internships to people with disabilities with a wide range of backgrounds and skills in support of our organizatio','can We have several training programs for people interested in working with our programs in their local communities. Please contact out programs depar','','Assisting persons with intellectual disabilities.\r\nAssistive devices.\r\nAwareness raising.\r\nChildren with disabilities.\r\nCoalition building and networking.\r\nComputers and disability.\r\nEducation and vocational training.\r\nEmployment.\r\nInternational development and disability.\r\nMedia work.\r\nPeer support.\r\nResearch.\r\nUniversal design.\r\nImproving the visibility and acknowledgement of the many talents and contributions of artists with disabilities.\r\nCareers in the visual arts, portfolio preparation, working with galleries, and other employment issues. Many resources will be added to our Internet site in the near future, available to all.\r\nWe have cooperated with organizations in other countries before:\r\n\r\nPlease see our Internet site under \"partnerships\" for brief details of these affiliations. Please contact our \"partnerships\" department for more detailed information. ','Awareness raising.\r\nChildren with disabilities.\r\nCoalition building and networking.\r\nEducation and vocational training.\r\nPeer support.\r\nCareers in the visual arts, portfolio preparation, working with galleries, and other employment issues. Many resources will be added to our Internet site in the near future, available to all.','A wide variety of national, and international organizations, government funds, and coporporate funders.','','1300 Connecticut Ave., N.W.\r\n20036','Washington','DC','','USA','','webmaster@vsarts.org','Chris Jeffries','202-628-2800','','',0,'2004-08-24 15:54:48',1,'2004-08-24 15:54:48','2004-08-23 14:52:33-OK no mail.','0000-00-00 00:00:00','2aa08eeb73a6ea87db4e2edf50b8d977',3,0,0,0,'','1999-06-21 00:00:00','1999-06-21 00:00:00');
INSERT INTO `tb_broken` (`id`, `fd_ili_url`, `fd_url`, `fd_org_name`, `fd_org_type`, `fd_org_issue`, `fd_org_mission`, `fd_org_run_by`, `fd_staff_count`, `fd_non_profit`, `fd_membership_count`, `fd_disability_policy_url`, `fd_disability_policy`, `fd_internships`, `fd_accessible`, `fd_accomodation`, `fd_description`, `fd_coop`, `fd_expertise`, `fd_org_funded_by`, `fd_ili_comments`, `fd_address`, `fd_city`, `fd_state`, `fd_land_iso`, `fd_land`, `fd_language`, `fd_email`, `fd_email_name`, `fd_phone`, `fd_fax`, `fd_ili_link`, `fd_editor`, `fd_date_mail_sent`, `fd_mail_count`, `fd_scan_date`, `fd_scan_log`, `fd_page_last_mod`, `fd_md5`, `fd_check_ok`, `fd_scan_result`, `fd_show`, `fd_traffic_rank`, `fd_log`, `fd_date_added`, `fd_date_changed`) VALUES (177,'177_axis_dance_company.html','http://www.axisdance.org','AXIS Dance Company','international','human and civil rights','AXIS Dance Companys primary mission is to create and perform high quality contemporary dance that is developed through the collaboration of dancers with and without disabilities.  AXIS teaches dance and educates about collaboration and disability through community outreach and education programs.  AXIS is committed to promoting and supporting this form of dance locally, nationally and internationally.','mainly',0,'',0,'','0','can Finding lodging, transportation.  study integrated dance','can Finding lodging, transportation.  study integrated dance','can Finding lodging, transportation.  study integrated dance','','Awareness raising.\r\nChildren with disabilities.\r\nCoalition building and networking.\r\nInternational development and disability.\r\nMedia work.\r\nRecreation and travel.\r\nintegrated dance for people with and without disabilities\r\nintegrated dance for people with and without disabilities\r\nWe have cooperated with organizations in other countries before:\r\nFINIST, Novosibirsk, Siberia\r\nresidency to teach dance, indep living skill, self defense\r\nCologne, Germany  residency to teach dance','Awareness raising.\r\nChildren with disabilities.\r\nCoalition building and networking.\r\nMedia work.\r\nRecreation and travel.\r\nintegrated dance for people with and without disabilities','Arts, disability, government, individuals, fees for our services','please add an arts category to your search','5337 College Ave #630\r\n94618','Oakland','CA','','USA','','iwjs@aol.com','Judith Smith','510.287.5792','510.558.0511','',0,'2004-08-24 15:54:49',1,'2004-08-24 15:54:49','2004-08-23 14:52:35-OK no mail.','2004-03-24 19:49:29','39d67d9775a7cc0df3e0403fa7fc216e',3,0,0,0,'','1999-06-21 00:00:00','1999-06-21 00:00:00');
INSERT INTO `tb_broken` (`id`, `fd_ili_url`, `fd_url`, `fd_org_name`, `fd_org_type`, `fd_org_issue`, `fd_org_mission`, `fd_org_run_by`, `fd_staff_count`, `fd_non_profit`, `fd_membership_count`, `fd_disability_policy_url`, `fd_disability_policy`, `fd_internships`, `fd_accessible`, `fd_accomodation`, `fd_description`, `fd_coop`, `fd_expertise`, `fd_org_funded_by`, `fd_ili_comments`, `fd_address`, `fd_city`, `fd_state`, `fd_land_iso`, `fd_land`, `fd_language`, `fd_email`, `fd_email_name`, `fd_phone`, `fd_fax`, `fd_ili_link`, `fd_editor`, `fd_date_mail_sent`, `fd_mail_count`, `fd_scan_date`, `fd_scan_log`, `fd_page_last_mod`, `fd_md5`, `fd_check_ok`, `fd_scan_result`, `fd_show`, `fd_traffic_rank`, `fd_log`, `fd_date_added`, `fd_date_changed`) VALUES (187,'187_agrenska.html','http://www.agrenska.se','Agrenska','national','medical','Rare disability is our first interest, and how it affect the whole family','mainly',0,'',0,'','0','can','can','can','','Children with disabilities.\r\nEducation and vocational training.\r\nParenting.\r\nWe have cooperated with organizations in other countries before:\r\nEurordis','Awareness raising.\r\nChildren with disabilities.\r\nEducation and vocational training.\r\nEmployment.\r\nInternational development and disability.\r\nParenting.\r\nResearch.','','','Box 2058\r\nS436 02','Hovas','','','Sweden','','agrenska@agrenska.se','Anders Olauson','+46 31 911090','4 631 911 979','',0,'2004-08-24 15:54:53',1,'2004-08-24 15:54:53','2004-08-23 14:52:44-OK no mail.','2004-08-23 14:52:35','b7663ff388a3f61a6a3db295eb5eac38',3,0,0,0,'','1999-06-24 00:00:00','1999-06-24 00:00:00');
[29 Aug 2004 0:55] MySQL Verification Team
Thank you for the bug report I was able to repeat:

mysql> check table tb_broken;
+----------------+-------+----------+------------------------------------+
| Table          | Op    | Msg_type | Msg_text                           |
+----------------+-------+----------+------------------------------------+
| test.tb_broken | check | error    | Key in wrong position at page 2048 |
| test.tb_broken | check | error    | Corrupt                            |
+----------------+-------+----------+------------------------------------+
2 rows in set (0.04 sec)

mysql> select version();
+-------------------+
| version()         |
+-------------------+
| 4.1.4-gamma-debug |
+-------------------+
1 row in set (0.03 sec)
[30 Aug 2004 11:31] Philip Day
In case it helps to narrow it down - this also produces a corrupt table:

DROP TABLE IF EXISTS tb_broken;
CREATE TABLE tb_broken (
  id int(11) NOT NULL auto_increment,
  fd_accessible varchar(150) NOT NULL default '',
  fd_accomodation varchar(150) NOT NULL default '',
  PRIMARY KEY  (id),
  KEY idx_acces (fd_accessible),
  KEY idx_accom (fd_accomodation)
);

#
# Dumping data for table 'tb_broken'
#

INSERT INTO tb_broken (id, fd_accessible, fd_accomodation) VALUES("176", "can \r\nWe are interested in", "can We have several");
INSERT INTO tb_broken (id, fd_accessible, fd_accomodation) VALUES("177", "can Finding lodging, transportation.  study integrated dance", "can Finding");
INSERT INTO tb_broken (id, fd_accessible, fd_accomodation) VALUES("187", "can", "can");
[30 Aug 2004 11:43] Philip Day
-- this one -  "can \r\nWe are interested in"  needs to be on one line..

DROP TABLE IF EXISTS tb_broken;
CREATE TABLE tb_broken (
  id int(11) NOT NULL auto_increment,
  fd_accessible varchar(150) NOT NULL default '',
  fd_accomodation varchar(150) NOT NULL default '',
  PRIMARY KEY  (id),
  KEY idx_acces (fd_accessible),
  KEY idx_accom (fd_accomodation)
);

INSERT INTO tb_broken (id, fd_accessible, fd_accomodation) 
VALUES
("17600000", "can \r\nWe are interested in", "can We have several");

INSERT INTO tb_broken (id, fd_accessible, fd_accomodation) 
VALUES
("17700000", "can Finding lodging, transportation.  study integrated dance", "can Finding");

INSERT INTO tb_broken (id, fd_accessible, fd_accomodation)
VALUES
("18700000", "can","can");
[30 Aug 2004 15:57] Sergei Golubchik
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

fixed in 4.1.5
thanks for the good test case!