Commit 463aaf28 authored by marko's avatar marko

branches/zip: Avoid memory fragmentation when adding column definitions

to tables.

dict_mem_table_add_col(): Add the parameter "heap" for temporary memory
allocation.  Allow it and "name" to be NULL.  These parameters are NULL
when creating dummy indexes.

dict_add_col_name(): Remove calls to ut_malloc() and ut_free().

dict_table_get_col_name(): Allow table->col_names to be NULL.

dict_table_add_system_columns(), dict_table_add_to_cache():
Add the parameter "heap".
parent 6e2c59d4
...@@ -213,6 +213,7 @@ dict_boot(void) ...@@ -213,6 +213,7 @@ dict_boot(void)
dict_table_t* table; dict_table_t* table;
dict_index_t* index; dict_index_t* index;
dict_hdr_t* dict_hdr; dict_hdr_t* dict_hdr;
mem_heap_t* heap;
mtr_t mtr; mtr_t mtr;
mtr_start(&mtr); mtr_start(&mtr);
...@@ -220,6 +221,8 @@ dict_boot(void) ...@@ -220,6 +221,8 @@ dict_boot(void)
/* Create the hash tables etc. */ /* Create the hash tables etc. */
dict_init(); dict_init();
heap = mem_heap_create(450);
mutex_enter(&(dict_sys->mutex)); mutex_enter(&(dict_sys->mutex));
/* Get the dictionary header */ /* Get the dictionary header */
...@@ -246,19 +249,20 @@ dict_boot(void) ...@@ -246,19 +249,20 @@ dict_boot(void)
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0); table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "N_COLS", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "N_COLS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "MIX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "MIX_LEN", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "MIX_LEN", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "CLUSTER_NAME", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "CLUSTER_NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "SPACE", DATA_INT, 0, 4);
table->id = DICT_TABLES_ID; table->id = DICT_TABLES_ID;
dict_table_add_to_cache(table); dict_table_add_to_cache(table, heap);
dict_sys->sys_tables = table; dict_sys->sys_tables = table;
mem_heap_empty(heap);
index = dict_mem_index_create("SYS_TABLES", "CLUST_IND", index = dict_mem_index_create("SYS_TABLES", "CLUST_IND",
DICT_HDR_SPACE, DICT_HDR_SPACE,
...@@ -285,18 +289,19 @@ dict_boot(void) ...@@ -285,18 +289,19 @@ dict_boot(void)
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0); table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "POS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "MTYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "PRTYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "LEN", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "PREC", DATA_INT, 0, 4);
table->id = DICT_COLUMNS_ID; table->id = DICT_COLUMNS_ID;
dict_table_add_to_cache(table); dict_table_add_to_cache(table, heap);
dict_sys->sys_columns = table; dict_sys->sys_columns = table;
mem_heap_empty(heap);
index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND", index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND",
DICT_HDR_SPACE, DICT_HDR_SPACE,
...@@ -313,13 +318,13 @@ dict_boot(void) ...@@ -313,13 +318,13 @@ dict_boot(void)
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0); table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "N_FIELDS", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "N_FIELDS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "SPACE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PAGE_NO", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "PAGE_NO", DATA_INT, 0, 4);
/* The '+ 2' below comes from the 2 system fields */ /* The '+ 2' below comes from the 2 system fields */
#if DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2 #if DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2
...@@ -333,8 +338,9 @@ dict_boot(void) ...@@ -333,8 +338,9 @@ dict_boot(void)
#endif #endif
table->id = DICT_INDEXES_ID; table->id = DICT_INDEXES_ID;
dict_table_add_to_cache(table); dict_table_add_to_cache(table, heap);
dict_sys->sys_indexes = table; dict_sys->sys_indexes = table;
mem_heap_empty(heap);
index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND", index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND",
DICT_HDR_SPACE, DICT_HDR_SPACE,
...@@ -351,13 +357,14 @@ dict_boot(void) ...@@ -351,13 +357,14 @@ dict_boot(void)
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0); table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0);
dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "INDEX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "POS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "COL_NAME", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "COL_NAME", DATA_BINARY, 0, 0);
table->id = DICT_FIELDS_ID; table->id = DICT_FIELDS_ID;
dict_table_add_to_cache(table); dict_table_add_to_cache(table, heap);
dict_sys->sys_fields = table; dict_sys->sys_fields = table;
mem_heap_free(heap);
index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND", index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND",
DICT_HDR_SPACE, DICT_HDR_SPACE,
......
...@@ -978,7 +978,7 @@ dict_create_table_step( ...@@ -978,7 +978,7 @@ dict_create_table_step(
if (node->state == TABLE_ADD_TO_CACHE) { if (node->state == TABLE_ADD_TO_CACHE) {
dict_table_add_to_cache(node->table); dict_table_add_to_cache(node->table, node->heap);
err = DB_SUCCESS; err = DB_SUCCESS;
} }
......
...@@ -400,9 +400,10 @@ dict_table_get_col_name( ...@@ -400,9 +400,10 @@ dict_table_get_col_name(
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
s = table->col_names; s = table->col_names;
if (s) {
for (i = 0; i < col_nr; i++) { for (i = 0; i < col_nr; i++) {
s += strlen(s) + 1; s += strlen(s) + 1;
}
} }
return(s); return(s);
...@@ -837,7 +838,8 @@ Adds system columns to a table object. */ ...@@ -837,7 +838,8 @@ Adds system columns to a table object. */
void void
dict_table_add_system_columns( dict_table_add_system_columns(
/*==========================*/ /*==========================*/
dict_table_t* table) /* in/out: table */ dict_table_t* table, /* in/out: table */
mem_heap_t* heap) /* in: temporary heap */
{ {
ut_ad(table); ut_ad(table);
ut_ad(table->n_def == table->n_cols - DATA_N_SYS_COLS); ut_ad(table->n_def == table->n_cols - DATA_N_SYS_COLS);
...@@ -850,19 +852,19 @@ dict_table_add_system_columns( ...@@ -850,19 +852,19 @@ dict_table_add_system_columns(
The clustered index will not always physically contain all The clustered index will not always physically contain all
system columns. */ system columns. */
dict_mem_table_add_col(table, "DB_ROW_ID", DATA_SYS, dict_mem_table_add_col(table, heap, "DB_ROW_ID", DATA_SYS,
DATA_ROW_ID | DATA_NOT_NULL, DATA_ROW_ID | DATA_NOT_NULL,
DATA_ROW_ID_LEN); DATA_ROW_ID_LEN);
#if DATA_ROW_ID != 0 #if DATA_ROW_ID != 0
#error "DATA_ROW_ID != 0" #error "DATA_ROW_ID != 0"
#endif #endif
dict_mem_table_add_col(table, "DB_TRX_ID", DATA_SYS, dict_mem_table_add_col(table, heap, "DB_TRX_ID", DATA_SYS,
DATA_TRX_ID | DATA_NOT_NULL, DATA_TRX_ID | DATA_NOT_NULL,
DATA_TRX_ID_LEN); DATA_TRX_ID_LEN);
#if DATA_TRX_ID != 1 #if DATA_TRX_ID != 1
#error "DATA_TRX_ID != 1" #error "DATA_TRX_ID != 1"
#endif #endif
dict_mem_table_add_col(table, "DB_ROLL_PTR", DATA_SYS, dict_mem_table_add_col(table, heap, "DB_ROLL_PTR", DATA_SYS,
DATA_ROLL_PTR | DATA_NOT_NULL, DATA_ROLL_PTR | DATA_NOT_NULL,
DATA_ROLL_PTR_LEN); DATA_ROLL_PTR_LEN);
#if DATA_ROLL_PTR != 2 #if DATA_ROLL_PTR != 2
...@@ -882,7 +884,8 @@ Adds a table object to the dictionary cache. */ ...@@ -882,7 +884,8 @@ Adds a table object to the dictionary cache. */
void void
dict_table_add_to_cache( dict_table_add_to_cache(
/*====================*/ /*====================*/
dict_table_t* table) /* in: table */ dict_table_t* table, /* in: table */
mem_heap_t* heap) /* in: temporary heap */
{ {
ulint fold; ulint fold;
ulint id_fold; ulint id_fold;
...@@ -894,7 +897,7 @@ dict_table_add_to_cache( ...@@ -894,7 +897,7 @@ dict_table_add_to_cache(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
dict_table_add_system_columns(table); dict_table_add_system_columns(table, heap);
table->cached = TRUE; table->cached = TRUE;
......
...@@ -467,7 +467,8 @@ dict_load_columns( ...@@ -467,7 +467,8 @@ dict_load_columns(
ut_a(name_of_col_is(sys_columns, sys_index, 8, "PREC")); ut_a(name_of_col_is(sys_columns, sys_index, 8, "PREC"));
dict_mem_table_add_col(table, name, mtype, prtype, col_len); dict_mem_table_add_col(table, heap, name,
mtype, prtype, col_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr); btr_pcur_move_to_next_user_rec(&pcur, &mtr);
} }
...@@ -791,7 +792,7 @@ dict_load_table( ...@@ -791,7 +792,7 @@ dict_load_table(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
heap = mem_heap_create(1000); heap = mem_heap_create(32000);
mtr_start(&mtr); mtr_start(&mtr);
...@@ -904,7 +905,9 @@ err_exit: ...@@ -904,7 +905,9 @@ err_exit:
dict_load_columns(table, heap); dict_load_columns(table, heap);
dict_table_add_to_cache(table); dict_table_add_to_cache(table, heap);
mem_heap_empty(heap);
dict_load_indexes(table, heap); dict_load_indexes(table, heap);
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
......
...@@ -116,9 +116,7 @@ dict_mem_table_free( ...@@ -116,9 +116,7 @@ dict_mem_table_free(
} }
/******************************************************************** /********************************************************************
Add 'name' to end of the col_names array (see dict_table_t::col_names). Call Append 'name' to 'col_names' (@see dict_table_t::col_names). */
ut_free on col_names (if not NULL), allocate new array (if heap, from it,
otherwise with ut_malloc), and copy col_names + name to it. */
static static
const char* const char*
dict_add_col_name( dict_add_col_name(
...@@ -128,21 +126,19 @@ dict_add_col_name( ...@@ -128,21 +126,19 @@ dict_add_col_name(
NULL */ NULL */
ulint cols, /* in: number of existing columns */ ulint cols, /* in: number of existing columns */
const char* name, /* in: new column name */ const char* name, /* in: new column name */
mem_heap_t* heap) /* in: heap, or NULL */ mem_heap_t* heap) /* in: heap */
{ {
ulint i; ulint old_len;
ulint old_len; ulint new_len;
ulint new_len; ulint total_len;
ulint total_len; char* res;
const char* s;
char* res;
ut_a(((cols == 0) && !col_names) || ((cols > 0) && col_names)); ut_ad(!cols == !col_names);
ut_a(*name);
/* Find out length of existing array. */ /* Find out length of existing array. */
if (col_names) { if (col_names) {
s = col_names; const char* s = col_names;
ulint i;
for (i = 0; i < cols; i++) { for (i = 0; i < cols; i++) {
s += strlen(s) + 1; s += strlen(s) + 1;
...@@ -156,11 +152,7 @@ dict_add_col_name( ...@@ -156,11 +152,7 @@ dict_add_col_name(
new_len = strlen(name) + 1; new_len = strlen(name) + 1;
total_len = old_len + new_len; total_len = old_len + new_len;
if (heap) { res = mem_heap_alloc(heap, total_len);
res = mem_heap_alloc(heap, total_len);
} else {
res = ut_malloc(total_len);
}
if (old_len > 0) { if (old_len > 0) {
memcpy(res, col_names, old_len); memcpy(res, col_names, old_len);
...@@ -168,10 +160,6 @@ dict_add_col_name( ...@@ -168,10 +160,6 @@ dict_add_col_name(
memcpy(res + old_len, name, new_len); memcpy(res + old_len, name, new_len);
if (col_names) {
ut_free((char*)col_names);
}
return(res); return(res);
} }
...@@ -182,7 +170,8 @@ void ...@@ -182,7 +170,8 @@ void
dict_mem_table_add_col( dict_mem_table_add_col(
/*===================*/ /*===================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in: table */
const char* name, /* in: column name */ mem_heap_t* heap, /* in: temporary memory heap, or NULL */
const char* name, /* in: column name, or NULL */
ulint mtype, /* in: main datatype */ ulint mtype, /* in: main datatype */
ulint prtype, /* in: precise type */ ulint prtype, /* in: precise type */
ulint len) /* in: precision */ ulint len) /* in: precision */
...@@ -190,21 +179,32 @@ dict_mem_table_add_col( ...@@ -190,21 +179,32 @@ dict_mem_table_add_col(
dict_col_t* col; dict_col_t* col;
ulint mbminlen; ulint mbminlen;
ulint mbmaxlen; ulint mbmaxlen;
mem_heap_t* heap; ulint i;
ut_ad(table && name); ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_ad(!heap == !name);
table->n_def++; i = table->n_def++;
heap = table->n_def < table->n_cols ? NULL : table->heap; if (name) {
table->col_names = dict_add_col_name(table->col_names, if (UNIV_UNLIKELY(table->n_def == table->n_cols)) {
table->n_def - 1, heap = table->heap;
name, heap); }
if (UNIV_LIKELY(i) && UNIV_UNLIKELY(!table->col_names)) {
/* All preceding column names are empty. */
char* s = mem_heap_alloc(heap, table->n_def);
memset(s, 0, table->n_def);
table->col_names = s;
}
col = dict_table_get_nth_col(table, table->n_def - 1); table->col_names = dict_add_col_name(table->col_names,
i, name, heap);
}
col = dict_table_get_nth_col(table, i);
col->ind = table->n_def - 1; col->ind = i;
col->ord_part = 0; col->ord_part = 0;
col->mtype = mtype; col->mtype = mtype;
...@@ -317,7 +317,7 @@ dict_mem_index_add_field( ...@@ -317,7 +317,7 @@ dict_mem_index_add_field(
{ {
dict_field_t* field; dict_field_t* field;
ut_ad(index && name); ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
index->n_def++; index->n_def++;
......
...@@ -4547,7 +4547,7 @@ create_table_def( ...@@ -4547,7 +4547,7 @@ create_table_def(
} }
} }
dict_mem_table_add_col(table, dict_mem_table_add_col(table, table->heap,
(char*) field->field_name, (char*) field->field_name,
col_type, col_type,
dtype_form_prtype( dtype_form_prtype(
......
...@@ -466,7 +466,8 @@ ibuf_data_init_for_space( ...@@ -466,7 +466,8 @@ ibuf_data_init_for_space(
page_t* root; page_t* root;
page_t* header_page; page_t* header_page;
mtr_t mtr; mtr_t mtr;
char buf[50]; char* buf;
mem_heap_t* heap;
dict_table_t* table; dict_table_t* table;
dict_index_t* index; dict_index_t* index;
ulint n_used; ulint n_used;
...@@ -524,16 +525,20 @@ ibuf_data_init_for_space( ...@@ -524,16 +525,20 @@ ibuf_data_init_for_space(
ibuf_exit(); ibuf_exit();
heap = mem_heap_create(450);
buf = mem_heap_alloc(heap, 50);
sprintf(buf, "SYS_IBUF_TABLE_%lu", (ulong) space); sprintf(buf, "SYS_IBUF_TABLE_%lu", (ulong) space);
/* use old-style record format for the insert buffer */ /* use old-style record format for the insert buffer */
table = dict_mem_table_create(buf, space, 2, 0); table = dict_mem_table_create(buf, space, 2, 0);
dict_mem_table_add_col(table, "PAGE_NO", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "PAGE_NO", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "TYPES", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "TYPES", DATA_BINARY, 0, 0);
table->id = ut_dulint_add(DICT_IBUF_ID_MIN, space); table->id = ut_dulint_add(DICT_IBUF_ID_MIN, space);
dict_table_add_to_cache(table); dict_table_add_to_cache(table, heap);
mem_heap_free(heap);
index = dict_mem_index_create( index = dict_mem_index_create(
buf, "CLUST_IND", space, buf, "CLUST_IND", space,
...@@ -1175,7 +1180,7 @@ ibuf_dummy_index_add_col( ...@@ -1175,7 +1180,7 @@ ibuf_dummy_index_add_col(
ulint len) /* in: length of the column */ ulint len) /* in: length of the column */
{ {
ulint i = index->table->n_def; ulint i = index->table->n_def;
dict_mem_table_add_col(index->table, "DUMMY", dict_mem_table_add_col(index->table, NULL, NULL,
dtype_get_mtype(type), dtype_get_mtype(type),
dtype_get_prtype(type), dtype_get_prtype(type),
dtype_get_len(type)); dtype_get_len(type));
......
...@@ -218,14 +218,16 @@ Adds system columns to a table object. */ ...@@ -218,14 +218,16 @@ Adds system columns to a table object. */
void void
dict_table_add_system_columns( dict_table_add_system_columns(
/*==========================*/ /*==========================*/
dict_table_t* table); /* in/out: table */ dict_table_t* table, /* in/out: table */
mem_heap_t* heap); /* in: temporary heap */
/************************************************************************** /**************************************************************************
Adds a table object to the dictionary cache. */ Adds a table object to the dictionary cache. */
void void
dict_table_add_to_cache( dict_table_add_to_cache(
/*====================*/ /*====================*/
dict_table_t* table); /* in: table */ dict_table_t* table, /* in: table */
mem_heap_t* heap); /* in: temporary heap */
/************************************************************************** /**************************************************************************
Removes a table object from the dictionary cache. */ Removes a table object from the dictionary cache. */
......
...@@ -75,7 +75,8 @@ void ...@@ -75,7 +75,8 @@ void
dict_mem_table_add_col( dict_mem_table_add_col(
/*===================*/ /*===================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in: table */
const char* name, /* in: column name */ mem_heap_t* heap, /* in: temporary memory heap, or NULL */
const char* name, /* in: column name, or NULL */
ulint mtype, /* in: main datatype */ ulint mtype, /* in: main datatype */
ulint prtype, /* in: precise type */ ulint prtype, /* in: precise type */
ulint len); /* in: precision */ ulint len); /* in: precision */
......
...@@ -560,7 +560,7 @@ mlog_parse_index( ...@@ -560,7 +560,7 @@ mlog_parse_index(
the rest is 0 or 0x7fff for variable-length fields, the rest is 0 or 0x7fff for variable-length fields,
and 1..0x7ffe for fixed-length fields. */ and 1..0x7ffe for fixed-length fields. */
dict_mem_table_add_col( dict_mem_table_add_col(
table, "DUMMY", table, NULL, NULL,
((len + 1) & 0x7fff) <= 1 ((len + 1) & 0x7fff) <= 1
? DATA_BINARY : DATA_FIXBINARY, ? DATA_BINARY : DATA_FIXBINARY,
len & 0x8000 ? DATA_NOT_NULL : 0, len & 0x8000 ? DATA_NOT_NULL : 0,
...@@ -570,7 +570,7 @@ mlog_parse_index( ...@@ -570,7 +570,7 @@ mlog_parse_index(
dict_table_get_nth_col(table, i), dict_table_get_nth_col(table, i),
0); 0);
} }
dict_table_add_system_columns(table); dict_table_add_system_columns(table, table->heap);
if (n_uniq != n) { if (n_uniq != n) {
/* Identify DB_TRX_ID and DB_ROLL_PTR in the index. */ /* Identify DB_TRX_ID and DB_ROLL_PTR in the index. */
ut_a(DATA_TRX_ID_LEN ut_a(DATA_TRX_ID_LEN
......
...@@ -1268,7 +1268,7 @@ page_zip_fields_decode( ...@@ -1268,7 +1268,7 @@ page_zip_fields_decode(
mtype = DATA_FIXBINARY; mtype = DATA_FIXBINARY;
} }
dict_mem_table_add_col(table, "DUMMY", mtype, dict_mem_table_add_col(table, NULL, NULL, mtype,
val & 1 ? DATA_NOT_NULL : 0, len); val & 1 ? DATA_NOT_NULL : 0, len);
dict_index_add_col(index, table, dict_index_add_col(index, table,
dict_table_get_nth_col(table, i), 0); dict_table_get_nth_col(table, i), 0);
......
...@@ -1640,7 +1640,8 @@ pars_create_table( ...@@ -1640,7 +1640,8 @@ pars_create_table(
while (column) { while (column) {
dtype = dfield_get_type(que_node_get_val(column)); dtype = dfield_get_type(que_node_get_val(column));
dict_mem_table_add_col(table, column->name, dtype->mtype, dict_mem_table_add_col(table, table->heap,
column->name, dtype->mtype,
dtype->prtype, dtype->len); dtype->prtype, dtype->len);
column->resolved = TRUE; column->resolved = TRUE;
column->token_type = SYM_COLUMN; column->token_type = SYM_COLUMN;
......
...@@ -886,7 +886,7 @@ srv_init(void) ...@@ -886,7 +886,7 @@ srv_init(void)
/* create dummy table and index for old-style infimum and supremum */ /* create dummy table and index for old-style infimum and supremum */
table = dict_mem_table_create("SYS_DUMMY1", table = dict_mem_table_create("SYS_DUMMY1",
DICT_HDR_SPACE, 1, 0); DICT_HDR_SPACE, 1, 0);
dict_mem_table_add_col(table, "DUMMY", DATA_CHAR, dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR,
DATA_ENGLISH | DATA_NOT_NULL, 8); DATA_ENGLISH | DATA_NOT_NULL, 8);
srv_sys->dummy_ind1 = dict_mem_index_create( srv_sys->dummy_ind1 = dict_mem_index_create(
...@@ -897,7 +897,7 @@ srv_init(void) ...@@ -897,7 +897,7 @@ srv_init(void)
/* create dummy table and index for new-style infimum and supremum */ /* create dummy table and index for new-style infimum and supremum */
table = dict_mem_table_create("SYS_DUMMY2", table = dict_mem_table_create("SYS_DUMMY2",
DICT_HDR_SPACE, 1, DICT_TF_COMPACT); DICT_HDR_SPACE, 1, DICT_TF_COMPACT);
dict_mem_table_add_col(table, "DUMMY", DATA_CHAR, dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR,
DATA_ENGLISH | DATA_NOT_NULL, 8); DATA_ENGLISH | DATA_NOT_NULL, 8);
srv_sys->dummy_ind2 = dict_mem_index_create( srv_sys->dummy_ind2 = dict_mem_index_create(
"SYS_DUMMY2", "SYS_DUMMY2", DICT_HDR_SPACE, 0, 1); "SYS_DUMMY2", "SYS_DUMMY2", DICT_HDR_SPACE, 0, 1);
......
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