mi_check T_xxx options massaged. T_REP_PARALLEL added

my_getopt-related style changes in myisamchk.c
parent 076fc1a6
...@@ -258,45 +258,47 @@ extern uint mi_get_pointer_length(ulonglong file_length, uint def); ...@@ -258,45 +258,47 @@ extern uint mi_get_pointer_length(ulonglong file_length, uint def);
/* /*
Definitions needed for myisamchk.c Definitions needed for myisamchk.c
Entries marked as "QQ to be removed" are NOT used to Entries marked as "QQ to be removed" are NOT used to
pass check/repair options to mi_check.c. They are used pass check/repair options to mi_check.c. They are used
internally by myisamchk.c or/and ha_myisam.cc and should NOT internally by myisamchk.c or/and ha_myisam.cc and should NOT
be stored together with other flags. They should be removed be stored together with other flags. They should be removed
from the following list to make adding of new flags possible. from the following list to make addition of new flags possible.
*/ */
#define T_VERBOSE 1 #define T_AUTO_INC 1
#define T_SILENT 2 #define T_AUTO_REPAIR 2 /* QQ to be removed */
#define T_DESCRIPT 4 #define T_BACKUP_DATA 4
#define T_EXTEND 8 #define T_CALC_CHECKSUM 8
#define T_INFO 16 #define T_CHECK 16 /* QQ to be removed */
#define T_REP 32 #define T_CHECK_ONLY_CHANGED 32 /* QQ to be removed */
#define T_FORCE_UNIQUENESS 64 #define T_CREATE_MISSING_KEYS 64
#define T_FORCE_CREATE 128 #define T_DESCRIPT 128
#define T_WRITE_LOOP 256 #define T_DONT_CHECK_CHECKSUM 256
#define T_UNPACK 512 #define T_EXTEND 512
#define T_STATISTICS (1L << 10) #define T_FAST (1L << 10) /* QQ to be removed */
#define T_VERY_SILENT (1L << 11) #define T_FORCE_CREATE (1L << 11) /* QQ to be removed */
#define T_SORT_RECORDS (1L << 12) /* QQ to be removed */ #define T_FORCE_UNIQUENESS (1L << 12)
#define T_SORT_INDEX (1L << 13) /* QQ to be removed */ #define T_INFO (1L << 13)
#define T_WAIT_FOREVER (1L << 14) #define T_MEDIUM (1L << 14)
#define T_REP_BY_SORT (1L << 15) #define T_QUICK (1L << 15) /* QQ to be removed */
#define T_FAST (1L << 16) /* QQ to be removed */ #define T_READONLY (1L << 16) /* QQ to be removed */
#define T_READONLY (1L << 17) /* QQ to be removed */ #define T_REP (1L << 17)
#define T_MEDIUM (1L << 18) #define T_REP_BY_SORT (1L << 18) /* QQ to be removed */
#define T_AUTO_INC (1L << 19) #define T_REP_PARALLEL (1L << 19) /* QQ to be removed */
#define T_CHECK (1L << 20) /* QQ to be removed */ #define T_RETRY_WITHOUT_QUICK (1L << 20)
#define T_UPDATE_STATE (1L << 21) #define T_SAFE_REPAIR (1L << 21)
#define T_CHECK_ONLY_CHANGED (1L << 22) /* QQ to be removed */ #define T_SILENT (1L << 22)
#define T_DONT_CHECK_CHECKSUM (1L << 23) #define T_SORT_INDEX (1L << 23) /* QQ to be removed */
#define T_TRUST_HEADER (1L << 24) #define T_SORT_RECORDS (1L << 24) /* QQ to be removed */
#define T_CREATE_MISSING_KEYS (1L << 25) #define T_STATISTICS (1L << 25)
#define T_SAFE_REPAIR (1L << 26) #define T_UNPACK (1L << 26)
#define T_AUTO_REPAIR (1L << 27) /* QQ to be removed */ #define T_UPDATE_STATE (1L << 27)
#define T_BACKUP_DATA (1L << 28) #define T_VERBOSE (1L << 28)
#define T_CALC_CHECKSUM (1L << 29) #define T_VERY_SILENT (1L << 29)
#define T_QUICK (1L << 30) #define T_WAIT_FOREVER (1L << 30)
#define T_RETRY_WITHOUT_QUICK (1L << 31) #define T_WRITE_LOOP (1L << 31)
#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL)
/* /*
Flags used by myisamchk.c or/and ha_myisam.cc that are NOT passed Flags used by myisamchk.c or/and ha_myisam.cc that are NOT passed
......
...@@ -1125,6 +1125,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, ...@@ -1125,6 +1125,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
printf("- recovering (with keycache) MyISAM-table '%s'\n",name); printf("- recovering (with keycache) MyISAM-table '%s'\n",name);
printf("Data records: %s\n", llstr(info->state->records,llbuff)); printf("Data records: %s\n", llstr(info->state->records,llbuff));
} }
param->testflag|=T_REP; /* for easy checking */
if (!param->using_global_keycache) if (!param->using_global_keycache)
VOID(init_key_cache(param->use_buffers,NEED_MEM)); VOID(init_key_cache(param->use_buffers,NEED_MEM));
...@@ -1767,6 +1768,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, ...@@ -1767,6 +1768,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
printf("- recovering (with sort) MyISAM-table '%s'\n",name); printf("- recovering (with sort) MyISAM-table '%s'\n",name);
printf("Data records: %s\n", llstr(start_records,llbuff)); printf("Data records: %s\n", llstr(start_records,llbuff));
} }
param->testflag|=T_REP; /* for easy checking */
bzero((char*)&sort_info,sizeof(sort_info)); bzero((char*)&sort_info,sizeof(sort_info));
if (!(sort_info.key_block= if (!(sort_info.key_block=
...@@ -1863,7 +1865,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, ...@@ -1863,7 +1865,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
else else
length=share->base.pack_reclength; length=share->base.pack_reclength;
sort_info.max_records= sort_info.max_records=
((param->testflag & T_TRUST_HEADER) ? info->state->records : ((param->testflag & T_CREATE_MISSING_KEYS) ? info->state->records :
(ha_rows) (sort_info.filelength/length+1)); (ha_rows) (sort_info.filelength/length+1));
sort_param.key_cmp=sort_key_cmp; sort_param.key_cmp=sort_key_cmp;
sort_param.key_write=sort_key_write; sort_param.key_write=sort_key_write;
...@@ -2109,6 +2111,7 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info, ...@@ -2109,6 +2111,7 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
printf("- parallel recovering (with sort) MyISAM-table '%s'\n",name); printf("- parallel recovering (with sort) MyISAM-table '%s'\n",name);
printf("Data records: %s\n", llstr(start_records,llbuff)); printf("Data records: %s\n", llstr(start_records,llbuff));
} }
param->testflag|=T_REP; /* for easy checking */
bzero((char*)&sort_info,sizeof(sort_info)); bzero((char*)&sort_info,sizeof(sort_info));
if (!(sort_info.key_block= if (!(sort_info.key_block=
...@@ -2196,7 +2199,7 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info, ...@@ -2196,7 +2199,7 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
else else
length=share->base.pack_reclength; length=share->base.pack_reclength;
sort_info.max_records= sort_info.max_records=
((param->testflag & T_TRUST_HEADER) ? info->state->records : ((param->testflag & T_CREATE_MISSING_KEYS) ? info->state->records :
(ha_rows) (sort_info.filelength/length+1)); (ha_rows) (sort_info.filelength/length+1));
del=info->state->del; del=info->state->del;
...@@ -3528,7 +3531,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, ...@@ -3528,7 +3531,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
return; return;
} }
if (!(param->testflag & T_SILENT) && if (!(param->testflag & T_SILENT) &&
!(param->testflag & (T_REP | T_REP_BY_SORT))) !(param->testflag & T_REP))
printf("Updating MyISAM file: %s\n", param->isam_file_name); printf("Updating MyISAM file: %s\n", param->isam_file_name);
/* We have to use keyread here as a normal read uses info->rec_buff */ /* We have to use keyread here as a normal read uses info->rec_buff */
mi_extra(info,HA_EXTRA_KEYREAD); mi_extra(info,HA_EXTRA_KEYREAD);
......
This diff is collapsed.
...@@ -67,8 +67,7 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, ...@@ -67,8 +67,7 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
sql_print_error(msgbuf); sql_print_error(msgbuf);
return; return;
} }
if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR | if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR | T_AUTO_REPAIR))
T_AUTO_REPAIR))
{ {
my_message(ER_NOT_KEYFILE,msgbuf,MYF(MY_WME)); my_message(ER_NOT_KEYFILE,msgbuf,MYF(MY_WME));
return; return;
...@@ -696,7 +695,7 @@ bool ha_myisam::activate_all_index(THD *thd) ...@@ -696,7 +695,7 @@ bool ha_myisam::activate_all_index(THD *thd)
myisamchk_init(&param); myisamchk_init(&param);
param.op_name = (char*) "recreating_index"; param.op_name = (char*) "recreating_index";
param.testflag = (T_SILENT | T_REP_BY_SORT | T_QUICK | param.testflag = (T_SILENT | T_REP_BY_SORT | T_QUICK |
T_CREATE_MISSING_KEYS | T_TRUST_HEADER); T_CREATE_MISSING_KEYS);
param.myf_rw&= ~MY_WAIT_IF_FULL; param.myf_rw&= ~MY_WAIT_IF_FULL;
param.sort_buffer_length= myisam_sort_buffer_size; param.sort_buffer_length= myisam_sort_buffer_size;
param.tmpdir=mysql_tmpdir; param.tmpdir=mysql_tmpdir;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment