~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to include/myisam.h

  • Committer: Stewart Smith
  • Date: 2008-07-13 06:56:15 UTC
  • mto: (210.1.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 211.
  • Revision ID: stewart@flamingspork.com-20080713065615-vzok75kgnnviokl9
Move MD5() into a UDF

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
/* This file should be included when using myisam_funktions */
17
17
 
18
 
#ifndef PLUGIN_MYISAM_MYISAM_H
19
 
#define PLUGIN_MYISAM_MYISAM_H
20
 
 
21
 
#include <drizzled/key_map.h>
22
 
 
23
 
#include <drizzled/base.h>
 
18
#ifndef _myisam_h
 
19
#define _myisam_h
 
20
#ifdef  __cplusplus
 
21
extern "C" {
 
22
#endif
 
23
 
 
24
#ifndef _my_base_h
 
25
#include <my_base.h>
 
26
#endif
24
27
#ifndef _m_ctype_h
25
 
#include "drizzled/charset_info.h"
 
28
#include <m_ctype.h>
26
29
#endif
27
30
#ifndef _keycache_h
28
31
#include "keycache.h"
29
32
#endif
30
 
#include <plugin/myisam/my_handler.h>
31
 
#include "drizzled/internal/iocache.h"
 
33
#include "my_handler.h"
 
34
#include <mysql/plugin.h>
32
35
 
33
36
/*
34
37
  Limit max keys according to HA_MAX_POSSIBLE_KEY
68
71
  This means that clearing of high keys is ignored, setting one high key
69
72
  sets all high keys.
70
73
*/
71
 
#define MI_KEYMAP_BITS      (64)
72
 
#define MI_KEYMAP_HIGH_MASK (1UL << (MI_KEYMAP_BITS - 1))
 
74
#define MI_KEYMAP_BITS      (8 * SIZEOF_LONG_LONG)
 
75
#define MI_KEYMAP_HIGH_MASK (1ULL << (MI_KEYMAP_BITS - 1))
73
76
#define mi_get_mask_all_keys_active(_keys_) \
74
77
                            (((_keys_) < MI_KEYMAP_BITS) ? \
75
 
                             ((1UL << (_keys_)) - 1UL) : \
76
 
                             (~ 0UL))
 
78
                             ((1ULL << (_keys_)) - 1ULL) : \
 
79
                             (~ 0ULL))
77
80
 
78
81
#if MI_MAX_KEY > MI_KEYMAP_BITS
79
82
 
80
83
#define mi_is_key_active(_keymap_,_keyno_) \
81
84
                            (((_keyno_) < MI_KEYMAP_BITS) ? \
82
 
                             test((_keymap_) & (1UL << (_keyno_))) : \
 
85
                             test((_keymap_) & (1ULL << (_keyno_))) : \
83
86
                             test((_keymap_) & MI_KEYMAP_HIGH_MASK))
84
87
#define mi_set_key_active(_keymap_,_keyno_) \
85
88
                            (_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \
86
 
                                          (1UL << (_keyno_)) : \
 
89
                                          (1ULL << (_keyno_)) : \
87
90
                                          MI_KEYMAP_HIGH_MASK)
88
91
#define mi_clear_key_active(_keymap_,_keyno_) \
89
92
                            (_keymap_)&= (((_keyno_) < MI_KEYMAP_BITS) ? \
90
 
                                          (~ (1UL << (_keyno_))) : \
91
 
                                          (~ (0UL)) /*ignore*/ )
 
93
                                          (~ (1ULL << (_keyno_))) : \
 
94
                                          (~ (0ULL)) /*ignore*/ )
92
95
 
93
96
#else
94
97
 
95
98
#define mi_is_key_active(_keymap_,_keyno_) \
96
 
                            test((_keymap_) & (1UL << (_keyno_)))
 
99
                            test((_keymap_) & (1ULL << (_keyno_)))
