~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/myisamdef.h

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#ifndef MYISAMDEF_H
19
19
#define MYISAMDEF_H
20
20
 
21
 
#include <drizzled/global.h>
22
21
#include "myisam.h"                     /* Structs & some defines */
23
22
#include "myisampack.h"                 /* packing of keys */
24
23
#include <mysys/my_tree.h>
25
24
#include <mysys/my_pthread.h>
26
25
#include <mysys/thr_lock.h>
27
 
#include <drizzled/common.h>
28
 
 
29
 
#include <string.h>
30
 
#include <list>
31
 
 
32
 
#if defined(my_write)
 
26
#include <libdrizzle/drizzle_com.h>
 
27
 
 
28
#if defined(my_write) && !defined(MAP_TO_USE_RAID)
33
29
#undef my_write                         /* undef map from my_nosys; We need test-if-disk full */
34
30
#endif
35
31
 
36
 
#ifdef  __cplusplus
37
 
extern "C" {
38
 
#endif
39
 
 
40
32
typedef struct st_mi_status_info
41
33
{
42
34
  ha_rows records;                      /* Rows in table */
138
130
  uint32_t extra_alloc_procent;
139
131
  /* Info about raid */
140
132
  uint32_t raid_type,raid_chunks;
141
 
  uint32_t raid_chunksize;
 
133
  ulong raid_chunksize;
142
134
  /* The following are from the header */
143
135
  uint32_t key_parts,all_key_parts;
144
136
} MI_BASE_INFO;
160
152
  unsigned char version;
161
153
} MI_PACK;
162
154
 
163
 
#define MAX_NONMAPPED_INSERTS 1000
164
 
 
165
 
class Session;
 
155
#define MAX_NONMAPPED_INSERTS 1000      
166
156
 
167
157
typedef struct st_mi_isam_share {       /* Shared between opens */
168
158
  MI_STATE_INFO state;
174
164
  MI_COLUMNDEF *rec;                    /* Pointer to field information */
175
165
  MI_PACK    pack;                      /* Data about packed records */
176
166
  MI_BLOB    *blobs;                    /* Pointer to blobs */
177
 
  std::list<Session *> *in_use;         /* List of threads using this table */
 
167
  LIST *in_use;                         /* List of threads using this table */
178
168
  char  *unique_file_name;              /* realpath() of index file */
179
169
  char  *data_file_name,                /* Resolved path names from symlinks */
180
170
        *index_file_name;
194
184
                        const unsigned char *record, my_off_t pos);
195
185
  size_t (*file_read)(MI_INFO *, unsigned char *, size_t, my_off_t, myf);
196
186
  size_t (*file_write)(MI_INFO *, const unsigned char *, size_t, my_off_t, myf);
 
187
  invalidator_by_filename invalidator;  /* query cache invalidator */
197
188
  ulong this_process;                   /* processid */
198
189
  ulong last_process;                   /* For table-change-check */
199
190
  ulong last_version;                   /* Version on start */
221
212
    concurrent_insert;
222
213
  THR_LOCK lock;
223
214
  pthread_mutex_t intern_lock;          /* Locking for use with _locking */
224
 
  pthread_rwlock_t *key_root_lock;
 
215
  rw_lock_t *key_root_lock;
225
216
  my_off_t mmaped_length;
226
217
  uint32_t     nonmmaped_inserts;           /* counter of writing in non-mmaped
227
218
                                           area */
228
 
  pthread_rwlock_t mmap_lock;
 
219
  rw_lock_t mmap_lock;
229
220
} MYISAM_SHARE;
230
221
 
231
222
 
248
239
  MI_BIT_BUFF  bit_buff;
249
240
  /* accumulate indexfile changes between write's */
250
241
  TREE          *bulk_insert;
251
 
  Session *in_use;                      /* Thread using this table          */
 
242
  LIST in_use;                          /* Thread using this table          */
252
243
  char *filename;                       /* parameter to open filename       */
253
244
  unsigned char *buff,                          /* Temp area for key                */
254
245
        *lastkey,*lastkey2;             /* Last used search key             */
259
250
  uint32_t  int_nod_flag;                       /*  -""-  */
260
251
  uint32_t int_keytree_version;         /*  -""-  */
261
252
  int (*read_record)(struct st_myisam_info*, my_off_t, unsigned char*);
 
253
  invalidator_by_filename invalidator;  /* query cache invalidator */
262
254
  ulong this_unique;                    /* uniq filenumber or thread */
263
255
  ulong last_unique;                    /* last unique number */
264
256
  ulong this_loop;                      /* counter for this open */
290
282
  uint  data_changed;                   /* Somebody has changed data */
291
283
  uint  save_update;                    /* When using KEY_READ */
292
284
  int   save_lastinx;
 
285
  LIST  open_list;
293
286
  IO_CACHE rec_cache;                   /* When cacheing records */
