Bug #43950 myisamchk shows negative value for 'Max keyfile length'
Submitted: 30 Mar 2009 6:14 Modified: 15 May 2009 23:57
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:5.0.80, 5.1.32 OS:Linux
Assigned to: Anurag Shekhar CPU Architecture:Any

[30 Mar 2009 6:14] Shane Bester
Description:
incorrect value for max keyfile length:

MyISAM file:         ./data/test/t1
Record format:       Packed
Character set:       latin1_swedish_ci (8)
File-version:        1
Creation time:       2009-03-30  6:07:40
Status:              checked,analyzed,optimized keys,sorted index pages
Auto increment key:              1  Last value:                     0
Keys are only flushed at close
Data records:                    0  Deleted blocks:                 0
Datafile parts:                  0  Deleted data:                   0
Datafile pointer (bytes):        6  Keyfile pointer (bytes):        7
Datafile length:                 0  Keyfile length:              4096
Max datafile length: 281474976710654  Max keyfile length:            -2
Recordlength:                 1013

table description:
Key Start Len Index   Type                     Rec/key         Root  Blocksize
1   2     8   unique  longlong                       1                    1024
2   10    1000 multip. ? NULL                         0                    4096
3   10    1000 multip. ? NULL                         0                    4096

Field Start Length Nullpos Nullbit Type
1     1     1                                                         
2     2     8                      no zeros                           
3     10    1002   1       1       varchar                            

How to repeat:
drop table if exists `t1`;
create table `t1`(`id` bigint not null auto_increment primary key,
`a` varchar(1000),key(`a`),key(`a`)
) engine=myisam delay_key_write=1 pack_keys=0 charset=latin1;

shutdown mysqld.

./bin/myisamchk --no-defaults -dvvvi ./data/test/t1

Suggested fix:
don't go negative
[30 Mar 2009 6:24] Valeriy Kravchuk
Thank you for the problem report. Verified just as described, also - with 5.0.80 from bzr on 32-bit Linux.
[2 Apr 2009 12:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71196

2725 Anurag Shekhar	2009-04-02
      Bug #43950 myisamchk shows negative value for 'Max keyfile length'
      
      While printing the Max keyfile length 'llstr' call was used which 
      was treating the max_key_file_length as negative.
      
      Changing this to ullstr fixes the problem. 
     @ myisam/myisamchk.c
        Changed llstr to ullstr while converting share->base.max_key_file_length-1 
        to string.
[8 Apr 2009 9:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71622

2748 Anurag Shekhar	2009-04-08
      Bug #43950 myisamchk shows negative value for 'Max keyfile length'  
      While printing the Max keyfile length 'llstr' call was used which 
      was treating the max_key_file_length as negative.
             
      Changing this to ullstr fixes the problem. 
      myisamchk output will differ in 32 bit and 64 bit Operating systems so its not 
      possible to have test case for this bug.
     @ myisam/myisamchk.c
        Replaced llstr by ullstr, while converting 
        share->base.max_key_file_length-1 to string.
[8 Apr 2009 10:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71630

2748 Anurag Shekhar	2009-04-08
      Bug #43950 myisamchk shows negative value for 'Max keyfile length'  
      While printing the Max keyfile length 'llstr' call was used which 
      was treating the max_key_file_length as negative.
      
      Changing this to ullstr fixes the problem. 
      myisamchk output will differ in 32 bit and 64 bit Operating systems 
      so its not possible to have test case for this bug.
     @ myisam/myisamchk.c
        Replaced llstr by ullstr, while converting 
        share->base.max_key_file_length-1 to string.
[8 Apr 2009 11:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/71633

2748 Anurag Shekhar	2009-04-08
      Bug #43950 myisamchk shows negative value for 'Max keyfile length'  
      While printing the Max keyfile length 'llstr' call was used which 
      was treating the max_key_file_length as negative.
      
      Changing this to ullstr fixes the problem. 
      myisamchk output will differ in 32 bit and 64 bit Operating systems 
      so its not possible to have test case for this bug.
     @ myisam/myisamchk.c
        Replaced llstr by ullstr, while converting 
        share->base.max_key_file_length-1 to string.
[5 May 2009 18:53] Bugs System
Pushed into 5.0.82 (revid:davi.arnaut@sun.com-20090505184158-dvmedh8n472y8np5) (version source revid:davi.arnaut@sun.com-20090505184158-dvmedh8n472y8np5) (merge vers: 5.0.82) (pib:6)
[5 May 2009 19:41] Bugs System
Pushed into 5.1.35 (revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (version source revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (merge vers: 5.1.35) (pib:6)
[6 May 2009 14:12] Bugs System
Pushed into 6.0.12-alpha (revid:svoj@sun.com-20090506125450-yokcmvqf2g7jhujq) (version source revid:anurag.shekhar@sun.com-20090409080925-gbowx3u79ki1ilt1) (merge vers: 6.0.11-alpha) (pib:6)
[15 May 2009 23:57] Paul DuBois
Noted in 5.0.82, 5.1.35, 6.0.12 changelogs.

myisamchk could display a negative "Max keyfile length" value.
[15 Jun 2009 8:28] Bugs System
Pushed into 5.1.35-ndb-6.3.26 (revid:jonas@mysql.com-20090615074202-0r5r2jmi83tww6sf) (version source revid:jonas@mysql.com-20090615070837-9pccutgc7repvb4d) (merge vers: 5.1.35-ndb-6.3.26) (pib:6)
[15 Jun 2009 9:07] Bugs System
Pushed into 5.1.35-ndb-7.0.7 (revid:jonas@mysql.com-20090615074335-9hcltksp5cu5fucn) (version source revid:jonas@mysql.com-20090615072714-rmfkvrbbipd9r32c) (merge vers: 5.1.35-ndb-7.0.7) (pib:6)
[15 Jun 2009 9:48] Bugs System
Pushed into 5.1.35-ndb-6.2.19 (revid:jonas@mysql.com-20090615061520-sq7ds4yw299ggugm) (version source revid:jonas@mysql.com-20090615054654-ebgpz7elwu1xj36j) (merge vers: 5.1.35-ndb-6.2.19) (pib:6)