• unknown's avatar
    BUG#31277 - myisamchk --unpack corrupts a table · 43dd5f39
    unknown authored
    With certain data sets (when compressed record length gets bigger than
    uncompressed) myisamchk --unpack may corrupt data file.
    
    Fixed that record length was wrongly restored from compressed table.
    
    
    myisam/mi_check.c:
      With compressed tables compressed record length may be bigger than
      pack_reclength, thus we may allocate insufficient memory for record
      buffer.
      
      Let single function allocate record buffer, performing needed record
      length calculations.
      
      Still, it is not doable with parallel repair, as it allocates needed
      record buffers at once. For parellel repair added better record length
      calculation.
    myisam/mi_open.c:
      When calculating record buffer size, take into account that compressed
      record length may be bigger than uncompressed.
    myisam/mi_packrec.c:
      With certain data set share->max_pack_length (compressed record length)
      may be bigger than share->base.pack_reclength (packed record length).
      
      set_if_bigger(pack_reclength, max_pack_length) in this case causes
      myisamchk --unpack to write extra garbage, whereas pack_reclength
      remains the same in new index file. As a result we get unreadable
      table.
    myisam/myisamchk.c:
      With compressed tables compressed record length may be bigger than
      pack_reclength, thus we may allocate insufficient memory for record
      buffer.
      
      Let single function allocate record buffer, performing needed record
      length calculations.
    mysql-test/mysql-test-run.pl:
      Environment variables to execute myisamchk and myisampack.
    mysql-test/r/myisampack.result:
      New BitKeeper file ``mysql-test/r/myisampack.result''
    mysql-test/t/myisampack.test:
      New BitKeeper file ``mysql-test/t/myisampack.test''
    43dd5f39
mysql-test-run.pl 138 KB