97
100
#define mi_set_key_active(_keymap_,_keyno_) \
98
 
                            (_keymap_)|= (1UL << (_keyno_))
 
101
                            (_keymap_)|= (1ULL << (_keyno_))
99
102
#define mi_clear_key_active(_keymap_,_keyno_) \
100
 
                            (_keymap_)&= (~ (1UL << (_keyno_)))
 
103
                            (_keymap_)&= (~ (1ULL << (_keyno_)))
101
104
 
102
105
#endif
103
106
 
122
125
 
123
126
typedef struct st_mi_isaminfo           /* Struct from h_info */
124
127
{
125
 
  drizzled::ha_rows records;                    /* Records in database */
126
 
  drizzled::ha_rows deleted;                    /* Deleted records in database */
127
 
  drizzled::internal::my_off_t recpos;                  /* Pos for last used record */
128
 
  drizzled::internal::my_off_t newrecpos;                       /* Pos if we write new record */
129
 
  drizzled::internal::my_off_t dupp_key_pos;            /* Position to record with dupp key */
130
 
  drizzled::internal::my_off_t data_file_length,                /* Length of data file */
 
128
  ha_rows records;                      /* Records in database */
 
129
  ha_rows deleted;                      /* Deleted records in database */
 
130
  my_off_t recpos;                      /* Pos for last used record */
 
131
  my_off_t newrecpos;                   /* Pos if we write new record */
 
132
  my_off_t dupp_key_pos;                /* Position to record with dupp key */
 
133
  my_off_t data_file_length,            /* Length of data file */
131
134
           max_data_file_length,
132
135
           index_file_length,
133
136
           max_index_file_length,
134
137
           delete_length;
135
138
  ulong reclength;                      /* Recordlength */
136
139
  ulong mean_reclength;                 /* Mean recordlength (if packed) */
137
 
  uint64_t auto_increment;
138
 
  uint64_t key_map;                     /* Which keys are used */
 
140
  ulonglong auto_increment;
 
141
  ulonglong key_map;                    /* Which keys are used */
139
142
  char  *data_file_name, *index_file_name;
140
 
  uint32_t  keys;                               /* Number of keys in use */
 
143
  uint  keys;                           /* Number of keys in use */
141
144
  uint  options;                        /* HA_OPTION_... used */
142
145
  int   errkey,                         /* With key was dupplicated on err */
143
146
        sortkey;                        /* clustered by this key */
144
 
  int   filenr;                         /* (uniq) filenr for datafile */
 
147
  File  filenr;                         /* (uniq) filenr for datafile */
145
148
  time_t create_time;                   /* When table was created */
146
149
  time_t check_time;
147
150
  time_t update_time;
148
 
  uint32_t  reflength;
 
151
  uint  reflength;
149
152
  ulong record_offset;
150
153
  ulong *rec_per_key;                   /* for sql optimizing */
151
154
} MI_ISAMINFO;
154
157
typedef struct st_mi_create_info
155
158
{
156
159
  const char *index_file_name, *data_file_name; /* If using symlinks */
157
 
  drizzled::ha_rows max_rows;
158
 
  drizzled::ha_rows reloc_rows;
159
 
  uint64_t auto_increment;
160
 
  uint64_t data_file_length;
161
 
  uint64_t key_file_length;
162
 
  uint32_t old_options;
163
 
  uint8_t language;
164
 
  bool with_auto_increment;
 
160
  ha_rows max_rows;
 
161
  ha_rows reloc_rows;
 
162
  ulonglong auto_increment;
 
163
  ulonglong data_file_length;
 
164
  ulonglong key_file_length;
 
165
  uint old_options;
 
166
  uint8 language;
 
167
  my_bool with_auto_increment;
165
168
} MI_CREATE_INFO;
166
169
 
