Commit 9a16aac7 authored by marko's avatar marko

branches/zip: Merge revisions 804:838 from trunk.

parent e4dc19ba
This diff is collapsed.
This diff is collapsed.
......@@ -76,20 +76,20 @@ btr_pcur_store_position(
{
page_cur_t* page_cursor;
rec_t* rec;
dict_tree_t* tree;
dict_index_t* index;
page_t* page;
ulint offs;
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor));
index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
page_cursor = btr_pcur_get_page_cur(cursor);
rec = page_cur_get_rec(page_cursor);
page = ut_align_down(rec, UNIV_PAGE_SIZE);
offs = ut_align_offset(rec, UNIV_PAGE_SIZE);
page = page_align(rec);
offs = page_offset(rec);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_S_FIX)
......@@ -133,13 +133,13 @@ btr_pcur_store_position(
}
cursor->old_stored = BTR_PCUR_OLD_STORED;
cursor->old_rec = dict_tree_copy_rec_order_prefix
(tree, rec, &cursor->old_n_fields,
&cursor->old_rec_buf, &cursor->buf_size);
cursor->old_rec = dict_index_copy_rec_order_prefix(
index, rec, &cursor->old_n_fields,
&cursor->old_rec_buf, &cursor->buf_size);
cursor->block_when_stored = buf_block_align(page);
cursor->modify_clock = buf_block_get_modify_clock
(cursor->block_when_stored);
cursor->modify_clock = buf_block_get_modify_clock(
cursor->block_when_stored);
}
/******************************************************************
......@@ -197,13 +197,15 @@ btr_pcur_restore_position(
btr_pcur_t* cursor, /* in: detached persistent cursor */
mtr_t* mtr) /* in: mtr */
{
dict_tree_t* tree;
dict_index_t* index;
page_t* page;
dtuple_t* tuple;
ulint mode;
ulint old_mode;
mem_heap_t* heap;
index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED)
|| UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
&& cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
......@@ -215,17 +217,16 @@ btr_pcur_restore_position(
ut_error;
}
if (UNIV_UNLIKELY
(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
if (UNIV_UNLIKELY(
cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
/* In these cases we do not try an optimistic restoration,
but always do a search */
btr_cur_open_at_index_side
(cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
btr_pcur_get_btr_cur(cursor)->index, latch_mode,
btr_pcur_get_btr_cur(cursor), mtr);
btr_cur_open_at_index_side(
cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
index, latch_mode, btr_pcur_get_btr_cur(cursor), mtr);
cursor->block_when_stored
= buf_block_align(btr_pcur_get_page(cursor));
......@@ -242,10 +243,10 @@ btr_pcur_restore_position(
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
/* Try optimistic restoration */
if (UNIV_LIKELY
(buf_page_optimistic_get(latch_mode,
cursor->block_when_stored, page,
cursor->modify_clock, mtr))) {
if (UNIV_LIKELY(buf_page_optimistic_get(
latch_mode,
cursor->block_when_stored, page,
cursor->modify_clock, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
......@@ -255,20 +256,18 @@ btr_pcur_restore_position(
rec_t* rec;
ulint* offsets1;
ulint* offsets2;
dict_index_t* index;
#endif /* UNIV_DEBUG */
cursor->latch_mode = latch_mode;
#ifdef UNIV_DEBUG
rec = btr_pcur_get_rec(cursor);
index = btr_pcur_get_btr_cur(cursor)->index;
heap = mem_heap_create(256);
offsets1 = rec_get_offsets
(cursor->old_rec, index, NULL,
cursor->old_n_fields, &heap);
offsets2 = rec_get_offsets
(rec, index, NULL,
cursor->old_n_fields, &heap);
offsets1 = rec_get_offsets(
cursor->old_rec, index, NULL,
cursor->old_n_fields, &heap);
offsets2 = rec_get_offsets(
rec, index, NULL,
cursor->old_n_fields, &heap);
ut_ad(!cmp_rec_rec(cursor->old_rec,
rec, offsets1, offsets2,
......@@ -286,9 +285,8 @@ btr_pcur_restore_position(
heap = mem_heap_create(256);
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor));
tuple = dict_tree_build_data_tuple(tree, cursor->old_rec,
cursor->old_n_fields, heap);
tuple = dict_index_build_data_tuple(index, cursor->old_rec,
cursor->old_n_fields, heap);
/* Save the old search mode of the cursor */
old_mode = cursor->search_mode;
......@@ -302,8 +300,8 @@ btr_pcur_restore_position(
mode = PAGE_CUR_L;
}
btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple,
mode, latch_mode, cursor, 0, mtr);
btr_pcur_open_with_no_init(index, tuple, mode, latch_mode,
cursor, 0, mtr);
/* Restore the old search mode */
cursor->search_mode = old_mode;
......@@ -311,19 +309,18 @@ btr_pcur_restore_position(
if (cursor->rel_pos == BTR_PCUR_ON
&& btr_pcur_is_on_user_rec(cursor, mtr)
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
rec_get_offsets
(btr_pcur_get_rec(cursor),
btr_pcur_get_btr_cur(cursor)->index,
NULL, ULINT_UNDEFINED, &heap))) {
rec_get_offsets(
btr_pcur_get_rec(cursor), index,
NULL, ULINT_UNDEFINED, &heap))) {
/* We have to store the NEW value for the modify clock, since
the cursor can now be on a different page! But we can retain
the value of old_rec */
cursor->block_when_stored = buf_block_align
(btr_pcur_get_page(cursor));
cursor->modify_clock = buf_block_get_modify_clock
(cursor->block_when_stored);
cursor->block_when_stored = buf_block_align(
btr_pcur_get_page(cursor));
cursor->modify_clock = buf_block_get_modify_clock(
cursor->block_when_stored);
cursor->old_stored = BTR_PCUR_OLD_STORED;
mem_heap_free(heap);
......
This diff is collapsed.
......@@ -335,10 +335,12 @@ buf_page_is_corrupted(
"InnoDB: for more information.\n",
(ulong) mach_read_from_4(read_buf
+ FIL_PAGE_OFFSET),
(ulong) ut_dulint_get_high
(mach_read_from_8(read_buf + FIL_PAGE_LSN)),
(ulong) ut_dulint_get_low
(mach_read_from_8(read_buf + FIL_PAGE_LSN)),
(ulong) ut_dulint_get_high(
mach_read_from_8(read_buf
+ FIL_PAGE_LSN)),
(ulong) ut_dulint_get_low(
mach_read_from_8(read_buf
+ FIL_PAGE_LSN)),
(ulong) ut_dulint_get_high(current_lsn),
(ulong) ut_dulint_get_low(current_lsn));
}
......@@ -360,9 +362,9 @@ buf_page_is_corrupted(
!= page_zip_calc_checksum(read_buf, zip_size));
}
old_checksum_field = mach_read_from_4
(read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM);
old_checksum_field = mach_read_from_4(
read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM);
/* There are 2 valid formulas for old_checksum_field:
......@@ -439,16 +441,16 @@ buf_page_print(
"InnoDB: space id (if stored"
" to page already) %lu\n",
(ulong) checksum,
(ulong) mach_read_from_4
(read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
(ulong) mach_read_from_4
(read_buf + FIL_PAGE_LSN),
(ulong) mach_read_from_4
(read_buf + (FIL_PAGE_LSN + 4)),
(ulong) mach_read_from_4
(read_buf + FIL_PAGE_OFFSET),
(ulong) mach_read_from_4
(read_buf + FIL_PAGE_ZBLOB_SPACE_ID));
(ulong) mach_read_from_4(
read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
(ulong) mach_read_from_4(
read_buf + FIL_PAGE_LSN),
(ulong) mach_read_from_4(
read_buf + (FIL_PAGE_LSN + 4)),
(ulong) mach_read_from_4(
read_buf + FIL_PAGE_OFFSET),
(ulong) mach_read_from_4(
read_buf + FIL_PAGE_ZBLOB_SPACE_ID));
return;
default:
ut_print_timestamp(stderr);
......@@ -472,16 +474,17 @@ buf_page_print(
"InnoDB: space id (if stored"
" to page already) %lu\n",
(ulong) checksum,
(ulong) mach_read_from_4
(read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
(ulong) mach_read_from_4
(read_buf + FIL_PAGE_LSN),
(ulong) mach_read_from_4
(read_buf + (FIL_PAGE_LSN + 4)),
(ulong) mach_read_from_4
(read_buf + FIL_PAGE_OFFSET),
(ulong) mach_read_from_4
(read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
(ulong) mach_read_from_4(
read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
(ulong) mach_read_from_4(
read_buf + FIL_PAGE_LSN),
(ulong) mach_read_from_4(
read_buf + (FIL_PAGE_LSN + 4)),
(ulong) mach_read_from_4(
read_buf + FIL_PAGE_OFFSET),
(ulong) mach_read_from_4(
read_buf
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
return;
case FIL_PAGE_TYPE_XDES:
/* This is an uncompressed page. */
......@@ -533,10 +536,10 @@ buf_page_print(
fprintf(stderr,
"InnoDB: Page may be an index page where"
" index id is %lu %lu\n",
(ulong) ut_dulint_get_high
(btr_page_get_index_id(read_buf)),
(ulong) ut_dulint_get_low
(btr_page_get_index_id(read_buf)));
(ulong) ut_dulint_get_high(
btr_page_get_index_id(read_buf)),
(ulong) ut_dulint_get_low(
btr_page_get_index_id(read_buf)));
#ifdef UNIV_HOTBACKUP
/* If the code is in ibbackup, dict_sys may be uninitialized,
......@@ -547,8 +550,8 @@ buf_page_print(
}
#endif /* UNIV_HOTBACKUP */
index = dict_index_find_on_id_low
(btr_page_get_index_id(read_buf));
index = dict_index_find_on_id_low(
btr_page_get_index_id(read_buf));
if (index) {
fputs("InnoDB: (", stderr);
dict_index_name_print(stderr, NULL, index);
......@@ -691,8 +694,8 @@ buf_pool_init(
/* Allocate the virtual address space window, i.e., the
buffer pool frames */
buf_pool->frame_mem = os_awe_allocate_virtual_mem_window
(UNIV_PAGE_SIZE * (n_frames + 1));
buf_pool->frame_mem = os_awe_allocate_virtual_mem_window(
UNIV_PAGE_SIZE * (n_frames + 1));
/* Allocate the physical memory for AWE and the AWE info array
for buf_pool */
......@@ -718,8 +721,8 @@ buf_pool_init(
}
/*----------------------------------------*/
} else {
buf_pool->frame_mem = os_mem_alloc_large
(UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE);
buf_pool->frame_mem = os_mem_alloc_large(
UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE);
}
if (buf_pool->frame_mem == NULL) {
......@@ -914,10 +917,10 @@ buf_awe_map_page_to_frame(
} else {
/* We can map block to the frame of bck */
os_awe_map_physical_mem_to_window
(bck->frame,
UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
block->awe_info);
os_awe_map_physical_mem_to_window(
bck->frame,
UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
block->awe_info);
block->frame = bck->frame;
......@@ -933,10 +936,10 @@ buf_awe_map_page_to_frame(
bck);
if (add_to_mapped_list) {
UT_LIST_ADD_FIRST
(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped,
block);
UT_LIST_ADD_FIRST(
awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped,
block);
}
buf_pool->n_pages_awe_remapped++;
......@@ -1621,7 +1624,7 @@ buf_page_init_for_backup_restore(
block->is_hashed = FALSE;
block->n_fields = 1;
block->n_bytes = 0;
block->side = BTR_SEARCH_LEFT_SIDE;
block->left_side = TRUE;
page_zip_des_init(&block->page_zip);
/* TODO: allocate page_zip->data? */
......@@ -1691,7 +1694,7 @@ buf_page_init(
block->is_hashed = FALSE;
block->n_fields = 1;
block->n_bytes = 0;
block->side = BTR_SEARCH_LEFT_SIDE;
block->left_side = TRUE;
block->file_page_was_freed = FALSE;
}
......@@ -1752,8 +1755,8 @@ buf_page_init_for_read(
mutex_enter(&(buf_pool->mutex));
if (fil_tablespace_deleted_or_being_deleted_in_mem
(space, tablespace_version)) {
if (fil_tablespace_deleted_or_being_deleted_in_mem(
space, tablespace_version)) {
*err = DB_TABLESPACE_DELETED;
}
......@@ -1944,8 +1947,9 @@ buf_page_io_complete(
switch (fil_page_get_type(frame)) {
case FIL_PAGE_INDEX:
if (block->frame) {
if (!page_zip_decompress
(&block->page_zip, block->frame)) {
if (!page_zip_decompress(
&block->page_zip,
block->frame)) {
goto corrupt;
}
}
......@@ -1978,12 +1982,12 @@ buf_page_io_complete(
read_page_no = mach_read_from_4(frame + FIL_PAGE_OFFSET);
switch (fil_page_get_type(frame)) {
case FIL_PAGE_TYPE_ZBLOB:
read_space_id = mach_read_from_4
(frame + FIL_PAGE_ZBLOB_SPACE_ID);
read_space_id = mach_read_from_4(
frame + FIL_PAGE_ZBLOB_SPACE_ID);
break;
default:
read_space_id = mach_read_from_4
(frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
read_space_id = mach_read_from_4(
frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
}
if (!block->space
......@@ -2069,9 +2073,9 @@ buf_page_io_complete(
}
if (!recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page
(block->frame, block->space,
block->offset, TRUE);
ibuf_merge_or_delete_for_page(
block->frame, block->space, block->offset,
TRUE);
}
}
......@@ -2199,8 +2203,9 @@ buf_validate(void)
if (block->flush_type == BUF_FLUSH_LRU) {
n_lru_flush++;
ut_a(rw_lock_is_locked
(&block->lock, RW_LOCK_SHARED));
ut_a(rw_lock_is_locked(
&block->lock,
RW_LOCK_SHARED));
} else if (block->flush_type
== BUF_FLUSH_LIST) {
n_list_flush++;
......@@ -2320,7 +2325,7 @@ buf_print(void)
while (j < n_found) {
if (ut_dulint_cmp(index_ids[j], id) == 0) {
(counts[j])++;
counts[j]++;
break;
}
......
......@@ -191,7 +191,7 @@ buf_flush_write_complete(
ut_d(UT_LIST_VALIDATE(flush_list, buf_block_t, buf_pool->flush_list));
(buf_pool->n_flush[block->flush_type])--;
buf_pool->n_flush[block->flush_type]--;
if (block->flush_type == BUF_FLUSH_LRU) {
/* Put the block to the end of the LRU list to wait to be
......@@ -527,8 +527,8 @@ buf_flush_init_for_writing(
mach_write_to_4(page_zip->data
+ FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums
? page_zip_calc_checksum
(page_zip->data, zip_size)
? page_zip_calc_checksum(
page_zip->data, zip_size)
: BUF_NO_CHECKSUM_MAGIC);
return;
case FIL_PAGE_TYPE_ALLOCATED:
......@@ -556,8 +556,8 @@ buf_flush_init_for_writing(
mach_write_to_4(page_zip->data
+ FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums
? page_zip_calc_checksum
(page_zip->data, zip_size)
? page_zip_calc_checksum(
page_zip->data, zip_size)
: BUF_NO_CHECKSUM_MAGIC);
return;
}
......@@ -692,7 +692,7 @@ buf_flush_try_page(
os_event_reset(buf_pool->no_flush[flush_type]);
}
(buf_pool->n_flush[flush_type])++;
buf_pool->n_flush[flush_type]++;
locked = FALSE;
......@@ -759,7 +759,7 @@ buf_flush_try_page(
os_event_reset(buf_pool->no_flush[flush_type]);
}
(buf_pool->n_flush[flush_type])++;
buf_pool->n_flush[flush_type]++;
rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
......@@ -798,7 +798,7 @@ buf_flush_try_page(
os_event_reset(buf_pool->no_flush[block->flush_type]);
}
(buf_pool->n_flush[flush_type])++;
buf_pool->n_flush[flush_type]++;
mutex_exit(&(buf_pool->mutex));
......@@ -949,7 +949,7 @@ buf_flush_batch(
return(ULINT_UNDEFINED);
}
(buf_pool->init_flush)[flush_type] = TRUE;
buf_pool->init_flush[flush_type] = TRUE;
for (;;) {
/* If we have flushed enough, leave the loop */
......@@ -998,8 +998,8 @@ buf_flush_batch(
old_page_count = page_count;
/* Try to flush also all the neighbors */
page_count += buf_flush_try_neighbors
(space, offset, flush_type);
page_count += buf_flush_try_neighbors(
space, offset, flush_type);
/* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset,
......@@ -1024,7 +1024,7 @@ buf_flush_batch(
}
}
(buf_pool->init_flush)[flush_type] = FALSE;
buf_pool->init_flush[flush_type] = FALSE;
if ((buf_pool->n_flush[flush_type] == 0)
&& (buf_pool->init_flush[flush_type] == FALSE)) {
......
......@@ -561,16 +561,16 @@ buf_LRU_old_adjust_len(void)
if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) {
buf_pool->LRU_old = UT_LIST_GET_PREV
(LRU, buf_pool->LRU_old);
(buf_pool->LRU_old)->old = TRUE;
buf_pool->LRU_old = UT_LIST_GET_PREV(
LRU, buf_pool->LRU_old);
buf_pool->LRU_old->old = TRUE;
buf_pool->LRU_old_len++;
} else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) {
(buf_pool->LRU_old)->old = FALSE;
buf_pool->LRU_old = UT_LIST_GET_NEXT
(LRU, buf_pool->LRU_old);
buf_pool->LRU_old->old = FALSE;
buf_pool->LRU_old = UT_LIST_GET_NEXT(
LRU, buf_pool->LRU_old);
buf_pool->LRU_old_len--;
} else {
ut_a(buf_pool->LRU_old); /* Check that we did not
......@@ -638,7 +638,7 @@ buf_LRU_remove_block(
tolerance value from strict 3/8 of the LRU list length. */
buf_pool->LRU_old = UT_LIST_GET_PREV(LRU, block);
(buf_pool->LRU_old)->old = TRUE;
buf_pool->LRU_old->old = TRUE;
buf_pool->LRU_old_len++;
ut_a(buf_pool->LRU_old);
......@@ -923,12 +923,12 @@ buf_LRU_block_remove_hashed_page(
fprintf(stderr,
"InnoDB: In hash table we find block"
" %p of %lu %lu which is not %p\n",
(void*) buf_page_hash_get
(block->space, block->offset),
(ulong) buf_page_hash_get
(block->space, block->offset)->space,
(ulong) buf_page_hash_get
(block->space, block->offset)->offset,
(void*) buf_page_hash_get(
block->space, block->offset),
(ulong) buf_page_hash_get(
block->space, block->offset)->space,
(ulong) buf_page_hash_get(
block->space, block->offset)->offset,
(void*) block);
}
......@@ -1086,8 +1086,8 @@ buf_LRU_print(void)
fprintf(stderr, "\nLRU pos %lu type %lu index id %lu\n",
(ulong) block->LRU_position,
(ulong) fil_page_get_type(frame),
(ulong) ut_dulint_get_low
(btr_page_get_index_id(frame)));
(ulong) ut_dulint_get_low(
btr_page_get_index_id(frame)));
block = UT_LIST_GET_NEXT(LRU, block);
}
......
......@@ -268,10 +268,10 @@ buf_read_ahead_random(
mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(zip_size, i)) {
count += buf_read_page_low
(&err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, tablespace_version, i);
count += buf_read_page_low(
&err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
......@@ -566,10 +566,10 @@ buf_read_ahead_linear(
aio mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(zip_size, i)) {
count += buf_read_page_low
(&err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, tablespace_version, i);
count += buf_read_page_low(
&err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
......
......@@ -40,9 +40,6 @@ charset-collation code for them. */
ulint data_mysql_default_charset_coll = 99999999;
dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0, 0, 0};
dtype_t* dtype_binary = &dtype_binary_val;
/*************************************************************************
Determine how many bytes the first n characters of the given string occupy.
If the string is shorter than n characters, returns the number of bytes
......@@ -53,7 +50,11 @@ dtype_get_at_most_n_mbchars(
/*========================*/
/* out: length of the prefix,
in bytes */
const dtype_t* dtype, /* in: data type */
ulint prtype, /* in: precise type */
ulint mbminlen, /* in: minimum length of a
multi-byte character */
ulint mbmaxlen, /* in: maximum length of a
multi-byte character */
ulint prefix_len, /* in: length of the requested
prefix, in characters, multiplied by
dtype_get_mbmaxlen(dtype) */
......@@ -63,12 +64,12 @@ dtype_get_at_most_n_mbchars(
{
#ifndef UNIV_HOTBACKUP
ut_a(data_len != UNIV_SQL_NULL);
ut_ad(!dtype->mbmaxlen || !(prefix_len % dtype->mbmaxlen));
ut_ad(!mbmaxlen || !(prefix_len % mbmaxlen));
if (dtype->mbminlen != dtype->mbmaxlen) {
ut_a(!(prefix_len % dtype->mbmaxlen));
return(innobase_get_at_most_n_mbchars
(dtype_get_charset_coll(dtype->prtype),
if (mbminlen != mbmaxlen) {
ut_a(!(prefix_len % mbmaxlen));
return(innobase_get_at_most_n_mbchars(
dtype_get_charset_coll(prtype),
prefix_len, data_len, str));
}
......@@ -270,8 +271,6 @@ dtype_print(
} else if (prtype == DATA_TRX_ID) {
fputs("DATA_TRX_ID", stderr);
len = DATA_TRX_ID_LEN;
} else if (prtype == DATA_MIX_ID) {
fputs("DATA_MIX_ID", stderr);
} else if (prtype == DATA_ENGLISH) {
fputs("DATA_ENGLISH", stderr);
} else {
......@@ -291,38 +290,5 @@ dtype_print(
}
}
fprintf(stderr, " len %lu prec %lu", (ulong) len, (ulong) type->prec);
}
/***************************************************************************
Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */
ulint
dtype_get_max_size(
/*===============*/
/* out: maximum size (ULINT_MAX for
unbounded types) */
const dtype_t* type) /* in: type */
{
switch (type->mtype) {
case DATA_SYS:
case DATA_CHAR:
case DATA_FIXBINARY:
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
case DATA_MYSQL:
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
return(type->len);
case DATA_BLOB:
return(ULINT_MAX);
default:
ut_error;
}
return(ULINT_MAX);
fprintf(stderr, " len %lu", (ulong) len);
}
......@@ -58,8 +58,7 @@ dict_hdr_get_new_id(
dulint id;
mtr_t mtr;
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID)
|| (type == DICT_HDR_MIX_ID));
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID));
mtr_start(&mtr);
......@@ -141,6 +140,7 @@ dict_hdr_create(
mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
/* Obsolete, but we must initialize it to 0 anyway. */
mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
......@@ -219,7 +219,6 @@ dict_boot(void)
dict_index_t* index;
dict_hdr_t* dict_hdr;
mtr_t mtr;
ibool success;
mtr_start(&mtr);
......@@ -241,25 +240,25 @@ dict_boot(void)
..._MARGIN, it will immediately be updated to the disk-based
header. */
dict_sys->row_id = ut_dulint_add
(ut_dulint_align_up(mtr_read_dulint
(dict_hdr + DICT_HDR_ROW_ID, &mtr),
DICT_HDR_ROW_ID_WRITE_MARGIN),
DICT_HDR_ROW_ID_WRITE_MARGIN);
dict_sys->row_id = ut_dulint_add(
ut_dulint_align_up(mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
&mtr),
DICT_HDR_ROW_ID_WRITE_MARGIN),
DICT_HDR_ROW_ID_WRITE_MARGIN);
/* Insert into the dictionary cache the descriptions of the basic
system tables */
/*-------------------------*/
table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "N_COLS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "MIX_LEN", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "CLUSTER_NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "N_COLS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "MIX_LEN", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "CLUSTER_NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4);
table->id = DICT_TABLES_ID;
......@@ -274,31 +273,30 @@ dict_boot(void)
index->id = DICT_TABLES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_TABLES,
MLOG_4BYTES, &mtr));
ut_a(success);
dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr + DICT_HDR_TABLES,
MLOG_4BYTES, &mtr));
/*-------------------------*/
index = dict_mem_index_create("SYS_TABLES", "ID_IND",
DICT_HDR_SPACE, DICT_UNIQUE, 1);
dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_TABLE_IDS_ID;
success = dict_index_add_to_cache(table, index,
mtr_read_ulint
(dict_hdr + DICT_HDR_TABLE_IDS,
MLOG_4BYTES, &mtr));
ut_a(success);
dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr + DICT_HDR_TABLE_IDS,
MLOG_4BYTES, &mtr));
/*-------------------------*/
table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY,0,0,0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4);
table->id = DICT_COLUMNS_ID;
......@@ -313,20 +311,20 @@ dict_boot(void)
dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_COLUMNS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr));
ut_a(success);
dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr + DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr));
/*-------------------------*/
table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "N_FIELDS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "PAGE_NO", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "N_FIELDS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PAGE_NO", DATA_INT, 0, 4);
/* The '+ 2' below comes from the 2 system fields */
#if DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2
......@@ -351,16 +349,16 @@ dict_boot(void)
dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_INDEXES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr));
ut_a(success);
dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr + DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr));
/*-------------------------*/
table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0);
dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "COL_NAME", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "COL_NAME", DATA_BINARY, 0, 0);
table->id = DICT_FIELDS_ID;
dict_table_add_to_cache(table);
......@@ -374,10 +372,9 @@ dict_boot(void)
dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_FIELDS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr));
ut_a(success);
dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr + DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr));
mtr_commit(&mtr);
/*-------------------------*/
......
......@@ -85,14 +85,14 @@ dict_create_sys_tables_tuple(
}
dfield_set_data(dfield, ptr, 4);
/* 6: MIX_ID ---------------------------*/
/* 6: MIX_ID (obsolete) ---------------------------*/
dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 8);
memset(ptr, 0, 8);
dfield_set_data(dfield, ptr, 8);
/* 7: MIX_LEN --------------------------*/
/* 7: MIX_LEN (obsolete) --------------------------*/
dfield = dtuple_get_nth_field(entry, 5);
......@@ -131,11 +131,12 @@ dict_create_sys_columns_tuple(
mem_heap_t* heap) /* in: memory heap from which the memory for
the built tuple is allocated */
{
dict_table_t* sys_columns;
dtuple_t* entry;
dict_col_t* column;
dfield_t* dfield;
byte* ptr;
dict_table_t* sys_columns;
dtuple_t* entry;
const dict_col_t* column;
dfield_t* dfield;
byte* ptr;
const char* col_name;
ut_ad(table && heap);
......@@ -162,33 +163,34 @@ dict_create_sys_columns_tuple(
/* 4: NAME ---------------------------*/
dfield = dtuple_get_nth_field(entry, 2);
dfield_set_data(dfield, column->name, ut_strlen(column->name));
col_name = dict_table_get_col_name(table, i);
dfield_set_data(dfield, col_name, ut_strlen(col_name));
/* 5: MTYPE --------------------------*/
dfield = dtuple_get_nth_field(entry, 3);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).mtype);
mach_write_to_4(ptr, column->mtype);
dfield_set_data(dfield, ptr, 4);
/* 6: PRTYPE -------------------------*/
dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).prtype);
mach_write_to_4(ptr, column->prtype);
dfield_set_data(dfield, ptr, 4);
/* 7: LEN ----------------------------*/
dfield = dtuple_get_nth_field(entry, 5);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).len);
mach_write_to_4(ptr, column->len);
dfield_set_data(dfield, ptr, 4);
/* 8: PREC ---------------------------*/
dfield = dtuple_get_nth_field(entry, 6);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).prec);
mach_write_to_4(ptr, 0/* unused */);
dfield_set_data(dfield, ptr, 4);
/*---------------------------------*/
......@@ -229,8 +231,7 @@ dict_build_table_def_step(
row_len = 0;
for (i = 0; i < table->n_def; i++) {
row_len += dtype_get_min_size(dict_col_get_type
(&table->cols[i]));
row_len += dict_col_get_min_size(&table->cols[i]);
}
if (row_len > BTR_PAGE_MAX_REC_SIZE) {
return(DB_TOO_BIG_RECORD);
......@@ -245,7 +246,7 @@ dict_build_table_def_step(
- page 3 will contain the root of the clustered index of the
table we create here. */
table->space = 0; /* reset to zero for the call below */
ulint space = 0; /* reset to zero for the call below */
if (table->dir_path_of_temp_table) {
/* We place tables created with CREATE TEMPORARY
......@@ -258,10 +259,11 @@ dict_build_table_def_step(
is_path = FALSE;
}
error = fil_create_new_single_table_tablespace
(&(table->space), path_or_name, is_path,
dict_table_zip_size(table),
FIL_IBD_FILE_INITIAL_SIZE);
error = fil_create_new_single_table_tablespace(
&space, path_or_name, is_path,
dict_table_zip_size(table),
FIL_IBD_FILE_INITIAL_SIZE);
table->space = space;
if (error != DB_SUCCESS) {
......@@ -783,8 +785,8 @@ dict_truncate_index_tree(
appropriate field in the SYS_INDEXES record: this mini-transaction
marks the B-tree totally truncated */
comp = page_is_comp(btr_page_get
(space, root_page_no, RW_X_LATCH, mtr));
comp = page_is_comp(btr_page_get(space, root_page_no, RW_X_LATCH,
mtr));
btr_free_root(space, root_page_no, mtr);
/* We will temporarily write FIL_NULL to the PAGE_NO field
......@@ -813,7 +815,7 @@ dict_truncate_index_tree(
root_page_no = btr_create(type, space, index_id, index, mtr);
if (index) {
index->tree->page = root_page_no;
index->page = root_page_no;
} else {
ut_print_timestamp(stderr);
fprintf(stderr,
......@@ -1019,7 +1021,6 @@ dict_create_index_step(
que_thr_t* thr) /* in: query thread */
{
ind_node_t* node;
ibool success;
ulint err = DB_ERROR;
trx_t* trx;
......@@ -1080,10 +1081,7 @@ dict_create_index_step(
dulint index_id = node->index->id;
success = dict_index_add_to_cache(node->table, node->index,
FIL_NULL);
ut_a(success);
dict_index_add_to_cache(node->table, node->index, FIL_NULL);
node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(node->index);
......@@ -1104,7 +1102,7 @@ dict_create_index_step(
goto function_exit;
}
node->index->tree->page = node->page_no;
node->index->page = node->page_no;
node->state = INDEX_COMMIT_WORK;
}
......@@ -1353,13 +1351,14 @@ dict_create_add_foreign_field_to_dictionary(
pars_info_add_str_literal(info, "ref_col_name",
foreign->referenced_col_names[field_nr]);
return(dict_foreign_eval_sql
(info, "PROCEDURE P () IS\n"
"BEGIN\n"
"INSERT INTO SYS_FOREIGN_COLS VALUES"
"(:id, :pos, :for_col_name, :ref_col_name);\n"
"END;\n",
table, foreign, trx));
return(dict_foreign_eval_sql(
info,
"PROCEDURE P () IS\n"
"BEGIN\n"
"INSERT INTO SYS_FOREIGN_COLS VALUES"
"(:id, :pos, :for_col_name, :ref_col_name);\n"
"END;\n",
table, foreign, trx));
}
/************************************************************************
......@@ -1418,8 +1417,8 @@ dict_create_add_foreign_to_dictionary(
}
for (i = 0; i < foreign->n_fields; i++) {
error = dict_create_add_foreign_field_to_dictionary
(i, table, foreign, trx);
error = dict_create_add_foreign_field_to_dictionary(
i, table, foreign, trx);
if (error != DB_SUCCESS) {
......@@ -1475,8 +1474,8 @@ dict_create_add_foreigns_to_dictionary(
foreign;
foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
error = dict_create_add_foreign_to_dictionary
(&number, table, foreign, trx);
error = dict_create_add_foreign_to_dictionary(&number, table,
foreign, trx);
if (error != DB_SUCCESS) {
......
This diff is collapsed.
......@@ -26,6 +26,25 @@ Created 4/24/1996 Heikki Tuuri
#include "srv0start.h"
#include "srv0srv.h"
/********************************************************************
Returns TRUE if index's i'th column's name is 'name' .*/
static
ibool
name_of_col_is(
/*===========*/
/* out: */
dict_table_t* table, /* in: table */
dict_index_t* index, /* in: index */
ulint i, /* in: */
const char* name) /* in: name to compare to */
{
ulint tmp = dict_col_get_no(dict_field_get_col(
dict_index_get_nth_field(
index, i)));
return(strcmp(name, dict_table_get_col_name(table, tmp)) == 0);
}
/************************************************************************
Finds the first table name in the given database. */
......@@ -375,7 +394,6 @@ dict_load_columns(
ulint mtype;
ulint prtype;
ulint col_len;
ulint prec;
ulint i;
mtr_t mtr;
......@@ -400,7 +418,7 @@ dict_load_columns(
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < table->n_cols - DATA_N_SYS_COLS; i++) {
for (i = 0; i + DATA_N_SYS_COLS < (ulint) table->n_cols; i++) {
rec = btr_pcur_get_rec(&pcur);
......@@ -416,8 +434,7 @@ dict_load_columns(
ut_ad(len == 4);
ut_a(i == mach_read_from_4(field));
ut_a(!strcmp("NAME", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
ut_a(name_of_col_is(sys_columns, sys_index, 4, "NAME"));
field = rec_get_nth_field_old(rec, 4, &len);
name = mem_heap_strdupl(heap, (char*) field, len);
......@@ -436,30 +453,25 @@ dict_load_columns(
/* Use the binary collation for
string columns of binary type. */
prtype = dtype_form_prtype
(prtype,
DATA_MYSQL_BINARY_CHARSET_COLL);
prtype = dtype_form_prtype(
prtype,
DATA_MYSQL_BINARY_CHARSET_COLL);
} else {
/* Use the default charset for
other than binary columns. */
prtype = dtype_form_prtype
(prtype,
data_mysql_default_charset_coll);
prtype = dtype_form_prtype(
prtype,
data_mysql_default_charset_coll);
}
}
field = rec_get_nth_field_old(rec, 7, &len);
col_len = mach_read_from_4(field);
ut_a(!strcmp("PREC", dict_field_get_col
(dict_index_get_nth_field(sys_index, 8))->name));
field = rec_get_nth_field_old(rec, 8, &len);
prec = mach_read_from_4(field);
ut_a(name_of_col_is(sys_columns, sys_index, 8, "PREC"));
dict_mem_table_add_col(table, name, mtype, prtype, col_len,
prec);
dict_mem_table_add_col(table, name, mtype, prtype, col_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
......@@ -570,13 +582,13 @@ dict_load_fields(
prefix_len = 0;
}
ut_a(!strcmp("COL_NAME", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
ut_a(name_of_col_is(sys_fields, sys_index, 4, "COL_NAME"));
field = rec_get_nth_field_old(rec, 4, &len);
dict_mem_index_add_field(index, mem_heap_strdupl
(heap, (char*) field, len),
dict_mem_index_add_field(index,
mem_heap_strdupl(heap,
(char*) field, len),
prefix_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
......@@ -675,8 +687,7 @@ dict_load_indexes(
ut_ad(len == 8);
id = mach_read_from_8(field);
ut_a(!strcmp("NAME", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
ut_a(name_of_col_is(sys_indexes, sys_index, 4, "NAME"));
field = rec_get_nth_field_old(rec, 4, &name_len);
name_buf = mem_heap_strdupl(heap, (char*) field, name_len);
......@@ -690,8 +701,7 @@ dict_load_indexes(
field = rec_get_nth_field_old(rec, 7, &len);
space = mach_read_from_4(field);
ut_a(!strcmp("PAGE_NO", dict_field_get_col
(dict_index_get_nth_field(sys_index, 8))->name));
ut_a(name_of_col_is(sys_indexes, sys_index, 8, "PAGE_NO"));
field = rec_get_nth_field_old(rec, 8, &len);
page_no = mach_read_from_4(field);
......@@ -830,8 +840,7 @@ dict_load_table(
goto err_exit;
}
ut_a(!strcmp("SPACE", dict_field_get_col
(dict_index_get_nth_field(sys_index, 9))->name));
ut_a(name_of_col_is(sys_tables, sys_index, 9, "SPACE"));
field = rec_get_nth_field_old(rec, 9, &len);
space = mach_read_from_4(field);
......@@ -857,8 +866,8 @@ dict_load_table(
" Retrying an open.\n",
name, (ulong)space);
/* Try to open the tablespace */
if (!fil_open_single_table_tablespace
(TRUE, space, zip_size, name)) {
if (!fil_open_single_table_tablespace(
TRUE, space, zip_size, name)) {
/* We failed to find a sensible tablespace
file */
......@@ -869,8 +878,7 @@ dict_load_table(
zip_size = 0;
}
ut_a(!strcmp("N_COLS", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS"));
field = rec_get_nth_field_old(rec, 4, &len);
n_cols = mach_read_from_4(field);
......@@ -887,8 +895,7 @@ dict_load_table(
table->ibd_file_missing = ibd_file_missing;
ut_a(!strcmp("ID", dict_field_get_col
(dict_index_get_nth_field(sys_index, 3))->name));
ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID"));
field = rec_get_nth_field_old(rec, 3, &len);
table->id = mach_read_from_8(field);
......@@ -977,8 +984,8 @@ dict_load_table_on_id(
/*---------------------------------------------------*/
/* Get the secondary index based on ID for table SYS_TABLES */
sys_tables = dict_sys->sys_tables;
sys_table_ids = dict_table_get_next_index
(dict_table_get_first_index(sys_tables));
sys_table_ids = dict_table_get_next_index(
dict_table_get_first_index(sys_tables));
ut_a(!dict_table_is_comp(sys_tables));
heap = mem_heap_create(256);
......@@ -1084,11 +1091,11 @@ dict_load_foreign_cols(
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
foreign->foreign_col_names = mem_heap_alloc
(foreign->heap, foreign->n_fields * sizeof(void*));
foreign->foreign_col_names = mem_heap_alloc(
foreign->heap, foreign->n_fields * sizeof(void*));
foreign->referenced_col_names = mem_heap_alloc
(foreign->heap, foreign->n_fields * sizeof(void*));
foreign->referenced_col_names = mem_heap_alloc(
foreign->heap, foreign->n_fields * sizeof(void*));
mtr_start(&mtr);
sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS");
......@@ -1119,12 +1126,12 @@ dict_load_foreign_cols(
ut_a(i == mach_read_from_4(field));
field = rec_get_nth_field_old(rec, 4, &len);
foreign->foreign_col_names[i] = mem_heap_strdupl
(foreign->heap, (char*) field, len);
foreign->foreign_col_names[i] = mem_heap_strdupl(
foreign->heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 5, &len);
foreign->referenced_col_names[i] = mem_heap_strdupl
(foreign->heap, (char*) field, len);
foreign->referenced_col_names[i] = mem_heap_strdupl(
foreign->heap, (char*) field, len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
......@@ -1217,8 +1224,8 @@ dict_load_foreign(
foreign = dict_mem_foreign_create();
foreign->n_fields = mach_read_from_4
(rec_get_nth_field_old(rec, 5, &len));
foreign->n_fields = mach_read_from_4(
rec_get_nth_field_old(rec, 5, &len));
ut_a(len == 4);
......@@ -1230,12 +1237,12 @@ dict_load_foreign(
foreign->id = mem_heap_strdup(foreign->heap, id);
field = rec_get_nth_field_old(rec, 3, &len);
foreign->foreign_table_name = mem_heap_strdupl
(foreign->heap, (char*) field, len);
foreign->foreign_table_name = mem_heap_strdupl(
foreign->heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 4, &len);
foreign->referenced_table_name = mem_heap_strdupl
(foreign->heap, (char*) field, len);
foreign->referenced_table_name = mem_heap_strdupl(
foreign->heap, (char*) field, len);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -1309,8 +1316,8 @@ dict_load_foreigns(
/* Get the secondary index based on FOR_NAME from table
SYS_FOREIGN */
sec_index = dict_table_get_next_index
(dict_table_get_first_index(sys_foreign));
sec_index = dict_table_get_next_index(
dict_table_get_first_index(sys_foreign));
start_load:
heap = mem_heap_create(256);
......@@ -1341,7 +1348,8 @@ dict_load_foreigns(
following call does the comparison in the latin1_swedish_ci
charset-collation, in a case-insensitive way. */
if (0 != cmp_data_data(dfield_get_type(dfield),
if (0 != cmp_data_data(dfield_get_type(dfield)->mtype,
dfield_get_type(dfield)->prtype,
dfield_get_data(dfield), dfield_get_len(dfield),
field, len)) {
......
......@@ -65,6 +65,7 @@ dict_mem_table_create(
table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS)
* sizeof(dict_col_t));
table->col_names = NULL;
UT_LIST_INIT(table->indexes);
table->auto_inc_lock = mem_heap_alloc(heap, lock_get_size());
......@@ -75,20 +76,22 @@ dict_mem_table_create(
UT_LIST_INIT(table->foreign_list);
UT_LIST_INIT(table->referenced_list);
#ifdef UNIV_DEBUG
table->does_not_fit_in_memory = FALSE;
#endif /* UNIV_DEBUG */
table->stat_initialized = FALSE;
table->stat_modified_counter = 0;
table->max_row_size = 0;
table->big_rows = 0;
mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
table->autoinc_inited = FALSE;
#ifdef UNIV_DEBUG
table->magic_n = DICT_TABLE_MAGIC_N;
#endif /* UNIV_DEBUG */
return(table);
}
......@@ -104,9 +107,74 @@ dict_mem_table_free(
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
mutex_free(&(table->autoinc_mutex));
if (table->col_names && (table->n_def < table->n_cols)) {
ut_free((void*)table->col_names);
}
mem_heap_free(table->heap);
}
/********************************************************************
Add 'name' to end of the col_names array (see dict_table_t::col_names). Call
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
const char*
dict_add_col_name(
/*==============*/
/* out: new column names array */
const char* col_names, /* in: existing column names, or
NULL */
ulint cols, /* in: number of existing columns */
const char* name, /* in: new column name */
mem_heap_t* heap) /* in: heap, or NULL */
{
ulint i;
ulint old_len;
ulint new_len;
ulint total_len;
const char* s;
char* res;
ut_a(((cols == 0) && !col_names) || ((cols > 0) && col_names));
ut_a(*name);
/* Find out length of existing array. */
if (col_names) {
s = col_names;
for (i = 0; i < cols; i++) {
s += strlen(s) + 1;
}
old_len = s - col_names;
} else {
old_len = 0;
}
new_len = strlen(name) + 1;
total_len = old_len + new_len;
if (heap) {
res = mem_heap_alloc(heap, total_len);
} else {
res = ut_malloc(total_len);
}
if (old_len > 0) {
memcpy(res, col_names, old_len);
}
memcpy(res + old_len, name, new_len);
if (col_names) {
ut_free((char*)col_names);
}
return(res);
}
/**************************************************************************
Adds a column definition to a table. */
......@@ -117,30 +185,37 @@ dict_mem_table_add_col(
const char* name, /* in: column name */
ulint mtype, /* in: main datatype */
ulint prtype, /* in: precise type */
ulint len, /* in: length */
ulint prec) /* in: precision */
ulint len) /* in: precision */
{
dict_col_t* col;
dtype_t* type;
ulint mbminlen;
ulint mbmaxlen;
mem_heap_t* heap;
ut_ad(table && name);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
table->n_def++;
col = dict_table_get_nth_col(table, table->n_def - 1);
heap = table->n_def < table->n_cols ? NULL : table->heap;
table->col_names = dict_add_col_name(table->col_names,
table->n_def - 1,
name, heap);
col = (dict_col_t*) dict_table_get_nth_col(table, table->n_def - 1);
col->ind = table->n_def - 1;
col->name = mem_heap_strdup(table->heap, name);
col->table = table;
col->ord_part = 0;
col->min_prefix = 0;
col->clust_pos = ULINT_UNDEFINED;
col->mtype = mtype;
col->prtype = prtype;
col->len = len;
type = dict_col_get_type(col);
dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen);
dtype_set(type, mtype, prtype, len, prec);
col->mbminlen = mbminlen;
col->mbmaxlen = mbmaxlen;
}
/**************************************************************************
......@@ -171,6 +246,7 @@ dict_mem_index_create(
index->type = type;
index->space = space;
index->page = 0;
index->name = mem_heap_strdup(heap, index_name);
index->table_name = table_name;
index->table = NULL;
......@@ -183,8 +259,10 @@ dict_mem_index_create(
index->stat_n_diff_key_vals = NULL;
index->cached = FALSE;
memset(&index->lock, 0, sizeof index->lock);
#ifdef UNIV_DEBUG
index->magic_n = DICT_INDEX_MAGIC_N;
#endif /* UNIV_DEBUG */
return(index);
}
......
......@@ -334,7 +334,7 @@ eval_predefined_2(
if (len2 > len1) {
int_val = (lint) (len1
+ (eval_rnd % (len2 - len1 + 1)));
+ (eval_rnd % (len2 - len1 + 1)));
} else {
int_val = (lint) len1;
}
......
......@@ -51,8 +51,8 @@ if_step(
for (;;) {
eval_exp(elsif_node->cond);
if (eval_node_get_ibool_val
(elsif_node->cond)) {
if (eval_node_get_ibool_val(
elsif_node->cond)) {
/* The condition evaluated to TRUE:
start execution from the first
......
......@@ -591,9 +591,8 @@ fil_node_open_file(
os_file_read() in Windows to read from a file opened for
async I/O! */
node->handle = os_file_create_simple_no_error_handling
(node->name,
OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
node->handle = os_file_create_simple_no_error_handling(
node->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
......@@ -1696,8 +1695,8 @@ fil_write_flushed_lsn_to_data_files(
while (node) {
mutex_exit(&(fil_system->mutex));
err = fil_write_lsn_and_arch_no_to_file
(sum_of_sizes, lsn, arch_log_no);
err = fil_write_lsn_and_arch_no_to_file(
sum_of_sizes, lsn, arch_log_no);
if (err != DB_SUCCESS) {
return(err);
......@@ -2088,9 +2087,9 @@ fil_op_log_parse_or_replay(
not exist yet */
fil_create_directory_for_tablename(name);
if (fil_create_new_single_table_tablespace
(&space_id, name, FALSE, zip_size,
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
if (fil_create_new_single_table_tablespace(
&space_id, name, FALSE, zip_size,
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
ut_error;
}
}
......@@ -2752,8 +2751,8 @@ fil_reset_too_high_lsns(
filepath = fil_make_ibd_name(name, FALSE);
file = os_file_create_simple_no_error_handling
(filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success);
file = os_file_create_simple_no_error_handling(
filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
......@@ -2827,8 +2826,8 @@ fil_reset_too_high_lsns(
if (ut_dulint_cmp(mach_read_from_8(page + FIL_PAGE_LSN),
current_lsn) > 0) {
/* We have to reset the lsn */
space_id = mach_read_from_4
(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
space_id = mach_read_from_4(
page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
buf_flush_init_for_writing(page,
......@@ -2912,8 +2911,8 @@ fil_open_single_table_tablespace(
filepath = fil_make_ibd_name(name, FALSE);
file = os_file_create_simple_no_error_handling
(filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
file = os_file_create_simple_no_error_handling(
filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
......@@ -3066,8 +3065,8 @@ fil_load_single_table_tablespace(
dict_casedn_str(filepath);
# endif /* !UNIV_HOTBACKUP */
#endif
file = os_file_create_simple_no_error_handling
(filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
file = os_file_create_simple_no_error_handling(
filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
......@@ -3424,8 +3423,8 @@ fil_load_single_table_tablespaces(void)
".ibd")) {
/* The name ends in .ibd; try opening
the file */
fil_load_single_table_tablespace
(dbinfo.name, fileinfo.name);
fil_load_single_table_tablespace(
dbinfo.name, fileinfo.name);
}
next_file_item:
ret = fil_file_readdir_next_file(&err,
......@@ -3845,8 +3844,8 @@ fil_extend_space_to_desired_size(
how much we were able to extend it */
n_pages = ((ulint)
(os_file_get_size_as_iblonglong
(node->handle)
(os_file_get_size_as_iblonglong(
node->handle)
/ page_size)) - node->size;
node->size += n_pages;
......@@ -3923,8 +3922,8 @@ fil_extend_tablespaces_to_stored_len(void)
size_in_header = fsp_get_size_low(buf);
success = fil_extend_space_to_desired_size
(&actual_size, space->id, size_in_header);
success = fil_extend_space_to_desired_size(
&actual_size, space->id, size_in_header);
if (!success) {
fprintf(stderr,
"InnoDB: Error: could not extend the"
......@@ -4276,9 +4275,9 @@ fil_io(
for (;;) {
if (UNIV_UNLIKELY(node == NULL)) {
fil_report_invalid_page_access
(block_offset, space_id,
space->name, byte_offset, len, type);
fil_report_invalid_page_access(
block_offset, space_id, space->name,
byte_offset, len, type);
ut_error;
}
......@@ -4307,9 +4306,9 @@ fil_io(
if (UNIV_UNLIKELY(node->size <= block_offset)
&& space->id != 0 && space->purpose == FIL_TABLESPACE) {
fil_report_invalid_page_access
(block_offset, space_id,
space->name, byte_offset, len, type);
fil_report_invalid_page_access(
block_offset, space_id, space->name, byte_offset,
len, type);
ut_error;
}
......@@ -4540,10 +4539,10 @@ fil_flush(
space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE
(unflushed_spaces,
system->unflushed_spaces,
space);
UT_LIST_REMOVE(
unflushed_spaces,
system->unflushed_spaces,
space);
}
}
......
......@@ -685,10 +685,10 @@ xdes_get_descriptor_with_space_hdr(
ut_ad(mtr);
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains
(mtr, buf_block_align(sp_header), MTR_MEMO_PAGE_S_FIX)
|| mtr_memo_contains
(mtr, buf_block_align(sp_header), MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(
mtr, buf_block_align(sp_header), MTR_MEMO_PAGE_S_FIX)
|| mtr_memo_contains(
mtr, buf_block_align(sp_header), MTR_MEMO_PAGE_X_FIX));
/* Read free limit and space size */
limit = mach_read_from_4(sp_header + FSP_FREE_LIMIT);
size = mach_read_from_4(sp_header + FSP_SIZE);
......@@ -795,8 +795,9 @@ xdes_lst_get_next(
space = buf_frame_get_space_id(descr);
return(xdes_lst_get_descriptor
(space, flst_get_next_addr(descr + XDES_FLST_NODE, mtr), mtr));
return(xdes_lst_get_descriptor(
space,
flst_get_next_addr(descr + XDES_FLST_NODE, mtr), mtr));
}
/************************************************************************
......@@ -1212,11 +1213,11 @@ fsp_try_extend_data_file(
if (size < extent_size) {
/* Let us first extend the file to extent_size */
success = fsp_try_extend_data_file_with_pages
(space, extent_size - 1, header, mtr);
success = fsp_try_extend_data_file_with_pages(
space, extent_size - 1, header, mtr);
if (!success) {
new_size = mtr_read_ulint
(header + FSP_SIZE, MLOG_4BYTES, mtr);
new_size = mtr_read_ulint(header + FSP_SIZE,
MLOG_4BYTES, mtr);
*actual_increase = new_size - old_size;
......@@ -1335,9 +1336,9 @@ fsp_fill_free_list(
a checkpoint */
if (space == 0) {
ut_a(!zip_size);
log_fsp_current_free_limit_set_and_checkpoint
((i + FSP_EXTENT_SIZE)
/ ((1024 * 1024) / UNIV_PAGE_SIZE));
log_fsp_current_free_limit_set_and_checkpoint(
(i + FSP_EXTENT_SIZE)
/ ((1024 * 1024) / UNIV_PAGE_SIZE));
}
if (UNIV_UNLIKELY(init_xdes)) {
......@@ -1347,8 +1348,8 @@ fsp_fill_free_list(
pages should be ignored. */
if (i > 0) {
descr_page = buf_page_create
(space, i, zip_size, mtr);
descr_page = buf_page_create(
space, i, zip_size, mtr);
buf_page_get(space, i, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(descr_page,
......@@ -1766,8 +1767,8 @@ fsp_seg_inode_page_find_used(
for (i = 0; i < FSP_SEG_INODES_PER_PAGE(zip_size); i++) {
inode = fsp_seg_inode_page_get_nth_inode
(page, i, zip_size, mtr);
inode = fsp_seg_inode_page_get_nth_inode(
page, i, zip_size, mtr);
if (ut_dulint_cmp(mach_read_from_8(inode + FSEG_ID),
ut_dulint_zero) != 0) {
......@@ -1797,8 +1798,8 @@ fsp_seg_inode_page_find_free(
for (; i < FSP_SEG_INODES_PER_PAGE(zip_size); i++) {
inode = fsp_seg_inode_page_get_nth_inode
(page, i, zip_size, mtr);
inode = fsp_seg_inode_page_get_nth_inode(
page, i, zip_size, mtr);
if (ut_dulint_cmp(mach_read_from_8(inode + FSEG_ID),
ut_dulint_zero) == 0) {
......@@ -1847,13 +1848,13 @@ fsp_alloc_seg_inode_page(
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
zip_size = mtr_read_ulint
(space_header + FSP_PAGE_ZIP_SIZE, MLOG_4BYTES, mtr);
zip_size = mtr_read_ulint(space_header + FSP_PAGE_ZIP_SIZE,
MLOG_4BYTES, mtr);
for (i = 0; i < FSP_SEG_INODES_PER_PAGE(zip_size); i++) {
inode = fsp_seg_inode_page_get_nth_inode
(page, i, zip_size, mtr);
inode = fsp_seg_inode_page_get_nth_inode(page, i,
zip_size, mtr);
mlog_write_dulint(inode + FSEG_ID, ut_dulint_zero, mtr);
}
......@@ -2078,8 +2079,8 @@ fseg_find_last_used_frag_page_slot(
ut_ad(inode && mtr);
for (i = 0; i < FSEG_FRAG_ARR_N_SLOTS; i++) {
page_no = fseg_get_nth_frag_page_no
(inode, FSEG_FRAG_ARR_N_SLOTS - i - 1, mtr);
page_no = fseg_get_nth_frag_page_no(
inode, FSEG_FRAG_ARR_N_SLOTS - i - 1, mtr);
if (page_no != FIL_NULL) {
......@@ -2637,8 +2638,8 @@ fseg_alloc_free_page_low(
return(FIL_NULL);
}
success = fsp_try_extend_data_file_with_pages
(space, ret_page, space_header, mtr);
success = fsp_try_extend_data_file_with_pages(
space, ret_page, space_header, mtr);
if (!success) {
/* No disk space left */
return(FIL_NULL);
......@@ -3300,8 +3301,8 @@ fseg_free_extent(
/* Drop search system page hash index if the page is
found in the pool and is hashed */
btr_search_drop_page_hash_when_freed
(space, first_page_in_extent + i);
btr_search_drop_page_hash_when_freed(
space, first_page_in_extent + i);
}
}
......@@ -3315,8 +3316,8 @@ fseg_free_extent(
flst_remove(seg_inode + FSEG_NOT_FULL,
descr + XDES_FLST_NODE, mtr);
not_full_n_used = mtr_read_ulint
(seg_inode + FSEG_NOT_FULL_N_USED, MLOG_4BYTES, mtr);
not_full_n_used = mtr_read_ulint(
seg_inode + FSEG_NOT_FULL_N_USED, MLOG_4BYTES, mtr);
descr_n_used = xdes_get_n_used(descr, mtr);
ut_a(not_full_n_used >= descr_n_used);
......@@ -3903,15 +3904,15 @@ fsp_validate(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr
(space, node_addr, RW_X_LATCH, &mtr)
seg_inode_page = fut_get_ptr(
space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode
(seg_inode_page, n, zip_size, &mtr);
ut_a(ut_dulint_cmp
(mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0);
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, zip_size, &mtr);
ut_a(ut_dulint_cmp(
mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0);
fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_FREE,
......@@ -3923,8 +3924,8 @@ fsp_validate(
n_used2 += fseg_get_n_frag_pages(seg_inode, &mtr);
next_node_addr = flst_get_next_addr
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
next_node_addr = flst_get_next_addr(
seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
} while (++n < FSP_SEG_INODES_PER_PAGE(zip_size));
......@@ -3950,29 +3951,29 @@ fsp_validate(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr
(space, node_addr, RW_X_LATCH, &mtr)
seg_inode_page = fut_get_ptr(
space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode
(seg_inode_page, n, zip_size, &mtr);
if (ut_dulint_cmp
(mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0) {
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, zip_size, &mtr);
if (ut_dulint_cmp(
mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0) {
fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len
(seg_inode + FSEG_FREE, &mtr);
descr_count += flst_get_len
(seg_inode + FSEG_FULL, &mtr);
descr_count += flst_get_len
(seg_inode + FSEG_NOT_FULL, &mtr);
n_used2 += fseg_get_n_frag_pages
(seg_inode, &mtr);
descr_count += flst_get_len(
seg_inode + FSEG_FREE, &mtr);
descr_count += flst_get_len(
seg_inode + FSEG_FULL, &mtr);
descr_count += flst_get_len(
seg_inode + FSEG_NOT_FULL, &mtr);
n_used2 += fseg_get_n_frag_pages(
seg_inode, &mtr);
}
next_node_addr = flst_get_next_addr
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
next_node_addr = flst_get_next_addr(
seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
} while (++n < FSP_SEG_INODES_PER_PAGE(zip_size));
......@@ -4088,21 +4089,21 @@ fsp_print(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr
(space, node_addr, RW_X_LATCH, &mtr)
seg_inode_page = fut_get_ptr(
space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode
(seg_inode_page, n, zip_size, &mtr);
ut_a(ut_dulint_cmp
(mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0);
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, zip_size, &mtr);
ut_a(ut_dulint_cmp(
mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0);
fseg_print_low(seg_inode, &mtr);
n_segs++;
next_node_addr = flst_get_next_addr
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
next_node_addr = flst_get_next_addr(
seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
} while (++n < FSP_SEG_INODES_PER_PAGE(zip_size));
......@@ -4127,22 +4128,22 @@ fsp_print(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr
(space, node_addr, RW_X_LATCH, &mtr)
seg_inode_page = fut_get_ptr(
space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode
(seg_inode_page, n, zip_size, &mtr);
if (ut_dulint_cmp
(mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0) {
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, zip_size, &mtr);
if (ut_dulint_cmp(
mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0) {
fseg_print_low(seg_inode, &mtr);
n_segs++;
}
next_node_addr = flst_get_next_addr
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
next_node_addr = flst_get_next_addr(
seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
} while (++n < FSP_SEG_INODES_PER_PAGE(zip_size));
......
......@@ -3022,8 +3022,9 @@ ha_innobase::store_key_val_for_row(
/******************************************************************
Builds a 'template' to the prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
static
void
ha_innobase::build_template(
build_template(
/*===========*/
row_prebuilt_t* prebuilt, /* in: prebuilt struct */
THD* thd, /* in: current user thread, used
......@@ -3164,8 +3165,8 @@ ha_innobase::build_template(
templ->col_no = i;
if (index == clust_index) {
templ->rec_field_no = (index->table->cols + i)
->clust_pos;
templ->rec_field_no = dict_col_get_clust_pos_noninline(
&index->table->cols[i], index);
} else {
templ->rec_field_no = dict_index_get_nth_col_pos(
index, i);
......@@ -3194,7 +3195,7 @@ ha_innobase::build_template(
mysql_prefix_len = templ->mysql_col_offset
+ templ->mysql_col_len;
}
templ->type = index->table->cols[i].type.mtype;
templ->type = index->table->cols[i].mtype;
templ->mysql_type = (ulint)field->type();
if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR) {
......@@ -3203,10 +3204,10 @@ ha_innobase::build_template(
}
templ->charset = dtype_get_charset_coll_noninline(
index->table->cols[i].type.prtype);
templ->mbminlen = index->table->cols[i].type.mbminlen;
templ->mbmaxlen = index->table->cols[i].type.mbmaxlen;
templ->is_unsigned = index->table->cols[i].type.prtype
index->table->cols[i].prtype);
templ->mbminlen = index->table->cols[i].mbminlen;
templ->mbmaxlen = index->table->cols[i].mbmaxlen;
templ->is_unsigned = index->table->cols[i].prtype
& DATA_UNSIGNED;
if (templ->type == DATA_BLOB) {
prebuilt->templ_contains_blob = TRUE;
......@@ -3224,8 +3225,9 @@ ha_innobase::build_template(
for (i = 0; i < n_requested_fields; i++) {
templ = prebuilt->mysql_template + i;
templ->rec_field_no =
(index->table->cols + templ->col_no)->clust_pos;
templ->rec_field_no = dict_col_get_clust_pos_noninline(
&index->table->cols[templ->col_no],
clust_index);
}
}
}
......@@ -3491,9 +3493,11 @@ calc_row_difference(
ulint col_type;
ulint n_changed = 0;
dfield_t dfield;
dict_index_t* clust_index;
uint i;
n_fields = table->s->fields;
clust_index = dict_table_get_first_index_noninline(prebuilt->table);
/* We use upd_buff to convert changed fields */
buf = (byte*) upd_buff;
......@@ -3524,7 +3528,7 @@ calc_row_difference(
field_mysql_type = field->type();
col_type = prebuilt->table->cols[i].type.mtype;
col_type = prebuilt->table->cols[i].mtype;
switch (col_type) {
......@@ -3579,7 +3583,8 @@ calc_row_difference(
/* Let us use a dummy dfield to make the conversion
from the MySQL column format to the InnoDB format */
dfield.type = (prebuilt->table->cols + i)->type;
dict_col_copy_type_noninline(prebuilt->table->cols + i,
&dfield.type);
if (n_len != UNIV_SQL_NULL) {
buf = row_mysql_store_col_in_innobase_format(
......@@ -3598,7 +3603,8 @@ calc_row_difference(
}
ufield->exp = NULL;
ufield->field_no = prebuilt->table->cols[i].clust_pos;
ufield->field_no = dict_col_get_clust_pos_noninline(
&prebuilt->table->cols[i], clust_index);
n_changed++;
}
}
......@@ -4578,8 +4584,7 @@ create_table_def(
| nulls_allowed | unsigned_type
| binary_type | long_true_varchar,
charset_no),
col_len,
0);
col_len);
}
error = row_create_table_for_mysql(table, trx);
......@@ -7624,7 +7629,9 @@ mysql_declare_plugin(innobase)
innobase_init, /* Plugin Init */
NULL, /* Plugin Deinit */
0x0100 /* 1.0 */,
innodb_status_variables_export
innodb_status_variables_export,
NULL, /* system variables */
NULL /* config options */
}
mysql_declare_plugin_end;
......@@ -201,8 +201,6 @@ class ha_innobase: public handler
int cmp_ref(const byte *ref1, const byte *ref2);
bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes);
void build_template(struct row_prebuilt_struct *prebuilt, THD *thd,
TABLE *table, uint templ_type);
};
extern SHOW_VAR innodb_status_variables[];
......
This diff is collapsed.
This diff is collapsed.
......@@ -238,7 +238,7 @@ btr_node_ptr_get_child_page_no(
fprintf(stderr,
"InnoDB: a nonsensical page number 0"
" in a node ptr record at offset %lu\n",
(ulong) ut_align_offset(rec, UNIV_PAGE_SIZE));
(ulong) page_offset(rec));
buf_page_print(buf_frame_align(rec), 0);
}
......
......@@ -59,13 +59,13 @@ btr_cur_get_page(
/* out: pointer to page */
btr_cur_t* cursor);/* in: tree cursor */
/*************************************************************
Returns the tree of a cursor. */
Returns the index of a cursor. */
UNIV_INLINE
dict_tree_t*
btr_cur_get_tree(
/*=============*/
/* out: tree */
btr_cur_t* cursor);/* in: tree cursor */
dict_index_t*
btr_cur_get_index(
/*==============*/
/* out: index */
btr_cur_t* cursor);/* in: B-tree cursor */
/*************************************************************
Positions a tree cursor at a given record. */
UNIV_INLINE
......
This diff is collapsed.
......@@ -445,7 +445,7 @@ selects, updates, and deletes. */
struct btr_pcur_struct{
btr_cur_t btr_cur; /* a B-tree cursor */
ulint latch_mode; /* see FIXME note below!
ulint latch_mode; /* see TODO note below!
BTR_SEARCH_LEAF, BTR_MODIFY_LEAF,
BTR_MODIFY_TREE, or BTR_NO_LATCHES,
depending on the latching state of
......@@ -473,7 +473,7 @@ struct btr_pcur_struct{
dulint modify_clock; /* the modify clock value of the
buffer block when the cursor position
was stored */
ulint pos_state; /* see FIXME note below!
ulint pos_state; /* see TODO note below!
BTR_PCUR_IS_POSITIONED,
BTR_PCUR_WAS_POSITIONED,
BTR_PCUR_NOT_POSITIONED */
......@@ -495,14 +495,18 @@ struct btr_pcur_struct{
is not NULL */
};
#define BTR_PCUR_IS_POSITIONED 1997660512 /* FIXME: currently, the state
#define BTR_PCUR_IS_POSITIONED 1997660512 /* TODO: currently, the state
can be BTR_PCUR_IS_POSITIONED,
though it really should be
BTR_PCUR_WAS_POSITIONED,
because we have no obligation
to commit the cursor with
mtr; similarly latch_mode may
be out of date */
be out of date. This can
lead to problems if btr_pcur
is not used the right way;
all current code should be
ok. */
#define BTR_PCUR_WAS_POSITIONED 1187549791
#define BTR_PCUR_NOT_POSITIONED 1328997689
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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