Commit 68a65c14 authored by marko's avatar marko

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

parent 48dd1ece
No related merge requests found
This diff is collapsed.
This diff is collapsed.
...@@ -76,20 +76,20 @@ btr_pcur_store_position( ...@@ -76,20 +76,20 @@ btr_pcur_store_position(
{ {
page_cur_t* page_cursor; page_cur_t* page_cursor;
rec_t* rec; rec_t* rec;
dict_tree_t* tree; dict_index_t* index;
page_t* page; page_t* page;
ulint offs; ulint offs;
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES); 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); page_cursor = btr_pcur_get_page_cur(cursor);
rec = page_cur_get_rec(page_cursor); rec = page_cur_get_rec(page_cursor);
page = ut_align_down(rec, UNIV_PAGE_SIZE); page = page_align(rec);
offs = ut_align_offset(rec, UNIV_PAGE_SIZE); offs = page_offset(rec);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_S_FIX) MTR_MEMO_PAGE_S_FIX)
...@@ -133,13 +133,13 @@ btr_pcur_store_position( ...@@ -133,13 +133,13 @@ btr_pcur_store_position(
} }
cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_stored = BTR_PCUR_OLD_STORED;
cursor->old_rec = dict_tree_copy_rec_order_prefix cursor->old_rec = dict_index_copy_rec_order_prefix(
(tree, rec, &cursor->old_n_fields, index, rec, &cursor->old_n_fields,
&cursor->old_rec_buf, &cursor->buf_size); &cursor->old_rec_buf, &cursor->buf_size);
cursor->block_when_stored = buf_block_align(page); cursor->block_when_stored = buf_block_align(page);
cursor->modify_clock = buf_block_get_modify_clock cursor->modify_clock = buf_block_get_modify_clock(
(cursor->block_when_stored); cursor->block_when_stored);
} }
/****************************************************************** /******************************************************************
...@@ -197,13 +197,15 @@ btr_pcur_restore_position( ...@@ -197,13 +197,15 @@ btr_pcur_restore_position(
btr_pcur_t* cursor, /* in: detached persistent cursor */ btr_pcur_t* cursor, /* in: detached persistent cursor */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
dict_tree_t* tree; dict_index_t* index;
page_t* page; page_t* page;
dtuple_t* tuple; dtuple_t* tuple;
ulint mode; ulint mode;
ulint old_mode; ulint old_mode;
mem_heap_t* heap; 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) if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED)
|| UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED || UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
&& cursor->pos_state != BTR_PCUR_IS_POSITIONED)) { && cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
...@@ -215,17 +217,16 @@ btr_pcur_restore_position( ...@@ -215,17 +217,16 @@ btr_pcur_restore_position(
ut_error; ut_error;
} }
if (UNIV_UNLIKELY if (UNIV_UNLIKELY(
(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) { || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
/* In these cases we do not try an optimistic restoration, /* In these cases we do not try an optimistic restoration,
but always do a search */ but always do a search */
btr_cur_open_at_index_side btr_cur_open_at_index_side(
(cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE, cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
btr_pcur_get_btr_cur(cursor)->index, latch_mode, index, latch_mode, btr_pcur_get_btr_cur(cursor), mtr);
btr_pcur_get_btr_cur(cursor), mtr);
cursor->block_when_stored cursor->block_when_stored
= buf_block_align(btr_pcur_get_page(cursor)); = buf_block_align(btr_pcur_get_page(cursor));
...@@ -242,8 +243,8 @@ btr_pcur_restore_position( ...@@ -242,8 +243,8 @@ btr_pcur_restore_position(
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) { || UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
/* Try optimistic restoration */ /* Try optimistic restoration */
if (UNIV_LIKELY if (UNIV_LIKELY(buf_page_optimistic_get(
(buf_page_optimistic_get(latch_mode, latch_mode,
cursor->block_when_stored, page, cursor->block_when_stored, page,
cursor->modify_clock, mtr))) { cursor->modify_clock, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->pos_state = BTR_PCUR_IS_POSITIONED;
...@@ -255,19 +256,17 @@ btr_pcur_restore_position( ...@@ -255,19 +256,17 @@ btr_pcur_restore_position(
rec_t* rec; rec_t* rec;
ulint* offsets1; ulint* offsets1;
ulint* offsets2; ulint* offsets2;
dict_index_t* index;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
cursor->latch_mode = latch_mode; cursor->latch_mode = latch_mode;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
rec = btr_pcur_get_rec(cursor); rec = btr_pcur_get_rec(cursor);
index = btr_pcur_get_btr_cur(cursor)->index;
heap = mem_heap_create(256); heap = mem_heap_create(256);
offsets1 = rec_get_offsets offsets1 = rec_get_offsets(
(cursor->old_rec, index, NULL, cursor->old_rec, index, NULL,
cursor->old_n_fields, &heap); cursor->old_n_fields, &heap);
offsets2 = rec_get_offsets offsets2 = rec_get_offsets(
(rec, index, NULL, rec, index, NULL,
cursor->old_n_fields, &heap); cursor->old_n_fields, &heap);
ut_ad(!cmp_rec_rec(cursor->old_rec, ut_ad(!cmp_rec_rec(cursor->old_rec,
...@@ -286,8 +285,7 @@ btr_pcur_restore_position( ...@@ -286,8 +285,7 @@ btr_pcur_restore_position(
heap = mem_heap_create(256); heap = mem_heap_create(256);
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor)); tuple = dict_index_build_data_tuple(index, cursor->old_rec,
tuple = dict_tree_build_data_tuple(tree, cursor->old_rec,
cursor->old_n_fields, heap); cursor->old_n_fields, heap);
/* Save the old search mode of the cursor */ /* Save the old search mode of the cursor */
...@@ -302,8 +300,8 @@ btr_pcur_restore_position( ...@@ -302,8 +300,8 @@ btr_pcur_restore_position(
mode = PAGE_CUR_L; mode = PAGE_CUR_L;
} }
btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple, btr_pcur_open_with_no_init(index, tuple, mode, latch_mode,
mode, latch_mode, cursor, 0, mtr); cursor, 0, mtr);
/* Restore the old search mode */ /* Restore the old search mode */
cursor->search_mode = old_mode; cursor->search_mode = old_mode;
...@@ -311,19 +309,18 @@ btr_pcur_restore_position( ...@@ -311,19 +309,18 @@ btr_pcur_restore_position(
if (cursor->rel_pos == BTR_PCUR_ON if (cursor->rel_pos == BTR_PCUR_ON
&& btr_pcur_is_on_user_rec(cursor, mtr) && btr_pcur_is_on_user_rec(cursor, mtr)
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor), && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
rec_get_offsets rec_get_offsets(
(btr_pcur_get_rec(cursor), btr_pcur_get_rec(cursor), index,
btr_pcur_get_btr_cur(cursor)->index,
NULL, ULINT_UNDEFINED, &heap))) { NULL, ULINT_UNDEFINED, &heap))) {
/* We have to store the NEW value for the modify clock, since /* 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 cursor can now be on a different page! But we can retain
the value of old_rec */ the value of old_rec */
cursor->block_when_stored = buf_block_align cursor->block_when_stored = buf_block_align(
(btr_pcur_get_page(cursor)); btr_pcur_get_page(cursor));
cursor->modify_clock = buf_block_get_modify_clock cursor->modify_clock = buf_block_get_modify_clock(
(cursor->block_when_stored); cursor->block_when_stored);
cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_stored = BTR_PCUR_OLD_STORED;
mem_heap_free(heap); mem_heap_free(heap);
......
This diff is collapsed.
...@@ -335,10 +335,12 @@ buf_page_is_corrupted( ...@@ -335,10 +335,12 @@ buf_page_is_corrupted(
"InnoDB: for more information.\n", "InnoDB: for more information.\n",
(ulong) mach_read_from_4(read_buf (ulong) mach_read_from_4(read_buf
+ FIL_PAGE_OFFSET), + FIL_PAGE_OFFSET),
(ulong) ut_dulint_get_high (ulong) ut_dulint_get_high(
(mach_read_from_8(read_buf + FIL_PAGE_LSN)), mach_read_from_8(read_buf
(ulong) ut_dulint_get_low + FIL_PAGE_LSN)),
(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_high(current_lsn),
(ulong) ut_dulint_get_low(current_lsn)); (ulong) ut_dulint_get_low(current_lsn));
} }
...@@ -360,8 +362,8 @@ buf_page_is_corrupted( ...@@ -360,8 +362,8 @@ buf_page_is_corrupted(
!= page_zip_calc_checksum(read_buf, zip_size)); != page_zip_calc_checksum(read_buf, zip_size));
} }
old_checksum_field = mach_read_from_4 old_checksum_field = mach_read_from_4(
(read_buf + UNIV_PAGE_SIZE read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM); - FIL_PAGE_END_LSN_OLD_CHKSUM);
/* There are 2 valid formulas for old_checksum_field: /* There are 2 valid formulas for old_checksum_field:
...@@ -439,16 +441,16 @@ buf_page_print( ...@@ -439,16 +441,16 @@ buf_page_print(
"InnoDB: space id (if stored" "InnoDB: space id (if stored"
" to page already) %lu\n", " to page already) %lu\n",
(ulong) checksum, (ulong) checksum,
(ulong) mach_read_from_4 (ulong) mach_read_from_4(
(read_buf + FIL_PAGE_SPACE_OR_CHKSUM), read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
(ulong) mach_read_from_4 (ulong) mach_read_from_4(
(read_buf + FIL_PAGE_LSN), read_buf + FIL_PAGE_LSN),
(ulong) mach_read_from_4 (ulong) mach_read_from_4(
(read_buf + (FIL_PAGE_LSN + 4)), read_buf + (FIL_PAGE_LSN + 4)),
(ulong) mach_read_from_4 (ulong) mach_read_from_4(
(read_buf + FIL_PAGE_OFFSET), read_buf + FIL_PAGE_OFFSET),
(ulong) mach_read_from_4 (ulong) mach_read_from_4(
(read_buf + FIL_PAGE_ZBLOB_SPACE_ID)); read_buf + FIL_PAGE_ZBLOB_SPACE_ID));
return; return;
default: default:
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
...@@ -472,16 +474,17 @@ buf_page_print( ...@@ -472,16 +474,17 @@ buf_page_print(
"InnoDB: space id (if stored" "InnoDB: space id (if stored"
" to page already) %lu\n", " to page already) %lu\n",
(ulong) checksum, (ulong) checksum,
(ulong) mach_read_from_4 (ulong) mach_read_from_4(
(read_buf + FIL_PAGE_SPACE_OR_CHKSUM), read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
(ulong) mach_read_from_4 (ulong) mach_read_from_4(
(read_buf + FIL_PAGE_LSN), read_buf + FIL_PAGE_LSN),
(ulong) mach_read_from_4 (ulong) mach_read_from_4(
(read_buf + (FIL_PAGE_LSN + 4)), read_buf + (FIL_PAGE_LSN + 4)),
(ulong) mach_read_from_4 (ulong) mach_read_from_4(
(read_buf + FIL_PAGE_OFFSET), read_buf + FIL_PAGE_OFFSET),
(ulong) mach_read_from_4 (ulong) mach_read_from_4(
(read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID)); read_buf
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
return; return;
case FIL_PAGE_TYPE_XDES: case FIL_PAGE_TYPE_XDES:
/* This is an uncompressed page. */ /* This is an uncompressed page. */
...@@ -533,10 +536,10 @@ buf_page_print( ...@@ -533,10 +536,10 @@ buf_page_print(
fprintf(stderr, fprintf(stderr,
"InnoDB: Page may be an index page where" "InnoDB: Page may be an index page where"
" index id is %lu %lu\n", " index id is %lu %lu\n",
(ulong) ut_dulint_get_high (ulong) ut_dulint_get_high(
(btr_page_get_index_id(read_buf)), btr_page_get_index_id(read_buf)),
(ulong) ut_dulint_get_low (ulong) ut_dulint_get_low(
(btr_page_get_index_id(read_buf))); btr_page_get_index_id(read_buf)));
#ifdef UNIV_HOTBACKUP #ifdef UNIV_HOTBACKUP
/* If the code is in ibbackup, dict_sys may be uninitialized, /* If the code is in ibbackup, dict_sys may be uninitialized,
...@@ -547,8 +550,8 @@ buf_page_print( ...@@ -547,8 +550,8 @@ buf_page_print(
} }
#endif /* UNIV_HOTBACKUP */ #endif /* UNIV_HOTBACKUP */
index = dict_index_find_on_id_low index = dict_index_find_on_id_low(
(btr_page_get_index_id(read_buf)); btr_page_get_index_id(read_buf));
if (index) { if (index) {
fputs("InnoDB: (", stderr); fputs("InnoDB: (", stderr);
dict_index_name_print(stderr, NULL, index); dict_index_name_print(stderr, NULL, index);
...@@ -691,8 +694,8 @@ buf_pool_init( ...@@ -691,8 +694,8 @@ buf_pool_init(
/* Allocate the virtual address space window, i.e., the /* Allocate the virtual address space window, i.e., the
buffer pool frames */ buffer pool frames */
buf_pool->frame_mem = os_awe_allocate_virtual_mem_window buf_pool->frame_mem = os_awe_allocate_virtual_mem_window(
(UNIV_PAGE_SIZE * (n_frames + 1)); UNIV_PAGE_SIZE * (n_frames + 1));
/* Allocate the physical memory for AWE and the AWE info array /* Allocate the physical memory for AWE and the AWE info array
for buf_pool */ for buf_pool */
...@@ -718,8 +721,8 @@ buf_pool_init( ...@@ -718,8 +721,8 @@ buf_pool_init(
} }
/*----------------------------------------*/ /*----------------------------------------*/
} else { } else {
buf_pool->frame_mem = os_mem_alloc_large buf_pool->frame_mem = os_mem_alloc_large(
(UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE); UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE);
} }
if (buf_pool->frame_mem == NULL) { if (buf_pool->frame_mem == NULL) {
...@@ -914,8 +917,8 @@ buf_awe_map_page_to_frame( ...@@ -914,8 +917,8 @@ buf_awe_map_page_to_frame(
} else { } else {
/* We can map block to the frame of bck */ /* We can map block to the frame of bck */
os_awe_map_physical_mem_to_window os_awe_map_physical_mem_to_window(
(bck->frame, bck->frame,
UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE, UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
block->awe_info); block->awe_info);
...@@ -933,8 +936,8 @@ buf_awe_map_page_to_frame( ...@@ -933,8 +936,8 @@ buf_awe_map_page_to_frame(
bck); bck);
if (add_to_mapped_list) { if (add_to_mapped_list) {
UT_LIST_ADD_FIRST UT_LIST_ADD_FIRST(
(awe_LRU_free_mapped, awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, buf_pool->awe_LRU_free_mapped,
block); block);
} }
...@@ -1621,7 +1624,7 @@ buf_page_init_for_backup_restore( ...@@ -1621,7 +1624,7 @@ buf_page_init_for_backup_restore(
block->is_hashed = FALSE; block->is_hashed = FALSE;
block->n_fields = 1; block->n_fields = 1;
block->n_bytes = 0; block->n_bytes = 0;
block->side = BTR_SEARCH_LEFT_SIDE; block->left_side = TRUE;
page_zip_des_init(&block->page_zip); page_zip_des_init(&block->page_zip);
/* TODO: allocate page_zip->data? */ /* TODO: allocate page_zip->data? */
...@@ -1691,7 +1694,7 @@ buf_page_init( ...@@ -1691,7 +1694,7 @@ buf_page_init(
block->is_hashed = FALSE; block->is_hashed = FALSE;
block->n_fields = 1; block->n_fields = 1;
block->n_bytes = 0; block->n_bytes = 0;
block->side = BTR_SEARCH_LEFT_SIDE; block->left_side = TRUE;
block->file_page_was_freed = FALSE; block->file_page_was_freed = FALSE;
} }
...@@ -1752,8 +1755,8 @@ buf_page_init_for_read( ...@@ -1752,8 +1755,8 @@ buf_page_init_for_read(
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
if (fil_tablespace_deleted_or_being_deleted_in_mem if (fil_tablespace_deleted_or_being_deleted_in_mem(
(space, tablespace_version)) { space, tablespace_version)) {
*err = DB_TABLESPACE_DELETED; *err = DB_TABLESPACE_DELETED;
} }
...@@ -1944,8 +1947,9 @@ buf_page_io_complete( ...@@ -1944,8 +1947,9 @@ buf_page_io_complete(
switch (fil_page_get_type(frame)) { switch (fil_page_get_type(frame)) {
case FIL_PAGE_INDEX: case FIL_PAGE_INDEX:
if (block->frame) { if (block->frame) {
if (!page_zip_decompress if (!page_zip_decompress(
(&block->page_zip, block->frame)) { &block->page_zip,
block->frame)) {
goto corrupt; goto corrupt;
} }
} }
...@@ -1978,12 +1982,12 @@ buf_page_io_complete( ...@@ -1978,12 +1982,12 @@ buf_page_io_complete(
read_page_no = mach_read_from_4(frame + FIL_PAGE_OFFSET); read_page_no = mach_read_from_4(frame + FIL_PAGE_OFFSET);
switch (fil_page_get_type(frame)) { switch (fil_page_get_type(frame)) {
case FIL_PAGE_TYPE_ZBLOB: case FIL_PAGE_TYPE_ZBLOB:
read_space_id = mach_read_from_4 read_space_id = mach_read_from_4(
(frame + FIL_PAGE_ZBLOB_SPACE_ID); frame + FIL_PAGE_ZBLOB_SPACE_ID);
break; break;
default: default:
read_space_id = mach_read_from_4 read_space_id = mach_read_from_4(
(frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
} }
if (!block->space if (!block->space
...@@ -2069,9 +2073,9 @@ corrupt: ...@@ -2069,9 +2073,9 @@ corrupt:
} }
if (!recv_no_ibuf_operations) { if (!recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page ibuf_merge_or_delete_for_page(
(block->frame, block->space, block->frame, block->space, block->offset,
block->offset, TRUE); TRUE);
} }
} }
...@@ -2199,8 +2203,9 @@ buf_validate(void) ...@@ -2199,8 +2203,9 @@ buf_validate(void)
if (block->flush_type == BUF_FLUSH_LRU) { if (block->flush_type == BUF_FLUSH_LRU) {
n_lru_flush++; n_lru_flush++;
ut_a(rw_lock_is_locked ut_a(rw_lock_is_locked(
(&block->lock, RW_LOCK_SHARED)); &block->lock,
RW_LOCK_SHARED));
} else if (block->flush_type } else if (block->flush_type
== BUF_FLUSH_LIST) { == BUF_FLUSH_LIST) {
n_list_flush++; n_list_flush++;
...@@ -2320,7 +2325,7 @@ buf_print(void) ...@@ -2320,7 +2325,7 @@ buf_print(void)
while (j < n_found) { while (j < n_found) {
if (ut_dulint_cmp(index_ids[j], id) == 0) { if (ut_dulint_cmp(index_ids[j], id) == 0) {
(counts[j])++; counts[j]++;
break; break;
} }
......
...@@ -191,7 +191,7 @@ buf_flush_write_complete( ...@@ -191,7 +191,7 @@ buf_flush_write_complete(
ut_d(UT_LIST_VALIDATE(flush_list, buf_block_t, buf_pool->flush_list)); 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) { if (block->flush_type == BUF_FLUSH_LRU) {
/* Put the block to the end of the LRU list to wait to be /* Put the block to the end of the LRU list to wait to be
...@@ -527,8 +527,8 @@ buf_flush_init_for_writing( ...@@ -527,8 +527,8 @@ buf_flush_init_for_writing(
mach_write_to_4(page_zip->data mach_write_to_4(page_zip->data
+ FIL_PAGE_SPACE_OR_CHKSUM, + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums srv_use_checksums
? page_zip_calc_checksum ? page_zip_calc_checksum(
(page_zip->data, zip_size) page_zip->data, zip_size)
: BUF_NO_CHECKSUM_MAGIC); : BUF_NO_CHECKSUM_MAGIC);
return; return;
case FIL_PAGE_TYPE_ALLOCATED: case FIL_PAGE_TYPE_ALLOCATED:
...@@ -556,8 +556,8 @@ buf_flush_init_for_writing( ...@@ -556,8 +556,8 @@ buf_flush_init_for_writing(
mach_write_to_4(page_zip->data mach_write_to_4(page_zip->data
+ FIL_PAGE_SPACE_OR_CHKSUM, + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums srv_use_checksums
? page_zip_calc_checksum ? page_zip_calc_checksum(
(page_zip->data, zip_size) page_zip->data, zip_size)
: BUF_NO_CHECKSUM_MAGIC); : BUF_NO_CHECKSUM_MAGIC);
return; return;
} }
...@@ -692,7 +692,7 @@ buf_flush_try_page( ...@@ -692,7 +692,7 @@ buf_flush_try_page(
os_event_reset(buf_pool->no_flush[flush_type]); os_event_reset(buf_pool->no_flush[flush_type]);
} }
(buf_pool->n_flush[flush_type])++; buf_pool->n_flush[flush_type]++;
locked = FALSE; locked = FALSE;
...@@ -759,7 +759,7 @@ buf_flush_try_page( ...@@ -759,7 +759,7 @@ buf_flush_try_page(
os_event_reset(buf_pool->no_flush[flush_type]); 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); rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
...@@ -798,7 +798,7 @@ buf_flush_try_page( ...@@ -798,7 +798,7 @@ buf_flush_try_page(
os_event_reset(buf_pool->no_flush[block->flush_type]); 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)); mutex_exit(&(buf_pool->mutex));
...@@ -949,7 +949,7 @@ buf_flush_batch( ...@@ -949,7 +949,7 @@ buf_flush_batch(
return(ULINT_UNDEFINED); return(ULINT_UNDEFINED);
} }
(buf_pool->init_flush)[flush_type] = TRUE; buf_pool->init_flush[flush_type] = TRUE;
for (;;) { for (;;) {
/* If we have flushed enough, leave the loop */ /* If we have flushed enough, leave the loop */
...@@ -998,8 +998,8 @@ buf_flush_batch( ...@@ -998,8 +998,8 @@ buf_flush_batch(
old_page_count = page_count; old_page_count = page_count;
/* Try to flush also all the neighbors */ /* Try to flush also all the neighbors */
page_count += buf_flush_try_neighbors page_count += buf_flush_try_neighbors(
(space, offset, flush_type); space, offset, flush_type);
/* fprintf(stderr, /* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n", "Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset, flush_type, offset,
...@@ -1024,7 +1024,7 @@ buf_flush_batch( ...@@ -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) if ((buf_pool->n_flush[flush_type] == 0)
&& (buf_pool->init_flush[flush_type] == FALSE)) { && (buf_pool->init_flush[flush_type] == FALSE)) {
......
...@@ -561,16 +561,16 @@ buf_LRU_old_adjust_len(void) ...@@ -561,16 +561,16 @@ buf_LRU_old_adjust_len(void)
if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) { if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) {
buf_pool->LRU_old = UT_LIST_GET_PREV buf_pool->LRU_old = UT_LIST_GET_PREV(
(LRU, buf_pool->LRU_old); LRU, buf_pool->LRU_old);
(buf_pool->LRU_old)->old = TRUE; buf_pool->LRU_old->old = TRUE;
buf_pool->LRU_old_len++; buf_pool->LRU_old_len++;
} else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) { } else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) {
(buf_pool->LRU_old)->old = FALSE; buf_pool->LRU_old->old = FALSE;
buf_pool->LRU_old = UT_LIST_GET_NEXT buf_pool->LRU_old = UT_LIST_GET_NEXT(
(LRU, buf_pool->LRU_old); LRU, buf_pool->LRU_old);
buf_pool->LRU_old_len--; buf_pool->LRU_old_len--;
} else { } else {
ut_a(buf_pool->LRU_old); /* Check that we did not ut_a(buf_pool->LRU_old); /* Check that we did not
...@@ -638,7 +638,7 @@ buf_LRU_remove_block( ...@@ -638,7 +638,7 @@ buf_LRU_remove_block(
tolerance value from strict 3/8 of the LRU list length. */ 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 = UT_LIST_GET_PREV(LRU, block);
(buf_pool->LRU_old)->old = TRUE; buf_pool->LRU_old->old = TRUE;
buf_pool->LRU_old_len++; buf_pool->LRU_old_len++;
ut_a(buf_pool->LRU_old); ut_a(buf_pool->LRU_old);
...@@ -923,12 +923,12 @@ buf_LRU_block_remove_hashed_page( ...@@ -923,12 +923,12 @@ buf_LRU_block_remove_hashed_page(
fprintf(stderr, fprintf(stderr,
"InnoDB: In hash table we find block" "InnoDB: In hash table we find block"
" %p of %lu %lu which is not %p\n", " %p of %lu %lu which is not %p\n",
(void*) buf_page_hash_get (void*) buf_page_hash_get(
(block->space, block->offset), block->space, block->offset),
(ulong) buf_page_hash_get (ulong) buf_page_hash_get(
(block->space, block->offset)->space, block->space, block->offset)->space,
(ulong) buf_page_hash_get (ulong) buf_page_hash_get(
(block->space, block->offset)->offset, block->space, block->offset)->offset,
(void*) block); (void*) block);
} }
...@@ -1086,8 +1086,8 @@ buf_LRU_print(void) ...@@ -1086,8 +1086,8 @@ buf_LRU_print(void)
fprintf(stderr, "\nLRU pos %lu type %lu index id %lu\n", fprintf(stderr, "\nLRU pos %lu type %lu index id %lu\n",
(ulong) block->LRU_position, (ulong) block->LRU_position,
(ulong) fil_page_get_type(frame), (ulong) fil_page_get_type(frame),
(ulong) ut_dulint_get_low (ulong) ut_dulint_get_low(
(btr_page_get_index_id(frame))); btr_page_get_index_id(frame)));
block = UT_LIST_GET_NEXT(LRU, block); block = UT_LIST_GET_NEXT(LRU, block);
} }
......
...@@ -268,8 +268,8 @@ buf_read_ahead_random( ...@@ -268,8 +268,8 @@ buf_read_ahead_random(
mode: hence FALSE as the first parameter */ mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(zip_size, i)) { if (!ibuf_bitmap_page(zip_size, i)) {
count += buf_read_page_low count += buf_read_page_low(
(&err, FALSE, &err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER, ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, tablespace_version, i); space, zip_size, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
...@@ -566,8 +566,8 @@ buf_read_ahead_linear( ...@@ -566,8 +566,8 @@ buf_read_ahead_linear(
aio mode: hence FALSE as the first parameter */ aio mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(zip_size, i)) { if (!ibuf_bitmap_page(zip_size, i)) {
count += buf_read_page_low count += buf_read_page_low(
(&err, FALSE, &err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER, ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, tablespace_version, i); space, zip_size, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
......
...@@ -40,9 +40,6 @@ charset-collation code for them. */ ...@@ -40,9 +40,6 @@ charset-collation code for them. */
ulint data_mysql_default_charset_coll = 99999999; 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. 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 If the string is shorter than n characters, returns the number of bytes
...@@ -53,7 +50,11 @@ dtype_get_at_most_n_mbchars( ...@@ -53,7 +50,11 @@ dtype_get_at_most_n_mbchars(
/*========================*/ /*========================*/
/* out: length of the prefix, /* out: length of the prefix,
in bytes */ 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 ulint prefix_len, /* in: length of the requested
prefix, in characters, multiplied by prefix, in characters, multiplied by
dtype_get_mbmaxlen(dtype) */ dtype_get_mbmaxlen(dtype) */
...@@ -63,12 +64,12 @@ dtype_get_at_most_n_mbchars( ...@@ -63,12 +64,12 @@ dtype_get_at_most_n_mbchars(
{ {
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
ut_a(data_len != UNIV_SQL_NULL); 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) { if (mbminlen != mbmaxlen) {
ut_a(!(prefix_len % dtype->mbmaxlen)); ut_a(!(prefix_len % mbmaxlen));
return(innobase_get_at_most_n_mbchars return(innobase_get_at_most_n_mbchars(
(dtype_get_charset_coll(dtype->prtype), dtype_get_charset_coll(prtype),
prefix_len, data_len, str)); prefix_len, data_len, str));
} }
...@@ -270,8 +271,6 @@ dtype_print( ...@@ -270,8 +271,6 @@ dtype_print(
} else if (prtype == DATA_TRX_ID) { } else if (prtype == DATA_TRX_ID) {
fputs("DATA_TRX_ID", stderr); fputs("DATA_TRX_ID", stderr);
len = DATA_TRX_ID_LEN; len = DATA_TRX_ID_LEN;
} else if (prtype == DATA_MIX_ID) {
fputs("DATA_MIX_ID", stderr);
} else if (prtype == DATA_ENGLISH) { } else if (prtype == DATA_ENGLISH) {
fputs("DATA_ENGLISH", stderr); fputs("DATA_ENGLISH", stderr);
} else { } else {
...@@ -291,38 +290,5 @@ dtype_print( ...@@ -291,38 +290,5 @@ dtype_print(
} }
} }
fprintf(stderr, " len %lu prec %lu", (ulong) len, (ulong) type->prec); fprintf(stderr, " len %lu", (ulong) len);
}
/***************************************************************************
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);
} }
...@@ -58,8 +58,7 @@ dict_hdr_get_new_id( ...@@ -58,8 +58,7 @@ dict_hdr_get_new_id(
dulint id; dulint id;
mtr_t mtr; mtr_t mtr;
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID) ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID));
|| (type == DICT_HDR_MIX_ID));
mtr_start(&mtr); mtr_start(&mtr);
...@@ -141,6 +140,7 @@ dict_hdr_create( ...@@ -141,6 +140,7 @@ dict_hdr_create(
mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID, mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr); 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, mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr); ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
...@@ -219,7 +219,6 @@ dict_boot(void) ...@@ -219,7 +219,6 @@ dict_boot(void)
dict_index_t* index; dict_index_t* index;
dict_hdr_t* dict_hdr; dict_hdr_t* dict_hdr;
mtr_t mtr; mtr_t mtr;
ibool success;
mtr_start(&mtr); mtr_start(&mtr);
...@@ -241,9 +240,9 @@ dict_boot(void) ...@@ -241,9 +240,9 @@ dict_boot(void)
..._MARGIN, it will immediately be updated to the disk-based ..._MARGIN, it will immediately be updated to the disk-based
header. */ header. */
dict_sys->row_id = ut_dulint_add dict_sys->row_id = ut_dulint_add(
(ut_dulint_align_up(mtr_read_dulint ut_dulint_align_up(mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
(dict_hdr + DICT_HDR_ROW_ID, &mtr), &mtr),
DICT_HDR_ROW_ID_WRITE_MARGIN), DICT_HDR_ROW_ID_WRITE_MARGIN),
DICT_HDR_ROW_ID_WRITE_MARGIN); DICT_HDR_ROW_ID_WRITE_MARGIN);
...@@ -252,14 +251,14 @@ dict_boot(void) ...@@ -252,14 +251,14 @@ 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, 0); dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 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, 0); dict_mem_table_add_col(table, "N_COLS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "MIX_LEN", DATA_INT, 0, 4, 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, 0); dict_mem_table_add_col(table, "CLUSTER_NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4);
table->id = DICT_TABLES_ID; table->id = DICT_TABLES_ID;
...@@ -274,31 +273,30 @@ dict_boot(void) ...@@ -274,31 +273,30 @@ dict_boot(void)
index->id = DICT_TABLES_ID; index->id = DICT_TABLES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint dict_index_add_to_cache(table, index,
(dict_hdr + DICT_HDR_TABLES, mtr_read_ulint(dict_hdr + DICT_HDR_TABLES,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/ /*-------------------------*/
index = dict_mem_index_create("SYS_TABLES", "ID_IND", index = dict_mem_index_create("SYS_TABLES", "ID_IND",
DICT_HDR_SPACE, DICT_UNIQUE, 1); DICT_HDR_SPACE, DICT_UNIQUE, 1);
dict_mem_index_add_field(index, "ID", 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_TABLE_IDS_ID; index->id = DICT_TABLE_IDS_ID;
success = dict_index_add_to_cache(table, index, dict_index_add_to_cache(table, index,
mtr_read_ulint mtr_read_ulint(dict_hdr + DICT_HDR_TABLE_IDS,
(dict_hdr + DICT_HDR_TABLE_IDS,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/ /*-------------------------*/
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,0); dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4);
table->id = DICT_COLUMNS_ID; table->id = DICT_COLUMNS_ID;
...@@ -313,20 +311,20 @@ dict_boot(void) ...@@ -313,20 +311,20 @@ dict_boot(void)
dict_mem_index_add_field(index, "POS", 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_COLUMNS_ID; index->id = DICT_COLUMNS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint dict_index_add_to_cache(table, index,
(dict_hdr + DICT_HDR_COLUMNS, mtr_read_ulint(dict_hdr + DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/ /*-------------------------*/
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,0); dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 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, 0); dict_mem_table_add_col(table, "N_FIELDS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PAGE_NO", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "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
...@@ -351,16 +349,16 @@ dict_boot(void) ...@@ -351,16 +349,16 @@ dict_boot(void)
dict_mem_index_add_field(index, "ID", 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_INDEXES_ID; index->id = DICT_INDEXES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint dict_index_add_to_cache(table, index,
(dict_hdr + DICT_HDR_INDEXES, mtr_read_ulint(dict_hdr + DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/ /*-------------------------*/
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,0); dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "COL_NAME", DATA_BINARY, 0,0,0); dict_mem_table_add_col(table, "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);
...@@ -374,10 +372,9 @@ dict_boot(void) ...@@ -374,10 +372,9 @@ dict_boot(void)
dict_mem_index_add_field(index, "POS", 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_FIELDS_ID; index->id = DICT_FIELDS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint dict_index_add_to_cache(table, index,
(dict_hdr + DICT_HDR_FIELDS, mtr_read_ulint(dict_hdr + DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr));
ut_a(success);
mtr_commit(&mtr); mtr_commit(&mtr);
/*-------------------------*/ /*-------------------------*/
......
...@@ -85,14 +85,14 @@ dict_create_sys_tables_tuple( ...@@ -85,14 +85,14 @@ dict_create_sys_tables_tuple(
} }
dfield_set_data(dfield, ptr, 4); dfield_set_data(dfield, ptr, 4);
/* 6: MIX_ID ---------------------------*/ /* 6: MIX_ID (obsolete) ---------------------------*/
dfield = dtuple_get_nth_field(entry, 4); dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 8); ptr = mem_heap_alloc(heap, 8);
memset(ptr, 0, 8); memset(ptr, 0, 8);
dfield_set_data(dfield, ptr, 8); dfield_set_data(dfield, ptr, 8);
/* 7: MIX_LEN --------------------------*/ /* 7: MIX_LEN (obsolete) --------------------------*/
dfield = dtuple_get_nth_field(entry, 5); dfield = dtuple_get_nth_field(entry, 5);
...@@ -133,9 +133,10 @@ dict_create_sys_columns_tuple( ...@@ -133,9 +133,10 @@ dict_create_sys_columns_tuple(
{ {
dict_table_t* sys_columns; dict_table_t* sys_columns;
dtuple_t* entry; dtuple_t* entry;
dict_col_t* column; const dict_col_t* column;
dfield_t* dfield; dfield_t* dfield;
byte* ptr; byte* ptr;
const char* col_name;
ut_ad(table && heap); ut_ad(table && heap);
...@@ -162,33 +163,34 @@ dict_create_sys_columns_tuple( ...@@ -162,33 +163,34 @@ dict_create_sys_columns_tuple(
/* 4: NAME ---------------------------*/ /* 4: NAME ---------------------------*/
dfield = dtuple_get_nth_field(entry, 2); 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 --------------------------*/ /* 5: MTYPE --------------------------*/
dfield = dtuple_get_nth_field(entry, 3); dfield = dtuple_get_nth_field(entry, 3);
ptr = mem_heap_alloc(heap, 4); 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); dfield_set_data(dfield, ptr, 4);
/* 6: PRTYPE -------------------------*/ /* 6: PRTYPE -------------------------*/
dfield = dtuple_get_nth_field(entry, 4); dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 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); dfield_set_data(dfield, ptr, 4);
/* 7: LEN ----------------------------*/ /* 7: LEN ----------------------------*/
dfield = dtuple_get_nth_field(entry, 5); dfield = dtuple_get_nth_field(entry, 5);
ptr = mem_heap_alloc(heap, 4); 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); dfield_set_data(dfield, ptr, 4);
/* 8: PREC ---------------------------*/ /* 8: PREC ---------------------------*/
dfield = dtuple_get_nth_field(entry, 6); dfield = dtuple_get_nth_field(entry, 6);
ptr = mem_heap_alloc(heap, 4); 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); dfield_set_data(dfield, ptr, 4);
/*---------------------------------*/ /*---------------------------------*/
...@@ -229,8 +231,7 @@ dict_build_table_def_step( ...@@ -229,8 +231,7 @@ dict_build_table_def_step(
row_len = 0; row_len = 0;
for (i = 0; i < table->n_def; i++) { for (i = 0; i < table->n_def; i++) {
row_len += dtype_get_min_size(dict_col_get_type row_len += dict_col_get_min_size(&table->cols[i]);
(&table->cols[i]));
} }
if (row_len > BTR_PAGE_MAX_REC_SIZE) { if (row_len > BTR_PAGE_MAX_REC_SIZE) {
return(DB_TOO_BIG_RECORD); return(DB_TOO_BIG_RECORD);
...@@ -245,7 +246,7 @@ dict_build_table_def_step( ...@@ -245,7 +246,7 @@ dict_build_table_def_step(
- page 3 will contain the root of the clustered index of the - page 3 will contain the root of the clustered index of the
table we create here. */ 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) { if (table->dir_path_of_temp_table) {
/* We place tables created with CREATE TEMPORARY /* We place tables created with CREATE TEMPORARY
...@@ -258,10 +259,11 @@ dict_build_table_def_step( ...@@ -258,10 +259,11 @@ dict_build_table_def_step(
is_path = FALSE; is_path = FALSE;
} }
error = fil_create_new_single_table_tablespace error = fil_create_new_single_table_tablespace(
(&(table->space), path_or_name, is_path, &space, path_or_name, is_path,
dict_table_zip_size(table), dict_table_zip_size(table),
FIL_IBD_FILE_INITIAL_SIZE); FIL_IBD_FILE_INITIAL_SIZE);
table->space = space;
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
...@@ -783,8 +785,8 @@ dict_truncate_index_tree( ...@@ -783,8 +785,8 @@ dict_truncate_index_tree(
appropriate field in the SYS_INDEXES record: this mini-transaction appropriate field in the SYS_INDEXES record: this mini-transaction
marks the B-tree totally truncated */ marks the B-tree totally truncated */
comp = page_is_comp(btr_page_get comp = page_is_comp(btr_page_get(space, root_page_no, RW_X_LATCH,
(space, root_page_no, RW_X_LATCH, mtr)); mtr));
btr_free_root(space, root_page_no, mtr); btr_free_root(space, root_page_no, mtr);
/* We will temporarily write FIL_NULL to the PAGE_NO field /* We will temporarily write FIL_NULL to the PAGE_NO field
...@@ -813,7 +815,7 @@ dict_truncate_index_tree( ...@@ -813,7 +815,7 @@ dict_truncate_index_tree(
root_page_no = btr_create(type, space, index_id, index, mtr); root_page_no = btr_create(type, space, index_id, index, mtr);
if (index) { if (index) {
index->tree->page = root_page_no; index->page = root_page_no;
} else { } else {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
...@@ -1019,7 +1021,6 @@ dict_create_index_step( ...@@ -1019,7 +1021,6 @@ dict_create_index_step(
que_thr_t* thr) /* in: query thread */ que_thr_t* thr) /* in: query thread */
{ {
ind_node_t* node; ind_node_t* node;
ibool success;
ulint err = DB_ERROR; ulint err = DB_ERROR;
trx_t* trx; trx_t* trx;
...@@ -1080,10 +1081,7 @@ dict_create_index_step( ...@@ -1080,10 +1081,7 @@ dict_create_index_step(
dulint index_id = node->index->id; dulint index_id = node->index->id;
success = dict_index_add_to_cache(node->table, node->index, dict_index_add_to_cache(node->table, node->index, FIL_NULL);
FIL_NULL);
ut_a(success);
node->index = dict_index_get_if_in_cache_low(index_id); node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(node->index); ut_a(node->index);
...@@ -1104,7 +1102,7 @@ dict_create_index_step( ...@@ -1104,7 +1102,7 @@ dict_create_index_step(
goto function_exit; goto function_exit;
} }
node->index->tree->page = node->page_no; node->index->page = node->page_no;
node->state = INDEX_COMMIT_WORK; node->state = INDEX_COMMIT_WORK;
} }
...@@ -1353,8 +1351,9 @@ dict_create_add_foreign_field_to_dictionary( ...@@ -1353,8 +1351,9 @@ dict_create_add_foreign_field_to_dictionary(
pars_info_add_str_literal(info, "ref_col_name", pars_info_add_str_literal(info, "ref_col_name",
foreign->referenced_col_names[field_nr]); foreign->referenced_col_names[field_nr]);
return(dict_foreign_eval_sql return(dict_foreign_eval_sql(
(info, "PROCEDURE P () IS\n" info,
"PROCEDURE P () IS\n"
"BEGIN\n" "BEGIN\n"
"INSERT INTO SYS_FOREIGN_COLS VALUES" "INSERT INTO SYS_FOREIGN_COLS VALUES"
"(:id, :pos, :for_col_name, :ref_col_name);\n" "(:id, :pos, :for_col_name, :ref_col_name);\n"
...@@ -1418,8 +1417,8 @@ dict_create_add_foreign_to_dictionary( ...@@ -1418,8 +1417,8 @@ dict_create_add_foreign_to_dictionary(
} }
for (i = 0; i < foreign->n_fields; i++) { for (i = 0; i < foreign->n_fields; i++) {
error = dict_create_add_foreign_field_to_dictionary error = dict_create_add_foreign_field_to_dictionary(
(i, table, foreign, trx); i, table, foreign, trx);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
...@@ -1475,8 +1474,8 @@ dict_create_add_foreigns_to_dictionary( ...@@ -1475,8 +1474,8 @@ dict_create_add_foreigns_to_dictionary(
foreign; foreign;
foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) { foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
error = dict_create_add_foreign_to_dictionary error = dict_create_add_foreign_to_dictionary(&number, table,
(&number, table, foreign, trx); foreign, trx);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -51,8 +51,8 @@ if_step( ...@@ -51,8 +51,8 @@ if_step(
for (;;) { for (;;) {
eval_exp(elsif_node->cond); eval_exp(elsif_node->cond);
if (eval_node_get_ibool_val if (eval_node_get_ibool_val(
(elsif_node->cond)) { elsif_node->cond)) {
/* The condition evaluated to TRUE: /* The condition evaluated to TRUE:
start execution from the first start execution from the first
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -201,8 +201,6 @@ class ha_innobase: public handler ...@@ -201,8 +201,6 @@ class ha_innobase: public handler
int cmp_ref(const byte *ref1, const byte *ref2); int cmp_ref(const byte *ref1, const byte *ref2);
bool check_if_incompatible_data(HA_CREATE_INFO *info, bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes); uint table_changes);
void build_template(struct row_prebuilt_struct *prebuilt, THD *thd,
TABLE *table, uint templ_type);
}; };
extern SHOW_VAR innodb_status_variables[]; extern SHOW_VAR innodb_status_variables[];
......
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.
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