167
170
struct st_myisam_info;                  /* For referense */
172
175
typedef struct st_mi_keydef             /* Key definition with open & info */
173
176
{
174
177
  struct st_mi_isam_share *share;       /* Pointer to base (set in mi_open) */
175
 
  uint16_t keysegs;                     /* Number of key-segment */
176
 
  uint16_t flag;                                /* NOSAME, PACK_USED */
 
178
  uint16 keysegs;                       /* Number of key-segment */
 
179
  uint16 flag;                          /* NOSAME, PACK_USED */
177
180
 
178
 
  uint8_t  key_alg;                     /* BTREE, RTREE */
179
 
  uint16_t block_length;                        /* Length of keyblock (auto) */
180
 
  uint16_t underflow_block_length;      /* When to execute underflow */
181
 
  uint16_t keylength;                   /* Tot length of keyparts (auto) */
182
 
  uint16_t minlength;                   /* min length of (packed) key (auto) */
183
 
  uint16_t maxlength;                   /* max length of (packed) key (auto) */
184
 
  uint16_t block_size_index;            /* block_size (auto) */
185
 
  uint32_t version;                     /* For concurrent read/write */
 
181
  uint8  key_alg;                       /* BTREE, RTREE */
 
182
  uint16 block_length;                  /* Length of keyblock (auto) */
 
183
  uint16 underflow_block_length;        /* When to execute underflow */
 
184
  uint16 keylength;                     /* Tot length of keyparts (auto) */
 
185
  uint16 minlength;                     /* min length of (packed) key (auto) */
 
186
  uint16 maxlength;                     /* max length of (packed) key (auto) */
 
187
  uint16 block_size_index;              /* block_size (auto) */
 
188
  uint32 version;                       /* For concurrent read/write */
 
189
  uint32 ftparser_nr;                   /* distinct ftparser number */
186
190
 
187
191
  HA_KEYSEG *seg,*end;
188
 
 
 
192
  struct st_mysql_ftparser *parser;     /* Fulltext [pre]parser */
189
193
  int (*bin_search)(struct st_myisam_info *info,struct st_mi_keydef *keyinfo,
190
 
                    unsigned char *page,unsigned char *key,
191
 
                    uint32_t key_len,uint32_t comp_flag,unsigned char * *ret_pos,
192
 
                    unsigned char *buff, bool *was_last_key);
193
 
  uint32_t (*get_key)(struct st_mi_keydef *keyinfo,uint32_t nod_flag,unsigned char * *page,
194
 
                  unsigned char *key);
195
 
  int (*pack_key)(struct st_mi_keydef *keyinfo,uint32_t nod_flag,unsigned char *next_key,
196
 
                  unsigned char *org_key, unsigned char *prev_key, unsigned char *key,
 
194
                    uchar *page,uchar *key,
 
195
                    uint key_len,uint comp_flag,uchar * *ret_pos,
 
196
                    uchar *buff, my_bool *was_last_key);
 
197
  uint (*get_key)(struct st_mi_keydef *keyinfo,uint nod_flag,uchar * *page,
 
198
                  uchar *key);
 
199
  int (*pack_key)(struct st_mi_keydef *keyinfo,uint nod_flag,uchar *next_key,
 
200
                  uchar *org_key, uchar *prev_key, uchar *key,
197
201
                  struct st_mi_s_param *s_temp);
198
 
  void (*store_key)(struct st_mi_keydef *keyinfo, unsigned char *key_pos,
 
202
  void (*store_key)(struct st_mi_keydef *keyinfo, uchar *key_pos,
199
203
                    struct st_mi_s_param *s_temp);
200
 
  int (*ck_insert)(struct st_myisam_info *inf, uint32_t k_nr, unsigned char *k, uint32_t klen);
201
 
  int (*ck_delete)(struct st_myisam_info *inf, uint32_t k_nr, unsigned char *k, uint32_t klen);
 
204
  int (*ck_insert)(struct st_myisam_info *inf, uint k_nr, uchar *k, uint klen);
 
205
  int (*ck_delete)(struct st_myisam_info *inf, uint k_nr, uchar *k, uint klen);
202
206
} MI_KEYDEF;
203
207
 
204
208
 
206
210
 
207
211
typedef struct st_unique_def            /* Segment definition of unique */
208
212
{
209
 
  uint16_t keysegs;                     /* Number of key-segment */
210
 
  unsigned char key;                            /* Mapped to which key */
211
 
  uint8_t null_are_equal;
 
213
  uint16 keysegs;                       /* Number of key-segment */
 
214
  uchar key;                            /* Mapped to which key */
 
215
  uint8 null_are_equal;
212
216
  HA_KEYSEG *seg,*end;
213
217
} MI_UNIQUEDEF;
214
218
 
215
219
typedef struct st_mi_decode_tree        /* Decode huff-table */
216
220
{
217
 
  uint16_t *table;
 
221
  uint16 *table;
218
222
  uint   quick_table_bits;
219
 
  unsigned char  *intervalls;
 
223
  uchar  *intervalls;
220
224
} MI_DECODE_TREE;
221
225
 
222
226
 
228
232
  type, length, null_bit and null_pos
229
233
*/
230
234
 
231
 
namespace drizzled
232
 
{
233
 
 
234
235
typedef struct st_columndef             /* column information */
235
236
{
236
 
  int16_t  type;                                /* en_fieldtype */
237
 
  uint16_t length;                      /* length of field */
238
 
  uint32_t offset;                      /* Offset to position in row */
239
 
  uint8_t  null_bit;                    /* If column may be 0 */
240
 
  uint16_t null_pos;                    /* position for null marker */
 
237
  int16  type;                          /* en_fieldtype */
 
238
  uint16 length;                        /* length of field */
 
239
  uint32 offset;                        /* Offset to position in row */
 
240
  uint8  null_bit;                      /* If column may be 0 */
 
241
  uint16 null_pos;                      /* position for null marker */
241
242
 
242
243
#ifndef NOT_PACKED_DATABASES
243
244
  void (*unpack)(struct st_columndef *rec,struct st_mi_bit_buff *buff,
244
 
                 unsigned char *start,unsigned char *end);
245
 
  enum drizzled::en_fieldtype base_type;
246
 
  uint32_t space_length_bits,pack_type;
 
245
                 uchar *start,uchar *end);
 
246
  enum en_fieldtype base_type;
 
247
  uint space_length_bits,pack_type;
247
248
  MI_DECODE_TREE *huff_tree;
248
249
#endif
249
250
} MI_COLUMNDEF;
250
251
 
251
 
}
252
 
 
253
252
 
