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