9
3

myisamchk.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* Copyright (C) 2006 MySQL AB
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  13. /* Definitions needed for myisamchk/mariachk.c */
  14. /*
  15. Entries marked as "QQ to be removed" are NOT used to
  16. pass check/repair options to xxx_check.c. They are used
  17. internally by xxxchk.c or/and ha_xxxx.cc and should NOT
  18. be stored together with other flags. They should be removed
  19. from the following list to make addition of new flags possible.
  20. */
  21. #ifndef _myisamchk_h
  22. #define _myisamchk_h
  23. /*
  24. Flags used by xxxxchk.c or/and ha_xxxx.cc that are NOT passed
  25. to xxxcheck.c follows:
  26. */
  27. #define TT_USEFRM 1
  28. #define TT_FOR_UPGRADE 2
  29. #define TT_FROM_MYSQL 4
  30. /* Bits set in out_flag */
  31. #define O_NEW_DATA 2
  32. #define O_DATA_LOST 4
  33. typedef struct st_sort_key_blocks /* Used when sorting */
  34. {
  35. uchar *buff, *end_pos;
  36. uchar lastkey[HA_MAX_POSSIBLE_KEY_BUFF];
  37. uint last_length;
  38. int inited;
  39. } SORT_KEY_BLOCKS;
  40. /*
  41. MARIA/MYISAM supports several statistics collection
  42. methods. Currently statistics collection method is not stored in
  43. MARIA file and has to be specified for each table analyze/repair
  44. operation in MI_CHECK::stats_method.
  45. */
  46. typedef enum
  47. {
  48. /* Treat NULLs as inequal when collecting statistics (default for 4.1/5.0) */
  49. MI_STATS_METHOD_NULLS_NOT_EQUAL,
  50. /* Treat NULLs as equal when collecting statistics (like 4.0 did) */
  51. MI_STATS_METHOD_NULLS_EQUAL,
  52. /* Ignore NULLs - count only tuples without NULLs in the index components */
  53. MI_STATS_METHOD_IGNORE_NULLS
  54. } enum_handler_stats_method;
  55. typedef struct st_handler_check_param
  56. {
  57. char *isam_file_name;
  58. MY_TMPDIR *tmpdir;
  59. void *thd;
  60. const char *db_name, *table_name, *op_name;
  61. ulonglong auto_increment_value;
  62. ulonglong max_data_file_length;
  63. ulonglong keys_in_use;
  64. ulonglong max_record_length;
  65. /*
  66. The next two are used to collect statistics, see update_key_parts for
  67. description.
  68. */
  69. ulonglong unique_count[HA_MAX_KEY_SEG + 1];
  70. ulonglong notnull_count[HA_MAX_KEY_SEG + 1];
  71. my_off_t search_after_block;
  72. my_off_t new_file_pos, key_file_blocks;
  73. my_off_t keydata, totaldata, key_blocks, start_check_pos;
  74. my_off_t used, empty, splits, del_length, link_used, lost;
  75. ha_rows total_records, total_deleted, records,del_blocks;
  76. ha_rows full_page_count, tail_count;
  77. ha_checksum record_checksum, glob_crc;
  78. ha_checksum key_crc[HA_MAX_POSSIBLE_KEY];
  79. ha_checksum tmp_key_crc[HA_MAX_POSSIBLE_KEY];
  80. ha_checksum tmp_record_checksum;
  81. ulonglong org_key_map;
  82. ulonglong testflag;
  83. /* Following is used to check if rows are visible */
  84. ulonglong max_trid, max_found_trid;
  85. ulonglong not_visible_rows_found;
  86. ulonglong sort_buffer_length;
  87. ulonglong use_buffers; /* Used as param to getopt() */
  88. size_t read_buffer_length, write_buffer_length, sort_key_blocks;
  89. time_t backup_time; /* To sign backup files */
  90. ulong rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY];
  91. double new_rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY];
  92. uint out_flag, warning_printed, error_printed, note_printed, verbose;
  93. uint opt_sort_key, total_files, max_level;
  94. uint key_cache_block_size, pagecache_block_size;
  95. int tmpfile_createflag, err_count;
  96. myf myf_rw;
  97. uint16 language;
  98. my_bool using_global_keycache, opt_lock_memory, opt_follow_links;
  99. my_bool retry_repair, force_sort, calc_checksum, static_row_size;
  100. char temp_filename[FN_REFLEN];
  101. IO_CACHE read_cache;
  102. enum_handler_stats_method stats_method;
  103. /* For reporting progress */
  104. uint stage, max_stage;
  105. uint progress_counter; /* How often to call _report_progress() */
  106. ulonglong progress, max_progress;
  107. mysql_mutex_t print_msg_mutex;
  108. my_bool need_print_msg_lock;
  109. myf malloc_flags;
  110. } HA_CHECK;
  111. typedef struct st_sort_ftbuf
  112. {
  113. uchar *buf, *end;
  114. int count;
  115. uchar lastkey[HA_MAX_KEY_BUFF];
  116. } SORT_FT_BUF;
  117. typedef struct st_buffpek {
  118. my_off_t file_pos; /* Where we are in the sort file */
  119. uchar *base, *key; /* Key pointers */
  120. ha_rows count; /* Number of rows in table */
  121. ha_rows mem_count; /* Numbers of keys in memory */
  122. ha_rows max_keys; /* Max keys in buffert */
  123. } BUFFPEK;
  124. #endif /* _myisamchk_h */