Commit 1d418629 authored by unknown's avatar unknown

Additional key segment (HA_KEYTYPE_END) creation has been moved from handler to hp_create.c


BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent ce5696e2
...@@ -74,3 +74,4 @@ WAX@sergbook.mysql.com ...@@ -74,3 +74,4 @@ WAX@sergbook.mysql.com
bar@bar.udmsearch.izhnet.ru bar@bar.udmsearch.izhnet.ru
nick@mysql.com nick@mysql.com
bar@bar.mysql.r18.ru bar@bar.mysql.r18.ru
ram@mysql.r18.ru
...@@ -85,15 +85,24 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, ...@@ -85,15 +85,24 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
memcpy(share->keydef, keydef, (size_t) (sizeof(keydef[0]) * keys)); memcpy(share->keydef, keydef, (size_t) (sizeof(keydef[0]) * keys));
for (i= 0, keyinfo= share->keydef; i < keys; i++, keyinfo++) for (i= 0, keyinfo= share->keydef; i < keys; i++, keyinfo++)
{ {
uint nsegs= keydef[i].keysegs; keyinfo->seg= keyseg;
memcpy(keyseg, keydef[i].seg,
(size_t) (sizeof(keyseg[0]) * keydef[i].keysegs));
keyseg+= keydef[i].keysegs;
if (keydef[i].algorithm == HA_KEY_ALG_BTREE) if (keydef[i].algorithm == HA_KEY_ALG_BTREE)
{ {
/* additional HA_KEYTYPE_END keyseg */
keyseg->type= HA_KEYTYPE_END;
keyseg->length= sizeof(byte*);
keyseg->flag= 0;
keyseg->null_bit= 0;
keyseg++;
init_tree(&keyinfo->rb_tree, 0, 0, sizeof(byte*), init_tree(&keyinfo->rb_tree, 0, 0, sizeof(byte*),
(qsort_cmp2)keys_compare, 1, NULL, NULL); (qsort_cmp2)keys_compare, 1, NULL, NULL);
keyinfo->delete_key= hp_rb_delete_key; keyinfo->delete_key= hp_rb_delete_key;
keyinfo->write_key= hp_rb_write_key; keyinfo->write_key= hp_rb_write_key;
nsegs++;
} }
else else
{ {
...@@ -102,12 +111,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, ...@@ -102,12 +111,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
keyinfo->delete_key= hp_delete_key; keyinfo->delete_key= hp_delete_key;
keyinfo->write_key= hp_write_key; keyinfo->write_key= hp_write_key;
} }
keyinfo->seg= keyseg;
memcpy(keyseg, keydef[i].seg,
(size_t) (sizeof(keyseg[0]) * nsegs));
keyseg+= nsegs;
} }
share->min_records= min_records; share->min_records= min_records;
share->max_records= max_records; share->max_records= max_records;
share->data_length= share->index_length= 0; share->data_length= share->index_length= 0;
......
...@@ -243,11 +243,7 @@ int ha_heap::create(const char *name, TABLE *table, HA_CREATE_INFO *create_info) ...@@ -243,11 +243,7 @@ int ha_heap::create(const char *name, TABLE *table, HA_CREATE_INFO *create_info)
int error; int error;
for (key= parts= 0; key < table->keys; key++) for (key= parts= 0; key < table->keys; key++)
{
parts+= table->key_info[key].key_parts; parts+= table->key_info[key].key_parts;
if (table->key_info[key].algorithm == HA_KEY_ALG_BTREE)
parts++; /* additional HA_KEYTYPE_END keyseg */
}
if (!(keydef= (HP_KEYDEF*) my_malloc(table->keys * sizeof(HP_KEYDEF) + if (!(keydef= (HP_KEYDEF*) my_malloc(table->keys * sizeof(HP_KEYDEF) +
parts * sizeof(HA_KEYSEG), MYF(MY_WME)))) parts * sizeof(HA_KEYSEG), MYF(MY_WME))))
...@@ -299,15 +295,6 @@ int ha_heap::create(const char *name, TABLE *table, HA_CREATE_INFO *create_info) ...@@ -299,15 +295,6 @@ int ha_heap::create(const char *name, TABLE *table, HA_CREATE_INFO *create_info)
seg->null_pos= 0; seg->null_pos= 0;
} }
} }
if (pos->algorithm == HA_KEY_ALG_BTREE)
{
/* additional HA_KEYTYPE_END keyseg */
seg->type= HA_KEYTYPE_END;
seg->length= sizeof(byte*);
seg->flag= 0;
seg->null_bit= 0;
seg++;
}
} }
mem_per_row+= MY_ALIGN(table->reclength + 1, sizeof(char*)); mem_per_row+= MY_ALIGN(table->reclength + 1, sizeof(char*));
max_rows= (ulong) (max_heap_table_size / mem_per_row); max_rows= (ulong) (max_heap_table_size / mem_per_row);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment