~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/hp_create.cc

  • Committer: Monty Taylor
  • Date: 2009-08-17 18:46:08 UTC
  • mto: (1182.1.1 staging)
  • mto: This revision was merged to the branch mainline in revision 1183.
  • Revision ID: mordred@inaugust.com-20090817184608-0b2emowpjr9m6le7
"Fixed" the deadlock test. I'd still like someone to look at what's going on here.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "heap_priv.h"
 
16
#include "heapdef.h"
17
17
 
18
18
#include <drizzled/common.h>
19
19
#include <drizzled/error.h>
22
22
#include <algorithm>
23
23
 
24
24
using namespace std;
25
 
using namespace drizzled;
26
25
 
27
26
static int keys_compare(heap_rb_param *param, unsigned char *key1, unsigned char *key2);
28
27
static void init_block(HP_BLOCK *block,uint32_t chunk_length, uint32_t min_records,
198
197
            keyinfo->rb_tree.size_of_element++;
199
198
        }
200
199
        switch (keyinfo->seg[j].type) {
 
200
        case HA_KEYTYPE_SHORT_INT:
201
201
        case HA_KEYTYPE_LONG_INT:
 
202
        case HA_KEYTYPE_FLOAT:
202
203
        case HA_KEYTYPE_DOUBLE:
 
204
        case HA_KEYTYPE_USHORT_INT:
203
205
        case HA_KEYTYPE_ULONG_INT:
204
206
        case HA_KEYTYPE_LONGLONG:
205
207
        case HA_KEYTYPE_ULONGLONG:
 
208
        case HA_KEYTYPE_INT24:
206
209
        case HA_KEYTYPE_UINT24:
 
210
        case HA_KEYTYPE_INT8:
207
211
          keyinfo->seg[j].flag|= HA_SWAP_KEY;
208
212
          break;
209
213
        case HA_KEYTYPE_VARBINARY1:
305
309
        keyseg++;
306
310
 
307
311
        init_tree(&keyinfo->rb_tree, 0, 0, sizeof(unsigned char*),
308
 
                  (qsort_cmp2)keys_compare, true, NULL, NULL);
 
312
                  (qsort_cmp2)keys_compare, 1, NULL, NULL);
309
313
        keyinfo->delete_key= hp_rb_delete_key;
310
314
        keyinfo->write_key= hp_rb_write_key;
311
315
      }
406
410
  if (records_in_block < 10 && max_records)
407
411
    records_in_block= 10;
408
412
  if (!records_in_block || records_in_block*recbuffer >
409
 
      (internal::my_default_record_cache_size-sizeof(HP_PTRS)*HP_MAX_LEVELS))
410
 
    records_in_block= (internal::my_default_record_cache_size - sizeof(HP_PTRS) *
 
413
      (my_default_record_cache_size-sizeof(HP_PTRS)*HP_MAX_LEVELS))
 
414
    records_in_block= (my_default_record_cache_size - sizeof(HP_PTRS) *
411
415
                      HP_MAX_LEVELS) / recbuffer + 1;
412
416
  block->records_in_block= records_in_block;
413
417
  block->recbuffer= recbuffer;
442
446
  }
443
447
  else
444
448
  {
445
 
    result= errno=ENOENT;
 
449
    result= my_errno=ENOENT;
446
450
  }
447
451
  pthread_mutex_unlock(&THR_LOCK_heap);
448
452
  return(result);