~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_check.cc

  • Committer: lbieber
  • Date: 2010-10-01 13:06:31 UTC
  • mfrom: (1802.2.2 drizzle-bug-651948)
  • mto: This revision was merged to the branch mainline in revision 1805.
  • Revision ID: lbieber@orisndriz08-20101001130631-xubscnhmj7r5dn6g
Merge Andrew - Fix bug 651948 - Index lengths not retrieved using drizzledump

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/* Describe, check and repair of MyISAM tables */
17
17
 
459
459
                  llstr(share->state.key_root[key],buff));
460
460
      if (!(param->testflag & T_INFO))
461
461
        return(-1);
462
 
      result= UINT32_MAX;
 
462
      result= -1;
463
463
      continue;
464
464
    }
465
465
    param->key_file_blocks+=keyinfo->block_length;
478
478
                    llstr(info->state->records,buff2));
479
479
        if (!(param->testflag & T_INFO))
480
480
        return(-1);
481
 
        result= UINT32_MAX;
 
481
        result= -1;
482
482
        continue;
483
483
      }
484
484
      if (found_keys - full_text_keys == 1 &&
495
495
          mi_check_print_error(param,"Key 1 doesn't point at all records");
496
496
        if (!(param->testflag & T_INFO))
497
497
          return(-1);
498
 
        result= UINT32_MAX;
 
498
        result= -1;
499
499
        continue;
500
500
      }
501
501
    }
894
894
      puts("- check record links");
895
895
  }
896
896
 
897
 
  if (!mi_alloc_rec_buff(info, SIZE_MAX, &record))
 
897
  if (!mi_alloc_rec_buff(info, -1, &record))