254
253
extern char * myisam_log_filename;              /* Name of logfile */
255
 
extern uint32_t myisam_block_size;
256
 
extern uint32_t myisam_concurrent_insert;
257
 
extern uint32_t myisam_bulk_insert_tree_size; 
258
 
extern uint32_t data_pointer_size;
 
254
extern ulong myisam_block_size;
 
255
extern ulong myisam_concurrent_insert;
 
256
extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user;
 
257
extern my_off_t myisam_max_temp_length;
 
258
extern ulong myisam_bulk_insert_tree_size, myisam_data_pointer_size;
259
259
 
260
260
        /* Prototypes for myisam-functions */
261
261
 
262
262
extern int mi_close(struct st_myisam_info *file);
263
 
extern int mi_delete(struct st_myisam_info *file,const unsigned char *buff);
 
263
extern int mi_delete(struct st_myisam_info *file,const uchar *buff);
264
264
extern struct st_myisam_info *mi_open(const char *name,int mode,
265
 
                                      uint32_t wait_if_locked);
266
 
extern int mi_panic(enum drizzled::ha_panic_function function);
267
 
extern int mi_rfirst(struct st_myisam_info *file,unsigned char *buf,int inx);
268
 
extern int mi_rkey(MI_INFO *info, unsigned char *buf, int inx, const unsigned char *key,
269
 
                   drizzled::key_part_map keypart_map, enum drizzled::ha_rkey_function search_flag);
270
 
extern int mi_rlast(struct st_myisam_info *file,unsigned char *buf,int inx);
271
 
extern int mi_rnext(struct st_myisam_info *file,unsigned char *buf,int inx);
272
 
extern int mi_rnext_same(struct st_myisam_info *info, unsigned char *buf);
273
 
extern int mi_rprev(struct st_myisam_info *file,unsigned char *buf,int inx);
274
 
extern int mi_rrnd(struct st_myisam_info *file,unsigned char *buf, drizzled::internal::my_off_t pos);
 
265
                                      uint wait_if_locked);
 
266
extern int mi_panic(enum ha_panic_function function);
 
267
extern int mi_rfirst(struct st_myisam_info *file,uchar *buf,int inx);
 
268
extern int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
 
269
                   key_part_map keypart_map, enum ha_rkey_function search_flag);
 
270
extern int mi_rlast(struct st_myisam_info *file,uchar *buf,int inx);
 
271
extern int mi_rnext(struct st_myisam_info *file,uchar *buf,int inx);
 
272
extern int mi_rnext_same(struct st_myisam_info *info, uchar *buf);
 
273
extern int mi_rprev(struct st_myisam_info *file,uchar *buf,int inx);
 
274
extern int mi_rrnd(struct st_myisam_info *file,uchar *buf, my_off_t pos);
275
275
extern int mi_scan_init(struct st_myisam_info *file);
276
 
extern int mi_scan(struct st_myisam_info *file,unsigned char *buf);
277
 
extern int mi_rsame(struct st_myisam_info *file,unsigned char *record,int inx);
278
 
extern int mi_update(struct st_myisam_info *file,const unsigned char *old,
279
 
                     unsigned char *new_record);
280
 
extern int mi_write(struct st_myisam_info *file,unsigned char *buff);
281
 
extern drizzled::internal::my_off_t mi_position(struct st_myisam_info *file);
282
 
extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint32_t flag);
 
276
extern int mi_scan(struct st_myisam_info *file,uchar *buf);
 
277
extern int mi_rsame(struct st_myisam_info *file,uchar *record,int inx);
 
278
extern int mi_rsame_with_pos(struct st_myisam_info *file,uchar *record,
 
279
                             int inx, my_off_t pos);
 
280
extern int mi_update(struct st_myisam_info *file,const uchar *old,
 
281
                     uchar *new_record);
 
282
extern int mi_write(struct st_myisam_info *file,uchar *buff);
 
283
extern my_off_t mi_position(struct st_myisam_info *file);
 
284
extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint flag);
283
285
extern int mi_lock_database(struct st_myisam_info *file,int lock_type);
284
 
extern int mi_create(const char *name,uint32_t keys,MI_KEYDEF *keydef,
285
 
                     uint32_t columns, drizzled::MI_COLUMNDEF *columndef,
286
 
                     uint32_t uniques, MI_UNIQUEDEF *uniquedef,
287
 
                     MI_CREATE_INFO *create_info, uint32_t flags);
 
286
extern int mi_create(const char *name,uint keys,MI_KEYDEF *keydef,
 
287
                     uint columns, MI_COLUMNDEF *columndef,
 
288
                     uint uniques, MI_UNIQUEDEF *uniquedef,
 
289
                     MI_CREATE_INFO *create_info, uint flags);
288
290
extern int mi_delete_table(const char *name);
289
291
extern int mi_rename(const char *from, const char *to);
290
292
extern int mi_extra(struct st_myisam_info *file,
291
 
                    enum drizzled::ha_extra_function function,
 
293
                    enum ha_extra_function function,
292
294
                    void *extra_arg);
