~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/ha_myisam.cc

  • Committer: Brian Aker
  • Date: 2009-01-15 03:28:20 UTC
  • Revision ID: brian@tangent.org-20090115032820-lt6jzt5plvadzb1y
MyISAM fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
static uint32_t repair_threads;
36
36
static uint32_t block_size;
37
37
static uint64_t max_sort_file_size;
 
38
static uint64_t sort_buffer_size;
38
39
 
39
40
/* bits in myisam_recover_options */
40
41
const char *myisam_recover_names[] =
765
766
  param.testflag= ((check_opt->flags & ~(T_EXTEND)) |
766
767
                   T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM |
767
768
                   (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT));
768
 
  param.sort_buffer_length=  check_opt->sort_buffer_size;
 
769
  param.sort_buffer_length=  sort_buffer_size;
769
770
  start_records=file->state->records;
770
771
  while ((error=repair(session,param,0)) && param.retry_repair)
771
772
  {
811
812
  param.op_name= "optimize";
812
813
  param.testflag= (check_opt->flags | T_SILENT | T_FORCE_CREATE |
813
814
                   T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX);
814
 
  param.sort_buffer_length=  check_opt->sort_buffer_size;
 
815
  param.sort_buffer_length= sort_buffer_size;
815
816
  if ((error= repair(session,param,1)) && param.retry_repair)
816
817
  {
817
818
    errmsg_printf(ERRMSG_LVL_WARN, "Warning: Optimize table got errno %d on %s.%s, retrying",
826
827
int ha_myisam::repair(Session *session, MI_CHECK &param, bool do_optimize)
827
828
{
828
829
  int error=0;
829
 
  uint32_t local_testflag=param.testflag;
 
830
  uint32_t local_testflag= param.testflag;
830
831
  bool optimize_done= !do_optimize, statistics_done=0;
831
832
  const char *old_proc_info= session->get_proc_info();
832
833
  char fixed_name[FN_REFLEN];
855
856
  param.using_global_keycache = 1;
856
857
  param.session= session;
857
858
  param.out_flag= 0;
 
859
  param.sort_buffer_length= sort_buffer_size;
858
860
  strcpy(fixed_name,file->filename);
859
861
 
860
862
  // Don't lock tables if we have used LOCK Table
1123
1125
    param.testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK |
1124
1126
                     T_CREATE_MISSING_KEYS);
1125
1127
    param.myf_rw&= ~MY_WAIT_IF_FULL;
1126
 
    param.sort_buffer_length=  session->variables.myisam_sort_buff_size;
 
1128
    param.sort_buffer_length=  sort_buffer_size;
1127
1129
    param.stats_method= (enum_mi_stats_method)session->variables.myisam_stats_method;
1128
1130
    if ((error= (repair(session,param,0) != HA_ADMIN_OK)) && param.retry_repair)
1129
1131
    {
1877
1879
                           NULL, NULL, 1, 1, UINT32_MAX, 0);
1878
1880
 
1879
1881
static DRIZZLE_SYSVAR_ULONGLONG(max_sort_file_size, max_sort_file_size,
1880
 
  PLUGIN_VAR_RQCMDARG,
1881
 
  N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."),
1882
 
  NULL, NULL, INT32_MAX, 0, UINT64_MAX, 0);
 
1882
                                PLUGIN_VAR_RQCMDARG,
 
1883
                                N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."),
 
1884
                                NULL, NULL, INT32_MAX, 0, UINT64_MAX, 0);
 
1885
 
 
1886
static DRIZZLE_SYSVAR_ULONGLONG(sort_buffer_size, sort_buffer_size,
 
1887
                                PLUGIN_VAR_RQCMDARG,
 
1888
                                N_("The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."),
 
1889
                                NULL, NULL, 8192*1024, 1024, UINT64_MAX, 0);
1883
1890
 
1884
1891
static struct st_mysql_sys_var* system_variables[]= {
1885
1892
  DRIZZLE_SYSVAR(block_size),
1886
1893
  DRIZZLE_SYSVAR(repair_threads),
1887
1894
  DRIZZLE_SYSVAR(max_sort_file_size),
 
1895
  DRIZZLE_SYSVAR(sort_buffer_size),
1888
1896
  NULL
1889
1897
};
1890
1898