1
by brian
clean slate |
1 |
/* Copyright (C) 2000-2006 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
|
|
1802.10.2
by Monty Taylor
Update all of the copyright headers to include the correct address. |
14 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
1
by brian
clean slate |
15 |
|
16 |
/* This file is included by all internal myisam files */
|
|
17 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
18 |
#pragma once
|
77.1.3
by Monty Taylor
MyISAM cleanups. |
19 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
20 |
#include <config.h> |
2041.3.13
by Brian Aker
Merge in changes such that we are strict with error type. |
21 |
|
1
by brian
clean slate |
22 |
#include "myisam.h" /* Structs & some defines */ |
23 |
#include "myisampack.h" /* packing of keys */ |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
24 |
#include <drizzled/tree.h> |
25 |
#include <drizzled/internal/my_pthread.h> |
|
1241.9.43
by Monty Taylor
Merged trunk. Also renamed thr_lock. Doh. I hate it when I do both. |
26 |
#include <drizzled/thr_lock.h> |
543
by Monty Taylor
Renamed drizzle_common again. Removed sql_common. (empty) |
27 |
#include <drizzled/common.h> |
2041.3.13
by Brian Aker
Merge in changes such that we are strict with error type. |
28 |
#include <drizzled/enum.h> |
2221.7.4
by Olaf van der Spek
Refactor |
29 |
#include <drizzled/dynamic_array.h> |
2241.4.14
by Stewart Smith
remove some includes from my_sys.h and instead only include where needed. This helps reduce the number of files that have to be rebuilt when you change some of the more widely included header files (such as the drizzled::identifier ones) |
30 |
#include <drizzled/error_t.h> |
1
by brian
clean slate |
31 |
|
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
32 |
#include <assert.h> |
33 |
#include <fcntl.h> |
|
612.2.13
by Monty Taylor
Work on removing global.h from headers that should be installed. |
34 |
#include <string.h> |
916.1.32
by Padraig O'Sullivan
Refactoring MyISAM storage engine again based on LIST replacement with |
35 |
#include <list> |
612.2.13
by Monty Taylor
Work on removing global.h from headers that should be installed. |
36 |
|
1703.1.3
by Brian Aker
Replace pthread mutex with boost based one for myisam. |
37 |
#include <boost/thread/mutex.hpp> |
38 |
||
489.1.6
by Monty Taylor
Removed RAID garbage. |
39 |
#if defined(my_write)
|
1
by brian
clean slate |
40 |
#undef my_write /* undef map from my_nosys; We need test-if-disk full */ |
41 |
#endif
|
|
42 |
||
1689.2.22
by Brian Aker
Shuffle out dead crap around keycache. |
43 |
/* Typical key cash */
|
44 |
static const uint32_t KEY_CACHE_SIZE= 8*1024*1024; |
|
45 |
||
46 |
/* Default size of a key cache block */
|
|
47 |
static const uint32_t KEY_CACHE_BLOCK_SIZE= 1024; |
|
48 |
||
1
by brian
clean slate |
49 |
typedef struct st_mi_status_info |
50 |
{
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
51 |
drizzled::ha_rows records; /* Rows in table */ |
52 |
drizzled::ha_rows del; /* Removed rows */ |
|
53 |
drizzled::internal::my_off_t empty; /* lost space in datafile */ |
|
54 |
drizzled::internal::my_off_t key_empty; /* lost space in indexfile */ |
|
55 |
drizzled::internal::my_off_t key_file_length; |
|
56 |
drizzled::internal::my_off_t data_file_length; |
|
2241.4.37
by Stewart Smith
remove the drizzled::internal namespace prefix from teh typedef for ha_checksum - it's just for myisam now |
57 |
ha_checksum checksum; |
1
by brian
clean slate |
58 |
} MI_STATUS_INFO; |
59 |
||
60 |
typedef struct st_mi_state_info |
|
61 |
{
|
|
62 |
struct { /* Fileheader */ |
|
481
by Brian Aker
Remove all of uchar. |
63 |
unsigned char file_version[4]; |
64 |
unsigned char options[2]; |
|
65 |
unsigned char header_length[2]; |
|
66 |
unsigned char state_info_length[2]; |
|
67 |
unsigned char base_info_length[2]; |
|
68 |
unsigned char base_pos[2]; |
|
69 |
unsigned char key_parts[2]; /* Key parts */ |
|
70 |
unsigned char unique_key_parts[2]; /* Key parts + unique parts */ |
|
71 |
unsigned char keys; /* number of keys in file */ |
|
72 |
unsigned char uniques; /* number of UNIQUE definitions */ |
|
73 |
unsigned char language; /* Language for indexes */ |
|
74 |
unsigned char max_block_size_index; /* max keyblock size */ |
|
75 |
unsigned char fulltext_keys; |
|
76 |
unsigned char not_used; /* To align to 8 */ |
|
1
by brian
clean slate |
77 |
} header; |
78 |
||
79 |
MI_STATUS_INFO state; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
80 |
drizzled::ha_rows split; /* number of split blocks */ |
81 |
drizzled::internal::my_off_t dellink; /* Link to next removed block */ |
|
151
by Brian Aker
Ulonglong to uint64_t |
82 |
uint64_t auto_increment; |
1
by brian
clean slate |
83 |
ulong process; /* process that updated table last */ |
84 |
ulong unique; /* Unique number for this process */ |
|
85 |
ulong update_count; /* Updated for each write lock */ |
|
86 |
ulong status; |
|
87 |
ulong *rec_per_key_part; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
88 |
drizzled::internal::my_off_t *key_root; /* Start of key trees */ |
89 |
drizzled::internal::my_off_t *key_del; /* delete links for trees */ |
|
90 |
drizzled::internal::my_off_t rec_per_key_rows; /* Rows when calculating rec_per_key */ |
|
1
by brian
clean slate |
91 |
|
92 |
ulong sec_index_changed; /* Updated when new sec_index */ |
|
93 |
ulong sec_index_used; /* which extra index are in use */ |
|
151
by Brian Aker
Ulonglong to uint64_t |
94 |
uint64_t key_map; /* Which keys are in use */ |
2241.4.37
by Stewart Smith
remove the drizzled::internal namespace prefix from teh typedef for ha_checksum - it's just for myisam now |
95 |
ha_checksum checksum; /* Table checksum */ |
1
by brian
clean slate |
96 |
ulong version; /* timestamp of create */ |
97 |
time_t create_time; /* Time when created database */ |
|
98 |
time_t recover_time; /* Time for last recover */ |
|
99 |
time_t check_time; /* Time for last check */ |
|
100 |
uint sortkey; /* sorted by this key (not used) */ |
|
482
by Brian Aker
Remove uint. |
101 |
uint32_t open_count; |
206
by Brian Aker
Removed final uint dead types. |
102 |
uint8_t changed; /* Changed since myisamchk */ |
1
by brian
clean slate |
103 |
|
104 |
/* the following isn't saved on disk */
|
|
482
by Brian Aker
Remove uint. |
105 |
uint32_t state_diff_length; /* Should be 0 */ |
1
by brian
clean slate |
106 |
uint state_length; /* Length of state header in file */ |
107 |
ulong *key_info; |
|
108 |
} MI_STATE_INFO; |
|
109 |
||
110 |
#define MI_STATE_INFO_SIZE (24+14*8+7*4+2*2+8)
|
|
111 |
#define MI_STATE_KEY_SIZE 8
|
|
112 |
#define MI_STATE_KEYBLOCK_SIZE 8
|
|
113 |
#define MI_STATE_KEYSEG_SIZE 4
|
|
114 |
#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)
|
|
115 |
#define MI_KEYDEF_SIZE (2+ 5*2)
|
|
116 |
#define MI_UNIQUEDEF_SIZE (2+1+1)
|
|
117 |
#define HA_KEYSEG_SIZE (6+ 2*2 + 4*2)
|
|
118 |
#define MI_COLUMNDEF_SIZE (2*3+1)
|
|
119 |
#define MI_BASE_INFO_SIZE (5*8 + 8*4 + 4 + 4*2 + 16)
|
|
120 |
#define MI_INDEX_BLOCK_MARGIN 16 /* Safety margin for .MYI tables */ |
|
121 |
||
122 |
typedef struct st_mi_base_info |
|
123 |
{
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
124 |
drizzled::internal::my_off_t keystart; /* Start of keys */ |
125 |
drizzled::internal::my_off_t max_data_file_length; |
|
126 |
drizzled::internal::my_off_t max_key_file_length; |
|
127 |
drizzled::internal::my_off_t margin_key_file_length; |
|
128 |
drizzled::ha_rows records,reloc; /* Create information */ |
|
1
by brian
clean slate |
129 |
ulong mean_row_length; /* Create information */ |
130 |
ulong reclength; /* length of unpacked record */ |
|
131 |
ulong pack_reclength; /* Length of full packed rec. */ |
|
132 |
ulong min_pack_length; |
|
133 |
ulong max_pack_length; /* Max possibly length of packed rec.*/ |
|
134 |
ulong min_block_length; |
|
135 |
ulong fields, /* fields in table */ |
|
136 |
pack_fields; /* packed fields in table */ |
|
482
by Brian Aker
Remove uint. |
137 |
uint32_t rec_reflength; /* = 2-8 */ |
138 |
uint32_t key_reflength; /* = 2-8 */ |
|
139 |
uint32_t keys; /* same as in state.header */ |
|
140 |
uint32_t auto_key; /* Which key-1 is a auto key */ |
|
141 |
uint32_t blobs; /* Number of blobs */ |
|
142 |
uint32_t pack_bits; /* Length of packed bits */ |
|
143 |
uint32_t max_key_block_length; /* Max block length */ |
|
144 |
uint32_t max_key_length; /* Max key length */ |
|
1
by brian
clean slate |
145 |
/* Extra allocation when using dynamic record format */
|
482
by Brian Aker
Remove uint. |
146 |
uint32_t extra_alloc_bytes; |
147 |
uint32_t extra_alloc_procent; |
|
1
by brian
clean slate |
148 |
/* Info about raid */
|
482
by Brian Aker
Remove uint. |
149 |
uint32_t raid_type,raid_chunks; |
489.1.6
by Monty Taylor
Removed RAID garbage. |
150 |
uint32_t raid_chunksize; |
1
by brian
clean slate |
151 |
/* The following are from the header */
|
482
by Brian Aker
Remove uint. |
152 |
uint32_t key_parts,all_key_parts; |
1
by brian
clean slate |
153 |
} MI_BASE_INFO; |
154 |
||
155 |
||
156 |
/* Structs used intern in database */
|
|
157 |
||
158 |
typedef struct st_mi_blob /* Info of record */ |
|
159 |
{
|
|
160 |
ulong offset; /* Offset to blob in record */ |
|
482
by Brian Aker
Remove uint. |
161 |
uint32_t pack_length; /* Type of packed length */ |
1
by brian
clean slate |
162 |
ulong length; /* Calc:ed for each record */ |
163 |
} MI_BLOB; |
|
164 |
||
165 |
||
166 |
typedef struct st_mi_isam_pack { |
|
167 |
ulong header_length; |
|
482
by Brian Aker
Remove uint. |
168 |
uint32_t ref_length; |
481
by Brian Aker
Remove all of uchar. |
169 |
unsigned char version; |
1
by brian
clean slate |
170 |
} MI_PACK; |
171 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
172 |
#define MAX_NONMAPPED_INSERTS 1000
|
1
by brian
clean slate |
173 |
|
174 |
typedef struct st_mi_isam_share { /* Shared between opens */ |
|
175 |
MI_STATE_INFO state; |
|
176 |
MI_BASE_INFO base; |
|
177 |
MI_KEYDEF ft2_keyinfo; /* Second-level ft-key definition */ |
|
178 |
MI_KEYDEF *keyinfo; /* Key definitions */ |
|
179 |
MI_UNIQUEDEF *uniqueinfo; /* unique definitions */ |
|
180 |
HA_KEYSEG *keyparts; /* key part info */ |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
181 |
drizzled::MI_COLUMNDEF *rec; /* Pointer to field information */ |
1
by brian
clean slate |
182 |
MI_PACK pack; /* Data about packed records */ |
183 |
MI_BLOB *blobs; /* Pointer to blobs */ |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
184 |
std::list<drizzled::Session *> *in_use; /* List of threads using this table */ |
1
by brian
clean slate |
185 |
char *unique_file_name; /* realpath() of index file */ |
186 |
char *data_file_name, /* Resolved path names from symlinks */ |
|
187 |
*index_file_name; |
|
481
by Brian Aker
Remove all of uchar. |
188 |
unsigned char *file_map; /* mem-map of file if possible */ |
1
by brian
clean slate |
189 |
MI_DECODE_TREE *decode_trees; |
206
by Brian Aker
Removed final uint dead types. |
190 |
uint16_t *decode_tables; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
191 |
int (*read_record)(struct st_myisam_info*, drizzled::internal::my_off_t, unsigned char*); |
481
by Brian Aker
Remove all of uchar. |
192 |
int (*write_record)(struct st_myisam_info*, const unsigned char*); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
193 |
int (*update_record)(struct st_myisam_info*, drizzled::internal::my_off_t, const unsigned char*); |
1
by brian
clean slate |
194 |
int (*delete_record)(struct st_myisam_info*); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
195 |
int (*read_rnd)(struct st_myisam_info*, unsigned char*, drizzled::internal::my_off_t, bool); |
481
by Brian Aker
Remove all of uchar. |
196 |
int (*compare_record)(struct st_myisam_info*, const unsigned char *); |
1
by brian
clean slate |
197 |
/* Function to use for a row checksum. */
|
2241.4.37
by Stewart Smith
remove the drizzled::internal namespace prefix from teh typedef for ha_checksum - it's just for myisam now |
198 |
ha_checksum (*calc_checksum)(struct st_myisam_info*, const unsigned char *); |
1
by brian
clean slate |
199 |
int (*compare_unique)(struct st_myisam_info*, MI_UNIQUEDEF *, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
200 |
const unsigned char *record, drizzled::internal::my_off_t pos); |
201 |
size_t (*file_read)(MI_INFO *, unsigned char *, size_t, drizzled::internal::my_off_t, drizzled::myf); |
|
202 |
size_t (*file_write)(MI_INFO *, const unsigned char *, size_t, drizzled::internal::my_off_t, drizzled::myf); |
|
1
by brian
clean slate |
203 |
ulong this_process; /* processid */ |
204 |
ulong last_process; /* For table-change-check */ |
|
205 |
ulong last_version; /* Version on start */ |
|
1816.2.4
by Monty Taylor
Cleaned up a bunch more warnings. |
206 |
uint64_t options; /* Options used */ |
1
by brian
clean slate |
207 |
ulong min_pack_length; /* Theese are used by packed data */ |
208 |
ulong max_pack_length; |
|
209 |
ulong state_diff_length; |
|
210 |
uint rec_reflength; /* rec_reflength in use now */ |
|
482
by Brian Aker
Remove uint. |
211 |
uint32_t unique_name_length; |
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
212 |
int kfile; /* Shared keyfile */ |
213 |
int data_file; /* Shared data file */ |
|
1
by brian
clean slate |
214 |
int mode; /* mode of file on open */ |
215 |
uint reopen; /* How many times reopened */ |
|
216 |
uint w_locks,r_locks,tot_locks; /* Number of read/write locks */ |
|
217 |
uint blocksize; /* blocksize of keyfile */ |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
218 |
drizzled::myf write_flag; |
219 |
enum drizzled::data_file_type data_file_type; |
|
1
by brian
clean slate |
220 |
/* Below flag is needed to make log tables work with concurrent insert */
|
281
by Brian Aker
Converted myisam away from my_bool |
221 |
bool is_log_table; |
1
by brian
clean slate |
222 |
|
281
by Brian Aker
Converted myisam away from my_bool |
223 |
bool changed, /* If changed since lock */ |
1
by brian
clean slate |
224 |
global_changed, /* If changed since open */ |
225 |
not_flushed, |
|
226 |
temporary,delay_key_write, |
|
227 |
concurrent_insert; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
228 |
drizzled::internal::my_off_t mmaped_length; |
482
by Brian Aker
Remove uint. |
229 |
uint32_t nonmmaped_inserts; /* counter of writing in non-mmaped |
1
by brian
clean slate |
230 |
area */
|
231 |
} MYISAM_SHARE; |
|
232 |
||
233 |
||
482
by Brian Aker
Remove uint. |
234 |
typedef uint32_t mi_bit_type; |
1
by brian
clean slate |
235 |
|
236 |
typedef struct st_mi_bit_buff { /* Used for packing of record */ |
|
237 |
mi_bit_type current_byte; |
|
482
by Brian Aker
Remove uint. |
238 |
uint32_t bits; |
481
by Brian Aker
Remove all of uchar. |
239 |
unsigned char *pos,*end,*blob_pos,*blob_end; |
482
by Brian Aker
Remove uint. |
240 |
uint32_t error; |
1
by brian
clean slate |
241 |
} MI_BIT_BUFF; |
242 |
||
243 |
||
281
by Brian Aker
Converted myisam away from my_bool |
244 |
typedef bool (*index_cond_func_t)(void *param); |
1
by brian
clean slate |
245 |
|
246 |
struct st_myisam_info { |
|
247 |
MYISAM_SHARE *s; /* Shared between open:s */ |
|
248 |
MI_STATUS_INFO *state,save_state; |
|
249 |
MI_BLOB *blobs; /* Pointer to blobs */ |
|
250 |
MI_BIT_BUFF bit_buff; |
|
251 |
/* accumulate indexfile changes between write's */
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
252 |
drizzled::TREE *bulk_insert; |
253 |
drizzled::Session *in_use; /* Thread using this table */ |
|
1
by brian
clean slate |
254 |
char *filename; /* parameter to open filename */ |
481
by Brian Aker
Remove all of uchar. |
255 |
unsigned char *buff, /* Temp area for key */ |
1
by brian
clean slate |
256 |
*lastkey,*lastkey2; /* Last used search key */ |
481
by Brian Aker
Remove all of uchar. |
257 |
unsigned char *first_mbr_key; /* Searhed spatial key */ |
258 |
unsigned char *rec_buff; /* Tempbuff for recordpack */ |
|
259 |
unsigned char *int_keypos, /* Save position for next/previous */ |
|
1
by brian
clean slate |
260 |
*int_maxpos; /* -""- */ |
482
by Brian Aker
Remove uint. |
261 |
uint32_t int_nod_flag; /* -""- */ |
205
by Brian Aker
uint32 -> uin32_t |
262 |
uint32_t int_keytree_version; /* -""- */ |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
263 |
int (*read_record)(struct st_myisam_info*, drizzled::internal::my_off_t, unsigned char*); |
1
by brian
clean slate |
264 |
ulong this_unique; /* uniq filenumber or thread */ |
265 |
ulong last_unique; /* last unique number */ |
|
266 |
ulong this_loop; /* counter for this open */ |
|
267 |
ulong last_loop; /* last used counter */ |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
268 |
drizzled::internal::my_off_t lastpos, /* Last record position */ |
1
by brian
clean slate |
269 |
nextpos; /* Position to next record */ |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
270 |
drizzled::internal::my_off_t save_lastpos; |
271 |
drizzled::internal::my_off_t pos; /* Intern variable */ |
|
272 |
drizzled::internal::my_off_t last_keypage; /* Last key page read */ |
|
273 |
drizzled::internal::my_off_t last_search_keypage; /* Last keypage when searching */ |
|
274 |
drizzled::internal::my_off_t dupp_key_pos; |
|
2241.4.37
by Stewart Smith
remove the drizzled::internal namespace prefix from teh typedef for ha_checksum - it's just for myisam now |
275 |
ha_checksum checksum; /* Temp storage for row checksum */ |
1
by brian
clean slate |
276 |
/* QQ: the folloing two xxx_length fields should be removed,
|
277 |
as they are not compatible with parallel repair */
|
|
278 |
ulong packed_length,blob_length; /* Length of found, packed record */ |
|
279 |
int dfile; /* The datafile */ |
|
482
by Brian Aker
Remove uint. |
280 |
uint32_t opt_flag; /* Optim. for space/speed */ |
281 |
uint32_t update; /* If file changed since open */ |
|
1
by brian
clean slate |
282 |
int lastinx; /* Last used index */ |
283 |
uint lastkey_length; /* Length of key in lastkey */ |
|
284 |
uint last_rkey_length; /* Last length in mi_rkey() */ |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
285 |
enum drizzled::ha_rkey_function last_key_func; /* CONTAIN, OVERLAP, etc */ |
482
by Brian Aker
Remove uint. |
286 |
uint32_t save_lastkey_length; |
287 |
uint32_t pack_key_length; /* For MYISAMMRG */ |
|
206
by Brian Aker
Removed final uint dead types. |
288 |
uint16_t last_used_keyseg; /* For MyISAMMRG */ |
1
by brian
clean slate |
289 |
int errkey; /* Got last error on this key */ |
290 |
int lock_type; /* How database was locked */ |
|
291 |
int tmp_lock_type; /* When locked by readinfo */ |
|
292 |
uint data_changed; /* Somebody has changed data */ |
|
293 |
uint save_update; /* When using KEY_READ */ |
|
294 |
int save_lastinx; |
|
2296.1.1
by Mark Atwood
Merge in Fixes of Brian's IOCACHE. |
295 |
drizzled::internal::io_cache_st rec_cache; /* When cacheing records */ |
482
by Brian Aker
Remove uint. |
296 |
uint32_t preload_buff_size; /* When preloading indexes */ |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
297 |
drizzled::myf lock_wait; /* is 0 or MY_DONT_WAIT */ |
281
by Brian Aker
Converted myisam away from my_bool |
298 |
bool was_locked; /* Was locked in panic */ |
299 |
bool append_insert_at_end; /* Set if concurrent insert */ |
|
300 |
bool quick_mode; |
|
301 |
bool page_changed; /* If info->buff can't be used for rnext */ |
|
302 |
bool buff_used; /* If info->buff has to be reread for rnext */ |
|
303 |
bool once_flags; /* For MYISAMMRG */ |
|
1
by brian
clean slate |
304 |
|
305 |
index_cond_func_t index_cond_func; /* Index condition function */ |
|
306 |
void *index_cond_func_arg; /* parameter for the func */ |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
307 |
drizzled::THR_LOCK_DATA lock; |
481
by Brian Aker
Remove all of uchar. |
308 |
unsigned char *rtree_recursion_state; /* For RTREE */ |
1
by brian
clean slate |
309 |
int rtree_recursion_depth; |
310 |
};
|
|
311 |
||
312 |
typedef struct st_buffpek { |
|
1241.9.45
by Monty Taylor
Added a header for qsort_cmp. |
313 |
off_t file_pos; /* Where we are in the sort file */ |
481
by Brian Aker
Remove all of uchar. |
314 |
unsigned char *base,*key; /* Key pointers */ |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
315 |
drizzled::ha_rows count; /* Number of rows in table */ |
1
by brian
clean slate |
316 |
ulong mem_count; /* numbers of keys in memory */ |
317 |
ulong max_keys; /* Max keys in buffert */ |
|
318 |
} BUFFPEK; |
|
319 |
||
320 |
typedef struct st_mi_sort_param |
|
321 |
{
|
|
322 |
pthread_t thr; |
|
2296.1.1
by Mark Atwood
Merge in Fixes of Brian's IOCACHE. |
323 |
drizzled::internal::io_cache_st read_cache, tempfile, tempfile_for_exceptions; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
324 |
drizzled::DYNAMIC_ARRAY buffpek; |
1
by brian
clean slate |
325 |
MI_BIT_BUFF bit_buff; /* For parallel repair of packrec. */ |
326 |
||
327 |
/*
|
|
328 |
The next two are used to collect statistics, see update_key_parts for
|
|
329 |
description.
|
|
330 |
*/
|
|
151
by Brian Aker
Ulonglong to uint64_t |
331 |
uint64_t unique[MI_MAX_KEY_SEG+1]; |
332 |
uint64_t notnull[MI_MAX_KEY_SEG+1]; |
|
1
by brian
clean slate |
333 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
334 |
drizzled::internal::my_off_t pos,max_pos,filepos,start_recpos; |
482
by Brian Aker
Remove uint. |
335 |
uint32_t key, key_length,real_key_length,sortbuff_size; |
336 |
uint32_t maxbuffers, keys, find_length, sort_keys_length; |
|
281
by Brian Aker
Converted myisam away from my_bool |
337 |
bool fix_datafile, master; |
338 |
bool calc_checksum; /* calculate table checksum */ |
|
1
by brian
clean slate |
339 |
MI_KEYDEF *keyinfo; |
340 |
HA_KEYSEG *seg; |
|
341 |
SORT_INFO *sort_info; |
|
481
by Brian Aker
Remove all of uchar. |
342 |
unsigned char **sort_keys; |
343 |
unsigned char *rec_buff; |
|
1
by brian
clean slate |
344 |
void *wordlist, *wordptr; |
1253.1.3
by Monty Taylor
MEM_ROOT == memory::Root |
345 |
drizzled::memory::Root wordroot; |
481
by Brian Aker
Remove all of uchar. |
346 |
unsigned char *record; |
1
by brian
clean slate |
347 |
int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *); |
348 |
int (*key_read)(struct st_mi_sort_param *,void *); |
|
349 |
int (*key_write)(struct st_mi_sort_param *, const void *); |
|
350 |
void (*lock_in_memory)(MI_CHECK *); |
|
481
by Brian Aker
Remove all of uchar. |
351 |
int (*write_keys)(struct st_mi_sort_param *, register unsigned char **, |
2296.1.1
by Mark Atwood
Merge in Fixes of Brian's IOCACHE. |
352 |
uint32_t , struct st_buffpek *, drizzled::internal::io_cache_st *); |
353 |
unsigned int (*read_to_buffer)(drizzled::internal::io_cache_st *,struct st_buffpek *, uint); |
|
354 |
int (*write_key)(struct st_mi_sort_param *, drizzled::internal::io_cache_st *,unsigned char *, |
|
1
by brian
clean slate |
355 |
uint, uint); |
356 |
} MI_SORT_PARAM; |
|
357 |
||
358 |
/* Some defines used by isam-funktions */
|
|
359 |
||
360 |
#define USE_WHOLE_KEY MI_MAX_KEY_BUFF*2 /* Use whole key in _mi_search() */ |
|
361 |
#define F_EXTRA_LCK -1
|
|
362 |
||
363 |
/* bits in opt_flag */
|
|
364 |
#define MEMMAP_USED 32
|
|
365 |
#define REMEMBER_OLD_POS 64
|
|
366 |
||
367 |
#define WRITEINFO_UPDATE_KEYFILE 1
|
|
368 |
#define WRITEINFO_NO_UNLOCK 2
|
|
369 |
||
370 |
/* once_flags */
|
|
371 |
#define USE_PACKED_KEYS 1
|
|
372 |
#define RRND_PRESERVE_LASTINX 2
|
|
373 |
||
374 |
/* bits in state.changed */
|
|
375 |
||
376 |
#define STATE_CHANGED 1
|
|
377 |
#define STATE_CRASHED 2
|
|
378 |
#define STATE_CRASHED_ON_REPAIR 4
|
|
379 |
#define STATE_NOT_ANALYZED 8
|
|
380 |
#define STATE_NOT_OPTIMIZED_KEYS 16
|
|
381 |
#define STATE_NOT_SORTED_PAGES 32
|
|
382 |
||
383 |
/* options to mi_read_cache */
|
|
384 |
||
385 |
#define READING_NEXT 1
|
|
386 |
#define READING_HEADER 2
|
|
387 |
||
51.1.127
by Monty Taylor
Fixed the _mi_report_crashed warning (and a couple of others) |
388 |
|
1
by brian
clean slate |
389 |
#define mi_getint(x) ((uint) mi_uint2korr(x) & 32767)
|
206
by Brian Aker
Removed final uint dead types. |
390 |
#define mi_putint(x,y,nod) { uint16_t boh=(nod ? (uint16_t) 32768 : 0) + (uint16_t) (y);\
|
1
by brian
clean slate |
391 |
mi_int2store(x,boh); }
|
392 |
#define mi_test_if_nod(x) (x[0] & 128 ? info->s->base.key_reflength : 0)
|
|
393 |
#define mi_report_crashed(A, B) _mi_report_crashed((A), (B), __FILE__, __LINE__)
|
|
394 |
#define mi_mark_crashed(x) do{(x)->s->state.changed|= STATE_CRASHED; \
|
|
395 |
mi_report_crashed((x), 0); \
|
|
396 |
}while(0)
|
|
397 |
#define mi_mark_crashed_on_repair(x) do{(x)->s->state.changed|= \
|
|
398 |
STATE_CRASHED|STATE_CRASHED_ON_REPAIR; \
|
|
399 |
(x)->update|= HA_STATE_CHANGED; \
|
|
400 |
}while(0)
|
|
401 |
#define mi_is_crashed(x) ((x)->s->state.changed & STATE_CRASHED)
|
|
402 |
#define mi_is_crashed_on_repair(x) ((x)->s->state.changed & STATE_CRASHED_ON_REPAIR)
|
|
403 |
#define mi_print_error(SHARE, ERRNO) \
|
|
404 |
mi_report_error((ERRNO), (SHARE)->index_file_name)
|
|
405 |
||
406 |
/* Functions to store length of space packed keys, VARCHAR or BLOB keys */
|
|
407 |
||
408 |
#define store_key_length(key,length) \
|
|
409 |
{ if ((length) < 255) \
|
|
410 |
{ *(key)=(length); } \
|
|
411 |
else \
|
|
412 |
{ *(key)=255; mi_int2store((key)+1,(length)); } \
|
|
413 |
}
|
|
414 |
||
415 |
#define get_key_full_length(length,key) \
|
|
481
by Brian Aker
Remove all of uchar. |
416 |
{ if ((unsigned char) *(key) != 255) \
|
417 |
length= ((uint) (unsigned char) *((key)++))+1; \
|
|
1
by brian
clean slate |
418 |
else \
|
419 |
{ length=mi_uint2korr((key)+1)+3; (key)+=3; } \
|
|
420 |
}
|
|
421 |
||
422 |
#define get_key_full_length_rdonly(length,key) \
|
|
481
by Brian Aker
Remove all of uchar. |
423 |
{ if ((unsigned char) *(key) != 255) \
|
424 |
length= ((uint) (unsigned char) *((key)))+1; \
|
|
1
by brian
clean slate |
425 |
else \
|
426 |
{ length=mi_uint2korr((key)+1)+3; } \
|
|
427 |
}
|
|
428 |
||
429 |
#define get_pack_length(length) ((length) >= 255 ? 3 : 1)
|
|
430 |
||
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)))
|
|
205
by Brian Aker
uint32 -> uin32_t |
442 |
#define MI_REC_BUFF_OFFSET ALIGN_SIZE(MI_DYN_DELETE_BLOCK_HEADER+sizeof(uint32_t))
|
1
by brian
clean slate |
443 |
|
444 |
#define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for file */ |
|
445 |
||
446 |
#define PACK_TYPE_SELECTED 1 /* Bits in field->pack_type */ |
|
447 |
#define PACK_TYPE_SPACE_FIELDS 2
|
|
448 |
#define PACK_TYPE_ZERO_FILL 4
|
|
449 |
#define MI_FOUND_WRONG_KEY 32738 /* Impossible value from ha_key_cmp */ |
|
450 |
||
451 |
#define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_MIN_KEY_BLOCK_LENGTH)
|
|
452 |
#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))
|
|
453 |
#define MI_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */ |
|
454 |
#define MI_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */ |
|
455 |
||
456 |
#define MI_MIN_SIZE_BULK_INSERT_TREE 16384 /* this is per key */ |
|
457 |
#define MI_MIN_ROWS_TO_USE_BULK_INSERT 100
|
|
458 |
#define MI_MIN_ROWS_TO_DISABLE_INDEXES 100
|
|
459 |
#define MI_MIN_ROWS_TO_USE_WRITE_CACHE 10
|
|
460 |
||
461 |
/* The UNIQUE check is done with a hashed long key */
|
|
462 |
||
463 |
#define MI_UNIQUE_HASH_TYPE HA_KEYTYPE_ULONG_INT
|
|
464 |
#define mi_unique_store(A,B) mi_int4store((A),(B))
|
|
465 |
||
1703.1.3
by Brian Aker
Replace pthread mutex with boost based one for myisam. |
466 |
extern boost::mutex THR_LOCK_myisam; |
1
by brian
clean slate |
467 |
|
468 |
/* Some extern variables */
|
|
469 |
||
916.1.32
by Padraig O'Sullivan
Refactoring MyISAM storage engine again based on LIST replacement with |
470 |
extern std::list<MI_INFO *> myisam_open_list; |
481
by Brian Aker
Remove all of uchar. |
471 |
extern unsigned char myisam_file_magic[], myisam_pack_file_magic[]; |
482
by Brian Aker
Remove uint. |
472 |
extern uint32_t myisam_read_vec[], myisam_readnext_vec[]; |
473 |
extern uint32_t myisam_quick_table_bits; |
|
1
by brian
clean slate |
474 |
extern ulong myisam_pid; |
475 |
||
476 |
/* This is used by _mi_calc_xxx_key_length och _mi_store_key */
|
|
477 |
||
478 |
typedef struct st_mi_s_param |
|
479 |
{
|
|
480 |
uint ref_length,key_length, |
|
481 |
n_ref_length, |
|
482 |
n_length, |
|
483 |
totlength, |
|
484 |
part_of_prev_key,prev_length,pack_marker; |
|
481
by Brian Aker
Remove all of uchar. |
485 |
unsigned char *key, *prev_key,*next_key_pos; |
281
by Brian Aker
Converted myisam away from my_bool |
486 |
bool store_not_null; |
1
by brian
clean slate |
487 |
} MI_KEY_PARAM; |
488 |
||
489 |
/* Prototypes for intern functions */
|
|
490 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
491 |
extern int _mi_read_dynamic_record(MI_INFO *info,drizzled::internal::my_off_t filepos,unsigned char *buf); |
481
by Brian Aker
Remove all of uchar. |
492 |
extern int _mi_write_dynamic_record(MI_INFO*, const unsigned char*); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
493 |
extern int _mi_update_dynamic_record(MI_INFO*, drizzled::internal::my_off_t, const unsigned char*); |
1
by brian
clean slate |
494 |
extern int _mi_delete_dynamic_record(MI_INFO *info); |
481
by Brian Aker
Remove all of uchar. |
495 |
extern int _mi_cmp_dynamic_record(MI_INFO *info,const unsigned char *record); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
496 |
extern int _mi_read_rnd_dynamic_record(MI_INFO *, unsigned char *,drizzled::internal::my_off_t, bool); |
481
by Brian Aker
Remove all of uchar. |
497 |
extern int _mi_write_blob_record(MI_INFO*, const unsigned char*); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
498 |
extern int _mi_update_blob_record(MI_INFO*, drizzled::internal::my_off_t, const unsigned char*); |
499 |
extern int _mi_read_static_record(MI_INFO *info, drizzled::internal::my_off_t filepos,unsigned char *buf); |
|
481
by Brian Aker
Remove all of uchar. |
500 |
extern int _mi_write_static_record(MI_INFO*, const unsigned char*); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
501 |
extern int _mi_update_static_record(MI_INFO*, drizzled::internal::my_off_t, const unsigned char*); |
1
by brian
clean slate |
502 |
extern int _mi_delete_static_record(MI_INFO *info); |
481
by Brian Aker
Remove all of uchar. |
503 |
extern int _mi_cmp_static_record(MI_INFO *info,const unsigned char *record); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
504 |
extern int _mi_read_rnd_static_record(MI_INFO*, unsigned char *,drizzled::internal::my_off_t, bool); |
482
by Brian Aker
Remove uint. |
505 |
extern int _mi_ck_write(MI_INFO *info,uint32_t keynr,unsigned char *key,uint32_t length); |
1
by brian
clean slate |
506 |
extern int _mi_ck_real_write_btree(MI_INFO *info, MI_KEYDEF *keyinfo, |
482
by Brian Aker
Remove uint. |
507 |
unsigned char *key, uint32_t key_length, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
508 |
drizzled::internal::my_off_t *root, uint32_t comp_flag); |
509 |
extern int _mi_enlarge_root(MI_INFO *info,MI_KEYDEF *keyinfo,unsigned char *key, drizzled::internal::my_off_t *root); |
|
481
by Brian Aker
Remove all of uchar. |
510 |
extern int _mi_insert(MI_INFO *info,MI_KEYDEF *keyinfo,unsigned char *key, |
511 |
unsigned char *anc_buff,unsigned char *key_pos,unsigned char *key_buff, |
|
512 |
unsigned char *father_buff, unsigned char *father_keypos, |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
513 |
drizzled::internal::my_off_t father_page, bool insert_last); |
481
by Brian Aker
Remove all of uchar. |
514 |
extern int _mi_split_page(MI_INFO *info,MI_KEYDEF *keyinfo,unsigned char *key, |
515 |
unsigned char *buff,unsigned char *key_buff, bool insert_last); |
|
482
by Brian Aker
Remove uint. |
516 |
extern unsigned char *_mi_find_half_pos(uint32_t nod_flag,MI_KEYDEF *keyinfo,unsigned char *page, |
517 |
unsigned char *key,uint32_t *return_key_length, |
|
481
by Brian Aker
Remove all of uchar. |
518 |
unsigned char **after_key); |
482
by Brian Aker
Remove uint. |
519 |
extern int _mi_calc_static_key_length(MI_KEYDEF *keyinfo,uint32_t nod_flag, |
481
by Brian Aker
Remove all of uchar. |
520 |
unsigned char *key_pos, unsigned char *org_key, |
521 |
unsigned char *key_buff, |
|
522 |
unsigned char *key, MI_KEY_PARAM *s_temp); |
|
482
by Brian Aker
Remove uint. |
523 |
extern int _mi_calc_var_key_length(MI_KEYDEF *keyinfo,uint32_t nod_flag, |
481
by Brian Aker
Remove all of uchar. |
524 |
unsigned char *key_pos, unsigned char *org_key, |
525 |
unsigned char *key_buff, |
|
526 |
unsigned char *key, MI_KEY_PARAM *s_temp); |
|
482
by Brian Aker
Remove uint. |
527 |
extern int _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint32_t nod_flag, |
481
by Brian Aker
Remove all of uchar. |
528 |
unsigned char *key_pos, unsigned char *org_key, |
529 |
unsigned char *prev_key, |
|
530 |
unsigned char *key, MI_KEY_PARAM *s_temp); |
|
482
by Brian Aker
Remove uint. |
531 |
extern int _mi_calc_bin_pack_key_length(MI_KEYDEF *keyinfo,uint32_t nod_flag, |
481
by Brian Aker
Remove all of uchar. |
532 |
unsigned char *key_pos,unsigned char *org_key, |
533 |
unsigned char *prev_key, |
|
534 |
unsigned char *key, MI_KEY_PARAM *s_temp); |
|
535 |
void _mi_store_static_key(MI_KEYDEF *keyinfo, unsigned char *key_pos, |
|
1
by brian
clean slate |
536 |
MI_KEY_PARAM *s_temp); |
481
by Brian Aker
Remove all of uchar. |
537 |
void _mi_store_var_pack_key(MI_KEYDEF *keyinfo, unsigned char *key_pos, |
1
by brian
clean slate |
538 |
MI_KEY_PARAM *s_temp); |
539 |
#ifdef NOT_USED
|
|
481
by Brian Aker
Remove all of uchar. |
540 |
void _mi_store_pack_key(MI_KEYDEF *keyinfo, unsigned char *key_pos, |
1
by brian
clean slate |
541 |
MI_KEY_PARAM *s_temp); |
542 |
#endif
|
|
481
by Brian Aker
Remove all of uchar. |
543 |
void _mi_store_bin_pack_key(MI_KEYDEF *keyinfo, unsigned char *key_pos, |
1
by brian
clean slate |
544 |
MI_KEY_PARAM *s_temp); |
545 |
||
482
by Brian Aker
Remove uint. |
546 |
extern int _mi_ck_delete(MI_INFO *info,uint32_t keynr,unsigned char *key,uint32_t key_length); |
598.1.1
by Super-User
Fixed solaris build crap. |
547 |
int _mi_readinfo(MI_INFO *info,int lock_flag,int check_keybuffer); |
482
by Brian Aker
Remove uint. |
548 |
extern int _mi_writeinfo(MI_INFO *info,uint32_t options); |
1
by brian
clean slate |
549 |
extern int _mi_test_if_changed(MI_INFO *info); |
550 |
extern int _mi_mark_file_changed(MI_INFO *info); |
|
551 |
extern int _mi_decrement_open_count(MI_INFO *info); |
|
552 |
extern int _mi_check_index(MI_INFO *info,int inx); |
|
482
by Brian Aker
Remove uint. |
553 |
extern int _mi_search(MI_INFO *info,MI_KEYDEF *keyinfo,unsigned char *key,uint32_t key_len, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
554 |
uint32_t nextflag,drizzled::internal::my_off_t pos); |
1
by brian
clean slate |
555 |
extern int _mi_bin_search(struct st_myisam_info *info,MI_KEYDEF *keyinfo, |
482
by Brian Aker
Remove uint. |
556 |
unsigned char *page,unsigned char *key,uint32_t key_len,uint32_t comp_flag, |
481
by Brian Aker
Remove all of uchar. |
557 |
unsigned char * *ret_pos,unsigned char *buff, bool *was_last_key); |
558 |
extern int _mi_seq_search(MI_INFO *info,MI_KEYDEF *keyinfo,unsigned char *page, |
|
482
by Brian Aker
Remove uint. |
559 |
unsigned char *key,uint32_t key_len,uint32_t comp_flag, |
481
by Brian Aker
Remove all of uchar. |
560 |
unsigned char **ret_pos,unsigned char *buff, bool *was_last_key); |
561 |
extern int _mi_prefix_search(MI_INFO *info,MI_KEYDEF *keyinfo,unsigned char *page, |
|
482
by Brian Aker
Remove uint. |
562 |
unsigned char *key,uint32_t key_len,uint32_t comp_flag, |
481
by Brian Aker
Remove all of uchar. |
563 |
unsigned char **ret_pos,unsigned char *buff, bool *was_last_key); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
564 |
extern drizzled::internal::my_off_t _mi_kpos(uint32_t nod_flag,unsigned char *after_key); |
565 |
extern void _mi_kpointer(MI_INFO *info,unsigned char *buff,drizzled::internal::my_off_t pos); |
|
566 |
extern drizzled::internal::my_off_t _mi_dpos(MI_INFO *info, uint32_t nod_flag,unsigned char *after_key); |
|
567 |
extern drizzled::internal::my_off_t _mi_rec_pos(MYISAM_SHARE *info, unsigned char *ptr); |
|
568 |
void _mi_dpointer(MI_INFO *info, unsigned char *buff,drizzled::internal::my_off_t pos); |
|
482
by Brian Aker
Remove uint. |
569 |
extern uint32_t _mi_get_static_key(MI_KEYDEF *keyinfo,uint32_t nod_flag,unsigned char * *page, |
481
by Brian Aker
Remove all of uchar. |
570 |
unsigned char *key); |
482
by Brian Aker
Remove uint. |
571 |
extern uint32_t _mi_get_pack_key(MI_KEYDEF *keyinfo,uint32_t nod_flag,unsigned char * *page, |
481
by Brian Aker
Remove all of uchar. |
572 |
unsigned char *key); |
482
by Brian Aker
Remove uint. |
573 |
extern uint32_t _mi_get_binary_pack_key(MI_KEYDEF *keyinfo, uint32_t nod_flag, |
481
by Brian Aker
Remove all of uchar. |
574 |
unsigned char **page_pos, unsigned char *key); |
575 |
extern unsigned char *_mi_get_last_key(MI_INFO *info,MI_KEYDEF *keyinfo,unsigned char *keypos, |
|
576 |
unsigned char *lastkey,unsigned char *endpos, |
|
482
by Brian Aker
Remove uint. |
577 |
uint32_t *return_key_length); |
481
by Brian Aker
Remove all of uchar. |
578 |
extern unsigned char *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, unsigned char *page, |
482
by Brian Aker
Remove uint. |
579 |
unsigned char *key, unsigned char *keypos, uint32_t *return_key_length); |
580 |
extern uint32_t _mi_keylength(MI_KEYDEF *keyinfo,unsigned char *key); |
|
581 |
extern uint32_t _mi_keylength_part(MI_KEYDEF *keyinfo, register unsigned char *key, |
|
1
by brian
clean slate |
582 |
HA_KEYSEG *end); |
481
by Brian Aker
Remove all of uchar. |
583 |
extern unsigned char *_mi_move_key(MI_KEYDEF *keyinfo,unsigned char *to,unsigned char *from); |
584 |
extern int _mi_search_next(MI_INFO *info,MI_KEYDEF *keyinfo,unsigned char *key, |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
585 |
uint32_t key_length,uint32_t nextflag,drizzled::internal::my_off_t pos); |
586 |
extern int _mi_search_first(MI_INFO *info,MI_KEYDEF *keyinfo,drizzled::internal::my_off_t pos); |
|
587 |
extern int _mi_search_last(MI_INFO *info,MI_KEYDEF *keyinfo,drizzled::internal::my_off_t pos); |
|
588 |
extern unsigned char *_mi_fetch_keypage(MI_INFO *info,MI_KEYDEF *keyinfo,drizzled::internal::my_off_t page, |
|
481
by Brian Aker
Remove all of uchar. |
589 |
int level,unsigned char *buff,int return_buffer); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
590 |
extern int _mi_write_keypage(MI_INFO *info,MI_KEYDEF *keyinfo,drizzled::internal::my_off_t page, |
481
by Brian Aker
Remove all of uchar. |
591 |
int level, unsigned char *buff); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
592 |
extern int _mi_dispose(MI_INFO *info,MI_KEYDEF *keyinfo,drizzled::internal::my_off_t pos, |
1
by brian
clean slate |
593 |
int level); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
594 |
extern drizzled::internal::my_off_t _mi_new(MI_INFO *info,MI_KEYDEF *keyinfo,int level); |
482
by Brian Aker
Remove uint. |
595 |
extern uint32_t _mi_make_key(MI_INFO *info,uint32_t keynr,unsigned char *key, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
596 |
const unsigned char *record,drizzled::internal::my_off_t filepos); |
482
by Brian Aker
Remove uint. |
597 |
extern uint32_t _mi_pack_key(register MI_INFO *info, uint32_t keynr, unsigned char *key, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
598 |
unsigned char *old, drizzled::key_part_map keypart_map, |
1
by brian
clean slate |
599 |
HA_KEYSEG **last_used_keyseg); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
600 |
extern int _mi_read_key_record(MI_INFO *info,drizzled::internal::my_off_t filepos,unsigned char *buf); |
2296.1.1
by Mark Atwood
Merge in Fixes of Brian's IOCACHE. |
601 |
extern int _mi_read_cache(drizzled::internal::io_cache_st *info,unsigned char *buff,drizzled::internal::my_off_t pos, |
482
by Brian Aker
Remove uint. |
602 |
uint32_t length,int re_read_if_possibly); |
481
by Brian Aker
Remove all of uchar. |
603 |
extern uint64_t retrieve_auto_increment(MI_INFO *info,const unsigned char *record); |
1
by brian
clean slate |
604 |
|
656.1.39
by Monty Taylor
Removed my_seek, my_tell, my_fwrite, my_fseek. |
605 |
unsigned char *mi_alloc_rec_buff(MI_INFO *info, size_t length, unsigned char **buf); |
1
by brian
clean slate |
606 |
#define mi_get_rec_buff_ptr(info,buf) \
|
607 |
((((info)->s->options & HA_OPTION_PACK_RECORD) && (buf)) ? \
|
|
608 |
(buf) - MI_REC_BUFF_OFFSET : (buf))
|
|
609 |
#define mi_get_rec_buff_len(info,buf) \
|
|
205
by Brian Aker
uint32 -> uin32_t |
610 |
(*((uint32_t *)(mi_get_rec_buff_ptr(info,buf))))
|
1
by brian
clean slate |
611 |
|
481
by Brian Aker
Remove all of uchar. |
612 |
extern ulong _mi_rec_unpack(MI_INFO *info,unsigned char *to,unsigned char *from, |
1
by brian
clean slate |
613 |
ulong reclength); |
481
by Brian Aker
Remove all of uchar. |
614 |
extern bool _mi_rec_check(MI_INFO *info,const unsigned char *record, unsigned char *packpos, |
281
by Brian Aker
Converted myisam away from my_bool |
615 |
ulong packed_length, bool with_checkum); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
616 |
extern int _mi_write_part_record(MI_INFO *info,drizzled::internal::my_off_t filepos,ulong length, |
617 |
drizzled::internal::my_off_t next_filepos,unsigned char **record, |
|
1
by brian
clean slate |
618 |
ulong *reclength,int *flag); |
481
by Brian Aker
Remove all of uchar. |
619 |
extern void _mi_print_key(FILE *stream,HA_KEYSEG *keyseg,const unsigned char *key, |
482
by Brian Aker
Remove uint. |
620 |
uint32_t length); |
281
by Brian Aker
Converted myisam away from my_bool |
621 |
extern bool _mi_read_pack_info(MI_INFO *info,bool fix_keys); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
622 |
extern int _mi_read_pack_record(MI_INFO *info,drizzled::internal::my_off_t filepos,unsigned char *buf); |
623 |
extern int _mi_read_rnd_pack_record(MI_INFO*, unsigned char *,drizzled::internal::my_off_t, bool); |
|
1
by brian
clean slate |
624 |
extern int _mi_pack_rec_unpack(MI_INFO *info, MI_BIT_BUFF *bit_buff, |
481
by Brian Aker
Remove all of uchar. |
625 |
unsigned char *to, unsigned char *from, ulong reclength); |
1
by brian
clean slate |
626 |
|
627 |
struct st_sort_info; |
|
628 |
||
629 |
||
630 |
typedef struct st_mi_block_info { /* Parameter to _mi_get_block_info */ |
|
481
by Brian Aker
Remove all of uchar. |
631 |
unsigned char header[MI_BLOCK_INFO_HEADER_LENGTH]; |
1
by brian
clean slate |
632 |
ulong rec_len; |
633 |
ulong data_len; |
|
634 |
ulong block_len; |
|
635 |
ulong blob_len; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
636 |
drizzled::internal::my_off_t filepos; |
637 |
drizzled::internal::my_off_t next_filepos; |
|
638 |
drizzled::internal::my_off_t prev_filepos; |
|
482
by Brian Aker
Remove uint. |
639 |
uint32_t second_read; |
640 |
uint32_t offset; |
|
1
by brian
clean slate |
641 |
} MI_BLOCK_INFO; |
642 |
||
643 |
/* bits in return from _mi_get_block_info */
|
|
644 |
||
645 |
#define BLOCK_FIRST 1
|
|
646 |
#define BLOCK_LAST 2
|
|
647 |
#define BLOCK_DELETED 4
|
|
648 |
#define BLOCK_ERROR 8 /* Wrong data */ |
|
649 |
#define BLOCK_SYNC_ERROR 16 /* Right data at wrong place */ |
|
650 |
#define BLOCK_FATAL_ERROR 32 /* hardware-error */ |
|
651 |
||
652 |
#define NEED_MEM ((uint) 10*4*(IO_SIZE+32)+32) /* Nead for recursion */ |
|
653 |
#define MAXERR 20
|
|
654 |
#define BUFFERS_WHEN_SORTING 16 /* Alloc for sort-key-tree */ |
|
1183.4.3
by Stewart Smith
remove MY_HOW_OFTEN_TO_WRITE. Think this was a leftover from unireg. MyISAM has a 'how often to write' define that is defined to this, just put the value directly in myisamdef.h |
655 |
#define WRITE_COUNT 1000
|
1
by brian
clean slate |
656 |
#define INDEX_TMP_EXT ".TMM"
|
657 |
#define DATA_TMP_EXT ".TMD"
|
|
658 |
||
659 |
#define UPDATE_TIME 1
|
|
660 |
#define UPDATE_STAT 2
|
|
661 |
#define UPDATE_SORT 4
|
|
662 |
#define UPDATE_AUTO_INC 8
|
|
663 |
#define UPDATE_OPEN_COUNT 16
|
|
664 |
||
665 |
#define USE_BUFFER_INIT (((1024L*512L-MALLOC_OVERHEAD)/IO_SIZE)*IO_SIZE)
|
|
666 |
#define READ_BUFFER_INIT (1024L*256L-MALLOC_OVERHEAD)
|
|
667 |
#define SORT_BUFFER_INIT (2048L*1024L-MALLOC_OVERHEAD)
|
|
668 |
#define MIN_SORT_BUFFER (4096-MALLOC_OVERHEAD)
|
|
669 |
||
670 |
#define fast_mi_writeinfo(INFO) if (!(INFO)->s->tot_locks) (void) _mi_writeinfo((INFO),0)
|
|
671 |
#define fast_mi_readinfo(INFO) ((INFO)->lock_type == F_UNLCK) && _mi_readinfo((INFO),F_RDLCK,1)
|
|
672 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
673 |
extern uint32_t _mi_get_block_info(MI_BLOCK_INFO *,int, drizzled::internal::my_off_t); |
482
by Brian Aker
Remove uint. |
674 |
extern uint32_t _mi_rec_pack(MI_INFO *info,unsigned char *to,const unsigned char *from); |
675 |
extern uint32_t _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, |
|
481
by Brian Aker
Remove all of uchar. |
676 |
MI_BLOCK_INFO *info, unsigned char **rec_buff_p, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
677 |
int file, drizzled::internal::my_off_t filepos); |
482
by Brian Aker
Remove uint. |
678 |
extern void _my_store_blob_length(unsigned char *pos,uint32_t pack_length,uint32_t length); |
1
by brian
clean slate |
679 |
extern void mi_report_error(int errcode, const char *file_name); |
2054.1.2
by Brian Aker
Rename of the Loooongggggg error type over to simply drizzled::error_t |
680 |
extern void mi_report_error(drizzled::error_t errcode, const char *file_name); |
481
by Brian Aker
Remove all of uchar. |
681 |
extern size_t mi_mmap_pread(MI_INFO *info, unsigned char *Buffer, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
682 |
size_t Count, drizzled::internal::my_off_t offset, drizzled::myf MyFlags); |
481
by Brian Aker
Remove all of uchar. |
683 |
extern size_t mi_mmap_pwrite(MI_INFO *info, const unsigned char *Buffer, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
684 |
size_t Count, drizzled::internal::my_off_t offset, drizzled::myf MyFlags); |
481
by Brian Aker
Remove all of uchar. |
685 |
extern size_t mi_nommap_pread(MI_INFO *info, unsigned char *Buffer, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
686 |
size_t Count, drizzled::internal::my_off_t offset, drizzled::myf MyFlags); |
481
by Brian Aker
Remove all of uchar. |
687 |
extern size_t mi_nommap_pwrite(MI_INFO *info, const unsigned char *Buffer, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
688 |
size_t Count, drizzled::internal::my_off_t offset, drizzled::myf MyFlags); |
1
by brian
clean slate |
689 |
|
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
690 |
uint32_t mi_state_info_write(int file, MI_STATE_INFO *state, uint32_t pWrite); |
691 |
uint32_t mi_state_info_read_dsk(int file, MI_STATE_INFO *state, bool pRead); |
|
692 |
uint32_t mi_base_info_write(int file, MI_BASE_INFO *base); |
|
693 |
int mi_keyseg_write(int file, const HA_KEYSEG *keyseg); |
|
694 |
uint32_t mi_keydef_write(int file, MI_KEYDEF *keydef); |
|
695 |
uint32_t mi_uniquedef_write(int file, MI_UNIQUEDEF *keydef); |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
696 |
uint32_t mi_recinfo_write(int file, drizzled::MI_COLUMNDEF *recinfo); |
1
by brian
clean slate |
697 |
extern int mi_disable_indexes(MI_INFO *info); |
698 |
extern int mi_enable_indexes(MI_INFO *info); |
|
699 |
extern int mi_indexes_are_disabled(MI_INFO *info); |
|
481
by Brian Aker
Remove all of uchar. |
700 |
ulong _my_calc_total_blob_length(MI_INFO *info, const unsigned char *record); |
2241.4.37
by Stewart Smith
remove the drizzled::internal namespace prefix from teh typedef for ha_checksum - it's just for myisam now |
701 |
ha_checksum mi_checksum(MI_INFO *info, const unsigned char *buf); |
702 |
ha_checksum mi_static_checksum(MI_INFO *info, const unsigned char *buf); |
|
481
by Brian Aker
Remove all of uchar. |
703 |
bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, unsigned char *record, |
2241.4.37
by Stewart Smith
remove the drizzled::internal namespace prefix from teh typedef for ha_checksum - it's just for myisam now |
704 |
ha_checksum unique_hash, drizzled::internal::my_off_t pos); |
705 |
ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const unsigned char *buf); |
|
1
by brian
clean slate |
706 |
int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
707 |
const unsigned char *record, drizzled::internal::my_off_t pos); |
1
by brian
clean slate |
708 |
int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
709 |
const unsigned char *record, drizzled::internal::my_off_t pos); |
481
by Brian Aker
Remove all of uchar. |
710 |
int mi_unique_comp(MI_UNIQUEDEF *def, const unsigned char *a, const unsigned char *b, |
281
by Brian Aker
Converted myisam away from my_bool |
711 |
bool null_are_equal); |
1
by brian
clean slate |
712 |
|
713 |
extern MI_INFO *test_if_reopen(char *filename); |
|
281
by Brian Aker
Converted myisam away from my_bool |
714 |
bool check_table_is_closed(const char *name, const char *where); |
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
715 |
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, int file_to_dup); |
1
by brian
clean slate |
716 |
int mi_open_keyfile(MYISAM_SHARE *share); |
717 |
void mi_setup_functions(register MYISAM_SHARE *share); |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
718 |
bool mi_dynmap_file(MI_INFO *info, drizzled::internal::my_off_t size); |
719 |
void mi_remap_file(MI_INFO *info, drizzled::internal::my_off_t size); |
|
1
by brian
clean slate |
720 |
|
482
by Brian Aker
Remove uint. |
721 |
int mi_check_index_cond(register MI_INFO *info, uint32_t keynr, unsigned char *record); |
1
by brian
clean slate |
722 |
|
723 |
/* Functions needed by mi_check */
|
|
724 |
volatile int *killed_ptr(MI_CHECK *param); |
|
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
725 |
void mi_check_print_error(MI_CHECK *param, const char *fmt,...); |
726 |
void mi_check_print_warning(MI_CHECK *param, const char *fmt,...); |
|
727 |
void mi_check_print_info(MI_CHECK *param, const char *fmt,...); |
|
1
by brian
clean slate |
728 |
int flush_pending_blocks(MI_SORT_PARAM *param); |
729 |
int thr_write_keys(MI_SORT_PARAM *sort_param); |
|
730 |
||
731 |
int sort_write_record(MI_SORT_PARAM *sort_param); |
|
629.4.1
by Monty Taylor
First step in support size_t sys_var stuff. |
732 |
int _create_index_by_sort(MI_SORT_PARAM *info,bool no_messages, size_t); |
1
by brian
clean slate |
733 |
|
734 |
extern void mi_set_index_cond_func(MI_INFO *info, index_cond_func_t func, |
|
735 |
void *func_arg); |
|
36
by Brian Aker
Moved pread over to just supporting myisam (someone can refactor from here |
736 |
/* Just for myisam legacy */
|
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
737 |
extern size_t my_pwrite(int Filedes,const unsigned char *Buffer,size_t Count, |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
738 |
drizzled::internal::my_off_t offset,drizzled::myf MyFlags); |
739 |
extern size_t my_pread(int Filedes,unsigned char *Buffer,size_t Count,drizzled::internal::my_off_t offset, |
|
740 |
drizzled::myf MyFlags); |
|
77
by Brian Aker
Resolved merge from Monty |
741 |
|
742 |
/* Needed for handler */
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
743 |
void mi_disable_non_unique_index(MI_INFO *info, drizzled::ha_rows rows); |
779.1.28
by Monty Taylor
More __attribute__ removal. |
744 |
void _mi_report_crashed(MI_INFO *file, const char *message, const char *sfile, |
745 |
uint32_t sline); |
|
51.1.127
by Monty Taylor
Fixed the _mi_report_crashed warning (and a couple of others) |
746 |
|
2241.4.28
by Stewart Smith
move DFLT_INIT_HITS define to myisam_priv.h - only used by myisam |
747 |
|
748 |
#define DFLT_INIT_HITS 3
|