#include "ftdefs.h"#include <my_getopt.h>#include <help_start.h>#include <help_end.h>Include dependency graph for myisam_ftdump.c:

Go to the source code of this file.
Defines | |
| #define | MAX_LEN (HA_FT_MAXBYTELEN+10) |
| #define | HOW_OFTEN_TO_WRITE 10000 |
Functions | |
| static void | usage () |
| static void | complain (int val) |
| static my_bool | get_one_option (int, const struct my_option *, char *) |
| int | main (int argc, char *argv[]) |
| static my_bool | get_one_option (int optid, const struct my_option *opt __attribute__((unused)), char *argument __attribute__((unused))) |
Variables | |
| static int | count = 0 |
| static int | stats = 0 |
| static int | dump = 0 |
| static int | lstats = 0 |
| static my_bool | verbose |
| static char * | query = NULL |
| static uint | lengths [256] |
| static struct my_option | my_long_options [] |
| #define HOW_OFTEN_TO_WRITE 10000 |
| #define MAX_LEN (HA_FT_MAXBYTELEN+10) |
| static void complain | ( | int | val | ) | [static] |
Definition at line 271 of file myisam_ftdump.c.
References exit.
Referenced by get_one_option().
00271 :-) */ 00272 { 00273 if (val) 00274 { 00275 printf("You cannot use these options together!\n"); 00276 exit(1); 00277 } 00278 }
Here is the caller graph for this function:

| static my_bool get_one_option | ( | int | optid, | |
| const struct my_option *opt | __attribute__((unused)), | |||
| char *argument | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 231 of file myisam_ftdump.c.
References complain(), count, dump, lstats, and usage().
00233 { 00234 switch(optid) { 00235 case 'd': 00236 dump=1; 00237 complain(count || query); 00238 break; 00239 case 's': 00240 stats=1; 00241 complain(query!=0); 00242 break; 00243 case 'c': 00244 count= 1; 00245 complain(dump || query); 00246 break; 00247 case 'l': 00248 lstats=1; 00249 complain(query!=0); 00250 break; 00251 case '?': 00252 case 'h': 00253 usage(); 00254 } 00255 return 0; 00256 }
Here is the call graph for this function:

| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Definition at line 55 of file myisam_ftdump.c.
References st_mi_isam_share::base, buf, count, default_charset_info, dflt_key_cache, dump, err, error, exit, F_EXTRA_LCK, F_UNLCK, st_myisam_info::filename, st_mi_keydef::flag, ft_sintXkorr, get_one_option(), GWS_IN_USE, HA_ERR_END_OF_FILE, HA_FULLTEXT, HA_OFFSET_ERROR, HA_OPEN_ABORT_IF_LOCKED, HA_OPEN_FROM_SQL_LAYER, HA_STATE_PREV_FOUND, handle_options(), HOW_OFTEN_TO_WRITE, info, init_key_cache(), st_mi_isam_share::keyinfo, st_mi_base_info::keys, st_myisam_info::lastkey, st_myisam_info::lastpos, lengths, lstats, MAX_LEN, mi_close(), MI_KEY_BLOCK_LENGTH, mi_lock_database(), mi_open(), mi_rnext(), my_casedn_str, my_errno, MY_INIT, my_long_options, NULL, st_mi_status_info::records, st_myisam_info::s, st_myisam_info::state, strcmp(), strmov(), strtoll, st_myisam_info::update, usage(), USE_BUFFER_INIT, and verbose.
00056 { 00057 int error=0, subkeys; 00058 uint keylen, keylen2=0, inx, doc_cnt=0; 00059 float weight= 1.0; 00060 double gws, min_gws=0, avg_gws=0; 00061 MI_INFO *info; 00062 char buf[MAX_LEN], buf2[MAX_LEN], buf_maxlen[MAX_LEN], buf_min_gws[MAX_LEN]; 00063 ulong total=0, maxlen=0, uniq=0, max_doc_cnt=0; 00064 struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */ 00065 00066 MY_INIT(argv[0]); 00067 if ((error= handle_options(&argc, &argv, my_long_options, get_one_option))) 00068 exit(error); 00069 if (count || dump) 00070 verbose=0; 00071 if (!count && !dump && !lstats && !query) 00072 stats=1; 00073 00074 if (verbose) 00075 setbuf(stdout,NULL); 00076 00077 if (argc < 2) 00078 usage(); 00079 00080 { 00081 char *end; 00082 inx= (uint) strtoll(argv[1], &end, 10); 00083 if (*end) 00084 usage(); 00085 } 00086 00087 init_key_cache(dflt_key_cache,MI_KEY_BLOCK_LENGTH,USE_BUFFER_INIT, 0, 0); 00088 00089 if (!(info=mi_open(argv[0], O_RDONLY, 00090 HA_OPEN_ABORT_IF_LOCKED|HA_OPEN_FROM_SQL_LAYER))) 00091 { 00092 error=my_errno; 00093 goto err; 00094 } 00095 00096 *buf2=0; 00097 aio->info=info; 00098 00099 if ((inx >= info->s->base.keys) || 00100 !(info->s->keyinfo[inx].flag & HA_FULLTEXT)) 00101 { 00102 printf("Key %d in table %s is not a FULLTEXT key\n", inx, info->filename); 00103 goto err; 00104 } 00105 00106 mi_lock_database(info, F_EXTRA_LCK); 00107 00108 info->lastpos= HA_OFFSET_ERROR; 00109 info->update|= HA_STATE_PREV_FOUND; 00110 00111 while (!(error=mi_rnext(info,NULL,inx))) 00112 { 00113 keylen=*(info->lastkey); 00114 00115 subkeys=ft_sintXkorr(info->lastkey+keylen+1); 00116 if (subkeys >= 0) 00117 weight=*(float*)&subkeys; 00118 00119 #ifdef HAVE_SNPRINTF 00120 snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1); 00121 #else 00122 sprintf(buf,"%.*s",(int) keylen,info->lastkey+1); 00123 #endif 00124 my_casedn_str(default_charset_info,buf); 00125 total++; 00126 lengths[keylen]++; 00127 00128 if (count || stats) 00129 { 00130 doc_cnt++; 00131 if (strcmp(buf, buf2)) 00132 { 00133 if (*buf2) 00134 { 00135 uniq++; 00136 avg_gws+=gws=GWS_IN_USE; 00137 if (count) 00138 printf("%9u %20.7f %s\n",doc_cnt,gws,buf2); 00139 if (maxlen<keylen2) 00140 { 00141 maxlen=keylen2; 00142 strmov(buf_maxlen, buf2); 00143 } 00144 if (max_doc_cnt < doc_cnt) 00145 { 00146 max_doc_cnt=doc_cnt; 00147 strmov(buf_min_gws, buf2); 00148 min_gws=gws; 00149 } 00150 } 00151 strmov(buf2, buf); 00152 keylen2=keylen; 00153 doc_cnt=0; 00154 } 00155 } 00156 if (dump) 00157 { 00158 if (subkeys>=0) 00159 printf("%9lx %20.7f %s\n", (long) info->lastpos,weight,buf); 00160 else 00161 printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys,buf); 00162 } 00163 if (verbose && (total%HOW_OFTEN_TO_WRITE)==0) 00164 printf("%10ld\r",total); 00165 } 00166 mi_lock_database(info, F_UNLCK); 00167 00168 if (count || stats) 00169 { 00170 doc_cnt++; 00171 if (*buf2) 00172 { 00173 uniq++; 00174 avg_gws+=gws=GWS_IN_USE; 00175 if (count) 00176 printf("%9u %20.7f %s\n",doc_cnt,gws,buf2); 00177 if (maxlen<keylen2) 00178 { 00179 maxlen=keylen2; 00180 strmov(buf_maxlen, buf2); 00181 } 00182 if (max_doc_cnt < doc_cnt) 00183 { 00184 max_doc_cnt=doc_cnt; 00185 strmov(buf_min_gws, buf2); 00186 min_gws=gws; 00187 } 00188 } 00189 } 00190 00191 if (stats) 00192 { 00193 count=0; 00194 for (inx=0;inx<256;inx++) 00195 { 00196 count+=lengths[inx]; 00197 if ((ulong) count >= total/2) 00198 break; 00199 } 00200 printf("Total rows: %lu\nTotal words: %lu\n" 00201 "Unique words: %lu\nLongest word: %lu chars (%s)\n" 00202 "Median length: %u\n" 00203 "Average global weight: %f\n" 00204 "Most common word: %lu times, weight: %f (%s)\n", 00205 (long) info->state->records, total, uniq, maxlen, buf_maxlen, 00206 inx, avg_gws/uniq, max_doc_cnt, min_gws, buf_min_gws); 00207 } 00208 if (lstats) 00209 { 00210 count=0; 00211 for (inx=0; inx<256; inx++) 00212 { 00213 count+=lengths[inx]; 00214 if (count && lengths[inx]) 00215 printf("%3u: %10lu %5.2f%% %20lu %4.1f%%\n", inx, 00216 (ulong) lengths[inx],100.0*lengths[inx]/total,(ulong) count, 00217 100.0*count/total); 00218 } 00219 } 00220 00221 err: 00222 if (error && error != HA_ERR_END_OF_FILE) 00223 printf("got error %d\n",my_errno); 00224 if (info) 00225 mi_close(info); 00226 return 0; 00227 }
Here is the call graph for this function:

| static void usage | ( | ) | [static] |
Definition at line 3308 of file mysqltest.c.
03309 { 03310 print_version(); 03311 printf("MySQL AB, by Sasha, Matt, Monty & Jani\n"); 03312 printf("This software comes with ABSOLUTELY NO WARRANTY\n\n"); 03313 printf("Runs a test against the mysql server and compares output with a results file.\n\n"); 03314 printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname); 03315 my_print_help(my_long_options); 03316 printf(" --no-defaults Don't read default options from any options file.\n"); 03317 my_print_variables(my_long_options); 03318 }
int count = 0 [static] |
Definition at line 27 of file myisam_ftdump.c.
Referenced by _sanity(), Undo_buffer::alloc_copy_tuple(), append_warnings(), bind_fetch(), buf_flush_try_neighbors(), buf_read_ahead_linear(), buf_read_ahead_random(), buf_read_page(), buf_read_recv_pages(), TaoCrypt::ByteReverse(), ha_tina::check(), ha_archive::check(), clean_up(), close_connections(), Suma::completeSubRemove(), compress_isam_file(), default_local_infile_read(), NdbBlob::deletePartsUnknown(), do_save_master_pos(), doCopyLap(), doTime(), ed_insert(), Backup::execBACKUP_FRAGMENT_REQ(), Dbdih::execCHECKNODEGROUPSREQ(), Dbdih::execCREATE_FRAGMENTATION_REQ(), Dbdih::execDIGETPRIMREQ(), Tsman::execDUMP_STATE_ORD(), Dbdih::execPREP_DROP_TAB_REQ(), Backup::execREAD_NODESCONF(), Cmvmi::execTESTSIG(), CommandInterpreter::executeStartBackup(), MgmtSrvr::exitSingleUser(), fakebigcodes(), fil_delete_tablespace(), fil_mutex_enter_and_prepare_for_io(), fil_rename_tablespace(), find_longest_match(), find_message(), find_order_in_list(), find_type(), findKey(), findopt(), flush_cached_blocks(), flush_key_blocks_int(), fseg_get_n_frag_pages(), fsp_fill_free_list(), get_errcodes(), get_exact_record_count(), get_hash_symbol(), get_one_option(), get_schema_column_record(), get_statistic(), get_topics_for_keyword(), MgmtSrvr::getNodeCount(), NdbDictionary::Table::getPrimaryKey(), getStatus(), Indent(), inflate_table(), init_huff_count(), join_same_trees(), list_length(), NdbDictInterface::listObjects(), Event_scheduler::load_events_from_db(), lock_release_off_kernel(), SignalLoggerManager::log(), log_reserve_and_open(), lp_test(), main(), make_unireg_sortorder(), mi_lock_database(), my_regex_init(), my_uni_utf8(), mysql_stmt_bind_param(), ndb_mgm_start(), net_clear(), Backup::openFilesReply(), opt_sum_query(), os_file_delete(), os_file_delete_if_exists(), p_count(), p_ere_exp(), p_simp_re(), Dbdict::packTableIntoPages(), page_copy_rec_list_end_to_created_page(), page_delete_rec_list_end(), page_get_middle_rec(), page_print_list(), page_simple_validate(), page_validate(), pars_retrieve_table_list_defs(), parse_comma(), parse_delimiter(), Backup::parseTableDescription(), permute_aux(), print_cached_tables(), ConfigValuesFactory::put(), radixsort_for_str_ptr(), random_coprime(), read_texts(), read_to_buffer(), NdbBlob::readDataPrivate(), readline(), regrepeat(), NdbTransaction::report_node_failure(), rl_callback_read_char(), rl_display_match_list(), runConsumer(), runConsumer2(), runProducer(), runProducer2(), scan_tree(), search_categories(), search_keyword(), search_topics(), Suma::seize_page(), Dbdih::selectMasterCandidateAndSend(), Protocol::send_fields(), send_tree(), Dbdict::sendDictLockInfoEvent(), Filename::set(), SimulatedBlock::SimulatedBlock(), sql_connect(), srv_release_threads(), stab_demangle_args(), stab_demangle_count(), stab_demangle_get_count(), sync_arr_wake_threads_if_sema_free(), sync_array_signal_object(), sync_array_validate(), test_bind_date_conv(), test_cuted_rows(), test_multi_statements(), test_rrnd(), test_stmt_close(), test_write(), trx_recover_for_mysql(), update_key_parts(), update_line(), ut_strcount(), ut_strreplace(), Item_variance_field::val_decimal(), Item_avg_field::val_decimal(), Item_sum_count_distinct::val_int(), Item_variance_field::val_real(), Item_avg_field::val_real(), Item_func_lpad::val_str(), Item_func_rpad::val_str(), Item_func_repeat::val_str(), Item_func_substr_index::val_str(), yaSSL::CertManager::Validate(), SuperPool::verifyPageList(), vi_match(), wait_pidfile(), Event_scheduler::workers_count(), NdbBlob::writeDataPrivate(), and xdes_get_n_used().
int dump = 0 [static] |
Definition at line 27 of file myisam_ftdump.c.
Referenced by dtuple_check_typed_no_assert(), get_one_option(), ibuf_insert_to_index_page(), and main().
Definition at line 30 of file myisam_ftdump.c.
Referenced by append_result(), composite_key_cmp(), TaoCrypt::RSA_Decryptor< Pad >::Decrypt(), dump_table(), TaoCrypt::RSA_Encryptor< Pad >::Encrypt(), get_actual_table_name(), get_table_structure(), get_view_structure(), main(), print_tab_data(), print_table_data(), print_table_data_html(), print_table_data_xml(), print_xml_row(), TaoCrypt::SSL_Decrypt(), unpack_fields(), and var_query_set().
int lstats = 0 [static] |
struct my_option my_long_options[] [static] |
Initial value:
{
{"help", 'h', "Display help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Synonym for -h.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"count", 'c', "Calculate per-word stats (counts and global weights).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"dump", 'd', "Dump index (incl. data offsets and word weights).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"length", 'l', "Report length distribution.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"stats", 's', "Report global stats.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Be verbose.",
(gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}
Definition at line 35 of file myisam_ftdump.c.
char* query = NULL [static] |
Definition at line 29 of file myisam_ftdump.c.
int stats = 0 [static] |
Definition at line 27 of file myisam_ftdump.c.
Definition at line 28 of file myisam_ftdump.c.
1.4.7

