List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:November 20 1999 3:51pm
Subject:Insertion may corrupt the database when key is 255 characters long
View as plain text  
>>>>> "bruce" == bruce  <bruce@stripped> writes:

>> Description:
bruce> 	I have a database of approximately 1.5 million URLs that is
bruce> constantly getting corrupted.  Rebuilding it from scratch does not fix
bruce> the problem, nor has upgrading database versions and database
bruce> formats. I have tracked it down to two consecutive INSERT statements
bruce> that always cause the database to be corrupted afterwards.

bruce> I have had this problem with mysql 3.22.23b, 3.22.27 and 2.23.5_alpha.
bruce> All three times I did a source build using gcc-2.7.2.3.  With the
bruce> alpha release, I also rebuilt mysql with gcc-2.95.2.  With
bruce> 2.23.5_alpha, I tried using both the old ISAM format and the new
bruce> MYISAM with the same results.

<cut>

Fix (for the MyISAM format):

*** /my/monty/master/mysql-3.23.6-alpha/myisam/mi_search.c	Mon Oct 18 01:53:12 1999
--- ./mi_search.c	Sat Nov 20 17:16:22 1999
***************
*** 865,871 ****
  	/* If the stored length has changed, we must move the key */
  	if (tot_length >= 255 && *start != 255)
  	{
! 	  bmove_upp((char*) key+length+2,(char*) key+length,length);
  	  *key=255;
  	  mi_int2store(key+1,tot_length);
  	  key+=3+length;
--- 865,872 ----
  	/* If the stored length has changed, we must move the key */
  	if (tot_length >= 255 && *start != 255)
  	{
! 	  /* length prefix changed from a length of one to a length of 3 */
! 	  bmove_upp((char*) key+length+3,(char*) key+length+1,length);
  	  *key=255;
  	  mi_int2store(key+1,tot_length);
  	  key+=3+length;

Regards,
Monty
Thread
Insertion may corrupt the database when key is 255 characters longbruce17 Nov
  • Re: Insertion may corrupt the database when key is 255 characters longsasha17 Nov
    • Re: Insertion may corrupt the database when key is 255 characters longsinisa17 Nov
      • Re: Insertion may corrupt the database when key is 255 characters longbruce18 Nov
        • Re: Insertion may corrupt the database when key is 255 characters longsinisa18 Nov
          • Unknown Sender19 Nov
  • Insertion may corrupt the database when key is 255 characters longMichael Widenius20 Nov
    • Connections dies after logrotate has been runKristian Soerensen21 Nov
    • Re: Insertion may corrupt the database when key is 255 characters longbruce24 Nov
      • Re: Insertion may corrupt the database when key is 255 characters longMichael Widenius26 Nov