Bug #6151 | myisam index corruption | ||
---|---|---|---|
Submitted: | 19 Oct 2004 2:27 | Modified: | 22 Oct 2004 21:14 |
Reporter: | Matthew Lord | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 4.1.6 and 4.1.7-bk | OS: | Windows (windows & linux) |
Assigned to: | Ingo Strüwing | CPU Architecture: | Any |
[19 Oct 2004 2:27]
Matthew Lord
[19 Oct 2004 2:37]
Matthew Lord
To be a little more specific about the machines I verified the problem on: windows 2000 SMP RH 9 (Linux booty 2.4.21 #12 SMP Thu Aug 14 00:49:40 EDT 2003 i686 i686 i386 GNU/Linux)
[19 Oct 2004 17:23]
Alexey Kopytov
Not reproducible on 4.0 from BK.
[20 Oct 2004 10:20]
Ingo Strüwing
I cannot get at the file. Please attach it to the "Files" section of this bug report.
[21 Oct 2004 13:25]
Ingo Strüwing
My current findings are the following: The order of keys in the key file changed from 4.0 to 4.1. In 4.1 it appears that keys are compared as if they had blanks past their end, which is not the case in 4.0. The new key order seems to disturb the (packed-) key removal function. Based on this findings I could break down the customers case to: DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( c1 int, c2 varbinary(240), UNIQUE KEY (c1), KEY (c2) ) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'\Z\Z\Z\Z'); INSERT INTO t1 VALUES (2,'\Z\Z\Z\Z\Z\Z'); INSERT INTO t1 VALUES (3,'\Z\Z\Z\Z'); DELETE FROM t1 WHERE (c1 = 1); DELETE FROM t1 WHERE (c1 = 3); It does not matter, if c2 is varbinary(240) or char(10) or some other character type. The only thing that matters is that we need to have these control characters (ASII code below BLANK). With character codes above BLANK, everything works OK. The question is now if the new key order is intentional.
[21 Oct 2004 13:48]
Alexander Barkov
Ingo, you are right. Keys are compared like if the values were padded up to the maximum length with space character. There are two functions in CHARSET_INFO implementing comparison: strnncoll - for usual comparison strnncollsp - for comparison with space padding behaviour. Probably strnncoll should be changed into strnncollsp in some places in MyISAM.
[21 Oct 2004 20:22]
Ingo Strüwing
bk commit - 4.1 tree (ingo:1.2099) BUG#6151
[22 Oct 2004 21:14]
Ingo Strüwing
Fixed the packed key removal code. It relied on the fact that shorter keys come before longer keys with the same start. This is not always true anymore, since in 4.1 keys are compared by blank padding. Fixed in 4.1.7.