MySQL  8.0.19
Source Code Documentation
myisam.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License, version 2.0,
6  as published by the Free Software Foundation.
7 
8  This program is also distributed with certain software (including
9  but not limited to OpenSSL) that is licensed under separate terms,
10  as designated in a particular file or component or in included license
11  documentation. The authors of MySQL hereby grant you an additional
12  permission to link the program and your derivative works with the
13  separately licensed software that they have included with MySQL.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License, version 2.0, for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23 
24 /**
25  @file include/myisam.h
26  This file should be included when using myisam functions.
27 */
28 
29 #ifndef _myisam_h
30 #define _myisam_h
31 
32 #include "my_config.h"
33 
34 #include <sys/types.h>
35 #include <time.h>
36 
37 #include "keycache.h"
38 #include "m_ctype.h"
39 #include "m_string.h"
40 #include "my_base.h"
41 #include "my_check_opt.h"
42 #include "my_compare.h"
43 #include "my_inttypes.h"
44 #include "my_io.h"
45 #include "my_macros.h"
46 
47 /*
48  Limit max keys according to HA_MAX_POSSIBLE_KEY
49 */
50 
51 #if MAX_INDEXES > HA_MAX_POSSIBLE_KEY
52 #define MI_MAX_KEY HA_MAX_POSSIBLE_KEY /* Max allowed keys */
53 #else
54 #define MI_MAX_KEY MAX_INDEXES /* Max allowed keys */
55 #endif
56 
57 #define MI_MAX_POSSIBLE_KEY_BUFF HA_MAX_POSSIBLE_KEY_BUFF
58 /*
59  The following defines can be increased if necessary.
60  But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and MI_MAX_KEY_LENGTH.
61 */
62 #define MI_MAX_KEY_LENGTH 1000 /* Max length in bytes */
63 #define MI_MAX_KEY_SEG 16 /* Max segments for key */
64 
65 #define MI_MAX_KEY_BUFF (MI_MAX_KEY_LENGTH + MI_MAX_KEY_SEG * 6 + 8 + 8)
66 #define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */
67 #define MI_NAME_IEXT ".MYI"
68 #define MI_NAME_DEXT ".MYD"
69 
70 /* Possible values for myisam_block_size (must be power of 2) */
71 #define MI_KEY_BLOCK_LENGTH 1024 /* default key block length */
72 #define MI_MIN_KEY_BLOCK_LENGTH 1024 /* Min key block length */
73 #define MI_MAX_KEY_BLOCK_LENGTH 16384
74 
75 /*
76  In the following macros '_keyno_' is 0 .. keys-1.
77  If there can be more keys than bits in the key_map, the highest bit
78  is for all upper keys. They cannot be switched individually.
79  This means that clearing of high keys is ignored, setting one high key
80  sets all high keys.
81 */
82 #define MI_KEYMAP_BITS (8 * SIZEOF_LONG_LONG)
83 #define MI_KEYMAP_HIGH_MASK (1ULL << (MI_KEYMAP_BITS - 1))
84 #define mi_get_mask_all_keys_active(_keys_) \
85  (((_keys_) < MI_KEYMAP_BITS) ? ((1ULL << (_keys_)) - 1ULL) : (~0ULL))
86 
87 #if MI_MAX_KEY > MI_KEYMAP_BITS
88 
89 inline bool mi_is_key_active(uint64 _keymap_, unsigned int _keyno_) {
90  return (((_keyno_) < MI_KEYMAP_BITS) ? ((_keymap_) & (1ULL << (_keyno_)))
91  : ((_keymap_)&MI_KEYMAP_HIGH_MASK));
92 }
93 
94 #define mi_set_key_active(_keymap_, _keyno_) \
95  (_keymap_) |= (((_keyno_) < MI_KEYMAP_BITS) ? (1ULL << (_keyno_)) \
96  : MI_KEYMAP_HIGH_MASK)
97 #define mi_clear_key_active(_keymap_, _keyno_) \
98  (_keymap_) &= (((_keyno_) < MI_KEYMAP_BITS) ? (~(1ULL << (_keyno_))) \
99  : (~(0ULL)) /*ignore*/)
100 
101 #else
102 
103 inline bool mi_is_key_active(uint64 _keymap_, unsigned int _keyno_) {
104  return ((_keymap_) & (1ULL << (_keyno_)));
105 }
106 #define mi_set_key_active(_keymap_, _keyno_) (_keymap_) |= (1ULL << (_keyno_))
107 #define mi_clear_key_active(_keymap_, _keyno_) \
108  (_keymap_) &= (~(1ULL << (_keyno_)))
109 
110 #endif
111 
112 inline bool mi_is_any_key_active(uint64 _keymap_) { return (_keymap_ != 0); }
113 #define mi_is_all_keys_active(_keymap_, _keys_) \
114  ((_keymap_) == mi_get_mask_all_keys_active(_keys_))
115 #define mi_set_all_keys_active(_keymap_, _keys_) \
116  (_keymap_) = mi_get_mask_all_keys_active(_keys_)
117 #define mi_clear_all_keys_active(_keymap_) (_keymap_) = 0
118 #define mi_intersect_keys_active(_to_, _from_) (_to_) &= (_from_)
119 #define mi_is_any_intersect_keys_active(_keymap1_, _keys_, _keymap2_) \
120  ((_keymap1_) & (_keymap2_)&mi_get_mask_all_keys_active(_keys_))
121 #define mi_copy_keys_active(_to_, _maxkeys_, _from_) \
122  (_to_) = (mi_get_mask_all_keys_active(_maxkeys_) & (_from_))
123 
124 /* Param to/from mi_status */
125 
126 struct MI_ISAMINFO /* Struct from h_info */
127 {
128  ha_rows records{0}; /* Records in database */
129  ha_rows deleted{0}; /* Deleted records in database */
130  my_off_t recpos{0}; /* Pos for last used record */
131  my_off_t newrecpos{0}; /* Pos if we write new record */
132  my_off_t dupp_key_pos{0}; /* Position to record with dupp key */
133  my_off_t data_file_length{0}, /* Length of data file */
136  ulong reclength{0}; /* Recordlength */
137  ulong mean_reclength{0}; /* Mean recordlength (if packed) */
139  ulonglong key_map{0}; /* Which keys are used */
140  char *data_file_name{nullptr}, *index_file_name{nullptr};
141  uint keys{0}; /* Number of keys in use */
142  uint options{}; /* HA_OPTION_... used */
143  int errkey{0}, /* With key was dupplicated on err */
144  sortkey{0}; /* clustered by this key */
145  File filenr{0}; /* (uniq) filenr for datafile */
146  time_t create_time{0}; /* When table was created */
147  time_t check_time{0};
148  time_t update_time{0};
151  ulong *rec_per_key{0}; /* for sql optimizing */
152 };
153 
155  const char *index_file_name, *data_file_name; /* If using symlinks */
164 };
165 
166 struct MI_INFO; /* For referense */
167 struct MYISAM_SHARE;
168 struct MI_INFO;
169 struct MI_KEY_PARAM;
170 
171 struct MI_KEYDEF /* Key definition with open & info */
172 {
173  MYISAM_SHARE *share; /* Pointer to base (set in mi_open) */
174  uint16 keysegs; /* Number of key-segment */
175  uint16 flag; /* NOSAME, PACK_USED */
176 
177  uint8 key_alg; /* BTREE, RTREE */
178  uint16 block_length; /* Length of keyblock (auto) */
179  uint16 underflow_block_length; /* When to execute underflow */
180  uint16 keylength; /* Tot length of keyparts (auto) */
181  uint16 minlength; /* min length of (packed) key (auto) */
182  uint16 maxlength; /* max length of (packed) key (auto) */
183  uint16 block_size_index; /* block_size (auto) */
184  uint32 version; /* For concurrent read/write */
185  uint32 ftkey_nr; /* full-text index number */
186 
188  struct st_mysql_ftparser *parser; /* Fulltext [pre]parser */
190  uint key_len, uint comp_flag, uchar **ret_pos, uchar *buff,
191  bool *was_last_key);
193  int (*pack_key)(MI_KEYDEF *keyinfo, uint nod_flag, const uchar *next_key,
194  uchar *org_key, uchar *prev_key, const uchar *key,
195  MI_KEY_PARAM *s_temp);
196  void (*store_key)(MI_KEYDEF *keyinfo, uchar *key_pos, MI_KEY_PARAM *s_temp);
197  int (*ck_insert)(MI_INFO *inf, uint k_nr, uchar *k, uint klen);
198  int (*ck_delete)(MI_INFO *inf, uint k_nr, uchar *k, uint klen);
199 };
200 
201 #define MI_UNIQUE_HASH_LENGTH 4
202 
203 struct MI_UNIQUEDEF /* Segment definition of unique */
204 {
205  uint16 keysegs; /* Number of key-segment */
206  uchar key; /* Mapped to which key */
209 };
210 
211 struct MI_DECODE_TREE /* Decode huff-table */
212 {
216 };
217 
218 struct MI_BIT_BUFF;
219 
220 /*
221  Note that null markers should always be first in a row !
222  When creating a column, one should only specify:
223  type, length, null_bit and null_pos
224 */
225 
226 struct MI_COLUMNDEF /* column information */
227 {
228  int16 type; /* en_fieldtype */
229  uint16 length; /* length of field */
230  uint32 offset; /* Offset to position in row */
231  uint8 null_bit; /* If column may be 0 */
232  uint16 null_pos; /* position for null marker */
233 
234  void (*unpack)(MI_COLUMNDEF *rec, MI_BIT_BUFF *buff, uchar *start,
235  uchar *end);
239 };
240 
241 extern const char *myisam_log_filename; /* Name of logfile */
242 extern ulong myisam_block_size;
247 
248 /* usually used to check if a symlink points into the mysql data home */
249 /* which is normally forbidden */
250 extern int (*myisam_test_invalid_symlink)(const char *filename);
253 
254 /* Prototypes for myisam-functions */
255 
256 extern int mi_close_share(MI_INFO *file, bool *closed_share);
257 #define mi_close(file) mi_close_share(file, NULL)
258 extern int mi_delete(MI_INFO *file, const uchar *buff);
259 extern MI_INFO *mi_open_share(const char *name, MYISAM_SHARE *old_share,
260  int mode, uint wait_if_locked);
261 #define mi_open(name, mode, wait_if_locked) \
262  mi_open_share(name, NULL, mode, wait_if_locked)
263 extern int mi_panic(enum ha_panic_function function);
264 extern int mi_rfirst(MI_INFO *file, uchar *buf, int inx);
265 extern int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
266  key_part_map keypart_map, enum ha_rkey_function search_flag);
267 extern int mi_rlast(MI_INFO *file, uchar *buf, int inx);
268 extern int mi_rnext(MI_INFO *file, uchar *buf, int inx);
269 extern int mi_rnext_same(MI_INFO *info, uchar *buf);
270 extern int mi_rprev(MI_INFO *file, uchar *buf, int inx);
271 extern int mi_rrnd(MI_INFO *file, uchar *buf, my_off_t pos);
272 extern int mi_scan_init(MI_INFO *file);
273 extern int mi_scan(MI_INFO *file, uchar *buf);
274 extern int mi_rsame(MI_INFO *file, uchar *record, int inx);
275 extern int mi_rsame_with_pos(MI_INFO *file, uchar *record, int inx,
276  my_off_t pos);
277 extern int mi_update(MI_INFO *file, const uchar *old, uchar *new_record);
278 extern int mi_write(MI_INFO *file, uchar *buff);
279 extern my_off_t mi_position(MI_INFO *file);
280 extern int mi_status(MI_INFO *info, MI_ISAMINFO *x, uint flag);
281 extern int mi_lock_database(MI_INFO *file, int lock_type);
282 extern int mi_create(const char *name, uint keys, MI_KEYDEF *keydef,
283  uint columns, MI_COLUMNDEF *columndef, uint uniques,
284  MI_UNIQUEDEF *uniquedef, MI_CREATE_INFO *create_info,
285  uint flags);
286 extern int mi_delete_table(const char *name);
287 extern int mi_rename(const char *from, const char *to);
288 extern int mi_extra(MI_INFO *file, enum ha_extra_function function,
289  void *extra_arg);
290 extern int mi_reset(MI_INFO *file);
291 extern ha_rows mi_records_in_range(MI_INFO *info, int inx, key_range *min_key,
292  key_range *max_key);
293 extern int mi_log(int activate_log);
294 extern int mi_is_changed(MI_INFO *info);
295 extern int mi_delete_all_rows(MI_INFO *info);
297 extern uint mi_get_pointer_length(ulonglong file_length, uint def);
298 
299 #define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for mmap file */
300 /* this is used to pass to mysql_myisamchk_table */
301 
302 #define MYISAMCHK_REPAIR 1 /* equivalent to myisamchk -r */
303 #define MYISAMCHK_VERIFY 2 /* Verify, run repair if failure */
304 
305 /*
306  Flags used by myisamchk.c or/and ha_myisam.cc that are NOT passed
307  to mi_check.c follows:
308 */
309 
310 #define TT_USEFRM 1
311 #define TT_FOR_UPGRADE 2
312 
313 #define O_NEW_INDEX 1 /* Bits set in out_flag */
314 #define O_NEW_DATA 2
315 #define O_DATA_LOST 4
316 
317 /* these struct is used by my_check to tell it what to do */
318 
319 struct SORT_KEY_BLOCKS /* Used when sorting */
320 {
324  int inited;
325 };
326 
327 /*
328  MyISAM supports several statistics collection methods. Currently statistics
329  collection method is not stored in MyISAM file and has to be specified for
330  each table analyze/repair operation in MI_CHECK::stats_method.
331 */
332 
333 typedef enum {
334  /* Treat NULLs as inequal when collecting statistics (default for 4.1/5.0) */
336  /* Treat NULLs as equal when collecting statistics (like 4.0 did) */
338  /* Ignore NULLs - count only tuples without NULLs in the index components */
341 
342 struct MI_CHECK {
360  bool retry_repair{false}, force_sort{false};
362  MY_TMPDIR *tmpdir{nullptr};
366 
367  /*
368  The next two are used to collect statistics, see update_key_parts for
369  description.
370  */
373 
376  void *thd{nullptr};
377  const char *db_name{nullptr}, *table_name{nullptr};
378  const char *op_name{nullptr};
381  bool need_print_msg_lock{false};
382 };
383 
384 struct SORT_FT_BUF {
386  int count;
388 };
389 
390 struct SORT_INFO {
396  MI_INFO *info{nullptr};
397  MI_CHECK *param{nullptr};
398  uchar *buff{nullptr};
400  SORT_FT_BUF *ft_buf{nullptr};
401  /* sync things */
405 };
406 
407 /* functions in mi_check */
408 void myisamchk_init(MI_CHECK *param);
409 int chk_status(MI_CHECK *param, MI_INFO *info);
410 int chk_del(MI_CHECK *param, MI_INFO *info, uint test_flag);
411 int chk_size(MI_CHECK *param, MI_INFO *info);
412 int chk_key(MI_CHECK *param, MI_INFO *info);
413 int chk_data_link(MI_CHECK *param, MI_INFO *info, int extend);
414 int mi_repair(MI_CHECK *param, MI_INFO *info, char *name, int rep_quick,
415  bool no_copy_stat);
416 int mi_sort_index(MI_CHECK *param, MI_INFO *info, char *name,
417  bool no_copy_stat);
418 int mi_repair_by_sort(MI_CHECK *param, MI_INFO *info, const char *name,
419  int rep_quick, bool no_copy_stat);
420 int mi_repair_parallel(MI_CHECK *param, MI_INFO *info, const char *name,
421  int rep_quick, bool no_copy_stat);
422 int change_to_newfile(const char *filename, const char *old_ext,
423  const char *new_ext, myf myflags);
424 int lock_file(MI_CHECK *param, File file, int lock_type, const char *filetype,
425  const char *filename);
426 void lock_memory(MI_CHECK *param);
427 void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, bool repair);
429 void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
430  ulonglong *unique, ulonglong *notnull, ulonglong records);
431 int filecopy(MI_CHECK *param, File to, File from, my_off_t start,
432  my_off_t length, const char *type);
433 int movepoint(MI_INFO *info, uchar *record, my_off_t oldpos, my_off_t newpos,
434  uint prot_key);
435 int write_data_suffix(SORT_INFO *sort_info, bool fix_datafile);
437 int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename);
439 bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, ulonglong key_map,
440  bool force);
441 
446  KEY_CACHE *key_cache);
447 void mi_change_key_cache(KEY_CACHE *old_key_cache, KEY_CACHE *new_key_cache);
448 int mi_preload(MI_INFO *info, ulonglong key_map, bool ignore_leaves);
449 
452 #endif
mi_get_pointer_length
uint mi_get_pointer_length(ulonglong file_length, uint def)
Definition: mi_create.cc:776
myisam_mmap_used
ulonglong myisam_mmap_used
Definition: myisam.h:251
MI_ISAMINFO::max_data_file_length
my_off_t max_data_file_length
Definition: myisam.h:134
mi_repair_parallel
int mi_repair_parallel(MI_CHECK *param, MI_INFO *info, const char *name, int rep_quick, bool no_copy_stat)
Definition: mi_check.cc:2394
MI_CREATE_INFO::data_file_length
ulonglong data_file_length
Definition: myisam.h:159
MI_KEYDEF::block_size_index
uint16 block_size_index
Definition: myisam.h:183
MI_CHECK::myf_rw
myf myf_rw
Definition: myisam.h:364
MI_CHECK::max_data_file_length
ulonglong max_data_file_length
Definition: myisam.h:344
MI_CHECK::warning_printed
uint warning_printed
Definition: myisam.h:355
MI_COLUMNDEF::null_bit
uint8 null_bit
Definition: myisam.h:231
SORT_INFO::myf_rw
myf myf_rw
Definition: myisam.h:394
SORT_INFO::key_block_end
SORT_KEY_BLOCKS * key_block_end
Definition: myisam.h:399
MI_ISAMINFO::deleted
ha_rows deleted
Definition: myisam.h:129
MI_CREATE_INFO::reloc_rows
ha_rows reloc_rows
Definition: myisam.h:157
MI_CHECK::opt_follow_links
bool opt_follow_links
Definition: myisam.h:359
MI_UNIQUEDEF::end
HA_KEYSEG * end
Definition: myisam.h:208
MI_BIT_BUFF
Definition: myisamdef.h:241
MI_COLUMNDEF::base_type
enum en_fieldtype base_type
Definition: myisam.h:236
my_base.h
File
int File
Definition: my_io_bits.h:50
MI_ISAMINFO::mean_reclength
ulong mean_reclength
Definition: myisam.h:137
mi_rnext
int mi_rnext(MI_INFO *file, uchar *buf, int inx)
Definition: mi_rnext.cc:37
MI_ISAMINFO::create_time
time_t create_time
Definition: myisam.h:146
MI_CHECK::start_check_pos
my_off_t start_check_pos
Definition: myisam.h:350
mi_delete_all_rows
int mi_delete_all_rows(MI_INFO *info)
Definition: mi_delete_all.cc:34
mi_disable_non_unique_index
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows)
Definition: mi_check.cc:4213
MI_CHECK::verbose
uint verbose
Definition: myisam.h:355
MI_ISAMINFO::index_file_length
my_off_t index_file_length
Definition: myisam.h:134
MI_UNIQUEDEF::key
uchar key
Definition: myisam.h:206
MI_CREATE_INFO::with_auto_increment
bool with_auto_increment
Definition: myisam.h:163
MY_WME
#define MY_WME
Definition: my_sys.h:116
MI_CHECK::need_print_msg_lock
bool need_print_msg_lock
Definition: myisam.h:381
MI_KEYDEF::minlength
uint16 minlength
Definition: myisam.h:181
MI_ISAMINFO::sortkey
int sortkey
Definition: myisam.h:144
myisam_concurrent_insert
ulong myisam_concurrent_insert
Definition: mi_static.cc:60
MI_CHECK::table_name
const char * table_name
Definition: myisam.h:377
mi_rrnd
int mi_rrnd(MI_INFO *file, uchar *buf, my_off_t pos)
Definition: mi_rrnd.cc:40
record
Definition: mi_test3.cc:54
MI_MAX_KEY_BUFF
#define MI_MAX_KEY_BUFF
Definition: myisam.h:65
myisamchk_init
void myisamchk_init(MI_CHECK *param)
Definition: mi_check.cc:110
mi_panic
int mi_panic(enum ha_panic_function function)
Definition: mi_panic.cc:36
MI_STATS_METHOD_NULLS_EQUAL
@ MI_STATS_METHOD_NULLS_EQUAL
Definition: myisam.h:337
myisam_test_invalid_symlink
int(* myisam_test_invalid_symlink)(const char *filename)
Definition: mi_static.cc:73
SORT_INFO::ft_buf
SORT_FT_BUF * ft_buf
Definition: myisam.h:400
MI_CHECK::sort_key_blocks
ulong sort_key_blocks
Definition: myisam.h:354
MI_CHECK::key_crc
ha_checksum key_crc[HA_MAX_POSSIBLE_KEY]
Definition: myisam.h:374
uint64
uint64_t uint64
Definition: my_inttypes.h:68
MI_ISAMINFO::data_file_length
my_off_t data_file_length
Definition: myisam.h:133
MI_CHECK::testflag
uint testflag
Definition: myisam.h:357
MY_TMPDIR
Definition: my_sys.h:308
MI_DECODE_TREE::quick_table_bits
uint quick_table_bits
Definition: myisam.h:214
pos
char * pos
Definition: do_ctype.cc:76
MI_CHECK::read_cache
IO_CACHE read_cache
Definition: myisam.h:365
MI_CREATE_INFO::key_file_length
ulonglong key_file_length
Definition: myisam.h:160
chk_del
int chk_del(MI_CHECK *param, MI_INFO *info, uint test_flag)
Definition: mi_check.cc:157
HA_KEYSEG
Definition: my_compare.h:58
mi_sort_index
int mi_sort_index(MI_CHECK *param, MI_INFO *info, char *name, bool no_copy_stat)
Definition: mi_check.cc:1750
MI_KEYDEF::get_key
uint(* get_key)(MI_KEYDEF *keyinfo, uint nod_flag, uchar **page, uchar *key)
Definition: myisam.h:192
SORT_INFO::total_keys
uint total_keys
Definition: myisam.h:393
mi_delete
int mi_delete(MI_INFO *file, const uchar *buff)
Definition: mi_delete.cc:50
mysql_mutex_t
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
data_file_type
data_file_type
Definition: my_base.h:1062
MY_WAIT_IF_FULL
#define MY_WAIT_IF_FULL
Definition: my_sys.h:117
MI_MAX_POSSIBLE_KEY_BUFF
#define MI_MAX_POSSIBLE_KEY_BUFF
Definition: myisam.h:57
MI_ISAMINFO::check_time
time_t check_time
Definition: myisam.h:147
MI_CHECK::new_file_pos
my_off_t new_file_pos
Definition: myisam.h:349
key_part_map
ulong key_part_map
Definition: my_base.h:1000
my_off_t
ulonglong my_off_t
Definition: my_inttypes.h:71
mi_position
my_off_t mi_position(MI_INFO *file)
Definition: mi_info.cc:38
MI_CHECK::total_deleted
ha_rows total_deleted
Definition: myisam.h:351
MI_KEYDEF::version
uint32 version
Definition: myisam.h:184
enum_mi_stats_method
enum_mi_stats_method
Definition: myisam.h:333
myisam_data_pointer_size
ulong myisam_data_pointer_size
Definition: mi_static.cc:62
MI_CHECK::key_file_blocks
my_off_t key_file_blocks
Definition: myisam.h:349
MI_COLUMNDEF::huff_tree
MI_DECODE_TREE * huff_tree
Definition: myisam.h:238
MI_CHECK::max_record_length
ulonglong max_record_length
Definition: myisam.h:346
MI_UNIQUEDEF::seg
HA_KEYSEG * seg
Definition: myisam.h:208
myisam_block_size
ulong myisam_block_size
Definition: mi_static.cc:56
MI_KEYDEF
Definition: myisam.h:171
MI_ISAMINFO::newrecpos
my_off_t newrecpos
Definition: myisam.h:131
mi_rprev
int mi_rprev(MI_INFO *file, uchar *buf, int inx)
Definition: mi_rprev.cc:36
SORT_INFO::max_records
ha_rows max_records
Definition: myisam.h:392
ha_checksum
uint32 ha_checksum
Definition: my_sys.h:538
ha_panic_function
ha_panic_function
Definition: my_base.h:431
mi_open_share
MI_INFO * mi_open_share(const char *name, MYISAM_SHARE *old_share, int mode, uint wait_if_locked)
Definition: mi_open.cc:99
MI_CHECK::tmpfile_createflag
int tmpfile_createflag
Definition: myisam.h:363
myisam_mmap_size
ulonglong myisam_mmap_size
Definition: mi_static.cc:63
key
static const char * key
Definition: suite_stubs.c:14
MI_CHECK::record_checksum
ha_checksum record_checksum
Definition: myisam.h:352
test_if_almost_full
int test_if_almost_full(MI_INFO *info)
Definition: mi_check.cc:3793
chk_data_link
int chk_data_link(MI_CHECK *param, MI_INFO *info, int extend)
Definition: mi_check.cc:889
SORT_FT_BUF::count
int count
Definition: myisam.h:386
SORT_INFO
Definition: myisam.h:390
mi_rnext_same
int mi_rnext_same(MI_INFO *info, uchar *buf)
Definition: mi_rnext_same.cc:38
mi_records_in_range
ha_rows mi_records_in_range(MI_INFO *info, int inx, key_range *min_key, key_range *max_key)
Definition: mi_range.cc:61
MI_CHECK::op_name
const char * op_name
Definition: myisam.h:378
chk_size
int chk_size(MI_CHECK *param, MI_INFO *info)
Definition: mi_check.cc:317
MI_CHECK::temp_filename
char temp_filename[FN_REFLEN]
Definition: myisam.h:361
MI_ISAMINFO::keys
uint keys
Definition: myisam.h:141
MI_CHECK::key_blocks
my_off_t key_blocks
Definition: myisam.h:350
MI_ISAMINFO::key_map
ulonglong key_map
Definition: myisam.h:139
SORT_INFO::buff_length
my_off_t buff_length
Definition: myisam.h:391
FN_REFLEN
#define FN_REFLEN
Definition: my_io.h:82
SORT_FT_BUF::end
uchar * end
Definition: myisam.h:385
MI_KEYDEF::pack_key
int(* pack_key)(MI_KEYDEF *keyinfo, uint nod_flag, const uchar *next_key, uchar *org_key, uchar *prev_key, const uchar *key, MI_KEY_PARAM *s_temp)
Definition: myisam.h:193
STATIC_RECORD
@ STATIC_RECORD
Definition: my_base.h:1063
MI_ISAMINFO::max_index_file_length
my_off_t max_index_file_length
Definition: myisam.h:134
update_auto_increment_key
void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, bool repair)
Definition: mi_check.cc:4039
mi_scan
int mi_scan(MI_INFO *file, uchar *buf)
Definition: mi_scan.cc:47
cache_size
static uint64_t cache_size
Definition: xcom_cache.c:389
myisam_delay_key_write
bool myisam_delay_key_write
Definition: myisam.h:244
MI_KEYDEF::block_length
uint16 block_length
Definition: myisam.h:178
SORT_KEY_BLOCKS::buff
uchar * buff
Definition: myisam.h:321
SORT_KEY_BLOCKS
Definition: myisam.h:319
MI_COLUMNDEF::space_length_bits
uint space_length_bits
Definition: myisam.h:237
MI_STATS_METHOD_IGNORE_NULLS
@ MI_STATS_METHOD_IGNORE_NULLS
Definition: myisam.h:339
MI_COLUMNDEF::pack_type
uint pack_type
Definition: myisam.h:237
MI_ISAMINFO::records
ha_rows records
Definition: myisam.h:128
mi_rsame_with_pos
int mi_rsame_with_pos(MI_INFO *file, uchar *record, int inx, my_off_t pos)
Definition: mi_rsamepos.cc:40
MI_DECODE_TREE::intervalls
uchar * intervalls
Definition: myisam.h:215
KEY_CACHE_BLOCK_SIZE
#define KEY_CACHE_BLOCK_SIZE
Definition: keycache.h:61
MI_CHECK::search_after_block
my_off_t search_after_block
Definition: myisam.h:348
mi_preload
int mi_preload(MI_INFO *info, ulonglong key_map, bool ignore_leaves)
Definition: mi_preload.cc:56
my_inttypes.h
KEY_CACHE
Definition: keycache.h:70
main_thread_keycache_var
st_keycache_thread_var main_thread_keycache_var
Definition: mi_static.cc:65
m_ctype.h
MI_ISAMINFO
Definition: myisam.h:126
MI_ISAMINFO::dupp_key_pos
my_off_t dupp_key_pos
Definition: myisam.h:132
MI_CHECK::language
uint16 language
Definition: myisam.h:358
SORT_INFO::mutex
mysql_mutex_t mutex
Definition: myisam.h:403
MI_KEYDEF::parser
struct st_mysql_ftparser * parser
Definition: myisam.h:188
MI_ISAMINFO::delete_length
my_off_t delete_length
Definition: myisam.h:135
my_compare.h
mi_rkey
int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag)
Definition: mi_rkey.cc:35
MI_CHECK::totaldata
my_off_t totaldata
Definition: myisam.h:350
keyinfo
static MI_KEYDEF keyinfo[10]
Definition: mi_test1.cc:46
mi_repair
int mi_repair(MI_CHECK *param, MI_INFO *info, char *name, int rep_quick, bool no_copy_stat)
Definition: mi_check.cc:1407
MI_CHECK::use_buffers
ulonglong use_buffers
Definition: myisam.h:353
time.h
MI_KEYDEF::end
HA_KEYSEG * end
Definition: myisam.h:187
ha_extra_function
ha_extra_function
Definition: my_base.h:183
page
int page
Definition: ctype-mb.cc:1232
MI_COLUMNDEF::unpack
void(* unpack)(MI_COLUMNDEF *rec, MI_BIT_BUFF *buff, uchar *start, uchar *end)
Definition: myisam.h:234
MI_KEYDEF::flag
uint16 flag
Definition: myisam.h:175
uint
unsigned int uint
Definition: uca-dump.cc:29
chk_key
int chk_key(MI_CHECK *param, MI_INFO *info)
Definition: mi_check.cc:376
MI_KEYDEF::bin_search
int(* bin_search)(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key, uint key_len, uint comp_flag, uchar **ret_pos, uchar *buff, bool *was_last_key)
Definition: myisam.h:189
MI_KEYDEF::keylength
uint16 keylength
Definition: myisam.h:180
mi_rlast
int mi_rlast(MI_INFO *file, uchar *buf, int inx)
Definition: mi_rlast.cc:29
MI_CHECK::total_files
uint total_files
Definition: myisam.h:356
MI_COLUMNDEF::type
int16 type
Definition: myisam.h:228
mi_is_key_active
bool mi_is_key_active(uint64 _keymap_, unsigned int _keyno_)
Definition: myisam.h:103
MI_CREATE_INFO::data_file_name
const char * data_file_name
Definition: myisam.h:155
mi_is_changed
int mi_is_changed(MI_INFO *info)
Definition: mi_changed.cc:30
MI_CHECK::force_sort
bool force_sort
Definition: myisam.h:360
uchar
unsigned char uchar
Definition: my_inttypes.h:51
write_data_suffix
int write_data_suffix(SORT_INFO *sort_info, bool fix_datafile)
Definition: mi_check.cc:3955
mi_update
int mi_update(MI_INFO *file, const uchar *old, uchar *new_record)
Definition: mi_update.cc:37
SORT_INFO::threads_running
uint threads_running
Definition: myisam.h:402
MI_CHECK::isam_file_name
char * isam_file_name
Definition: myisam.h:361
MI_CHECK::sort_buffer_length
ulonglong sort_buffer_length
Definition: myisam.h:347
MI_CHECK::using_global_keycache
bool using_global_keycache
Definition: myisam.h:359
SORT_INFO::info
MI_INFO * info
Definition: myisam.h:396
MI_COLUMNDEF::offset
uint32 offset
Definition: myisam.h:230
MI_INFO
Definition: myisamdef.h:250
rules_table_service::end
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:188
MI_CHECK::keydata
my_off_t keydata
Definition: myisam.h:350
update
static uint update
Definition: myisamlog.cc:88
st_keycache_thread_var
Definition: keycache.h:47
keycache.h
mi_assign_to_key_cache
int mi_assign_to_key_cache(MI_INFO *info, ulonglong key_map, KEY_CACHE *key_cache)
Definition: mi_keycache.cc:59
uint32
uint32_t uint32
Definition: my_inttypes.h:66
MI_CHECK::rec_per_key_part
ulong rec_per_key_part[MI_MAX_KEY_SEG *HA_MAX_POSSIBLE_KEY]
Definition: myisam.h:375
MI_CHECK::unique_count
ulonglong unique_count[MI_MAX_KEY_SEG+1]
Definition: myisam.h:371
MI_CHECK::error_printed
uint error_printed
Definition: myisam.h:355
st_mysql_ftparser
Definition: plugin_ftparser.h:211
MI_UNIQUEDEF
Definition: myisam.h:203
SORT_KEY_BLOCKS::inited
int inited
Definition: myisam.h:324
MI_CHECK::max_level
uint max_level
Definition: myisam.h:356
mi_rsame
int mi_rsame(MI_INFO *file, uchar *record, int inx)
Definition: mi_rsame.cc:38
SORT_INFO::got_error
uint got_error
Definition: myisam.h:402
MI_CHECK::key_cache_block_size
uint key_cache_block_size
Definition: myisam.h:357
mi_close_share
int mi_close_share(MI_INFO *file, bool *closed_share)
Definition: mi_close.cc:38
mi_lock_database
int mi_lock_database(MI_INFO *file, int lock_type)
Definition: mi_locking.cc:45
MI_COLUMNDEF
Definition: myisam.h:226
SORT_KEY_BLOCKS::lastkey
uchar lastkey[MI_MAX_POSSIBLE_KEY_BUFF]
Definition: myisam.h:322
mi_write
int mi_write(MI_INFO *file, uchar *buff)
Definition: mi_write.cc:58
SORT_INFO::new_data_file_type
data_file_type new_data_file_type
Definition: myisam.h:395
MI_KEY_PARAM
Definition: myisamdef.h:520
movepoint
int movepoint(MI_INFO *info, uchar *record, my_off_t oldpos, my_off_t newpos, uint prot_key)
Definition: mi_check.cc:1702
MYISAM_SHARE
Definition: myisamdef.h:175
MI_CHECK::auto_increment_value
ulonglong auto_increment_value
Definition: myisam.h:343
MI_ISAMINFO::record_offset
ulong record_offset
Definition: myisam.h:150
MI_STATS_METHOD_NULLS_NOT_EQUAL
@ MI_STATS_METHOD_NULLS_NOT_EQUAL
Definition: myisam.h:335
name
const string name("\"Name\"")
update_state_info
int update_state_info(MI_CHECK *param, MI_INFO *info, uint update)
Definition: mi_check.cc:3973
MI_CHECK::keys_in_use
ulonglong keys_in_use
Definition: myisam.h:345
MI_ISAMINFO::options
uint options
Definition: myisam.h:142
mi_reset
int mi_reset(MI_INFO *file)
Definition: mi_extra.cc:236
mi_create
int mi_create(const char *name, uint keys, MI_KEYDEF *keydef, uint columns, MI_COLUMNDEF *columndef, uint uniques, MI_UNIQUEDEF *uniquedef, MI_CREATE_INFO *create_info, uint flags)
Definition: mi_create.cc:54
MI_UNIQUEDEF::null_are_equal
uint8 null_are_equal
Definition: myisam.h:207
MI_KEYDEF::seg
HA_KEYSEG * seg
Definition: myisam.h:187
mi_scan_init
int mi_scan_init(MI_INFO *file)
Definition: mi_scan.cc:29
MI_CHECK::tmpdir
MY_TMPDIR * tmpdir
Definition: myisam.h:362
MI_ISAMINFO::reflength
uint reflength
Definition: myisam.h:149
IO_CACHE
Definition: my_sys.h:337
MI_KEYDEF::ck_insert
int(* ck_insert)(MI_INFO *inf, uint k_nr, uchar *k, uint klen)
Definition: myisam.h:197
MI_KEYDEF::underflow_block_length
uint16 underflow_block_length
Definition: myisam.h:179
SORT_INFO::key_block
SORT_KEY_BLOCKS * key_block
Definition: myisam.h:399
myisam_log_filename
const char * myisam_log_filename
Definition: mi_static.cc:53
myisam_flush
bool myisam_flush
Definition: mi_static.cc:57
SORT_INFO::buff
uchar * buff
Definition: myisam.h:398
MI_CHECK::glob_crc
ha_checksum glob_crc
Definition: myisam.h:352
MI_ISAMINFO::data_file_name
char * data_file_name
Definition: myisam.h:140
uint8
uint8_t uint8
Definition: my_inttypes.h:62
HA_MAX_POSSIBLE_KEY
#define HA_MAX_POSSIBLE_KEY
Definition: my_compare.h:46
MI_CREATE_INFO::max_rows
ha_rows max_rows
Definition: myisam.h:156
MI_KEYDEF::keysegs
uint16 keysegs
Definition: myisam.h:174
SORT_INFO::filelength
my_off_t filelength
Definition: myisam.h:391
lock_memory
void lock_memory(MI_CHECK *param)
MI_KEYDEF::ck_delete
int(* ck_delete)(MI_INFO *inf, uint k_nr, uchar *k, uint klen)
Definition: myisam.h:198
MI_DECODE_TREE::table
uint16 * table
Definition: myisam.h:213
SORT_INFO::dupp
my_off_t dupp
Definition: myisam.h:391
MI_CHECK::total_records
ha_rows total_records
Definition: myisam.h:351
mi_flush_bulk_insert
void mi_flush_bulk_insert(MI_INFO *info, uint inx)
Definition: mi_write.cc:914
MI_CHECK::retry_repair
bool retry_repair
Definition: myisam.h:360
SORT_KEY_BLOCKS::last_length
uint last_length
Definition: myisam.h:323
mi_end_bulk_insert
void mi_end_bulk_insert(MI_INFO *info)
Definition: mi_write.cc:921
MI_ISAMINFO::errkey
int errkey
Definition: myisam.h:143
myisam_max_temp_length
my_off_t myisam_max_temp_length
Definition: mi_static.cc:61
change_to_newfile
int change_to_newfile(const char *filename, const char *old_ext, const char *new_ext, myf myflags)
Definition: mi_check.cc:1938
MI_CHECK::opt_sort_key
uint opt_sort_key
Definition: myisam.h:356
HttpMethod::type
int type
Definition: http_common.h:411
MI_CHECK::thd
void * thd
Definition: myisam.h:376
ha_rkey_function
ha_rkey_function
Definition: my_base.h:77
MI_ISAMINFO::recpos
my_off_t recpos
Definition: myisam.h:130
mi_delete_table
int mi_delete_table(const char *name)
Definition: mi_delete_table.cc:34
MI_CHECK::stats_method
enum_mi_stats_method stats_method
Definition: myisam.h:379
MI_ISAMINFO::filenr
File filenr
Definition: myisam.h:145
mi_test_if_sort_rep
bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, ulonglong key_map, bool force)
Definition: mi_check.cc:4236
mi_repair_by_sort
int mi_repair_by_sort(MI_CHECK *param, MI_INFO *info, const char *name, int rep_quick, bool no_copy_stat)
Definition: mi_check.cc:2016
SORT_INFO::param
MI_CHECK * param
Definition: myisam.h:397
MI_UNIQUEDEF::keysegs
uint16 keysegs
Definition: myisam.h:205
THR_LOCK_myisam_mmap
mysql_mutex_t THR_LOCK_myisam_mmap
Definition: my_thr_init.cc:71
MI_ISAMINFO::auto_increment
ulonglong auto_increment
Definition: myisam.h:138
MI_KEYMAP_BITS
#define MI_KEYMAP_BITS
Definition: myisam.h:82
SORT_INFO::cond
mysql_cond_t cond
Definition: myisam.h:404
MI_CHECK::read_buffer_length
ulong read_buffer_length
Definition: myisam.h:354
gis::length
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
mi_init_bulk_insert
int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows)
Definition: mi_write.cc:862
HA_OFFSET_ERROR
#define HA_OFFSET_ERROR
Definition: my_base.h:1135
MI_KEYDEF::share
MYISAM_SHARE * share
Definition: myisam.h:173
m_string.h
_mi_calc_blob_length
ulong _mi_calc_blob_length(uint length, const uchar *pos)
Definition: mi_dynrec.cc:1165
SORT_INFO::current_key
uint current_key
Definition: myisam.h:393
SORT_FT_BUF::lastkey
uchar lastkey[MI_MAX_KEY_BUFF]
Definition: myisam.h:387
filecopy
int filecopy(MI_CHECK *param, File to, File from, my_off_t start, my_off_t length, const char *type)
Definition: mi_check.cc:1967
ulong
unsigned long ulong
Definition: my_inttypes.h:48
SORT_FT_BUF
Definition: myisam.h:384
MI_CREATE_INFO::auto_increment
ulonglong auto_increment
Definition: myisam.h:158
uint16
uint16_t uint16
Definition: my_inttypes.h:64
myf
int myf
Definition: my_inttypes.h:93
ulonglong
unsigned long long int ulonglong
Definition: my_inttypes.h:55
MI_CHECK::print_msg_mutex
mysql_mutex_t print_msg_mutex
Definition: myisam.h:380
mi_change_key_cache
void mi_change_key_cache(KEY_CACHE *old_key_cache, KEY_CACHE *new_key_cache)
Definition: mi_keycache.cc:143
MI_CHECK
Definition: myisam.h:342
my_check_opt.h
MI_ISAMINFO::reclength
ulong reclength
Definition: myisam.h:136
MI_KEYMAP_HIGH_MASK
#define MI_KEYMAP_HIGH_MASK
Definition: myisam.h:83
MI_COLUMNDEF::length
uint16 length
Definition: myisam.h:229
start
static void start(PluginFuncEnv *env)
Definition: http_server_plugin.cc:572
MI_CREATE_INFO::language
uint16 language
Definition: myisam.h:162
mysql_cond_t
An instrumented cond structure.
Definition: mysql_cond_bits.h:49
ha_rows
my_off_t ha_rows
Definition: my_base.h:1132
MI_KEYDEF::key_alg
uint8 key_alg
Definition: myisam.h:177
my_io.h
int16
int16_t int16
Definition: my_inttypes.h:63
MI_ISAMINFO::update_time
time_t update_time
Definition: myisam.h:148
mi_is_any_key_active
bool mi_is_any_key_active(uint64 _keymap_)
Definition: myisam.h:112
MI_DECODE_TREE
Definition: myisam.h:211
SORT_KEY_BLOCKS::end_pos
uchar * end_pos
Definition: myisam.h:321
mi_log
int mi_log(int activate_log)
Definition: mi_log.cc:49
keys
static uint keys
Definition: hp_test2.cc:43
MI_MAX_KEY_SEG
#define MI_MAX_KEY_SEG
Definition: myisam.h:63
my_macros.h
key_range
Definition: my_base.h:1116
MI_KEYDEF::ftkey_nr
uint32 ftkey_nr
Definition: myisam.h:185
MI_CREATE_INFO::old_options
uint old_options
Definition: myisam.h:161
MY_NABP
#define MY_NABP
Definition: my_sys.h:114
MI_KEYDEF::maxlength
uint16 maxlength
Definition: myisam.h:182
store_key
class to copying an field/item to a key struct
Definition: sql_select.h:783
en_fieldtype
en_fieldtype
Definition: my_base.h:1047
lock_file
int lock_file(MI_CHECK *param, File file, int lock_type, const char *filetype, const char *filename)
Definition: mi_check.cc:1951
update_key_parts
void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part, ulonglong *unique, ulonglong *notnull, ulonglong records)
Definition: mi_check.cc:4137
MI_CHECK::out_flag
uint out_flag
Definition: myisam.h:355
MI_COLUMNDEF::null_pos
uint16 null_pos
Definition: myisam.h:232
chk_status
int chk_status(MI_CHECK *param, MI_INFO *info)
Definition: mi_check.cc:132
MI_ISAMINFO::rec_per_key
ulong * rec_per_key
Definition: myisam.h:151
myisam_single_user
bool myisam_single_user
Definition: myisam.h:244
info
Log info(cout, "NOTE")
recreate_table
int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
Definition: mi_check.cc:3803
MI_CHECK::write_buffer_length
ulong write_buffer_length
Definition: myisam.h:354
mi_rfirst
int mi_rfirst(MI_INFO *file, uchar *buf, int inx)
Definition: mi_rfirst.cc:29
mi_status
int mi_status(MI_INFO *info, MI_ISAMINFO *x, uint flag)
Definition: mi_info.cc:43
MI_CHECK::notnull_count
ulonglong notnull_count[MI_MAX_KEY_SEG+1]
Definition: myisam.h:372
SORT_FT_BUF::buf
uchar * buf
Definition: myisam.h:385
mi_extra
int mi_extra(MI_INFO *file, enum ha_extra_function function, void *extra_arg)
Definition: mi_extra.cc:53
MI_CREATE_INFO::index_file_name
const char * index_file_name
Definition: myisam.h:155
MI_CREATE_INFO
Definition: myisam.h:154
flag
static int flag
Definition: hp_test1.cc:39
MI_ISAMINFO::index_file_name
char * index_file_name
Definition: myisam.h:140
mi_rename
int mi_rename(const char *from, const char *to)
Definition: mi_rename.cc:33
keycache_thread_var
st_keycache_thread_var * keycache_thread_var()
Definition: ha_myisam.cc:1956
flags
static int flags[50]
Definition: hp_test1.cc:39
MI_CHECK::db_name
const char * db_name
Definition: myisam.h:377
filename
const char * filename
Definition: pfs_example_component_population.cc:64