294
287
  uint32_t  preload_buff_size;              /* When preloading indexes */
295
288
  myf lock_wait;                        /* is 0 or MY_DONT_WAIT */
342
335
  void *wordlist, *wordptr;
343
336
  MEM_ROOT wordroot;
344
337
  unsigned char *record;
 
338
  MY_TMPDIR *tmpdir;
345
339
  int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *);
346
340
  int (*key_read)(struct st_mi_sort_param *,void *);
347
341
  int (*key_write)(struct st_mi_sort_param *, const void *);
465
459
 
466
460
        /* Some extern variables */
467
461
 
468
 
extern std::list<MI_INFO *> myisam_open_list;
 
462
extern LIST *myisam_open_list;
469
463
extern unsigned char  myisam_file_magic[], myisam_pack_file_magic[];
470
464
extern uint32_t  myisam_read_vec[], myisam_readnext_vec[];
471
465
extern uint32_t myisam_quick_table_bits;
542
536
                            MI_KEY_PARAM *s_temp);
543
537
 
544
538
extern int _mi_ck_delete(MI_INFO *info,uint32_t keynr,unsigned char *key,uint32_t key_length);
545
 
int _mi_readinfo(MI_INFO *info,int lock_flag,int check_keybuffer);
 
539
extern int _mi_readinfo(MI_INFO *info,int lock_flag,int check_keybuffer);
546
540
extern int _mi_writeinfo(MI_INFO *info,uint32_t options);
547
541
extern int _mi_test_if_changed(MI_INFO *info);
548
542
extern int _mi_mark_file_changed(MI_INFO *info);
563
557
extern void _mi_kpointer(MI_INFO *info,unsigned char *buff,my_off_t pos);
564
558
extern my_off_t _mi_dpos(MI_INFO *info, uint32_t nod_flag,unsigned char *after_key);
565
559
extern my_off_t _mi_rec_pos(MYISAM_SHARE *info, unsigned char *ptr);
566
 
void _mi_dpointer(MI_INFO *info, unsigned char *buff,my_off_t pos);
 
560
extern void _mi_dpointer(MI_INFO *info, unsigned char *buff,my_off_t pos);
567
561
extern uint32_t _mi_get_static_key(MI_KEYDEF *keyinfo,uint32_t nod_flag,unsigned char * *page,
568
562
                               unsigned char *key);
569
563
extern uint32_t _mi_get_pack_key(MI_KEYDEF *keyinfo,uint32_t nod_flag,unsigned char * *page,
600
594
                          uint32_t length,int re_read_if_possibly);
601
595
extern uint64_t retrieve_auto_increment(MI_INFO *info,const unsigned char *record);
602
596
 
603
 
unsigned char *mi_alloc_rec_buff(MI_INFO *info, size_t length, unsigned char **buf);
 
597
extern unsigned char *mi_alloc_rec_buff(MI_INFO *,ulong, unsigned char**);
604
598
#define mi_get_rec_buff_ptr(info,buf)                              \
605
599
        ((((info)->s->options & HA_OPTION_PACK_RECORD) && (buf)) ? \
606
600
        (buf) - MI_REC_BUFF_OFFSET : (buf))
669
663
#define fast_mi_writeinfo(INFO) if (!(INFO)->s->tot_locks) (void) _mi_writeinfo((INFO),0)
670
664
#define fast_mi_readinfo(INFO) ((INFO)->lock_type == F_UNLCK) && _mi_readinfo((INFO),F_RDLCK,1)
671
665
 
 
666
#ifdef  __cplusplus
 
667
extern "C" {
 
668
#endif
 
669
 
672
670
extern uint32_t _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t);
673
671
extern uint32_t _mi_rec_pack(MI_INFO *info,unsigned char *to,const unsigned char *from);
674
672
extern uint32_t _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
740
738
int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file);
741
739
 
742
740
int sort_write_record(MI_SORT_PARAM *sort_param);
743
 
int _create_index_by_sort(MI_SORT_PARAM *info,bool no_messages, size_t);
 
741
int _create_index_by_sort(MI_SORT_PARAM *info,bool no_messages, uint32_t);
744
742
 
745
743
extern void mi_set_index_cond_func(MI_INFO *info, index_cond_func_t func,
746
744
                                   void *func_arg);
752
750
 
753
751
/* Needed for handler */
754
752
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows);
755
 
void _mi_report_crashed(MI_INFO *file, const char *message, const char *sfile,
756
 
                        uint32_t sline);
 
753
void _mi_report_crashed(MI_INFO *file __attribute__((unused)),
 
754
                        const char *message __attribute__((unused)),
 
755
                        const char *sfile __attribute__((unused)),
 
756
                        uint32_t sline __attribute__((unused)));
757
757
 
758
758
#ifdef __cplusplus
759
759
}