898
898
  {
899
899
    mi_check_print_error(param,"Not enough memory for record");
900
900
    return(-1);
1434
1434
  if (!param->using_global_keycache)
1435
1435
    assert(0);
1436
1436
 
1437
 
  if (param->read_cache.init_io_cache(info->dfile, (uint) param->read_buffer_length, READ_CACHE,share->pack.header_length,1,MYF(MY_WME)))
 
1437
  if (init_io_cache(&param->read_cache,info->dfile,
 
1438
                    (uint) param->read_buffer_length,
 
1439
                    READ_CACHE,share->pack.header_length,1,MYF(MY_WME)))
1438
1440
  {
1439
1441
    memset(&info->rec_cache, 0, sizeof(info->rec_cache));
1440
1442
    goto err;
1441
1443
  }
1442
 
  if (not rep_quick)
1443
 
  {
1444
 
    if (info->rec_cache.init_io_cache(-1, (uint) param->write_buffer_length, WRITE_CACHE, new_header_length, 1, MYF(MY_WME | MY_WAIT_IF_FULL)))
1445
 
    {
 
1444
  if (!rep_quick)
 
1445
    if (init_io_cache(&info->rec_cache,-1,(uint) param->write_buffer_length,
 
1446
                      WRITE_CACHE, new_header_length, 1,
 
1447
                      MYF(MY_WME | MY_WAIT_IF_FULL)))
1446
1448
      goto err;
1447
 
    }
1448
 
  }
1449
1449
  info->opt_flag|=WRITE_CACHE_USED;
1450
 
  if (!mi_alloc_rec_buff(info, SIZE_MAX, &sort_param.record) ||
1451
 
      !mi_alloc_rec_buff(info, SIZE_MAX, &sort_param.rec_buff))
 
1450
  if (!mi_alloc_rec_buff(info, -1, &sort_param.record) ||
 
1451
      !mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
1452
1452
  {
1453
1453
    mi_check_print_error(param, "Not enough memory for extra record");
1454
1454
    goto err;
1641
1641
  rec_buff_ptr= NULL;
1642
1642
 
1643
1643
  free(sort_info.buff);
1644
 
  param->read_cache.end_io_cache();
 
1644
  end_io_cache(&param->read_cache);
1645
1645
  info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
1646
 
  info->rec_cache.end_io_cache();
 
1646
  end_io_cache(&info->rec_cache);
1647
1647
  got_error|= flush_blocks(param, share->getKeyCache(), share->kfile);
1648
 
  if (not got_error && param->testflag & T_UNPACK)
 
1648
  if (!got_error && param->testflag & T_UNPACK)
1649
1649
  {
1650
1650
    share->state.header.options[0]&= (unsigned char) ~HA_OPTION_COMPRESS_RECORD;
1651
1651
    share->pack.header_length=0;
2045
2045
  memset(&sort_info, 0, sizeof(sort_info));
2046
2046
  memset(&sort_param, 0, sizeof(sort_param));
2047
2047
  if (!(sort_info.key_block=
2048
 
        alloc_key_blocks(param, (uint) param->sort_key_blocks, share->base.max_key_block_length))
2049
 
      || param->read_cache.init_io_cache(info->dfile, (uint) param->read_buffer_length, READ_CACHE,share->pack.header_length,1,MYF(MY_WME))
2050
 
      || (! rep_quick && info->rec_cache.init_io_cache(info->dfile, (uint) param->write_buffer_length, WRITE_CACHE,new_header_length,1, MYF(MY_WME | MY_WAIT_IF_FULL) & param->myf_rw)))
2051
 
  {
 
2048
        alloc_key_blocks(param,
 
2049
                         (uint) param->sort_key_blocks,
 
2050
                         share->base.max_key_block_length))
 
2051
      || init_io_cache(&param->read_cache,info->dfile,
 
2052
                       (uint) param->read_buffer_length,
 
2053
                       READ_CACHE,share->pack.header_length,1,MYF(MY_WME)) ||
 
2054
      (! rep_quick &&
 
2055
       init_io_cache(&info->rec_cache,info->dfile,
 
2056
                     (uint) param->write_buffer_length,
 
2057
                     WRITE_CACHE,new_header_length,1,
 
2058
                     MYF(MY_WME | MY_WAIT_IF_FULL) & param->myf_rw)))
2052
2059
    goto err;
2053
 
  }
2054
2060
  sort_info.key_block_end=sort_info.key_block+param->sort_key_blocks;
2055
2061
  info->opt_flag|=WRITE_CACHE_USED;
2056
2062
  info->rec_cache.file=info->dfile;             /* for sort_delete_record */
2057
2063
 
2058
 
  if (!mi_alloc_rec_buff(info, SIZE_MAX, &sort_param.record) ||
2059
 
      !mi_alloc_rec_buff(info, SIZE_MAX, &sort_param.rec_buff))
 
2064
  if (!mi_alloc_rec_buff(info, -1, &sort_param.record) ||
 
2065
      !mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
2060
2066
  {
2061
2067
    mi_check_print_error(param, "Not enough memory for extra record");
2062
2068
    goto err;
2201
2207
    if (sort_param.fix_datafile)
2202
2208
    {
2203
2209
      param->read_cache.end_of_file=sort_param.filepos;
2204
 
      if (write_data_suffix(&sort_info, 1) || info->rec_cache.end_io_cache())
 
2210
      if (write_data_suffix(&sort_info,1) || end_io_cache(&info->rec_cache))
2205
2211
      {
2206
2212
        goto err;
2207
2213
      }
2228
2234
      info->state->data_file_length=sort_param.max_pos;
2229
2235
 
2230
2236
    param->read_cache.file=info->dfile;         /* re-init read cache */
2231
 
    param->read_cache.reinit_io_cache(READ_CACHE,share->pack.header_length, 1,1);
 
2237
    reinit_io_cache(&param->read_cache,READ_CACHE,share->pack.header_length,
 
2238
                    1,1);
2232
2239
  }
2233
2240
 
2234
2241
  if (param->testflag & T_WRITE_LOOP)
2286
2293
 
2287
2294
err:
2288
2295
  got_error|= flush_blocks(param, share->getKeyCache(), share->kfile);
2289
 
  info->rec_cache.end_io_cache();
 
2296
  end_io_cache(&info->rec_cache);
2290
2297
  if (!got_error)
2291
2298
  {
2292
2299
    /* Replace the actual file with the temporary file */
2330
2337
 
2331
2338
  free((unsigned char*) sort_info.key_block);
2332
2339
  free(sort_info.buff);
2333
 
  param->read_cache.end_io_cache();
 
2340
  end_io_cache(&param->read_cache);
2334
2341
  info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
2335
2342
  if (!got_error && (param->testflag & T_UNPACK))
2336
2343
  {
2361
2368
    (info->s->rec_reflength+
2362
2369
     _mi_make_key(info, sort_param->key, (unsigned char*) key,
2363
2370
                  sort_param->record, sort_param->filepos));
2364
 
#ifdef HAVE_VALGRIND
 
2371
#ifdef HAVE_purify
2365
2372
  memset((unsigned char *)key+sort_param->real_key_length, 0,
2366
2373
         (sort_param->key_length-sort_param->real_key_length));
2367
2374
#endif
3269
3276
    We have to use an allocated buffer instead of info->rec_buff as
3270
3277
    _mi_put_key_in_record() may use info->rec_buff
3271
3278
  */
3272
 
  if (!mi_alloc_rec_buff(info, SIZE_MAX, &record))
 
3279
  if (!mi_alloc_rec_buff(info, -1, &record))
3273
3280
  {
3274
3281
    mi_check_print_error(param,"Not enough memory for extra record");
3275
3282
    return;