293
295
extern int mi_reset(struct st_myisam_info *file);
294
 
extern drizzled::ha_rows mi_records_in_range(MI_INFO *info, int inx,
295
 
                                   drizzled::key_range *min_key, drizzled::key_range *max_key);
 
296
extern ha_rows mi_records_in_range(MI_INFO *info, int inx,
 
297
                                   key_range *min_key, key_range *max_key);
296
298
extern int mi_log(int activate_log);
 
299
extern int mi_is_changed(struct st_myisam_info *info);
297
300
extern int mi_delete_all_rows(struct st_myisam_info *info);
298
 
extern ulong _mi_calc_blob_length(uint32_t length , const unsigned char *pos);
299
 
extern uint32_t mi_get_pointer_length(uint64_t file_length, uint32_t def);
 
301
extern ulong _mi_calc_blob_length(uint length , const uchar *pos);
 
302
extern uint mi_get_pointer_length(ulonglong file_length, uint def);
300
303
 
301
304
/* this is used to pass to mysql_myisamchk_table */
302
305
 
348
351
 
349
352
#define T_REP_ANY               (T_REP | T_REP_BY_SORT | T_REP_PARALLEL)
350
353
 
 
354
/*
 
355
  Flags used by myisamchk.c or/and ha_myisam.cc that are NOT passed
 
356
  to mi_check.c follows:
 
357
*/
 
358
 
 
359
#define TT_USEFRM               1
 
360
#define TT_FOR_UPGRADE          2
 
361
 
351
362
#define O_NEW_INDEX     1               /* Bits set in out_flag */
352
363
#define O_NEW_DATA      2
353
364
#define O_DATA_LOST     4
356
367
 
357
368
typedef struct st_sort_key_blocks               /* Used when sorting */
358
369
{
359
 
  unsigned char *buff,*end_pos;
360
 
  unsigned char lastkey[MI_MAX_POSSIBLE_KEY_BUFF];
361
 
  uint32_t last_length;
 
370
  uchar *buff,*end_pos;
 
371
  uchar lastkey[MI_MAX_POSSIBLE_KEY_BUFF];
 
372
  uint last_length;
362
373
  int inited;
363
374
} SORT_KEY_BLOCKS;
364
375
 
365
376
 
366
 
/*
367
 
  MyISAM supports several statistics collection methods. Currently statistics
368
 
  collection method is not stored in MyISAM file and has to be specified for
 
377
/* 
 
378
  MyISAM supports several statistics collection methods. Currently statistics 
 
379
  collection method is not stored in MyISAM file and has to be specified for 
369
380
  each table analyze/repair operation in  MI_CHECK::stats_method.
370
381
*/
371
382
 
372
 
typedef enum
 
