1
by brian
clean slate |
1 |
/* Copyright (C) 2000 MySQL AB
|
2 |
||
3 |
This program is free software; you can redistribute it and/or modify
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
5 |
the Free Software Foundation; version 2 of the License.
|
|
6 |
||
7 |
This program is distributed in the hope that it will be useful,
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
GNU General Public License for more details.
|
|
11 |
||
12 |
You should have received a copy of the GNU General Public License
|
|
13 |
along with this program; if not, write to the Free Software
|
|
14 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
15 |
||
16 |
/* This file should be included when using myisam_funktions */
|
|
17 |
||
18 |
#ifndef _myisam_h
|
|
19 |
#define _myisam_h
|
|
993.1.13
by Padraig O'Sullivan
Removing calls to to_ulong(). This could have thrown an out_of_range |
20 |
|
21 |
#include <drizzled/key_map.h> |
|
22 |
||
1
by brian
clean slate |
23 |
#ifdef __cplusplus
|
24 |
extern "C" { |
|
25 |
#endif
|
|
26 |
||
212.5.39
by Monty Taylor
Phew. Moved my_base and my_global. |
27 |
#include <drizzled/base.h> |
1
by brian
clean slate |
28 |
#ifndef _m_ctype_h
|
489.1.8
by Monty Taylor
Split out Item_int_func and Item_func from Item_func. (don't think too hard about the second one) |
29 |
#include <mystrings/m_ctype.h> |
1
by brian
clean slate |
30 |
#endif
|
31 |
#ifndef _keycache_h
|
|
32 |
#include "keycache.h" |
|
33 |
#endif
|
|
992.1.25
by Monty Taylor
Moved myisam to new plugin system. |
34 |
#include <plugin/myisam/my_handler.h> |
481.1.16
by Monty Taylor
Merged iocache.h addition. |
35 |
#include <mysys/iocache.h> |
1
by brian
clean slate |
36 |
|
37 |
/*
|
|
38 |
Limit max keys according to HA_MAX_POSSIBLE_KEY
|
|
39 |
*/
|
|
40 |
||
41 |
#if MAX_INDEXES > HA_MAX_POSSIBLE_KEY
|
|
42 |
#define MI_MAX_KEY HA_MAX_POSSIBLE_KEY /* Max allowed keys */ |
|
43 |
#else
|
|
44 |
#define MI_MAX_KEY MAX_INDEXES /* Max allowed keys */ |
|
45 |
#endif
|
|
46 |
||
47 |
/*
|
|
48 |
The following defines can be increased if necessary.
|
|
49 |
But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and MI_MAX_KEY_LENGTH.
|
|
50 |
*/
|
|
51 |
#define MI_MAX_KEY_LENGTH 1332 /* Max length in bytes */ |
|
52 |
#define MI_MAX_KEY_SEG 16 /* Max segments for key */ |
|
53 |
||
54 |
#define MI_MAX_POSSIBLE_KEY_BUFF (MI_MAX_KEY_LENGTH + 6 + 6) /* For mi_check */ |
|
55 |
||
56 |
#define MI_MAX_KEY_BUFF (MI_MAX_KEY_LENGTH+MI_MAX_KEY_SEG*6+8+8)
|
|
57 |
#define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */ |
|
58 |
#define MI_NAME_IEXT ".MYI"
|
|
59 |
#define MI_NAME_DEXT ".MYD"
|
|
60 |
/* Max extra space to use when sorting keys */
|
|
61 |
#define MI_MAX_TEMP_LENGTH 2*1024L*1024L*1024L
|
|
62 |
||
63 |
/* Possible values for myisam_block_size (must be power of 2) */
|
|
64 |
#define MI_KEY_BLOCK_LENGTH 1024 /* default key block length */ |
|
65 |
#define MI_MIN_KEY_BLOCK_LENGTH 1024 /* Min key block length */ |
|
66 |
#define MI_MAX_KEY_BLOCK_LENGTH 16384
|
|
67 |
||
68 |
/*
|
|
69 |
In the following macros '_keyno_' is 0 .. keys-1.
|
|
70 |
If there can be more keys than bits in the key_map, the highest bit
|
|
71 |
is for all upper keys. They cannot be switched individually.
|
|
72 |
This means that clearing of high keys is ignored, setting one high key
|
|
73 |
sets all high keys.
|
|
74 |
*/
|
|
481.1.5
by Monty Taylor
Removed sizeof(long) sizeof(long long) checks. |
75 |
#define MI_KEYMAP_BITS (64)
|
398.1.8
by Monty Taylor
Enabled -Wlong-long. |
76 |
#define MI_KEYMAP_HIGH_MASK (1UL << (MI_KEYMAP_BITS - 1))
|
1
by brian
clean slate |
77 |
#define mi_get_mask_all_keys_active(_keys_) \
|
78 |
(((_keys_) < MI_KEYMAP_BITS) ? \
|
|
398.1.8
by Monty Taylor
Enabled -Wlong-long. |
79 |
((1UL << (_keys_)) - 1UL) : \
|
80 |
(~ 0UL))
|
|
1
by brian
clean slate |
81 |
|
82 |
#if MI_MAX_KEY > MI_KEYMAP_BITS
|
|
83 |
||
84 |
#define mi_is_key_active(_keymap_,_keyno_) \
|
|
85 |
(((_keyno_) < MI_KEYMAP_BITS) ? \
|
|
398.1.8
by Monty Taylor
Enabled -Wlong-long. |
86 |
test((_keymap_) & (1UL << (_keyno_))) : \
|
1
by brian
clean slate |
87 |
test((_keymap_) & MI_KEYMAP_HIGH_MASK))
|
88 |
#define mi_set_key_active(_keymap_,_keyno_) \
|
|
89 |
(_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \
|
|
398.1.8
by Monty Taylor
Enabled -Wlong-long. |
90 |
(1UL << (_keyno_)) : \
|
1
by brian
clean slate |
91 |
MI_KEYMAP_HIGH_MASK)
|
92 |
#define mi_clear_key_active(_keymap_,_keyno_) \
|
|
93 |
(_keymap_)&= (((_keyno_) < MI_KEYMAP_BITS) ? \
|
|
398.1.8
by Monty Taylor
Enabled -Wlong-long. |
94 |
(~ (1UL << (_keyno_))) : \
|
95 |
(~ (0UL)) /*ignore*/ ) |
|
1
by brian
clean slate |
96 |
|
97 |
#else
|
|
98 |
||
99 |
#define mi_is_key_active(_keymap_,_keyno_) \
|
|
398.1.8
by Monty Taylor
Enabled -Wlong-long. |
100 |
test((_keymap_) & (1UL << (_keyno_)))
|
1
by brian
clean slate |
101 |
#define mi_set_key_active(_keymap_,_keyno_) \
|
398.1.8
by Monty Taylor
Enabled -Wlong-long. |
102 |
(_keymap_)|= (1UL << (_keyno_))
|
1
by brian
clean slate |
103 |
#define mi_clear_key_active(_keymap_,_keyno_) \
|
398.1.8
by Monty Taylor
Enabled -Wlong-long. |
104 |
(_keymap_)&= (~ (1UL << (_keyno_)))
|
1
by brian
clean slate |
105 |
|
106 |
#endif
|
|
107 |
||
108 |
#define mi_is_any_key_active(_keymap_) \
|
|
109 |
test((_keymap_))
|
|
110 |
#define mi_is_all_keys_active(_keymap_,_keys_) \
|
|
111 |
((_keymap_) == mi_get_mask_all_keys_active(_keys_))
|
|
112 |
#define mi_set_all_keys_active(_keymap_,_keys_) \
|
|
113 |
(_keymap_)= mi_get_mask_all_keys_active(_keys_)
|
|
114 |
#define mi_clear_all_keys_active(_keymap_) \
|
|
115 |
(_keymap_)= 0
|
|
116 |
#define mi_intersect_keys_active(_to_,_from_) \
|
|
117 |
(_to_)&= (_from_)
|
|
118 |
#define mi_is_any_intersect_keys_active(_keymap1_,_keys_,_keymap2_) \
|
|
119 |
((_keymap1_) & (_keymap2_) & \
|
|
120 |
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_) & \
|
|
123 |
(_from_))
|
|
124 |
||
125 |
/* Param to/from mi_status */
|
|
126 |
||
127 |
typedef struct st_mi_isaminfo /* Struct from h_info */ |
|
128 |
{
|
|
129 |
ha_rows records; /* Records in database */ |
|
130 |
ha_rows deleted; /* Deleted records in database */ |
|
131 |
my_off_t recpos; /* Pos for last used record */ |
|
132 |
my_off_t newrecpos; /* Pos if we write new record */ |
|
133 |
my_off_t dupp_key_pos; /* Position to record with dupp key */ |
|
134 |
my_off_t data_file_length, /* Length of data file */ |
|
135 |
max_data_file_length, |
|
136 |
index_file_length, |
|
137 |
max_index_file_length, |
|
138 |
delete_length; |
|
139 |
ulong reclength; /* Recordlength */ |
|
140 |
ulong mean_reclength; /* Mean recordlength (if packed) */ |
|
151
by Brian Aker
Ulonglong to uint64_t |
141 |
uint64_t auto_increment; |
142 |
uint64_t key_map; /* Which keys are used */ |
|
1
by brian
clean slate |
143 |
char *data_file_name, *index_file_name; |
482
by Brian Aker
Remove uint. |
144 |
uint32_t keys; /* Number of keys in use */ |
1
by brian
clean slate |
145 |
uint options; /* HA_OPTION_... used */ |
146 |
int errkey, /* With key was dupplicated on err */ |
|
147 |
sortkey; /* clustered by this key */ |
|
148 |
File filenr; /* (uniq) filenr for datafile */ |
|
149 |
time_t create_time; /* When table was created */ |
|
150 |
time_t check_time; |
|
151 |
time_t update_time; |
|
482
by Brian Aker
Remove uint. |
152 |
uint32_t reflength; |
1
by brian
clean slate |
153 |
ulong record_offset; |
154 |
ulong *rec_per_key; /* for sql optimizing */ |
|
155 |
} MI_ISAMINFO; |
|
156 |
||
157 |
||
158 |
typedef struct st_mi_create_info |
|
159 |
{
|
|
160 |
const char *index_file_name, *data_file_name; /* If using symlinks */ |
|
161 |
ha_rows max_rows; |
|
162 |
ha_rows reloc_rows; |
|
151
by Brian Aker
Ulonglong to uint64_t |
163 |
uint64_t auto_increment; |
164 |
uint64_t data_file_length; |
|
165 |
uint64_t key_file_length; |
|
482
by Brian Aker
Remove uint. |
166 |
uint32_t old_options; |
206
by Brian Aker
Removed final uint dead types. |
167 |
uint8_t language; |
281
by Brian Aker
Converted myisam away from my_bool |
168 |
bool with_auto_increment; |
1
by brian
clean slate |
169 |
} MI_CREATE_INFO; |
170 |
||
171 |
struct st_myisam_info; /* For referense */ |
|
172 |
struct st_mi_isam_share; |
|
173 |
typedef struct st_myisam_info MI_INFO; |
|
174 |
struct st_mi_s_param; |
|
175 |
||
176 |
typedef struct st_mi_keydef /* Key definition with open & info */ |
|
177 |
{
|
|
178 |
struct st_mi_isam_share *share; /* Pointer to base (set in mi_open) */ |
|
206
by Brian Aker
Removed final uint dead types. |
179 |
uint16_t keysegs; /* Number of key-segment */ |
180 |
uint16_t flag; /* NOSAME, PACK_USED */ |
|
1
by brian
clean slate |
181 |
|
206
by Brian Aker
Removed final uint dead types. |
182 |
uint8_t key_alg; /* BTREE, RTREE */ |
183 |
uint16_t block_length; /* Length of keyblock (auto) */ |
|
184 |
uint16_t underflow_block_length; /* When to execute underflow */ |
|
185 |
uint16_t keylength; /* Tot length of keyparts (auto) */ |
|
186 |
uint16_t minlength; /* min length of (packed) key (auto) */ |
|
187 |
uint16_t maxlength; /* max length of (packed) key (auto) */ |
|
188 |
uint16_t block_size_index; /* block_size (auto) */ |
|
205
by Brian Aker
uint32 -> uin32_t |
189 |
uint32_t version; /* For concurrent read/write */ |
1
by brian
clean slate |
190 |
|
191 |
HA_KEYSEG *seg,*end; |
|
160.1.2
by mark
remove FTPARSER and last remains of full text search |
192 |
|
1
by brian
clean slate |
193 |
int (*bin_search)(struct st_myisam_info *info,struct st_mi_keydef *keyinfo, |
481
by Brian Aker
Remove all of uchar. |
194 |
unsigned char *page,unsigned char *key, |
482
by Brian Aker
Remove uint. |
195 |
uint32_t key_len,uint32_t comp_flag,unsigned char * *ret_pos, |
481
by Brian Aker
Remove all of uchar. |
196 |
unsigned char *buff, bool *was_last_key); |
482
by Brian Aker
Remove uint. |
197 |
uint32_t (*get_key)(struct st_mi_keydef *keyinfo,uint32_t nod_flag,unsigned char * *page, |
481
by Brian Aker
Remove all of uchar. |
198 |
unsigned char *key); |
482
by Brian Aker
Remove uint. |
199 |
int (*pack_key)(struct st_mi_keydef *keyinfo,uint32_t nod_flag,unsigned char *next_key, |
481
by Brian Aker
Remove all of uchar. |
200 |
unsigned char *org_key, unsigned char *prev_key, unsigned char *key, |
1
by brian
clean slate |
201 |
struct st_mi_s_param *s_temp); |
481
by Brian Aker
Remove all of uchar. |
202 |
void (*store_key)(struct st_mi_keydef *keyinfo, unsigned char *key_pos, |
1
by brian
clean slate |
203 |
struct st_mi_s_param *s_temp); |
482
by Brian Aker
Remove uint. |
204 |
int (*ck_insert)(struct st_myisam_info *inf, uint32_t k_nr, unsigned char *k, uint32_t klen); |
205 |
int (*ck_delete)(struct st_myisam_info *inf, uint32_t k_nr, unsigned char *k, uint32_t klen); |
|
1
by brian
clean slate |
206 |
} MI_KEYDEF; |
207 |
||
208 |
||
209 |
#define MI_UNIQUE_HASH_LENGTH 4
|
|
210 |
||
211 |
typedef struct st_unique_def /* Segment definition of unique */ |
|
212 |
{
|
|
206
by Brian Aker
Removed final uint dead types. |
213 |
uint16_t keysegs; /* Number of key-segment */ |
481
by Brian Aker
Remove all of uchar. |
214 |
unsigned char key; /* Mapped to which key */ |
206
by Brian Aker
Removed final uint dead types. |
215 |
uint8_t null_are_equal; |
1
by brian
clean slate |
216 |
HA_KEYSEG *seg,*end; |
217 |
} MI_UNIQUEDEF; |
|
218 |
||
219 |
typedef struct st_mi_decode_tree /* Decode huff-table */ |
|
220 |
{
|
|
206
by Brian Aker
Removed final uint dead types. |
221 |
uint16_t *table; |
1
by brian
clean slate |
222 |
uint quick_table_bits; |
481
by Brian Aker
Remove all of uchar. |
223 |
unsigned char *intervalls; |
1
by brian
clean slate |
224 |
} MI_DECODE_TREE; |
225 |
||
226 |
||
227 |
struct st_mi_bit_buff; |
|
228 |
||
229 |
/*
|
|
230 |
Note that null markers should always be first in a row !
|
|
231 |
When creating a column, one should only specify:
|
|
232 |
type, length, null_bit and null_pos
|
|
233 |
*/
|
|
234 |
||
235 |
typedef struct st_columndef /* column information */ |
|
236 |
{
|
|
206
by Brian Aker
Removed final uint dead types. |
237 |
int16_t type; /* en_fieldtype */ |
238 |
uint16_t length; /* length of field */ |
|
205
by Brian Aker
uint32 -> uin32_t |
239 |
uint32_t offset; /* Offset to position in row */ |
206
by Brian Aker
Removed final uint dead types. |
240 |
uint8_t null_bit; /* If column may be 0 */ |
241 |
uint16_t null_pos; /* position for null marker */ |
|
1
by brian
clean slate |
242 |
|
243 |
#ifndef NOT_PACKED_DATABASES
|
|
244 |
void (*unpack)(struct st_columndef *rec,struct st_mi_bit_buff *buff, |
|
481
by Brian Aker
Remove all of uchar. |
245 |
unsigned char *start,unsigned char *end); |
1
by brian
clean slate |
246 |
enum en_fieldtype base_type; |
482
by Brian Aker
Remove uint. |
247 |
uint32_t space_length_bits,pack_type; |
1
by brian
clean slate |
248 |
MI_DECODE_TREE *huff_tree; |
249 |
#endif
|
|
250 |
} MI_COLUMNDEF; |
|
251 |
||
252 |
||
253 |
extern char * myisam_log_filename; /* Name of logfile */ |
|
312
by Brian Aker
Removed global variable calls, cleaned up static. |
254 |
extern uint32_t myisam_block_size; |
255 |
extern uint32_t myisam_concurrent_insert; |
|
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
256 |
extern bool myisam_flush,myisam_delay_key_write,myisam_single_user; |
1
by brian
clean slate |
257 |
extern my_off_t myisam_max_temp_length; |
790
by Brian Aker
More myisam plugin conversion. |
258 |
extern uint32_t myisam_bulk_insert_tree_size; |
259 |
extern uint32_t data_pointer_size; |
|
1
by brian
clean slate |
260 |
|
261 |
/* Prototypes for myisam-functions */
|
|
262 |
||
263 |
extern int mi_close(struct st_myisam_info *file); |
|
481
by Brian Aker
Remove all of uchar. |
264 |
extern int mi_delete(struct st_myisam_info *file,const unsigned char *buff); |
1
by brian
clean slate |
265 |
extern struct st_myisam_info *mi_open(const char *name,int mode, |
482
by Brian Aker
Remove uint. |
266 |
uint32_t wait_if_locked); |
1
by brian
clean slate |
267 |
extern int mi_panic(enum ha_panic_function function); |
481
by Brian Aker
Remove all of uchar. |
268 |
extern int mi_rfirst(struct st_myisam_info *file,unsigned char *buf,int inx); |
269 |
extern int mi_rkey(MI_INFO *info, unsigned char *buf, int inx, const unsigned char *key, |
|
1
by brian
clean slate |
270 |
key_part_map keypart_map, enum ha_rkey_function search_flag); |
481
by Brian Aker
Remove all of uchar. |
271 |
extern int mi_rlast(struct st_myisam_info *file,unsigned char *buf,int inx); |
272 |
extern int mi_rnext(struct st_myisam_info *file,unsigned char *buf,int inx); |
|
273 |
extern int mi_rnext_same(struct st_myisam_info *info, unsigned char *buf); |
|
274 |
extern int mi_rprev(struct st_myisam_info *file,unsigned char *buf,int inx); |
|
275 |
extern int mi_rrnd(struct st_myisam_info *file,unsigned char *buf, my_off_t pos); |
|
1
by brian
clean slate |
276 |
extern int mi_scan_init(struct st_myisam_info *file); |
481
by Brian Aker
Remove all of uchar. |
277 |
extern int mi_scan(struct st_myisam_info *file,unsigned char *buf); |
278 |
extern int mi_rsame(struct st_myisam_info *file,unsigned char *record,int inx); |
|
279 |
extern int mi_rsame_with_pos(struct st_myisam_info *file,unsigned char *record, |
|
1
by brian
clean slate |
280 |
int inx, my_off_t pos); |
481
by Brian Aker
Remove all of uchar. |
281 |
extern int mi_update(struct st_myisam_info *file,const unsigned char *old, |
282 |
unsigned char *new_record); |
|
283 |
extern int mi_write(struct st_myisam_info *file,unsigned char *buff); |
|
1
by brian
clean slate |
284 |
extern my_off_t mi_position(struct st_myisam_info *file); |
482
by Brian Aker
Remove uint. |
285 |
extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint32_t flag); |
1
by brian
clean slate |
286 |
extern int mi_lock_database(struct st_myisam_info *file,int lock_type); |
482
by Brian Aker
Remove uint. |
287 |
extern int mi_create(const char *name,uint32_t keys,MI_KEYDEF *keydef, |
288 |
uint32_t columns, MI_COLUMNDEF *columndef, |
|
289 |
uint32_t uniques, MI_UNIQUEDEF *uniquedef, |
|
290 |
MI_CREATE_INFO *create_info, uint32_t flags); |
|
1
by brian
clean slate |
291 |
extern int mi_delete_table(const char *name); |
292 |
extern int mi_rename(const char *from, const char *to); |
|
293 |
extern int mi_extra(struct st_myisam_info *file, |
|
294 |
enum ha_extra_function function, |
|
295 |
void *extra_arg); |
|
296 |
extern int mi_reset(struct st_myisam_info *file); |
|
297 |
extern ha_rows mi_records_in_range(MI_INFO *info, int inx, |
|
298 |
key_range *min_key, key_range *max_key); |
|
299 |
extern int mi_log(int activate_log); |
|
300 |
extern int mi_is_changed(struct st_myisam_info *info); |
|
301 |
extern int mi_delete_all_rows(struct st_myisam_info *info); |
|
482
by Brian Aker
Remove uint. |
302 |
extern ulong _mi_calc_blob_length(uint32_t length , const unsigned char *pos); |
303 |
extern uint32_t mi_get_pointer_length(uint64_t file_length, uint32_t def); |
|
1
by brian
clean slate |
304 |
|
305 |
/* this is used to pass to mysql_myisamchk_table */
|
|
306 |
||
307 |
#define MYISAMCHK_REPAIR 1 /* equivalent to myisamchk -r */ |
|
308 |
#define MYISAMCHK_VERIFY 2 /* Verify, run repair if failure */ |
|
309 |
||
310 |
/*
|
|
311 |
Definitions needed for myisamchk.c
|
|
312 |
||
313 |
Entries marked as "QQ to be removed" are NOT used to
|
|
314 |
pass check/repair options to mi_check.c. They are used
|
|
315 |
internally by myisamchk.c or/and ha_myisam.cc and should NOT
|
|
316 |
be stored together with other flags. They should be removed
|
|
317 |
from the following list to make addition of new flags possible.
|
|
318 |
*/
|
|
319 |
||
320 |
#define T_AUTO_INC 1
|
|
321 |
#define T_AUTO_REPAIR 2 /* QQ to be removed */ |
|
322 |
#define T_BACKUP_DATA 4
|
|
323 |
#define T_CALC_CHECKSUM 8
|
|
324 |
#define T_CHECK 16 /* QQ to be removed */ |
|
325 |
#define T_CHECK_ONLY_CHANGED 32 /* QQ to be removed */ |
|
326 |
#define T_CREATE_MISSING_KEYS 64
|
|
327 |
#define T_DESCRIPT 128
|
|
328 |
#define T_DONT_CHECK_CHECKSUM 256
|
|
329 |
#define T_EXTEND 512
|
|
330 |
#define T_FAST (1L << 10) /* QQ to be removed */ |
|
331 |
#define T_FORCE_CREATE (1L << 11) /* QQ to be removed */ |
|
332 |
#define T_FORCE_UNIQUENESS (1L << 12)
|
|
333 |
#define T_INFO (1L << 13)
|
|
334 |
#define T_MEDIUM (1L << 14)
|
|
335 |
#define T_QUICK (1L << 15) /* QQ to be removed */ |
|
336 |
#define T_READONLY (1L << 16) /* QQ to be removed */ |
|
337 |
#define T_REP (1L << 17)
|
|
338 |
#define T_REP_BY_SORT (1L << 18) /* QQ to be removed */ |
|
339 |
#define T_REP_PARALLEL (1L << 19) /* QQ to be removed */ |
|
340 |
#define T_RETRY_WITHOUT_QUICK (1L << 20)
|
|
341 |
#define T_SAFE_REPAIR (1L << 21)
|
|
342 |
#define T_SILENT (1L << 22)
|
|
343 |
#define T_SORT_INDEX (1L << 23) /* QQ to be removed */ |
|
344 |
#define T_SORT_RECORDS (1L << 24) /* QQ to be removed */ |
|
345 |
#define T_STATISTICS (1L << 25)
|
|
346 |
#define T_UNPACK (1L << 26)
|
|
347 |
#define T_UPDATE_STATE (1L << 27)
|
|
348 |
#define T_VERBOSE (1L << 28)
|
|
349 |
#define T_VERY_SILENT (1L << 29)
|
|
350 |
#define T_WAIT_FOREVER (1L << 30)
|
|
351 |
#define T_WRITE_LOOP ((ulong) 1L << 31)
|
|
352 |
||
353 |
#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL)
|
|
354 |
||
355 |
#define O_NEW_INDEX 1 /* Bits set in out_flag */ |
|
356 |
#define O_NEW_DATA 2
|
|
357 |
#define O_DATA_LOST 4
|
|
358 |
||
359 |
/* these struct is used by my_check to tell it what to do */
|
|
360 |
||
361 |
typedef struct st_sort_key_blocks /* Used when sorting */ |
|
362 |
{
|
|
481
by Brian Aker
Remove all of uchar. |
363 |
unsigned char *buff,*end_pos; |
364 |
unsigned char lastkey[MI_MAX_POSSIBLE_KEY_BUFF]; |
|
482
by Brian Aker
Remove uint. |
365 |
uint32_t last_length; |
1
by brian
clean slate |
366 |
int inited; |
367 |
} SORT_KEY_BLOCKS; |
|
368 |
||
369 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
370 |
/*
|
371 |
MyISAM supports several statistics collection methods. Currently statistics
|
|
372 |
collection method is not stored in MyISAM file and has to be specified for
|
|
1
by brian
clean slate |
373 |
each table analyze/repair operation in MI_CHECK::stats_method.
|
374 |
*/
|
|
375 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
376 |
typedef enum |
1
by brian
clean slate |
377 |
{
|
378 |
/* Treat NULLs as inequal when collecting statistics (default for 4.1/5.0) */
|
|
379 |
MI_STATS_METHOD_NULLS_NOT_EQUAL, |
|
380 |
/* Treat NULLs as equal when collecting statistics (like 4.0 did) */
|
|
381 |
MI_STATS_METHOD_NULLS_EQUAL, |
|
382 |
/* Ignore NULLs - count only tuples without NULLs in the index components */
|
|
383 |
MI_STATS_METHOD_IGNORE_NULLS
|
|
384 |
} enum_mi_stats_method; |
|
385 |
||
386 |
typedef struct st_mi_check_param |
|
387 |
{
|
|
151
by Brian Aker
Ulonglong to uint64_t |
388 |
uint64_t auto_increment_value; |
389 |
uint64_t max_data_file_length; |
|
390 |
uint64_t keys_in_use; |
|
391 |
uint64_t max_record_length; |
|
1
by brian
clean slate |
392 |
my_off_t search_after_block; |
393 |
my_off_t new_file_pos,key_file_blocks; |
|
394 |
my_off_t keydata,totaldata,key_blocks,start_check_pos; |
|
395 |
ha_rows total_records,total_deleted; |
|
396 |
ha_checksum record_checksum,glob_crc; |
|
896.4.16
by Stewart Smith
for getopt, replace GET_ULONG with GET_UINT32. |
397 |
uint64_t use_buffers; |
779.3.20
by Monty Taylor
Fixed Solaris warnings for MyISAM. |
398 |
size_t read_buffer_length, write_buffer_length, |
399 |
sort_buffer_length, sort_key_blocks; |
|
482
by Brian Aker
Remove uint. |
400 |
uint32_t out_flag,warning_printed,error_printed,verbose; |
401 |
uint32_t opt_sort_key,total_files,max_level; |
|
402 |
uint32_t testflag, key_cache_block_size; |
|
206
by Brian Aker
Removed final uint dead types. |
403 |
uint8_t language; |
281
by Brian Aker
Converted myisam away from my_bool |
404 |
bool using_global_keycache, opt_lock_memory, opt_follow_links; |
405 |
bool retry_repair, force_sort; |
|
1
by brian
clean slate |
406 |
char temp_filename[FN_REFLEN],*isam_file_name; |
407 |
int tmpfile_createflag; |
|
408 |
myf myf_rw; |
|
409 |
IO_CACHE read_cache; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
410 |
|
411 |
/*
|
|
1
by brian
clean slate |
412 |
The next two are used to collect statistics, see update_key_parts for
|
413 |
description.
|
|
414 |
*/
|
|
151
by Brian Aker
Ulonglong to uint64_t |
415 |
uint64_t unique_count[MI_MAX_KEY_SEG+1]; |
416 |
uint64_t notnull_count[MI_MAX_KEY_SEG+1]; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
417 |
|
1
by brian
clean slate |
418 |
ha_checksum key_crc[HA_MAX_POSSIBLE_KEY]; |
419 |
ulong rec_per_key_part[MI_MAX_KEY_SEG*HA_MAX_POSSIBLE_KEY]; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
420 |
void *session; |
1
by brian
clean slate |
421 |
const char *db_name, *table_name; |
422 |
const char *op_name; |
|
423 |
enum_mi_stats_method stats_method; |
|
424 |
} MI_CHECK; |
|
425 |
||
426 |
typedef struct st_sort_info |
|
427 |
{
|
|
428 |
my_off_t filelength,dupp,buff_length; |
|
429 |
ha_rows max_records; |
|
482
by Brian Aker
Remove uint. |
430 |
uint32_t current_key, total_keys; |
1
by brian
clean slate |
431 |
myf myf_rw; |
432 |
enum data_file_type new_data_file_type; |
|
433 |
MI_INFO *info; |
|
434 |
MI_CHECK *param; |
|
481
by Brian Aker
Remove all of uchar. |
435 |
unsigned char *buff; |
1
by brian
clean slate |
436 |
SORT_KEY_BLOCKS *key_block,*key_block_end; |
437 |
/* sync things */
|
|
482
by Brian Aker
Remove uint. |
438 |
uint32_t got_error, threads_running; |
1
by brian
clean slate |
439 |
pthread_mutex_t mutex; |
440 |
pthread_cond_t cond; |
|
441 |
} SORT_INFO; |
|
442 |
||
443 |
/* functions in mi_check */
|
|
444 |
void myisamchk_init(MI_CHECK *param); |
|
445 |
int chk_status(MI_CHECK *param, MI_INFO *info); |
|
482
by Brian Aker
Remove uint. |
446 |
int chk_del(MI_CHECK *param, register MI_INFO *info, uint32_t test_flag); |
1
by brian
clean slate |
447 |
int chk_size(MI_CHECK *param, MI_INFO *info); |
448 |
int chk_key(MI_CHECK *param, MI_INFO *info); |
|
449 |
int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend); |
|
450 |
int mi_repair(MI_CHECK *param, register MI_INFO *info, |
|
451 |
char * name, int rep_quick); |
|
452 |
int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name); |
|
453 |
int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, |
|
454 |
const char * name, int rep_quick); |
|
455 |
int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, |
|
456 |
const char * name, int rep_quick); |
|
457 |
int change_to_newfile(const char * filename, const char * old_ext, |
|
482
by Brian Aker
Remove uint. |
458 |
const char * new_ext, uint32_t raid_chunks, |
1
by brian
clean slate |
459 |
myf myflags); |
460 |
void lock_memory(MI_CHECK *param); |
|
461 |
void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, |
|
281
by Brian Aker
Converted myisam away from my_bool |
462 |
bool repair); |
482
by Brian Aker
Remove uint. |
463 |
int update_state_info(MI_CHECK *param, MI_INFO *info,uint32_t update); |
1
by brian
clean slate |
464 |
void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part, |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
465 |
uint64_t *unique, uint64_t *notnull, |
151
by Brian Aker
Ulonglong to uint64_t |
466 |
uint64_t records); |
1
by brian
clean slate |
467 |
int filecopy(MI_CHECK *param, File to,File from,my_off_t start, |
468 |
my_off_t length, const char *type); |
|
481
by Brian Aker
Remove all of uchar. |
469 |
int movepoint(MI_INFO *info,unsigned char *record,my_off_t oldpos, |
482
by Brian Aker
Remove uint. |
470 |
my_off_t newpos, uint32_t prot_key); |
281
by Brian Aker
Converted myisam away from my_bool |
471 |
int write_data_suffix(SORT_INFO *sort_info, bool fix_datafile); |
1
by brian
clean slate |
472 |
int test_if_almost_full(MI_INFO *info); |
473 |
int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename); |
|
281
by Brian Aker
Converted myisam away from my_bool |
474 |
bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, uint64_t key_map, |
475 |
bool force); |
|
1
by brian
clean slate |
476 |
|
303
by Brian Aker
First pass in removing ulong from MyISAM |
477 |
int mi_init_bulk_insert(MI_INFO *info, uint32_t cache_size, ha_rows rows); |
482
by Brian Aker
Remove uint. |
478 |
void mi_flush_bulk_insert(MI_INFO *info, uint32_t inx); |
1
by brian
clean slate |
479 |
void mi_end_bulk_insert(MI_INFO *info); |
993.1.23
by Padraig O'Sullivan
Removing an unused parameter in a function in the MyISAM storage engine. |
480 |
int mi_assign_to_key_cache(MI_INFO *info, KEY_CACHE *key_cache); |
1
by brian
clean slate |
481 |
void mi_change_key_cache(KEY_CACHE *old_key_cache, |
482 |
KEY_CACHE *new_key_cache); |
|
281
by Brian Aker
Converted myisam away from my_bool |
483 |
int mi_preload(MI_INFO *info, uint64_t key_map, bool ignore_leaves); |
1
by brian
clean slate |
484 |
|
485 |
#ifdef __cplusplus
|
|
486 |
}
|
|
487 |
#endif
|
|
488 |
#endif
|