~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/heap.h

  • Committer: Brian Aker
  • Date: 2009-03-27 22:55:28 UTC
  • mto: This revision was merged to the branch mainline in revision 968.
  • Revision ID: brian@tangent.org-20090327225528-8y76cfx8a4oemqv9
Remove ref_count

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#endif
24
24
 
25
25
#include <drizzled/base.h>
26
 
#include <libdrizzle/drizzle_com.h>
 
26
#include <drizzled/common.h>
27
27
#include <mysys/my_pthread.h>
28
28
#include <mysys/thr_lock.h>
29
29
 
30
 
#include <mysys/my_handler.h>
 
30
#include <storage/myisam/my_handler.h>
31
31
#include <mysys/my_tree.h>
32
32
 
33
33
        /* defines used by heap-funktions */
61
61
{
62
62
  /* Number of unused slots in *last_blocks HP_PTRS block (0 for 0th level) */
63
63
  uint32_t free_ptrs_in_block;
64
 
  
 
64
 
65
65
  /*
66
66
    Maximum number of records that can be 'contained' inside of each element
67
 
    of last_blocks array. For level 0 - 1, for level 1 - HP_PTRS_IN_NOD, for 
 
67
    of last_blocks array. For level 0 - 1, for level 1 - HP_PTRS_IN_NOD, for
68
68
    level 2 - HP_PTRS_IN_NOD^2 and so forth.
69
69
  */
70
70
  uint32_t records_under_level;
71
71
 
72
72
  /*
73
 
    Ptr to last allocated HP_PTRS (or records buffer for level 0) on this 
 
73
    Ptr to last allocated HP_PTRS (or records buffer for level 0) on this
74
74
    level.
75
75
  */
76
 
  HP_PTRS *last_blocks;                 
 
76
  HP_PTRS *last_blocks;
77
77
};
78
78
 
79
79
 
83
83
  is recbuffer bytes.
84
84
  The internal representation is as follows:
85
85
  HP_BLOCK is a hierarchical structure of 'blocks'.
86
 
  A block at level 0 is an array records_in_block records. 
87
 
  A block at higher level is an HP_PTRS structure with pointers to blocks at 
 
86
  A block at level 0 is an array records_in_block records.
 
87
  A block at higher level is an HP_PTRS structure with pointers to blocks at
88
88
  lower levels.
89
89
  At the highest level there is one top block. It is stored in HP_BLOCK::root.
90
90
 
91
 
  See hp_find_block for a description of how record pointer is obtained from 
 
91
  See hp_find_block for a description of how record pointer is obtained from
92
92
  its index.
93
 
  See hp_get_new_block 
 
93
  See hp_get_new_block
94
94
*/
95
95
 
96
96
typedef struct st_heap_block
97
97
{
98
 
  HP_PTRS *root;                        /* Top-level block */ 
 
98
  HP_PTRS *root;                        /* Top-level block */
99
99
  struct st_level_info level_info[HP_MAX_LEVELS+1];
100
100
  uint32_t levels;                          /* number of used levels */
101
101
  uint32_t records_in_block;            /* Records in one heap-block */
117
117
    Number of buckets used in hash table. Used only to provide
118
118
    #records estimates for heap key scans.
119
119
  */
120
 
  ha_rows hash_buckets; 
 
120
  ha_rows hash_buckets;
121
121
  TREE rb_tree;
122
122
  int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
123
123
                   const unsigned char *record, unsigned char *recpos);
135
135
  uint16_t null_pos;                    /* position for null marker */
136
136
  uint8_t  length_bytes;  /* length of the size, 1 o 2 bytes */
137
137
} HP_COLUMNDEF;
138
 
 
 
138
 
139
139
typedef struct st_heap_dataspace   /* control data for data space */
140
140
{
141
141
  HP_BLOCK block;
170
170
  uint32_t currently_disabled_keys;    /* saved value from "keys" when disabled */
171
171
  uint32_t open_count;
172
172
 
173
 
  
 
173
 
174
174
  char * name;                  /* Name of "memory-file" */
175
175
  THR_LOCK lock;
176
176
  pthread_mutex_t intern_lock;          /* Locking for use with _locking */
209
209
  uint32_t auto_key;                        /* keynr [1 - maxkey] for auto key */
210
210
  uint32_t auto_key_type;
211
211
  uint32_t max_chunk_size;
212
 
  uint32_t is_dynamic;  
 
212
  uint32_t is_dynamic;
213
213
  uint64_t max_table_size;
214
214
  uint64_t auto_increment;
215
215
  bool with_auto_increment;
266
266
   pointer to rows where a long instead of a (unsigned char*).
267
267
*/
268
268
 
269
 
#if defined(WANT_OLD_HEAP_VERSION) || defined(OLD_HEAP_VERSION)
270
 
extern int heap_rrnd_old(HP_INFO *info,unsigned char *buf,uint32_t pos);
271
 
extern uint32_t heap_position_old(HP_INFO *info);
272
 
#endif
273
 
#ifdef OLD_HEAP_VERSION
274
 
typedef uint32_t HEAP_PTR;
275
 
#define heap_position(A) heap_position_old(A)
276
 
#define heap_rrnd(A,B,C) heap_rrnd_old(A,B,C)
277
 
#else
278
269
typedef unsigned char *HEAP_PTR;
279
 
#endif
280
270
 
281
271
#ifdef  __cplusplus
282
272
}