1.1.5
by Marc Deslauriers
Import upstream version 5.1.61 |
1 |
/*
|
2 |
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
|
1
by Chuck Short
Import upstream version 5.1.30 |
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 as published by
|
|
6 |
the Free Software Foundation; version 2 of the License.
|
|
7 |
||
8 |
This program is distributed in the hope that it will be useful,
|
|
9 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
GNU General Public License for more details.
|
|
12 |
||
13 |
You should have received a copy of the GNU General Public License
|
|
14 |
along with this program; if not, write to the Free Software
|
|
1.1.5
by Marc Deslauriers
Import upstream version 5.1.61 |
15 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
16 |
*/
|
|
1
by Chuck Short
Import upstream version 5.1.30 |
17 |
|
18 |
/* This file is included by all internal myisam files */
|
|
19 |
||
20 |
#include "myisam.h" /* Structs & some defines */ |
|
21 |
#include "myisampack.h" /* packing of keys */ |
|
22 |
#include <my_tree.h> |
|
23 |
#ifdef THREAD
|
|
24 |
#include <my_pthread.h> |
|
25 |
#include <thr_lock.h> |
|
26 |
#else
|
|
27 |
#include <my_no_pthread.h> |
|
28 |
#endif
|
|
29 |
||
30 |
#if defined(my_write) && !defined(MAP_TO_USE_RAID)
|
|
31 |
#undef my_write /* undef map from my_nosys; We need test-if-disk full */ |
|
32 |
#endif
|
|
33 |
||
34 |
typedef struct st_mi_status_info |
|
35 |
{
|
|
36 |
ha_rows records; /* Rows in table */ |
|
37 |
ha_rows del; /* Removed rows */ |
|
38 |
my_off_t empty; /* lost space in datafile */ |
|
39 |
my_off_t key_empty; /* lost space in indexfile */ |
|
40 |
my_off_t key_file_length; |
|
41 |
my_off_t data_file_length; |
|
42 |
ha_checksum checksum; |
|
0.2.1
by Norbert Tretkowski
Import upstream version 5.1.34 |
43 |
my_bool uncacheable; /* Active concurrent insert */ |
1
by Chuck Short
Import upstream version 5.1.30 |
44 |
} MI_STATUS_INFO; |
45 |
||
46 |
typedef struct st_mi_state_info |
|
47 |
{
|
|
48 |
struct { /* Fileheader */ |
|
49 |
uchar file_version[4]; |
|
50 |
uchar options[2]; |
|
51 |
uchar header_length[2]; |
|
52 |
uchar state_info_length[2]; |
|
53 |
uchar base_info_length[2]; |
|
54 |
uchar base_pos[2]; |
|
55 |
uchar key_parts[2]; /* Key parts */ |
|
56 |
uchar unique_key_parts[2]; /* Key parts + unique parts */ |
|
57 |
uchar keys; /* number of keys in file */ |
|
58 |
uchar uniques; /* number of UNIQUE definitions */ |
|
59 |
uchar language; /* Language for indexes */ |
|
60 |
uchar max_block_size_index; /* max keyblock size */ |
|
61 |
uchar fulltext_keys; |
|
62 |
uchar not_used; /* To align to 8 */ |
|
63 |
} header; |
|
64 |
||
65 |
MI_STATUS_INFO state; |
|
66 |
ha_rows split; /* number of split blocks */ |
|
67 |
my_off_t dellink; /* Link to next removed block */ |
|
68 |
ulonglong auto_increment; |
|
69 |
ulong process; /* process that updated table last */ |
|
70 |
ulong unique; /* Unique number for this process */ |
|
71 |
ulong update_count; /* Updated for each write lock */ |
|
72 |
ulong status; |
|
73 |
ulong *rec_per_key_part; |
|
74 |
my_off_t *key_root; /* Start of key trees */ |
|
75 |
my_off_t *key_del; /* delete links for trees */ |
|
76 |
my_off_t rec_per_key_rows; /* Rows when calculating rec_per_key */ |
|
77 |
||
78 |
ulong sec_index_changed; /* Updated when new sec_index */ |
|
79 |
ulong sec_index_used; /* which extra index are in use */ |
|
80 |
ulonglong key_map; /* Which keys are in use */ |
|
81 |
ha_checksum checksum; /* Table checksum */ |
|
82 |
ulong version; /* timestamp of create */ |
|
83 |
time_t create_time; /* Time when created database */ |
|
84 |
time_t recover_time; /* Time for last recover */ |
|
85 |
time_t check_time; /* Time for last check */ |
|
86 |
uint sortkey; /* sorted by this key (not used) */ |
|
87 |
uint open_count; |
|
88 |
uint8 changed; /* Changed since myisamchk */ |
|
89 |
||
90 |
/* the following isn't saved on disk */
|
|
91 |
uint state_diff_length; /* Should be 0 */ |
|
92 |
uint state_length; /* Length of state header in file */ |
|
93 |
ulong *key_info; |
|
94 |
} MI_STATE_INFO; |
|
95 |
||
96 |
#define MI_STATE_INFO_SIZE (24+14*8+7*4+2*2+8)
|
|
97 |
#define MI_STATE_KEY_SIZE 8
|
|
98 |
#define MI_STATE_KEYBLOCK_SIZE 8
|
|
99 |
#define MI_STATE_KEYSEG_SIZE 4
|
|
100 |
#define MI_STATE_EXTRA_SIZE ((MI_MAX_KEY+MI_MAX_KEY_BLOCK_SIZE)*MI_STATE_KEY_SIZE + MI_MAX_KEY*MI_MAX_KEY_SEG*MI_STATE_KEYSEG_SIZE)
|
|
101 |
#define MI_KEYDEF_SIZE (2+ 5*2)
|
|
102 |
#define MI_UNIQUEDEF_SIZE (2+1+1)
|
|
103 |
#define HA_KEYSEG_SIZE (6+ 2*2 + 4*2)
|
|
104 |
#define MI_COLUMNDEF_SIZE (2*3+1)
|
|
105 |
#define MI_BASE_INFO_SIZE (5*8 + 8*4 + 4 + 4*2 + 16)
|
|
106 |
#define MI_INDEX_BLOCK_MARGIN 16 /* Safety margin for .MYI tables */ |
|
107 |
||
108 |
typedef struct st_mi_base_info |
|
109 |
{
|
|
110 |
my_off_t keystart; /* Start of keys */ |
|
111 |
my_off_t max_data_file_length; |
|
112 |
my_off_t max_key_file_length; |
|
113 |
my_off_t margin_key_file_length; |
|
114 |
ha_rows records,reloc; /* Create information */ |
|
115 |
ulong mean_row_length; /* Create information */ |
|
116 |
ulong reclength; /* length of unpacked record */ |
|
117 |
ulong pack_reclength; /* Length of full packed rec. */ |
|
118 |
ulong min_pack_length; |
|
119 |
ulong max_pack_length; /* Max possibly length of packed rec.*/ |
|
120 |
ulong min_block_length; |
|
121 |
ulong fields, /* fields in table */ |
|
122 |
pack_fields; /* packed fields in table */ |
|
123 |
uint rec_reflength; /* = 2-8 */ |
|
124 |
uint key_reflength; /* = 2-8 */ |
|
125 |
uint keys; /* same as in state.header */ |
|
126 |
uint auto_key; /* Which key-1 is a auto key */ |
|
127 |
uint blobs; /* Number of blobs */ |
|
128 |
uint pack_bits; /* Length of packed bits */ |
|
129 |
uint max_key_block_length; /* Max block length */ |
|
130 |
uint max_key_length; /* Max key length */ |
|
131 |
/* Extra allocation when using dynamic record format */
|
|
132 |
uint extra_alloc_bytes; |
|
133 |
uint extra_alloc_procent; |
|
134 |
/* Info about raid */
|
|
135 |
uint raid_type,raid_chunks; |
|
136 |
ulong raid_chunksize; |
|
137 |
/* The following are from the header */
|
|
138 |
uint key_parts,all_key_parts; |
|
139 |
} MI_BASE_INFO; |
|
140 |
||
141 |
||
142 |
/* Structs used intern in database */
|
|
143 |
||
144 |
typedef struct st_mi_blob /* Info of record */ |
|
145 |
{
|
|
146 |
ulong offset; /* Offset to blob in record */ |
|
147 |
uint pack_length; /* Type of packed length */ |
|
148 |
ulong length; /* Calc:ed for each record */ |
|
149 |
} MI_BLOB; |
|
150 |
||
151 |
||
152 |
typedef struct st_mi_isam_pack { |
|
153 |
ulong header_length; |
|
154 |
uint ref_length; |
|
155 |
uchar version; |
|
156 |
} MI_PACK; |
|
157 |
||
158 |
#define MAX_NONMAPPED_INSERTS 1000
|
|
159 |
||
160 |
typedef struct st_mi_isam_share { /* Shared between opens */ |
|
161 |
MI_STATE_INFO state; |
|
162 |
MI_BASE_INFO base; |
|
163 |
MI_KEYDEF ft2_keyinfo; /* Second-level ft-key definition */ |
|
164 |
MI_KEYDEF *keyinfo; /* Key definitions */ |
|
165 |
MI_UNIQUEDEF *uniqueinfo; /* unique definitions */ |
|
166 |
HA_KEYSEG *keyparts; /* key part info */ |
|
167 |
MI_COLUMNDEF *rec; /* Pointer to field information */ |
|
168 |
MI_PACK pack; /* Data about packed records */ |
|
169 |
MI_BLOB *blobs; /* Pointer to blobs */ |
|
170 |
char *unique_file_name; /* realpath() of index file */ |
|
171 |
char *data_file_name, /* Resolved path names from symlinks */ |
|
172 |
*index_file_name; |
|
173 |
uchar *file_map; /* mem-map of file if possible */ |
|
174 |
KEY_CACHE *key_cache; /* ref to the current key cache */ |
|
175 |
MI_DECODE_TREE *decode_trees; |
|
176 |
uint16 *decode_tables; |
|
177 |
int (*read_record)(struct st_myisam_info*, my_off_t, uchar*); |
|
178 |
int (*write_record)(struct st_myisam_info*, const uchar*); |
|
179 |
int (*update_record)(struct st_myisam_info*, my_off_t, const uchar*); |
|
180 |
int (*delete_record)(struct st_myisam_info*); |
|
181 |
int (*read_rnd)(struct st_myisam_info*, uchar*, my_off_t, my_bool); |
|
182 |
int (*compare_record)(struct st_myisam_info*, const uchar *); |
|
183 |
/* Function to use for a row checksum. */
|
|
184 |
ha_checksum (*calc_checksum)(struct st_myisam_info*, const uchar *); |
|
185 |
int (*compare_unique)(struct st_myisam_info*, MI_UNIQUEDEF *, |
|
186 |
const uchar *record, my_off_t pos); |
|
187 |
size_t (*file_read)(MI_INFO *, uchar *, size_t, my_off_t, myf); |
|
188 |
size_t (*file_write)(MI_INFO *, const uchar *, size_t, my_off_t, myf); |
|
189 |
invalidator_by_filename invalidator; /* query cache invalidator */ |
|
190 |
ulong this_process; /* processid */ |
|
191 |
ulong last_process; /* For table-change-check */ |
|
192 |
ulong last_version; /* Version on start */ |
|
193 |
ulong options; /* Options used */ |
|
194 |
ulong min_pack_length; /* Theese are used by packed data */ |
|
195 |
ulong max_pack_length; |
|
196 |
ulong state_diff_length; |
|
197 |
uint rec_reflength; /* rec_reflength in use now */ |
|
198 |
uint unique_name_length; |
|
0.1.1
by Norbert Tretkowski
Import upstream version 5.1.32 |
199 |
uint32 ftkeys; /* Number of full-text keys + 1 */ |
1
by Chuck Short
Import upstream version 5.1.30 |
200 |
File kfile; /* Shared keyfile */ |
201 |
File data_file; /* Shared data file */ |
|
202 |
int mode; /* mode of file on open */ |
|
203 |
uint reopen; /* How many times reopened */ |
|
204 |
uint w_locks,r_locks,tot_locks; /* Number of read/write locks */ |
|
205 |
uint blocksize; /* blocksize of keyfile */ |
|
206 |
myf write_flag; |
|
207 |
enum data_file_type data_file_type; |
|
208 |
/* Below flag is needed to make log tables work with concurrent insert */
|
|
209 |
my_bool is_log_table; |
|
210 |
||
211 |
my_bool changed, /* If changed since lock */ |
|
212 |
global_changed, /* If changed since open */ |
|
213 |
not_flushed, |
|
214 |
temporary,delay_key_write, |
|
215 |
concurrent_insert; |
|
216 |
#ifdef THREAD
|
|
217 |
THR_LOCK lock; |
|
218 |
pthread_mutex_t intern_lock; /* Locking for use with _locking */ |
|
219 |
rw_lock_t *key_root_lock; |
|
220 |
#endif
|
|
221 |
my_off_t mmaped_length; |
|
222 |
uint nonmmaped_inserts; /* counter of writing in non-mmaped |
|
223 |
area */
|
|
224 |
rw_lock_t mmap_lock; |
|
225 |
} MYISAM_SHARE; |
|
226 |
||
227 |
||
228 |
typedef uint mi_bit_type; |
|
229 |
||
230 |
typedef struct st_mi_bit_buff { /* Used for packing of record */ |
|
231 |
mi_bit_type current_byte; |
|
232 |
uint bits; |
|
233 |
uchar *pos,*end,*blob_pos,*blob_end; |
|
234 |
uint error; |
|
235 |
} MI_BIT_BUFF; |
|
236 |
||
237 |
struct st_myisam_info { |
|
238 |
MYISAM_SHARE *s; /* Shared between open:s */ |
|
239 |
MI_STATUS_INFO *state,save_state; |
|
240 |
MI_BLOB *blobs; /* Pointer to blobs */ |
|
241 |
MI_BIT_BUFF bit_buff; |
|
242 |
/* accumulate indexfile changes between write's */
|
|
243 |
TREE *bulk_insert; |
|
244 |
DYNAMIC_ARRAY *ft1_to_ft2; /* used only in ft1->ft2 conversion */ |
|
245 |
MEM_ROOT ft_memroot; /* used by the parser */ |
|
246 |
MYSQL_FTPARSER_PARAM *ftparser_param; /* share info between init/deinit */ |
|
247 |
char *filename; /* parameter to open filename */ |
|
248 |
uchar *buff, /* Temp area for key */ |
|
249 |
*lastkey,*lastkey2; /* Last used search key */ |
|
250 |
uchar *first_mbr_key; /* Searhed spatial key */ |
|
251 |
uchar *rec_buff; /* Tempbuff for recordpack */ |
|
252 |
uchar *int_keypos, /* Save position for next/previous */ |
|
253 |
*int_maxpos; /* -""- */ |
|
254 |
uint int_nod_flag; /* -""- */ |
|
255 |
uint32 int_keytree_version; /* -""- */ |
|
256 |
int (*read_record)(struct st_myisam_info*, my_off_t, uchar*); |
|
257 |
invalidator_by_filename invalidator; /* query cache invalidator */ |
|
258 |
ulong this_unique; /* uniq filenumber or thread */ |
|
259 |
ulong last_unique; /* last unique number */ |
|
260 |
ulong this_loop; /* counter for this open */ |
|
261 |
ulong last_loop; /* last used counter */ |
|
262 |
my_off_t lastpos, /* Last record position */ |
|
263 |
nextpos; /* Position to next record */ |
|
264 |
my_off_t save_lastpos; |
|
265 |
my_off_t pos; /* Intern variable */ |
|
266 |
my_off_t last_keypage; /* Last key page read */ |
|
267 |
my_off_t last_search_keypage; /* Last keypage when searching */ |
|
268 |
my_off_t dupp_key_pos; |
|
269 |
ha_checksum checksum; /* Temp storage for row checksum */ |
|
270 |
/* QQ: the folloing two xxx_length fields should be removed,
|
|
271 |
as they are not compatible with parallel repair */
|
|
272 |
ulong packed_length,blob_length; /* Length of found, packed record */ |
|
273 |
int dfile; /* The datafile */ |
|
274 |
uint opt_flag; /* Optim. for space/speed */ |
|
275 |
uint update; /* If file changed since open */ |
|
276 |
int lastinx; /* Last used index */ |
|
277 |
uint lastkey_length; /* Length of key in lastkey */ |
|
278 |
uint last_rkey_length; /* Last length in mi_rkey() */ |
|
279 |
enum ha_rkey_function last_key_func; /* CONTAIN, OVERLAP, etc */ |
|
280 |
uint save_lastkey_length; |
|
281 |
uint pack_key_length; /* For MYISAMMRG */ |
|
282 |
uint16 last_used_keyseg; /* For MyISAMMRG */ |
|
283 |
int errkey; /* Got last error on this key */ |
|
284 |
int lock_type; /* How database was locked */ |
|
285 |
int tmp_lock_type; /* When locked by readinfo */ |
|
286 |
uint data_changed; /* Somebody has changed data */ |
|
287 |
uint save_update; /* When using KEY_READ */ |
|
288 |
int save_lastinx; |
|
289 |
LIST open_list; |
|
290 |
IO_CACHE rec_cache; /* When cacheing records */ |
|
291 |
uint preload_buff_size; /* When preloading indexes */ |
|
292 |
myf lock_wait; /* is 0 or MY_DONT_WAIT */ |
|
293 |
my_bool was_locked; /* Was locked in panic */ |
|
294 |
my_bool append_insert_at_end; /* Set if concurrent insert */ |
|
295 |
my_bool quick_mode; |
|
296 |
my_bool page_changed; /* If info->buff can't be used for rnext */ |
|
297 |
my_bool buff_used; /* If info->buff has to be reread for rnext */ |
|
298 |
my_bool once_flags; /* For MYISAMMRG */ |
|
299 |
#ifdef __WIN__
|
|
300 |
my_bool owned_by_merge; /* This MyISAM table is part of a merge union */ |
|
301 |
#endif
|
|
302 |
#ifdef THREAD
|
|
303 |
THR_LOCK_DATA lock; |
|
304 |
#endif
|
|
305 |
uchar *rtree_recursion_state; /* For RTREE */ |
|
306 |
int rtree_recursion_depth; |
|
307 |
};
|
|
308 |
||
309 |
typedef struct st_buffpek { |
|
310 |
my_off_t file_pos; /* Where we are in the sort file */ |
|
311 |
uchar *base,*key; /* Key pointers */ |
|
312 |
ha_rows count; /* Number of rows in table */ |
|
313 |
ulong mem_count; /* numbers of keys in memory */ |
|
314 |
ulong max_keys; /* Max keys in buffert */ |
|
315 |
} BUFFPEK; |
|
316 |
||
317 |
typedef struct st_mi_sort_param |
|
318 |
{
|
|
319 |
pthread_t thr; |
|
320 |
IO_CACHE read_cache, tempfile, tempfile_for_exceptions; |
|
321 |
DYNAMIC_ARRAY buffpek; |
|
322 |
MI_BIT_BUFF bit_buff; /* For parallel repair of packrec. */ |
|
323 |
||
324 |
/*
|
|
325 |
The next two are used to collect statistics, see update_key_parts for
|
|
326 |
description.
|
|
327 |
*/
|
|
328 |
ulonglong unique[MI_MAX_KEY_SEG+1]; |
|
329 |
ulonglong notnull[MI_MAX_KEY_SEG+1]; |
|
330 |
||
331 |
my_off_t pos,max_pos,filepos,start_recpos; |
|
332 |
uint key, key_length,real_key_length,sortbuff_size; |
|
333 |
uint maxbuffers, keys, find_length, sort_keys_length; |
|
334 |
my_bool fix_datafile, master; |
|
335 |
my_bool calc_checksum; /* calculate table checksum */ |
|
336 |
MI_KEYDEF *keyinfo; |
|
337 |
HA_KEYSEG *seg; |
|
338 |
SORT_INFO *sort_info; |
|
339 |
uchar **sort_keys; |
|
340 |
uchar *rec_buff; |
|
341 |
void *wordlist, *wordptr; |
|
342 |
MEM_ROOT wordroot; |
|
343 |
uchar *record; |
|
344 |
MY_TMPDIR *tmpdir; |
|
345 |
int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *); |
|
346 |
int (*key_read)(struct st_mi_sort_param *,void *); |
|
347 |
int (*key_write)(struct st_mi_sort_param *, const void *); |
|
348 |
void (*lock_in_memory)(MI_CHECK *); |
|
349 |
NEAR int (*write_keys)(struct st_mi_sort_param *, register uchar **, |
|
350 |
uint , struct st_buffpek *, IO_CACHE *); |
|
351 |
NEAR uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); |
|
352 |
NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *, |
|
353 |
uint, uint); |
|
354 |
} MI_SORT_PARAM; |
|
355 |
||
356 |
/* Some defines used by isam-funktions */
|
|
357 |
||
358 |
#define USE_WHOLE_KEY MI_MAX_KEY_BUFF*2 /* Use whole key in _mi_search() */ |
|
359 |
#define F_EXTRA_LCK -1
|
|
360 |
||
361 |
/* bits in opt_flag */
|
|
362 |
#define MEMMAP_USED 32
|
|
363 |
#define REMEMBER_OLD_POS 64
|
|
364 |
||
365 |
#define WRITEINFO_UPDATE_KEYFILE 1
|
|
366 |
#define WRITEINFO_NO_UNLOCK 2
|
|
367 |
||
368 |
/* once_flags */
|
|
369 |
#define USE_PACKED_KEYS 1
|
|
370 |
#define RRND_PRESERVE_LASTINX 2
|
|
371 |
||
372 |
/* bits in state.changed */
|
|
373 |
||
374 |
#define STATE_CHANGED 1
|
|
375 |
#define STATE_CRASHED 2
|
|
376 |
#define STATE_CRASHED_ON_REPAIR 4
|
|
377 |
#define STATE_NOT_ANALYZED 8
|
|
378 |
#define STATE_NOT_OPTIMIZED_KEYS 16
|
|
379 |
#define STATE_NOT_SORTED_PAGES 32
|
|
380 |
||
381 |
/* options to mi_read_cache */
|
|
382 |
||
383 |
#define READING_NEXT 1
|
|
384 |
#define READING_HEADER 2
|
|
385 |
||
386 |
#define mi_getint(x) ((uint) mi_uint2korr(x) & 32767)
|
|
387 |
#define mi_putint(x,y,nod) { uint16 boh=(nod ? (uint16) 32768 : 0) + (uint16) (y);\
|
|
388 |
mi_int2store(x,boh); }
|
|
389 |
#define mi_test_if_nod(x) (x[0] & 128 ? info->s->base.key_reflength : 0)
|
|
390 |
#define mi_mark_crashed(x) do{(x)->s->state.changed|= STATE_CRASHED; \
|
|
391 |
DBUG_PRINT("error", ("Marked table crashed")); \
|
|
392 |
}while(0)
|
|
393 |
#define mi_mark_crashed_on_repair(x) do{(x)->s->state.changed|= \
|
|
394 |
STATE_CRASHED|STATE_CRASHED_ON_REPAIR; \
|
|
395 |
(x)->update|= HA_STATE_CHANGED; \
|
|
396 |
DBUG_PRINT("error", \
|
|
397 |
("Marked table crashed")); \
|
|
398 |
}while(0)
|
|
399 |
#define mi_is_crashed(x) ((x)->s->state.changed & STATE_CRASHED)
|
|
400 |
#define mi_is_crashed_on_repair(x) ((x)->s->state.changed & STATE_CRASHED_ON_REPAIR)
|
|
401 |
#define mi_print_error(SHARE, ERRNO) \
|
|
402 |
mi_report_error((ERRNO), (SHARE)->index_file_name)
|
|
403 |
||
404 |
/* Functions to store length of space packed keys, VARCHAR or BLOB keys */
|
|
405 |
||
406 |
#define store_key_length(key,length) \
|
|
407 |
{ if ((length) < 255) \
|
|
408 |
{ *(key)=(length); } \
|
|
409 |
else \
|
|
410 |
{ *(key)=255; mi_int2store((key)+1,(length)); } \
|
|
411 |
}
|
|
412 |
||
413 |
#define get_key_full_length(length,key) \
|
|
414 |
{ if ((uchar) *(key) != 255) \
|
|
415 |
length= ((uint) (uchar) *((key)++))+1; \
|
|
416 |
else \
|
|
417 |
{ length=mi_uint2korr((key)+1)+3; (key)+=3; } \
|
|
418 |
}
|
|
419 |
||
420 |
#define get_key_full_length_rdonly(length,key) \
|
|
421 |
{ if ((uchar) *(key) != 255) \
|
|
422 |
length= ((uint) (uchar) *((key)))+1; \
|
|
423 |
else \
|
|
424 |
{ length=mi_uint2korr((key)+1)+3; } \
|
|
425 |
}
|
|
426 |
||
427 |
#define get_pack_length(length) ((length) >= 255 ? 3 : 1)
|
|
428 |
||
1.1.5
by Marc Deslauriers
Import upstream version 5.1.61 |
429 |
#define portable_sizeof_char_ptr 8
|
430 |
||
1
by Chuck Short
Import upstream version 5.1.30 |
431 |
#define MI_MIN_BLOCK_LENGTH 20 /* Because of delete-link */ |
432 |
#define MI_EXTEND_BLOCK_LENGTH 20 /* Don't use to small record-blocks */ |
|
433 |
#define MI_SPLIT_LENGTH ((MI_EXTEND_BLOCK_LENGTH+4)*2)
|
|
434 |
#define MI_MAX_DYN_BLOCK_HEADER 20 /* Max prefix of record-block */ |
|
435 |
#define MI_BLOCK_INFO_HEADER_LENGTH 20
|
|
436 |
#define MI_DYN_DELETE_BLOCK_HEADER 20 /* length of delete-block-header */ |
|
437 |
#define MI_DYN_MAX_BLOCK_LENGTH ((1L << 24)-4L)
|
|
438 |
#define MI_DYN_MAX_ROW_LENGTH (MI_DYN_MAX_BLOCK_LENGTH - MI_SPLIT_LENGTH)
|
|
439 |
#define MI_DYN_ALIGN_SIZE 4 /* Align blocks on this */ |
|
440 |
#define MI_MAX_DYN_HEADER_BYTE 13 /* max header byte for dynamic rows */ |
|
441 |
#define MI_MAX_BLOCK_LENGTH ((((ulong) 1 << 24)-1) & (~ (ulong) (MI_DYN_ALIGN_SIZE-1)))
|
|
442 |
#define MI_REC_BUFF_OFFSET ALIGN_SIZE(MI_DYN_DELETE_BLOCK_HEADER+sizeof(uint32))
|
|
443 |
||
444 |
||
445 |
#define PACK_TYPE_SELECTED 1 /* Bits in field->pack_type */ |
|
446 |
#define PACK_TYPE_SPACE_FIELDS 2
|
|
447 |
#define PACK_TYPE_ZERO_FILL 4
|
|
448 |
#define MI_FOUND_WRONG_KEY 32738 /* Impossible value from ha_key_cmp */ |
|
449 |
||
450 |
#define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_MIN_KEY_BLOCK_LENGTH)
|
|
451 |
#define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer,block_size) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/(block_size)+1)*(block_size))
|
|
452 |
#define MI_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */ |
|
453 |
#define MI_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */ |
|
454 |
||
455 |
#define MI_MIN_SIZE_BULK_INSERT_TREE 16384 /* this is per key */ |
|
456 |
#define MI_MIN_ROWS_TO_USE_BULK_INSERT 100
|
|
457 |
#define MI_MIN_ROWS_TO_DISABLE_INDEXES 100
|
|
458 |
#define MI_MIN_ROWS_TO_USE_WRITE_CACHE 10
|
|
459 |
||
460 |
/* The UNIQUE check is done with a hashed long key */
|
|
461 |
||
462 |
#define MI_UNIQUE_HASH_TYPE HA_KEYTYPE_ULONG_INT
|
|
463 |
#define mi_unique_store(A,B) mi_int4store((A),(B))
|
|
464 |
||
465 |
#ifdef THREAD
|
|
466 |
extern pthread_mutex_t THR_LOCK_myisam; |
|
467 |
#endif
|
|
468 |
#if !defined(THREAD) || defined(DONT_USE_RW_LOCKS)
|
|
469 |
#define rw_wrlock(A) {}
|
|
470 |
#define rw_rdlock(A) {}
|
|
471 |
#define rw_unlock(A) {}
|
|
472 |
#endif
|
|
473 |
||
474 |
/* Some extern variables */
|
|
475 |
||
476 |
extern LIST *myisam_open_list; |
|
477 |
extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[]; |
|
478 |
extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[]; |
|
479 |
extern uint myisam_quick_table_bits; |
|
480 |
extern File myisam_log_file; |
|
481 |
extern ulong myisam_pid; |
|
482 |
||
483 |
/* This is used by _mi_calc_xxx_key_length och _mi_store_key */
|
|
484 |
||
485 |
typedef struct st_mi_s_param |
|
486 |
{
|
|
487 |
uint ref_length,key_length, |
|
488 |
n_ref_length, |
|
489 |
n_length, |
|
490 |
totlength, |
|
491 |
part_of_prev_key,prev_length,pack_marker; |
|
492 |
uchar *key, *prev_key,*next_key_pos; |
|
493 |
my_bool store_not_null; |
|
494 |
} MI_KEY_PARAM; |
|
495 |
||
496 |
/* Prototypes for intern functions */
|
|
497 |
||
498 |
extern int _mi_read_dynamic_record(MI_INFO *info,my_off_t filepos,uchar *buf); |
|
499 |
extern int _mi_write_dynamic_record(MI_INFO*, const uchar*); |
|
500 |
extern int _mi_update_dynamic_record(MI_INFO*, my_off_t, const uchar*); |
|
501 |
extern int _mi_delete_dynamic_record(MI_INFO *info); |
|
502 |
extern int _mi_cmp_dynamic_record(MI_INFO *info,const uchar *record); |
|
503 |
extern int _mi_read_rnd_dynamic_record(MI_INFO *, uchar *,my_off_t, my_bool); |
|
504 |
extern int _mi_write_blob_record(MI_INFO*, const uchar*); |
|
505 |
extern int _mi_update_blob_record(MI_INFO*, my_off_t, const uchar*); |
|
506 |
extern int _mi_read_static_record(MI_INFO *info, my_off_t filepos,uchar *buf); |
|
507 |
extern int _mi_write_static_record(MI_INFO*, const uchar*); |
|
508 |
extern int _mi_update_static_record(MI_INFO*, my_off_t, const uchar*); |
|
509 |
extern int _mi_delete_static_record(MI_INFO *info); |
|
510 |
extern int _mi_cmp_static_record(MI_INFO *info,const uchar *record); |
|
511 |
extern int _mi_read_rnd_static_record(MI_INFO*, uchar *,my_off_t, my_bool); |
|
512 |
extern int _mi_ck_write(MI_INFO *info,uint keynr,uchar *key,uint length); |
|
513 |
extern int _mi_ck_real_write_btree(MI_INFO *info, MI_KEYDEF *keyinfo, |
|
514 |
uchar *key, uint key_length, |
|
515 |
my_off_t *root, uint comp_flag); |
|
516 |
extern int _mi_enlarge_root(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *key, my_off_t *root); |
|
517 |
extern int _mi_insert(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *key, |
|
518 |
uchar *anc_buff,uchar *key_pos,uchar *key_buff, |
|
519 |
uchar *father_buff, uchar *father_keypos, |
|
520 |
my_off_t father_page, my_bool insert_last); |
|
521 |
extern int _mi_split_page(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *key, |
|
522 |
uchar *buff,uchar *key_buff, my_bool insert_last); |
|
523 |
extern uchar *_mi_find_half_pos(uint nod_flag,MI_KEYDEF *keyinfo,uchar *page, |
|
524 |
uchar *key,uint *return_key_length, |
|
525 |
uchar **after_key); |
|
526 |
extern int _mi_calc_static_key_length(MI_KEYDEF *keyinfo,uint nod_flag, |
|
527 |
uchar *key_pos, uchar *org_key, |
|
528 |
uchar *key_buff, |
|
529 |
uchar *key, MI_KEY_PARAM *s_temp); |
|
530 |
extern int _mi_calc_var_key_length(MI_KEYDEF *keyinfo,uint nod_flag, |
|
531 |
uchar *key_pos, uchar *org_key, |
|
532 |
uchar *key_buff, |
|
533 |
uchar *key, MI_KEY_PARAM *s_temp); |
|
534 |
extern int _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag, |
|
535 |
uchar *key_pos, uchar *org_key, |
|
536 |
uchar *prev_key, |
|
537 |
uchar *key, MI_KEY_PARAM *s_temp); |
|
538 |
extern int _mi_calc_bin_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag, |
|
539 |
uchar *key_pos,uchar *org_key, |
|
540 |
uchar *prev_key, |
|
541 |
uchar *key, MI_KEY_PARAM *s_temp); |
|
542 |
void _mi_store_static_key(MI_KEYDEF *keyinfo, uchar *key_pos, |
|
543 |
MI_KEY_PARAM *s_temp); |
|
544 |
void _mi_store_var_pack_key(MI_KEYDEF *keyinfo, uchar *key_pos, |
|
545 |
MI_KEY_PARAM *s_temp); |
|
546 |
#ifdef NOT_USED
|
|
547 |
void _mi_store_pack_key(MI_KEYDEF *keyinfo, uchar *key_pos, |
|
548 |
MI_KEY_PARAM *s_temp); |
|
549 |
#endif
|
|
550 |
void _mi_store_bin_pack_key(MI_KEYDEF *keyinfo, uchar *key_pos, |
|
551 |
MI_KEY_PARAM *s_temp); |
|
552 |
||
553 |
extern int _mi_ck_delete(MI_INFO *info,uint keynr,uchar *key,uint key_length); |
|
554 |
extern int _mi_readinfo(MI_INFO *info,int lock_flag,int check_keybuffer); |
|
555 |
extern int _mi_writeinfo(MI_INFO *info,uint options); |
|
556 |
extern int _mi_test_if_changed(MI_INFO *info); |
|
557 |
extern int _mi_mark_file_changed(MI_INFO *info); |
|
558 |
extern int _mi_decrement_open_count(MI_INFO *info); |
|
559 |
extern int _mi_check_index(MI_INFO *info,int inx); |
|
560 |
extern int _mi_search(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *key,uint key_len, |
|
561 |
uint nextflag,my_off_t pos); |
|
562 |
extern int _mi_bin_search(struct st_myisam_info *info,MI_KEYDEF *keyinfo, |
|
563 |
uchar *page,uchar *key,uint key_len,uint comp_flag, |
|
564 |
uchar * *ret_pos,uchar *buff, my_bool *was_last_key); |
|
565 |
extern int _mi_seq_search(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *page, |
|
566 |
uchar *key,uint key_len,uint comp_flag, |
|
567 |
uchar **ret_pos,uchar *buff, my_bool *was_last_key); |
|
568 |
extern int _mi_prefix_search(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *page, |
|
569 |
uchar *key,uint key_len,uint comp_flag, |
|
570 |
uchar **ret_pos,uchar *buff, my_bool *was_last_key); |
|
571 |
extern my_off_t _mi_kpos(uint nod_flag,uchar *after_key); |
|
572 |
extern void _mi_kpointer(MI_INFO *info,uchar *buff,my_off_t pos); |
|
573 |
extern my_off_t _mi_dpos(MI_INFO *info, uint nod_flag,uchar *after_key); |
|
574 |
extern my_off_t _mi_rec_pos(MYISAM_SHARE *info, uchar *ptr); |
|
575 |
extern void _mi_dpointer(MI_INFO *info, uchar *buff,my_off_t pos); |
|
576 |
extern int ha_key_cmp(HA_KEYSEG *keyseg, uchar *a,uchar *b, |
|
577 |
uint key_length,uint nextflag,uint *diff_length); |
|
578 |
extern uint _mi_get_static_key(MI_KEYDEF *keyinfo,uint nod_flag,uchar * *page, |
|
579 |
uchar *key); |
|
580 |
extern uint _mi_get_pack_key(MI_KEYDEF *keyinfo,uint nod_flag,uchar * *page, |
|
581 |
uchar *key); |
|
582 |
extern uint _mi_get_binary_pack_key(MI_KEYDEF *keyinfo, uint nod_flag, |
|
583 |
uchar **page_pos, uchar *key); |
|
584 |
extern uchar *_mi_get_last_key(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *keypos, |
|
585 |
uchar *lastkey,uchar *endpos, |
|
586 |
uint *return_key_length); |
|
587 |
extern uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, |
|
588 |
uchar *key, uchar *keypos, uint *return_key_length); |
|
589 |
extern uint _mi_keylength(MI_KEYDEF *keyinfo,uchar *key); |
|
590 |
extern uint _mi_keylength_part(MI_KEYDEF *keyinfo, register uchar *key, |
|
591 |
HA_KEYSEG *end); |
|
592 |
extern uchar *_mi_move_key(MI_KEYDEF *keyinfo,uchar *to,uchar *from); |
|
593 |
extern int _mi_search_next(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *key, |
|
594 |
uint key_length,uint nextflag,my_off_t pos); |
|
595 |
extern int _mi_search_first(MI_INFO *info,MI_KEYDEF *keyinfo,my_off_t pos); |
|
596 |
extern int _mi_search_last(MI_INFO *info,MI_KEYDEF *keyinfo,my_off_t pos); |
|
597 |
extern uchar *_mi_fetch_keypage(MI_INFO *info,MI_KEYDEF *keyinfo,my_off_t page, |
|
598 |
int level,uchar *buff,int return_buffer); |
|
599 |
extern int _mi_write_keypage(MI_INFO *info,MI_KEYDEF *keyinfo,my_off_t page, |
|
600 |
int level, uchar *buff); |
|
601 |
extern int _mi_dispose(MI_INFO *info,MI_KEYDEF *keyinfo,my_off_t pos, |
|
602 |
int level); |
|
603 |
extern my_off_t _mi_new(MI_INFO *info,MI_KEYDEF *keyinfo,int level); |
|
604 |
extern uint _mi_make_key(MI_INFO *info,uint keynr,uchar *key, |
|
605 |
const uchar *record,my_off_t filepos); |
|
606 |
extern uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, |
|
607 |
uchar *old, key_part_map keypart_map, |
|
608 |
HA_KEYSEG **last_used_keyseg); |
|
609 |
extern int _mi_read_key_record(MI_INFO *info,my_off_t filepos,uchar *buf); |
|
610 |
extern int _mi_read_cache(IO_CACHE *info,uchar *buff,my_off_t pos, |
|
611 |
uint length,int re_read_if_possibly); |
|
612 |
extern ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record); |
|
613 |
||
614 |
extern uchar *mi_alloc_rec_buff(MI_INFO *,ulong, uchar**); |
|
615 |
#define mi_get_rec_buff_ptr(info,buf) \
|
|
616 |
((((info)->s->options & HA_OPTION_PACK_RECORD) && (buf)) ? \
|
|
617 |
(buf) - MI_REC_BUFF_OFFSET : (buf))
|
|
618 |
#define mi_get_rec_buff_len(info,buf) \
|
|
619 |
(*((uint32 *)(mi_get_rec_buff_ptr(info,buf))))
|
|
620 |
||
621 |
extern ulong _mi_rec_unpack(MI_INFO *info,uchar *to,uchar *from, |
|
622 |
ulong reclength); |
|
623 |
extern my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *packpos, |
|
624 |
ulong packed_length, my_bool with_checkum); |
|
625 |
extern int _mi_write_part_record(MI_INFO *info,my_off_t filepos,ulong length, |
|
626 |
my_off_t next_filepos,uchar **record, |
|
627 |
ulong *reclength,int *flag); |
|
628 |
extern void _mi_print_key(FILE *stream,HA_KEYSEG *keyseg,const uchar *key, |
|
629 |
uint length); |
|
630 |
extern my_bool _mi_read_pack_info(MI_INFO *info,pbool fix_keys); |
|
631 |
extern int _mi_read_pack_record(MI_INFO *info,my_off_t filepos,uchar *buf); |
|
632 |
extern int _mi_read_rnd_pack_record(MI_INFO*, uchar *,my_off_t, my_bool); |
|
633 |
extern int _mi_pack_rec_unpack(MI_INFO *info, MI_BIT_BUFF *bit_buff, |
|
634 |
uchar *to, uchar *from, ulong reclength); |
|
635 |
extern ulonglong mi_safe_mul(ulonglong a,ulonglong b); |
|
636 |
extern int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf, |
|
637 |
const uchar *oldrec, const uchar *newrec, my_off_t pos); |
|
638 |
||
639 |
struct st_sort_info; |
|
640 |
||
641 |
||
642 |
typedef struct st_mi_block_info { /* Parameter to _mi_get_block_info */ |
|
643 |
uchar header[MI_BLOCK_INFO_HEADER_LENGTH]; |
|
644 |
ulong rec_len; |
|
645 |
ulong data_len; |
|
646 |
ulong block_len; |
|
647 |
ulong blob_len; |
|
648 |
my_off_t filepos; |
|
649 |
my_off_t next_filepos; |
|
650 |
my_off_t prev_filepos; |
|
651 |
uint second_read; |
|
652 |
uint offset; |
|
653 |
} MI_BLOCK_INFO; |
|
654 |
||
655 |
/* bits in return from _mi_get_block_info */
|
|
656 |
||
657 |
#define BLOCK_FIRST 1
|
|
658 |
#define BLOCK_LAST 2
|
|
659 |
#define BLOCK_DELETED 4
|
|
660 |
#define BLOCK_ERROR 8 /* Wrong data */ |
|
661 |
#define BLOCK_SYNC_ERROR 16 /* Right data at wrong place */ |
|
662 |
#define BLOCK_FATAL_ERROR 32 /* hardware-error */ |
|
663 |
||
664 |
#define NEED_MEM ((uint) 10*4*(IO_SIZE+32)+32) /* Nead for recursion */ |
|
665 |
#define MAXERR 20
|
|
666 |
#define BUFFERS_WHEN_SORTING 16 /* Alloc for sort-key-tree */ |
|
667 |
#define WRITE_COUNT MY_HOW_OFTEN_TO_WRITE
|
|
668 |
#define INDEX_TMP_EXT ".TMM"
|
|
669 |
#define DATA_TMP_EXT ".TMD"
|
|
670 |
||
671 |
#define UPDATE_TIME 1
|
|
672 |
#define UPDATE_STAT 2
|
|
673 |
#define UPDATE_SORT 4
|
|
674 |
#define UPDATE_AUTO_INC 8
|
|
675 |
#define UPDATE_OPEN_COUNT 16
|
|
676 |
||
677 |
#define USE_BUFFER_INIT (((1024L*512L-MALLOC_OVERHEAD)/IO_SIZE)*IO_SIZE)
|
|
678 |
#define READ_BUFFER_INIT (1024L*256L-MALLOC_OVERHEAD)
|
|
679 |
#define SORT_BUFFER_INIT (2048L*1024L-MALLOC_OVERHEAD)
|
|
680 |
#define MIN_SORT_BUFFER (4096-MALLOC_OVERHEAD)
|
|
681 |
||
682 |
enum myisam_log_commands { |
|
683 |
MI_LOG_OPEN,MI_LOG_WRITE,MI_LOG_UPDATE,MI_LOG_DELETE,MI_LOG_CLOSE,MI_LOG_EXTRA,MI_LOG_LOCK,MI_LOG_DELETE_ALL |
|
684 |
};
|
|
685 |
||
686 |
#define myisam_log(a,b,c,d) if (myisam_log_file >= 0) _myisam_log(a,b,c,d)
|
|
687 |
#define myisam_log_command(a,b,c,d,e) if (myisam_log_file >= 0) _myisam_log_command(a,b,c,d,e)
|
|
688 |
#define myisam_log_record(a,b,c,d,e) if (myisam_log_file >= 0) _myisam_log_record(a,b,c,d,e)
|
|
689 |
||
690 |
#define fast_mi_writeinfo(INFO) if (!(INFO)->s->tot_locks) (void) _mi_writeinfo((INFO),0)
|
|
691 |
#define fast_mi_readinfo(INFO) ((INFO)->lock_type == F_UNLCK) && _mi_readinfo((INFO),F_RDLCK,1)
|
|
692 |
||
693 |
#ifdef __cplusplus
|
|
694 |
extern "C" { |
|
695 |
#endif
|
|
696 |
||
697 |
extern uint _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t); |
|
698 |
extern uint _mi_rec_pack(MI_INFO *info,uchar *to,const uchar *from); |
|
699 |
extern uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, |
|
700 |
MI_BLOCK_INFO *info, uchar **rec_buff_p, |
|
701 |
File file, my_off_t filepos); |
|
702 |
extern void _my_store_blob_length(uchar *pos,uint pack_length,uint length); |
|
703 |
extern void _myisam_log(enum myisam_log_commands command,MI_INFO *info, |
|
704 |
const uchar *buffert,uint length); |
|
705 |
extern void _myisam_log_command(enum myisam_log_commands command, |
|
706 |
MI_INFO *info, const uchar *buffert, |
|
707 |
uint length, int result); |
|
708 |
extern void _myisam_log_record(enum myisam_log_commands command,MI_INFO *info, |
|
709 |
const uchar *record,my_off_t filepos, |
|
710 |
int result); |
|
711 |
extern void mi_report_error(int errcode, const char *file_name); |
|
712 |
extern my_bool _mi_memmap_file(MI_INFO *info); |
|
713 |
extern void _mi_unmap_file(MI_INFO *info); |
|
714 |
extern uint save_pack_length(uint version, uchar *block_buff, ulong length); |
|
715 |
extern uint read_pack_length(uint version, const uchar *buf, ulong *length); |
|
716 |
extern uint calc_pack_length(uint version, ulong length); |
|
717 |
extern size_t mi_mmap_pread(MI_INFO *info, uchar *Buffer, |
|
718 |
size_t Count, my_off_t offset, myf MyFlags); |
|
719 |
extern size_t mi_mmap_pwrite(MI_INFO *info, const uchar *Buffer, |
|
720 |
size_t Count, my_off_t offset, myf MyFlags); |
|
721 |
extern size_t mi_nommap_pread(MI_INFO *info, uchar *Buffer, |
|
722 |
size_t Count, my_off_t offset, myf MyFlags); |
|
723 |
extern size_t mi_nommap_pwrite(MI_INFO *info, const uchar *Buffer, |
|
724 |
size_t Count, my_off_t offset, myf MyFlags); |
|
725 |
||
726 |
uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite); |
|
727 |
uchar *mi_state_info_read(uchar *ptr, MI_STATE_INFO *state); |
|
728 |
uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead); |
|
729 |
uint mi_base_info_write(File file, MI_BASE_INFO *base); |
|
730 |
uchar *my_n_base_info_read(uchar *ptr, MI_BASE_INFO *base); |
|
731 |
int mi_keyseg_write(File file, const HA_KEYSEG *keyseg); |
|
732 |
uchar *mi_keyseg_read(uchar *ptr, HA_KEYSEG *keyseg); |
|
733 |
uint mi_keydef_write(File file, MI_KEYDEF *keydef); |
|
734 |
uchar *mi_keydef_read(uchar *ptr, MI_KEYDEF *keydef); |
|
735 |
uint mi_uniquedef_write(File file, MI_UNIQUEDEF *keydef); |
|
736 |
uchar *mi_uniquedef_read(uchar *ptr, MI_UNIQUEDEF *keydef); |
|
737 |
uint mi_recinfo_write(File file, MI_COLUMNDEF *recinfo); |
|
738 |
uchar *mi_recinfo_read(uchar *ptr, MI_COLUMNDEF *recinfo); |
|
739 |
extern int mi_disable_indexes(MI_INFO *info); |
|
740 |
extern int mi_enable_indexes(MI_INFO *info); |
|
741 |
extern int mi_indexes_are_disabled(MI_INFO *info); |
|
742 |
ulong _my_calc_total_blob_length(MI_INFO *info, const uchar *record); |
|
743 |
ha_checksum mi_checksum(MI_INFO *info, const uchar *buf); |
|
744 |
ha_checksum mi_static_checksum(MI_INFO *info, const uchar *buf); |
|
745 |
my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, |
|
746 |
ha_checksum unique_hash, my_off_t pos); |
|
747 |
ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *buf); |
|
748 |
int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, |
|
749 |
const uchar *record, my_off_t pos); |
|
750 |
int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def, |
|
751 |
const uchar *record, my_off_t pos); |
|
752 |
int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b, |
|
753 |
my_bool null_are_equal); |
|
754 |
void mi_get_status(void* param, int concurrent_insert); |
|
755 |
void mi_update_status(void* param); |
|
756 |
void mi_restore_status(void* param); |
|
757 |
void mi_copy_status(void* to,void *from); |
|
758 |
my_bool mi_check_status(void* param); |
|
759 |
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); |
|
760 |
||
761 |
extern MI_INFO *test_if_reopen(char *filename); |
|
762 |
my_bool check_table_is_closed(const char *name, const char *where); |
|
763 |
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *orn_name, |
|
764 |
File file_to_dup); |
|
765 |
||
766 |
int mi_open_keyfile(MYISAM_SHARE *share); |
|
767 |
void mi_setup_functions(register MYISAM_SHARE *share); |
|
768 |
my_bool mi_dynmap_file(MI_INFO *info, my_off_t size); |
|
1.1.5
by Marc Deslauriers
Import upstream version 5.1.61 |
769 |
int mi_munmap_file(MI_INFO *info); |
1
by Chuck Short
Import upstream version 5.1.30 |
770 |
void mi_remap_file(MI_INFO *info, my_off_t size); |
771 |
||
772 |
/* Functions needed by mi_check */
|
|
773 |
volatile int *killed_ptr(MI_CHECK *param); |
|
774 |
void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...)); |
|
775 |
void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...)); |
|
776 |
void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...)); |
|
777 |
int flush_pending_blocks(MI_SORT_PARAM *param); |
|
778 |
int sort_ft_buf_flush(MI_SORT_PARAM *sort_param); |
|
779 |
int thr_write_keys(MI_SORT_PARAM *sort_param); |
|
780 |
#ifdef THREAD
|
|
781 |
pthread_handler_t thr_find_all_keys(void *arg); |
|
782 |
#endif
|
|
783 |
int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file); |
|
784 |
||
785 |
int sort_write_record(MI_SORT_PARAM *sort_param); |
|
786 |
int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, ulong); |
|
787 |
||
788 |
#ifdef __cplusplus
|
|
789 |
}
|
|
790 |
#endif
|
|
791 |