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