383
typedef enum 
373
384
{
374
385
  /* Treat NULLs as inequal when collecting statistics (default for 4.1/5.0) */
375
386
  MI_STATS_METHOD_NULLS_NOT_EQUAL,
381
392
 
382
393
typedef struct st_mi_check_param
383
394
{
384
 
  uint64_t auto_increment_value;
385
 
  uint64_t max_data_file_length;
386
 
  uint64_t keys_in_use;
387
 
  uint64_t max_record_length;
388
 
  drizzled::internal::my_off_t search_after_block;
389
 
  drizzled::internal::my_off_t new_file_pos,key_file_blocks;
390
 
  drizzled::internal::my_off_t keydata,totaldata,key_blocks,start_check_pos;
391
 
  drizzled::ha_rows total_records,total_deleted;
392
 
  drizzled::internal::ha_checksum record_checksum,glob_crc;
393
 
  uint64_t use_buffers;
394
 
  size_t read_buffer_length, write_buffer_length,
395
 
         sort_buffer_length, sort_key_blocks;
396
 
  uint32_t out_flag,warning_printed,error_printed,verbose;
397
 
  uint32_t opt_sort_key,total_files,max_level;
398
 
  uint32_t testflag, key_cache_block_size;
399
 
  uint8_t language;
400
 
  bool using_global_keycache, opt_lock_memory, opt_follow_links;
401
 
  bool retry_repair, force_sort;
 
395
  ulonglong auto_increment_value;
 
396
  ulonglong max_data_file_length;
 
397
  ulonglong keys_in_use;
 
398
  ulonglong max_record_length;
 
399
  my_off_t search_after_block;
 
400
  my_off_t new_file_pos,key_file_blocks;
 
401
  my_off_t keydata,totaldata,key_blocks,start_check_pos;
 
402
  ha_rows total_records,total_deleted;
 
403
  ha_checksum record_checksum,glob_crc;
 
404
  ulong use_buffers,read_buffer_length,write_buffer_length,
 
405
        sort_buffer_length,sort_key_blocks;
 
406
  uint out_flag,warning_printed,error_printed,verbose;
 
407
  uint opt_sort_key,total_files,max_level;
 
408
  uint testflag, key_cache_block_size;
 
409
  uint8 language;
 
410
  my_bool using_global_keycache, opt_lock_memory, opt_follow_links;
 
411
  my_bool retry_repair, force_sort;
402
412
  char temp_filename[FN_REFLEN],*isam_file_name;
 
413
  MY_TMPDIR *tmpdir;
403
414
  int tmpfile_createflag;
404
 
  drizzled::myf myf_rw;
405
 
  drizzled::internal::IO_CACHE read_cache;
406
 
 
407
 
  /*
 
415
  myf myf_rw;
 
416
  IO_CACHE read_cache;
 
417
  
 
418
  /* 
408
419
    The next two are used to collect statistics, see update_key_parts for
409
420
    description.
410
421
  */
411
 
  uint64_t unique_count[MI_MAX_KEY_SEG+1];
412
 
  uint64_t notnull_count[MI_MAX_KEY_SEG+1];
413
 
 
414
 
  drizzled::internal::ha_checksum key_crc[HA_MAX_POSSIBLE_KEY];
 
422
  ulonglong unique_count[MI_MAX_KEY_SEG+1];
 
423
  ulonglong notnull_count[MI_MAX_KEY_SEG+1];
 
424
  
 
425
  ha_checksum key_crc[HA_MAX_POSSIBLE_KEY];
415
426
  ulong rec_per_key_part[MI_MAX_KEY_SEG*HA_MAX_POSSIBLE_KEY];
416
 
  void *session;
 
427
  void *thd;
417
428
  const char *db_name, *table_name;
418
429
  const char *op_name;
419
430
  enum_mi_stats_method stats_method;
420
431
} MI_CHECK;
421
432
 
 
433
typedef struct st_sort_ft_buf
 
434
{
 
435
  uchar *buf, *end;
 
436
  int   count;
 
437
  uchar lastkey[MI_MAX_KEY_BUFF];
 
438
} SORT_FT_BUF;
 
439
 
422
440
typedef struct st_sort_info
423
441
{
424
 
  drizzled::internal::my_off_t filelength,dupp,buff_length;
425
 
  drizzled::ha_rows max_records;
426
 
  uint32_t current_key, total_keys;
427
 
  drizzled::myf myf_rw;
428
 
  enum drizzled::data_file_type new_data_file_type;
 
442
  my_off_t filelength,dupp,buff_length;
 
443
  ha_rows max_records;
 
444
  uint current_key, total_keys;
 
445
  myf myf_rw;
 
446
  enum data_file_type new_data_file_type;
429
447
  MI_INFO *info;
430
448
  MI_CHECK *param;
431
 
  unsigned char *buff;
 
449
  uchar *buff;
432
450
  SORT_KEY_BLOCKS *key_block,*key_block_end;
 
451
  SORT_FT_BUF *ft_buf;
433
452
  /* sync things */
434
 
  uint32_t got_error, threads_running;
 
453
  uint got_error, threads_running;
435
454
  pthread_mutex_t mutex;
436
455
  pthread_cond_t  cond;
437
456
} SORT_INFO;
439
458
/* functions in mi_check */
440
459
void myisamchk_init(MI_CHECK *param);
441
460
int chk_status(MI_CHECK *param, MI_INFO *info);
442
 
int chk_del(MI_CHECK *param, register MI_INFO *info, uint32_t test_flag);
 
461
int chk_del(MI_CHECK *param, register MI_INFO *info, uint test_flag);
443
462
int chk_size(MI_CHECK *param, MI_INFO *info);
444
463
int chk_key(MI_CHECK *param, MI_INFO *info);
445
464
int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend);
451
470
int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
452
471
                      const char * name, int rep_quick);
453
472
int change_to_newfile(const char * filename, const char * old_ext,
454
 
                      const char * new_ext, uint32_t raid_chunks,
455
 
                      drizzled::myf myflags);
 
473
                      const char * new_ext, uint raid_chunks,
 
474
                      myf myflags);
 
475
int lock_file(MI_CHECK *param, File file, my_off_t start, int lock_type,
 
476
              const char *filetype, const char *filename);
456
477
void lock_memory(MI_CHECK *param);
457
478
void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
458
 
                               bool repair);
459
 
int update_state_info(MI_CHECK *param, MI_INFO *info,uint32_t update);
 
479
                               my_bool repair);
 
480
int update_state_info(MI_CHECK *param, MI_INFO *info,uint update);
460
481
void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
461
 
                      uint64_t *unique, uint64_t *notnull,
462
 
                      uint64_t records);
463
 
int filecopy(MI_CHECK *param, int to,int from,drizzled::internal::my_off_t start,
464
 
             drizzled::internal::my_off_t length, const char *type);
465
 
int movepoint(MI_INFO *info,unsigned char *record,drizzled::internal::my_off_t oldpos,
466
 
              drizzled::internal::my_off_t newpos, uint32_t prot_key);
467
 
int write_data_suffix(SORT_INFO *sort_info, bool fix_datafile);
 
482
                      ulonglong *unique, ulonglong *notnull, 
 
483
                      ulonglong records);
 
484
int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
 
485
             my_off_t length, const char *type);
 
486
int movepoint(MI_INFO *info,uchar *record,my_off_t oldpos,
 
487
              my_off_t newpos, uint prot_key);
 
488
int write_data_suffix(SORT_INFO *sort_info, my_bool fix_datafile);
468
489
int test_if_almost_full(MI_INFO *info);
469
490
int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename);
470
 
bool mi_test_if_sort_rep(MI_INFO *info, drizzled::ha_rows rows, uint64_t key_map,
471
 
                            bool force);
 
491
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, ulonglong key_map,
 
492
                            my_bool force);
472
493
 
473
 
int mi_init_bulk_insert(MI_INFO *info, uint32_t cache_size, drizzled::ha_rows rows);
474
 
void mi_flush_bulk_insert(MI_INFO *info, uint32_t inx);
 
494
int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows);
 
495
void mi_flush_bulk_insert(MI_INFO *info, uint inx);
475
496
void mi_end_bulk_insert(MI_INFO *info);
476
 
int mi_preload(MI_INFO *info, uint64_t key_map, bool ignore_leaves);
 
497
int mi_assign_to_key_cache(MI_INFO *info, ulonglong key_map, 
 
498
                           KEY_CACHE *key_cache);
 
499
void mi_change_key_cache(KEY_CACHE *old_key_cache,
 
500
                         KEY_CACHE *new_key_cache);
 
501
int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves);
477
502
 
478
 
#endif /* PLUGIN_MYISAM_MYISAM_H */
 
503
#ifdef  __cplusplus
 
504
}
 
505
#endif
 
506
#endif