Reindent the code base (except for ha_innodb.{cc,h} and generated parser

and lexer files).  From now on, the following Emacs cc-mode settings apply
when indenting C function bodies in InnoDB:

(setq c-basic-offset 8)
(setq c-label-minimum-indentation 0)
(add-to-list 'c-offsets-alist '(c . 0))
(add-to-list 'c-offsets-alist '(label . [0]))

The indentation rules for function declarations still have not been
formalized, and they must be formatted manually.

Try to limit all lines to at most 79 characters (assuming TAB stops every
8 characters) by splitting lines before opening parenthesis, or at
string constants.

Fix some grammar mistakes in diagnostic output:
 match to, match with -> match
 found from -> found in
 trying rename -> trying to rename

Fix an error in page_check_dir(): it said "supremum not pointed to"
when the infimum was not pointed to.

Enclose commented-out code snippets in #if 0 ... #endif instead of /* ... */.
Add (void*) casts to some %p parameters in fprintf() calls.  Try to
split lines before a binary operator, not after one.  (These three fixes
were not made everywhere.)
This commit is contained in:
marko 2006-08-28 17:42:45 +00:00
parent 9474455eac
commit e8435b3e45
120 changed files with 8916 additions and 7607 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -92,9 +92,9 @@ btr_pcur_store_position(
offs = ut_align_offset(rec, UNIV_PAGE_SIZE);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_S_FIX)
|| mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_S_FIX)
|| mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
ut_a(cursor->latch_mode != BTR_NO_LATCHES);
if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) {
@ -133,14 +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_tree_copy_rec_order_prefix
(tree, 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);
}
/******************************************************************
@ -165,7 +164,7 @@ btr_pcur_copy_stored_position(
pcur_receive->old_rec_buf = mem_alloc(pcur_donate->buf_size);
ut_memcpy(pcur_receive->old_rec_buf, pcur_donate->old_rec_buf,
pcur_donate->buf_size);
pcur_donate->buf_size);
pcur_receive->old_rec = pcur_receive->old_rec_buf
+ (pcur_donate->old_rec - pcur_donate->old_rec_buf);
}
@ -206,8 +205,8 @@ btr_pcur_restore_position(
mem_heap_t* heap;
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)) {
|| UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
&& cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
ut_print_buf(stderr, cursor, sizeof(btr_pcur_t));
if (cursor->trx_if_known) {
trx_print(stderr, cursor->trx_if_known, 0);
@ -216,19 +215,20 @@ 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,
btr_pcur_get_btr_cur(cursor)->index, latch_mode,
btr_pcur_get_btr_cur(cursor), mtr);
cursor->block_when_stored =
buf_block_align(btr_pcur_get_page(cursor));
buf_block_align(btr_pcur_get_page(cursor));
return(FALSE);
}
@ -239,12 +239,13 @@ btr_pcur_restore_position(
page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor));
if (UNIV_LIKELY(latch_mode == BTR_SEARCH_LEAF)
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
|| 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);
@ -262,14 +263,16 @@ btr_pcur_restore_position(
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, index) == 0);
ut_ad(!cmp_rec_rec(cursor->old_rec,
rec, offsets1, offsets2,
index));
mem_heap_free(heap);
#endif /* UNIV_DEBUG */
return(TRUE);
@ -285,7 +288,7 @@ btr_pcur_restore_position(
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);
cursor->old_n_fields, heap);
/* Save the old search mode of the cursor */
old_mode = cursor->search_mode;
@ -300,17 +303,18 @@ btr_pcur_restore_position(
}
btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple,
mode, latch_mode, cursor, 0, mtr);
mode, latch_mode, cursor, 0, mtr);
/* Restore the old search mode */
cursor->search_mode = old_mode;
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))) {
&& 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))) {
/* 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
@ -467,14 +471,14 @@ btr_pcur_move_backward_from_page(
space = buf_frame_get_space_id(page);
if (btr_pcur_is_before_first_on_page(cursor, mtr)
&& (prev_page_no != FIL_NULL)) {
&& (prev_page_no != FIL_NULL)) {
prev_page = btr_pcur_get_btr_cur(cursor)->left_page;
btr_leaf_page_release(page, latch_mode, mtr);
page_cur_set_after_last(prev_page,
btr_pcur_get_page_cur(cursor));
btr_pcur_get_page_cur(cursor));
} else if (prev_page_no != FIL_NULL) {
/* The repositioned cursor did not end on an infimum record on

View file

@ -231,19 +231,19 @@ btr_search_info_update_hash(
}
cmp = ut_pair_cmp(info->n_fields, info->n_bytes,
cursor->low_match, cursor->low_bytes);
cursor->low_match, cursor->low_bytes);
if ((info->side == BTR_SEARCH_LEFT_SIDE && cmp <= 0)
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp > 0)) {
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp > 0)) {
goto set_new_recomm;
}
cmp = ut_pair_cmp(info->n_fields, info->n_bytes,
cursor->up_match, cursor->up_bytes);
cursor->up_match, cursor->up_bytes);
if ((info->side == BTR_SEARCH_LEFT_SIDE && cmp > 0)
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp <= 0)) {
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp <= 0)) {
goto set_new_recomm;
}
@ -260,7 +260,7 @@ set_new_recomm:
info->hash_analysis = 0;
cmp = ut_pair_cmp(cursor->up_match, cursor->up_bytes,
cursor->low_match, cursor->low_bytes);
cursor->low_match, cursor->low_bytes);
if (cmp == 0) {
info->n_hash_potential = 0;
@ -328,7 +328,7 @@ btr_search_update_block_hash_info(
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
ut_ad(rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_SHARED)
|| rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_EX));
|| rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(cursor);
@ -338,15 +338,15 @@ btr_search_update_block_hash_info(
ut_a(info->magic_n == BTR_SEARCH_MAGIC_N);
if ((block->n_hash_helps > 0)
&& (info->n_hash_potential > 0)
&& (block->n_fields == info->n_fields)
&& (block->n_bytes == info->n_bytes)
&& (block->side == info->side)) {
&& (info->n_hash_potential > 0)
&& (block->n_fields == info->n_fields)
&& (block->n_bytes == info->n_bytes)
&& (block->side == info->side)) {
if ((block->is_hashed)
&& (block->curr_n_fields == info->n_fields)
&& (block->curr_n_bytes == info->n_bytes)
&& (block->curr_side == info->side)) {
&& (block->curr_n_fields == info->n_fields)
&& (block->curr_n_bytes == info->n_bytes)
&& (block->curr_side == info->side)) {
/* The search would presumably have succeeded using
the hash index */
@ -367,15 +367,15 @@ btr_search_update_block_hash_info(
}
if ((block->n_hash_helps > page_get_n_recs(block->frame)
/ BTR_SEARCH_PAGE_BUILD_LIMIT)
&& (info->n_hash_potential >= BTR_SEARCH_BUILD_LIMIT)) {
/ BTR_SEARCH_PAGE_BUILD_LIMIT)
&& (info->n_hash_potential >= BTR_SEARCH_BUILD_LIMIT)) {
if ((!block->is_hashed)
|| (block->n_hash_helps
> 2 * page_get_n_recs(block->frame))
|| (block->n_fields != block->curr_n_fields)
|| (block->n_bytes != block->curr_n_bytes)
|| (block->side != block->curr_side)) {
|| (block->n_hash_helps
> 2 * page_get_n_recs(block->frame))
|| (block->n_fields != block->curr_n_fields)
|| (block->n_bytes != block->curr_n_bytes)
|| (block->side != block->curr_side)) {
/* Build a new hash index on the page */
@ -410,16 +410,16 @@ btr_search_update_hash_ref(
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(buf_block_align(btr_cur_get_rec(cursor)) == block);
ut_a(!block->is_hashed || block->index == cursor->index);
if (block->is_hashed
&& (info->n_hash_potential > 0)
&& (block->curr_n_fields == info->n_fields)
&& (block->curr_n_bytes == info->n_bytes)
&& (block->curr_side == info->side)) {
&& (info->n_hash_potential > 0)
&& (block->curr_n_fields == info->n_fields)
&& (block->curr_n_bytes == info->n_bytes)
&& (block->curr_side == info->side)) {
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
@ -432,8 +432,9 @@ btr_search_update_hash_ref(
}
tree_id = ((cursor->index)->tree)->id;
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index,
offsets_, ULINT_UNDEFINED, &heap),
fold = rec_fold(rec,
rec_get_offsets(rec, cursor->index, offsets_,
ULINT_UNDEFINED, &heap),
block->curr_n_fields,
block->curr_n_bytes, tree_id);
if (UNIV_LIKELY_NULL(heap)) {
@ -516,10 +517,10 @@ btr_search_info_update_slow(
params2 = params + btr_search_this_is_zero;
btr_search_build_page_hash_index(cursor->index,
block->frame,
params2[0],
params2[1],
params2[2]);
block->frame,
params2[0],
params2[1],
params2[2]);
mem_free(params);
}
}
@ -568,9 +569,9 @@ btr_search_check_guess(
bytes = 0;
offsets = rec_get_offsets(rec, cursor->index, offsets,
n_unique, &heap);
n_unique, &heap);
cmp = page_cmp_dtuple_rec_with_match(tuple, rec,
offsets, &match, &bytes);
offsets, &match, &bytes);
if (mode == PAGE_CUR_GE) {
if (cmp == 1) {
@ -617,16 +618,16 @@ btr_search_check_guess(
prev_rec = page_rec_get_prev(rec);
if (page_rec_is_infimum(prev_rec)) {
success = btr_page_get_prev(
buf_frame_align(prev_rec), mtr) == FIL_NULL;
success = btr_page_get_prev
(buf_frame_align(prev_rec), mtr) == FIL_NULL;
goto exit_func;
}
offsets = rec_get_offsets(prev_rec, cursor->index, offsets,
n_unique, &heap);
n_unique, &heap);
cmp = page_cmp_dtuple_rec_with_match(tuple, prev_rec,
offsets, &match, &bytes);
offsets, &match, &bytes);
if (mode == PAGE_CUR_GE) {
success = cmp == 1;
} else {
@ -642,8 +643,8 @@ btr_search_check_guess(
next_rec = page_rec_get_next(rec);
if (page_rec_is_supremum(next_rec)) {
if (btr_page_get_next(
buf_frame_align(next_rec), mtr) == FIL_NULL) {
if (btr_page_get_next
(buf_frame_align(next_rec), mtr) == FIL_NULL) {
cursor->up_match = 0;
success = TRUE;
@ -653,9 +654,9 @@ btr_search_check_guess(
}
offsets = rec_get_offsets(next_rec, cursor->index, offsets,
n_unique, &heap);
n_unique, &heap);
cmp = page_cmp_dtuple_rec_with_match(tuple, next_rec,
offsets, &match, &bytes);
offsets, &match, &bytes);
if (mode == PAGE_CUR_LE) {
success = cmp == -1;
cursor->up_match = match;
@ -709,7 +710,7 @@ btr_search_guess_on_hash(
#endif
ut_ad(index && info && tuple && cursor && mtr);
ut_ad((latch_mode == BTR_SEARCH_LEAF)
|| (latch_mode == BTR_MODIFY_LEAF));
|| (latch_mode == BTR_MODIFY_LEAF));
/* Note that, for efficiency, the struct info may not be protected by
any latch here! */
@ -730,7 +731,7 @@ btr_search_guess_on_hash(
}
if (UNIV_UNLIKELY(tuple_n_fields == cursor->n_fields)
&& (cursor->n_bytes > 0)) {
&& (cursor->n_bytes > 0)) {
return(FALSE);
}
@ -762,10 +763,10 @@ btr_search_guess_on_hash(
if (UNIV_LIKELY(!has_search_latch)) {
if (UNIV_UNLIKELY(!buf_page_get_known_nowait(latch_mode, page,
if (UNIV_UNLIKELY
(!buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG,
__FILE__, __LINE__,
mtr))) {
__FILE__, __LINE__, mtr))) {
goto failure_unlock;
}
@ -801,10 +802,11 @@ btr_search_guess_on_hash(
record to determine if our guess for the cursor position is
right. */
if (UNIV_EXPECT(ut_dulint_cmp(tree_id, btr_page_get_index_id(page)), 0)
|| !btr_search_check_guess(cursor,
can_only_compare_to_cursor_rec, tuple, mode, mtr)) {
|| !btr_search_check_guess(cursor,
can_only_compare_to_cursor_rec,
tuple, mode, mtr)) {
if (UNIV_LIKELY(!has_search_latch)) {
btr_leaf_page_release(page, latch_mode, mtr);
btr_leaf_page_release(page, latch_mode, mtr);
}
goto failure;
@ -827,9 +829,9 @@ btr_search_guess_on_hash(
btr_leaf_page_release(page, latch_mode, mtr);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
&cursor2, 0, mtr);
&cursor2, 0, mtr);
if (mode == PAGE_CUR_GE
&& page_rec_is_supremum(btr_cur_get_rec(&cursor2))) {
&& page_rec_is_supremum(btr_cur_get_rec(&cursor2))) {
/* If mode is PAGE_CUR_GE, then the binary search
in the index tree may actually take us to the supremum
@ -838,7 +840,7 @@ btr_search_guess_on_hash(
info->last_hash_succ = FALSE;
btr_pcur_open_on_user_rec(index, tuple, mode, latch_mode,
&pcur, mtr);
&pcur, mtr);
ut_ad(btr_pcur_get_rec(&pcur) == btr_cur_get_rec(cursor));
} else {
ut_ad(btr_cur_get_rec(&cursor2) == btr_cur_get_rec(cursor));
@ -854,7 +856,7 @@ btr_search_guess_on_hash(
btr_search_n_succ++;
#endif
if (UNIV_LIKELY(!has_search_latch)
&& buf_block_peek_if_too_old(block)) {
&& buf_block_peek_if_too_old(block)) {
buf_page_make_young(page);
}
@ -931,8 +933,8 @@ retry:
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|| rw_lock_own(&(block->lock), RW_LOCK_EX)
|| (block->buf_fix_count == 0));
|| rw_lock_own(&(block->lock), RW_LOCK_EX)
|| (block->buf_fix_count == 0));
#endif /* UNIV_SYNC_DEBUG */
n_fields = block->curr_n_fields;
@ -972,7 +974,7 @@ retry:
/* FIXME: in a mixed tree, not all records may have enough
ordering fields: */
offsets = rec_get_offsets(rec, index, offsets,
n_fields + (n_bytes > 0), &heap);
n_fields + (n_bytes > 0), &heap);
ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
@ -1006,7 +1008,7 @@ next_rec:
ut_a(block->index == index);
if (UNIV_UNLIKELY(block->curr_n_fields != n_fields)
|| UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
|| UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
/* Someone else has meanwhile built a new hash index on the
page, with different parameters */
@ -1029,8 +1031,10 @@ cleanup:
/* Corruption */
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Corruption of adaptive hash index. After dropping\n"
"InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n",
" InnoDB: Corruption of adaptive hash index."
" After dropping\n"
"InnoDB: the hash index to a page of %s,"
" still %lu hash nodes remain.\n",
index->name, (ulong) block->n_pointers);
rw_lock_x_unlock(&btr_search_latch);
@ -1124,14 +1128,14 @@ btr_search_build_page_hash_index(
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
rw_lock_s_lock(&btr_search_latch);
if (block->is_hashed && ((block->curr_n_fields != n_fields)
|| (block->curr_n_bytes != n_bytes)
|| (block->curr_side != side))) {
|| (block->curr_n_bytes != n_bytes)
|| (block->curr_side != side))) {
rw_lock_s_unlock(&btr_search_latch);
@ -1155,8 +1159,8 @@ btr_search_build_page_hash_index(
}
if (dict_index_get_n_unique_in_tree(index) < n_fields
|| (dict_index_get_n_unique_in_tree(index) == n_fields
&& n_bytes > 0)) {
|| (dict_index_get_n_unique_in_tree(index) == n_fields
&& n_bytes > 0)) {
return;
}
@ -1174,7 +1178,7 @@ btr_search_build_page_hash_index(
rec = page_rec_get_next(rec);
offsets = rec_get_offsets(rec, index, offsets,
n_fields + (n_bytes > 0), &heap);
n_fields + (n_bytes > 0), &heap);
if (!page_rec_is_supremum(rec)) {
ut_a(n_fields <= rec_offs_n_fields(offsets));
@ -1211,9 +1215,9 @@ btr_search_build_page_hash_index(
}
offsets = rec_get_offsets(next_rec, index, offsets,
n_fields + (n_bytes > 0), &heap);
n_fields + (n_bytes > 0), &heap);
next_fold = rec_fold(next_rec, offsets, n_fields,
n_bytes, tree_id);
n_bytes, tree_id);
if (fold != next_fold) {
/* Insert an entry into the hash index */
@ -1239,8 +1243,8 @@ btr_search_build_page_hash_index(
rw_lock_x_lock(&btr_search_latch);
if (block->is_hashed && ((block->curr_n_fields != n_fields)
|| (block->curr_n_bytes != n_bytes)
|| (block->curr_side != side))) {
|| (block->curr_n_bytes != n_bytes)
|| (block->curr_side != side))) {
goto exit_func;
}
@ -1327,7 +1331,7 @@ btr_search_move_or_delete_hash_entries(
ut_a(n_fields + n_bytes > 0);
btr_search_build_page_hash_index(index, new_page, n_fields,
n_bytes, side);
n_bytes, side);
ut_a(n_fields == block->curr_n_fields);
ut_a(n_bytes == block->curr_n_bytes);
ut_a(side == block->curr_side);
@ -1378,8 +1382,8 @@ btr_search_update_hash_on_delete(
tree_id = cursor->index->tree->id;
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_,
ULINT_UNDEFINED, &heap), block->curr_n_fields,
block->curr_n_bytes, tree_id);
ULINT_UNDEFINED, &heap),
block->curr_n_fields, block->curr_n_bytes, tree_id);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@ -1423,14 +1427,14 @@ btr_search_update_hash_node_on_insert(
rw_lock_x_lock(&btr_search_latch);
if ((cursor->flag == BTR_CUR_HASH)
&& (cursor->n_fields == block->curr_n_fields)
&& (cursor->n_bytes == block->curr_n_bytes)
&& (block->curr_side == BTR_SEARCH_RIGHT_SIDE)) {
&& (cursor->n_fields == block->curr_n_fields)
&& (cursor->n_bytes == block->curr_n_bytes)
&& (block->curr_side == BTR_SEARCH_RIGHT_SIDE)) {
table = btr_search_sys->hash_index;
ha_search_and_update_if_found(table, cursor->fold, rec,
page_rec_get_next(rec));
page_rec_get_next(rec));
rw_lock_x_unlock(&btr_search_latch);
} else {
@ -1498,19 +1502,19 @@ btr_search_update_hash_on_insert(
next_rec = page_rec_get_next(ins_rec);
offsets = rec_get_offsets(ins_rec, cursor->index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
ins_fold = rec_fold(ins_rec, offsets, n_fields, n_bytes, tree_id);
if (!page_rec_is_supremum(next_rec)) {
offsets = rec_get_offsets(next_rec, cursor->index, offsets,
n_fields + (n_bytes > 0), &heap);
n_fields + (n_bytes > 0), &heap);
next_fold = rec_fold(next_rec, offsets, n_fields,
n_bytes, tree_id);
n_bytes, tree_id);
}
if (!page_rec_is_infimum(rec)) {
offsets = rec_get_offsets(rec, cursor->index, offsets,
n_fields + (n_bytes > 0), &heap);
n_fields + (n_bytes > 0), &heap);
fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
} else {
if (side == BTR_SEARCH_LEFT_SIDE) {
@ -1570,11 +1574,11 @@ check_next_rec:
if (side == BTR_SEARCH_RIGHT_SIDE) {
ha_insert_for_fold(table, ins_fold, ins_rec);
/*
/*
fputs("Hash insert for ", stderr);
dict_index_name_print(stderr, cursor->index);
fprintf(stderr, " fold %lu\n", ins_fold);
*/
*/
} else {
ha_insert_for_fold(table, next_fold, next_rec);
}
@ -1633,12 +1637,13 @@ btr_search_validate(void)
block = buf_block_align(node->data);
page = buf_frame_align(node->data);
offsets = rec_get_offsets((rec_t*) node->data,
block->index, offsets,
block->curr_n_fields
+ (block->curr_n_bytes > 0), &heap);
block->index, offsets,
block->curr_n_fields
+ (block->curr_n_bytes > 0),
&heap);
if (!block->is_hashed
|| node->fold != rec_fold((rec_t*)(node->data),
if (!block->is_hashed || node->fold
!= rec_fold((rec_t*)(node->data),
offsets,
block->curr_n_fields,
block->curr_n_bytes,
@ -1647,28 +1652,36 @@ btr_search_validate(void)
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error in an adaptive hash index pointer to page %lu\n"
"ptr mem address %p index id %lu %lu, node fold %lu, rec fold %lu\n",
" InnoDB: Error in an adaptive hash"
" index pointer to page %lu\n"
"InnoDB: ptr mem address %p"
" index id %lu %lu,"
" node fold %lu, rec fold %lu\n",
(ulong) buf_frame_get_page_no(page),
node->data,
(ulong) ut_dulint_get_high(btr_page_get_index_id(page)),
(ulong) ut_dulint_get_low(btr_page_get_index_id(page)),
(ulong) ut_dulint_get_high
(btr_page_get_index_id(page)),
(ulong) ut_dulint_get_low
(btr_page_get_index_id(page)),
(ulong) node->fold,
(ulong) rec_fold((rec_t*)(node->data),
offsets,
block->curr_n_fields,
block->curr_n_bytes,
btr_page_get_index_id(page)));
offsets,
block->curr_n_fields,
block->curr_n_bytes,
btr_page_get_index_id
(page)));
fputs("InnoDB: Record ", stderr);
rec_print_new(stderr, (rec_t*)node->data,
offsets);
offsets);
fprintf(stderr, "\nInnoDB: on that page."
"Page mem address %p, is hashed %lu, n fields %lu, n bytes %lu\n"
"side %lu\n",
page, (ulong) block->is_hashed,
(ulong) block->curr_n_fields,
(ulong) block->curr_n_bytes, (ulong) block->curr_side);
" Page mem address %p, is hashed %lu,"
" n fields %lu, n bytes %lu\n"
"InnoDB: side %lu\n",
(void*) page, (ulong) block->is_hashed,
(ulong) block->curr_n_fields,
(ulong) block->curr_n_bytes,
(ulong) block->curr_side);
if (n_page_dumps < 20) {
buf_page_print(page);

View file

@ -253,10 +253,10 @@ buf_calc_page_new_checksum(
there we store the old formula checksum. */
checksum = ut_fold_binary(page + FIL_PAGE_OFFSET,
FIL_PAGE_FILE_FLUSH_LSN - FIL_PAGE_OFFSET)
+ ut_fold_binary(page + FIL_PAGE_DATA,
UNIV_PAGE_SIZE - FIL_PAGE_DATA
- FIL_PAGE_END_LSN_OLD_CHKSUM);
FIL_PAGE_FILE_FLUSH_LSN - FIL_PAGE_OFFSET)
+ ut_fold_binary(page + FIL_PAGE_DATA,
UNIV_PAGE_SIZE - FIL_PAGE_DATA
- FIL_PAGE_END_LSN_OLD_CHKSUM);
checksum = checksum & 0xFFFFFFFFUL;
return(checksum);
@ -302,11 +302,11 @@ buf_page_is_corrupted(
dulint current_lsn;
#endif
if (mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
!= mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
!= mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
/* Stored log sequence numbers at the start and the end
of page do not match */
of page do not match */
return(TRUE);
}
@ -314,22 +314,28 @@ buf_page_is_corrupted(
#ifndef UNIV_HOTBACKUP
if (recv_lsn_checks_on && log_peek_lsn(&current_lsn)) {
if (ut_dulint_cmp(current_lsn,
mach_read_from_8(read_buf + FIL_PAGE_LSN))
< 0) {
mach_read_from_8(read_buf + FIL_PAGE_LSN))
< 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: page %lu log sequence number %lu %lu\n"
"InnoDB: is in the future! Current system log sequence number %lu %lu.\n"
"InnoDB: Your database may be corrupt or you may have copied the InnoDB\n"
"InnoDB: tablespace but not the InnoDB log files. See\n"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
"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)),
" InnoDB: Error: page %lu log sequence number"
" %lu %lu\n"
"InnoDB: is in the future! Current system "
"log sequence number %lu %lu.\n"
"InnoDB: Your database may be corrupt or "
"you may have copied the InnoDB\n"
"InnoDB: tablespace but not the InnoDB "
"log files. See\n"
"InnoDB: http://dev.mysql.com/doc/refman/"
"5.1/en/forcing-recovery.html\n"
"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(current_lsn),
(ulong) ut_dulint_get_low(current_lsn));
}
@ -344,8 +350,9 @@ buf_page_is_corrupted(
if (srv_use_checksums) {
old_checksum = buf_calc_page_old_checksum(read_buf);
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:
@ -356,22 +363,22 @@ buf_page_is_corrupted(
there. */
if (old_checksum_field != mach_read_from_4(read_buf
+ FIL_PAGE_LSN)
&& old_checksum_field != old_checksum
&& old_checksum_field != BUF_NO_CHECKSUM_MAGIC) {
+ FIL_PAGE_LSN)
&& old_checksum_field != old_checksum
&& old_checksum_field != BUF_NO_CHECKSUM_MAGIC) {
return(TRUE);
}
checksum = buf_calc_page_new_checksum(read_buf);
checksum_field = mach_read_from_4(read_buf +
FIL_PAGE_SPACE_OR_CHKSUM);
FIL_PAGE_SPACE_OR_CHKSUM);
/* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
(always equal to 0), to FIL_PAGE_SPACE_SPACE_OR_CHKSUM */
if (checksum_field != 0 && checksum_field != checksum
&& checksum_field != BUF_NO_CHECKSUM_MAGIC) {
&& checksum_field != BUF_NO_CHECKSUM_MAGIC) {
return(TRUE);
}
@ -398,37 +405,41 @@ buf_page_print(
ut_print_buf(stderr, read_buf, UNIV_PAGE_SIZE);
fputs("InnoDB: End of page dump\n", stderr);
checksum = srv_use_checksums ?
buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
old_checksum = srv_use_checksums ?
buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
checksum = srv_use_checksums
? buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
old_checksum = srv_use_checksums
? buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Page checksum %lu, prior-to-4.0.14-form checksum %lu\n"
"InnoDB: stored checksum %lu, prior-to-4.0.14-form stored checksum %lu\n",
(ulong) checksum, (ulong) old_checksum,
(ulong) mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
(ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM));
fprintf(stderr,
"InnoDB: Page lsn %lu %lu, low 4 bytes of lsn at page end %lu\n"
"InnoDB: Page number (if stored to page already) %lu,\n"
"InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) %lu\n",
" InnoDB: Page checksum %lu, prior-to-4.0.14-form"
" checksum %lu\n"
"InnoDB: stored checksum %lu, prior-to-4.0.14-form"
" stored checksum %lu\n"
"InnoDB: Page lsn %lu %lu, low 4 bytes of lsn"
" at page end %lu\n"
"InnoDB: Page number (if stored to page already) %lu,\n"
"InnoDB: space id (if created with >= MySQL-4.1.1"
" and stored already) %lu\n",
(ulong) checksum, (ulong) old_checksum,
(ulong) mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
(ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_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 + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4),
- FIL_PAGE_END_LSN_OLD_CHKSUM + 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_ARCH_LOG_NO_OR_SPACE_ID));
if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE)
== TRX_UNDO_INSERT) {
== TRX_UNDO_INSERT) {
fprintf(stderr,
"InnoDB: Page may be an insert undo log page\n");
} else if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_TYPE)
== TRX_UNDO_UPDATE) {
+ TRX_UNDO_PAGE_TYPE)
== TRX_UNDO_UPDATE) {
fprintf(stderr,
"InnoDB: Page may be an update undo log page\n");
}
@ -436,17 +447,20 @@ buf_page_print(
switch (fil_page_get_type(read_buf)) {
case FIL_PAGE_INDEX:
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)));
"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)));
/* If the code is in ibbackup, dict_sys may be uninitialized,
i.e., NULL */
if (dict_sys != NULL) {
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);
@ -459,35 +473,35 @@ buf_page_print(
break;
case FIL_PAGE_IBUF_FREE_LIST:
fputs("InnoDB: Page may be an insert buffer free list page\n",
stderr);
stderr);
break;
case FIL_PAGE_TYPE_ALLOCATED:
fputs("InnoDB: Page may be a freshly allocated page\n",
stderr);
stderr);
break;
case FIL_PAGE_IBUF_BITMAP:
fputs("InnoDB: Page may be an insert buffer bitmap page\n",
stderr);
stderr);
break;
case FIL_PAGE_TYPE_SYS:
fputs("InnoDB: Page may be a system page\n",
stderr);
stderr);
break;
case FIL_PAGE_TYPE_TRX_SYS:
fputs("InnoDB: Page may be a transaction system page\n",
stderr);
stderr);
break;
case FIL_PAGE_TYPE_FSP_HDR:
fputs("InnoDB: Page may be a file space header page\n",
stderr);
stderr);
break;
case FIL_PAGE_TYPE_XDES:
fputs("InnoDB: Page may be an extent descriptor page\n",
stderr);
stderr);
break;
case FIL_PAGE_TYPE_BLOB:
fputs("InnoDB: Page may be a BLOB page\n",
stderr);
stderr);
break;
}
}
@ -561,9 +575,12 @@ buf_pool_init(
if (n_frames > curr_size) {
fprintf(stderr,
"InnoDB: AWE: Error: you must specify in my.cnf .._awe_mem_mb larger\n"
"InnoDB: than .._buffer_pool_size. Now the former is %lu pages,\n"
"InnoDB: the latter %lu pages.\n", (ulong) curr_size, (ulong) n_frames);
"InnoDB: AWE: Error: you must specify in my.cnf"
" .._awe_mem_mb larger\n"
"InnoDB: than .._buffer_pool_size. Now the former"
" is %lu pages,\n"
"InnoDB: the latter %lu pages.\n",
(ulong) curr_size, (ulong) n_frames);
return(NULL);
}
@ -571,7 +588,7 @@ buf_pool_init(
buf_pool = mem_alloc(sizeof(buf_pool_t));
/* 1. Initialize general fields
---------------------------- */
---------------------------- */
mutex_create(&buf_pool->mutex, SYNC_BUF_POOL);
mutex_enter(&(buf_pool->mutex));
@ -581,8 +598,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 */
@ -590,23 +607,26 @@ buf_pool_init(
if ((curr_size % ((1024 * 1024) / UNIV_PAGE_SIZE)) != 0) {
fprintf(stderr,
"InnoDB: AWE: Error: physical memory must be allocated in full megabytes.\n"
"InnoDB: Trying to allocate %lu database pages.\n",
(ulong) curr_size);
"InnoDB: AWE: Error: physical memory must be"
" allocated in full megabytes.\n"
"InnoDB: Trying to allocate %lu"
" database pages.\n",
(ulong) curr_size);
return(NULL);
}
if (!os_awe_allocate_physical_mem(&(buf_pool->awe_info),
curr_size / ((1024 * 1024) / UNIV_PAGE_SIZE))) {
curr_size
/ ((1024 * 1024)
/ UNIV_PAGE_SIZE))) {
return(NULL);
}
/*----------------------------------------*/
} 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) {
@ -639,9 +659,10 @@ buf_pool_init(
the window */
os_awe_map_physical_mem_to_window(buf_pool->frame_zero,
n_frames *
(UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE),
buf_pool->awe_info);
n_frames *
(UNIV_PAGE_SIZE
/ OS_AWE_X86_PAGE_SIZE),
buf_pool->awe_info);
/*----------------------------------------*/
}
@ -697,7 +718,7 @@ buf_pool_init(
buf_pool->n_pages_awe_remapped_old = 0;
/* 2. Initialize flushing fields
---------------------------- */
---------------------------- */
UT_LIST_INIT(buf_pool->flush_list);
for (i = BUF_FLUSH_LRU; i <= BUF_FLUSH_LIST; i++) {
@ -712,7 +733,7 @@ buf_pool_init(
buf_pool->freed_page_clock = 0;
/* 3. Initialize LRU fields
---------------------------- */
---------------------------- */
UT_LIST_INIT(buf_pool->LRU);
buf_pool->LRU_old = NULL;
@ -738,7 +759,8 @@ buf_pool_init(
frames */
UT_LIST_ADD_LAST(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
buf_pool->awe_LRU_free_mapped,
block);
}
}
@ -749,8 +771,8 @@ buf_pool_init(
mutex_exit(&(buf_pool->mutex));
if (srv_use_adaptive_hash_indexes) {
btr_search_sys_create(
curr_size * UNIV_PAGE_SIZE / sizeof(void*) / 64);
btr_search_sys_create(curr_size * UNIV_PAGE_SIZE
/ sizeof(void*) / 64);
} else {
/* Create only a small dummy system */
btr_search_sys_create(1000);
@ -792,35 +814,36 @@ buf_awe_map_page_to_frame(
while (bck) {
if (bck->state == BUF_BLOCK_FILE_PAGE
&& (bck->buf_fix_count != 0 || bck->io_fix != 0)) {
&& (bck->buf_fix_count != 0 || bck->io_fix != 0)) {
/* We have to skip this */
bck = UT_LIST_GET_PREV(awe_LRU_free_mapped, bck);
} 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;
*(buf_pool->blocks_of_frames
+ (((ulint)(block->frame
- buf_pool->frame_zero))
>> UNIV_PAGE_SIZE_SHIFT))
+ (((ulint)(block->frame
- buf_pool->frame_zero))
>> UNIV_PAGE_SIZE_SHIFT))
= block;
bck->frame = NULL;
UT_LIST_REMOVE(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped,
bck);
buf_pool->awe_LRU_free_mapped,
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++;
@ -830,8 +853,8 @@ buf_awe_map_page_to_frame(
}
fprintf(stderr,
"InnoDB: AWE: Fatal error: cannot find a page to unmap\n"
"InnoDB: awe_LRU_free_mapped list length %lu\n",
"InnoDB: AWE: Fatal error: cannot find a page to unmap\n"
"InnoDB: awe_LRU_free_mapped list length %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
ut_a(0);
@ -864,7 +887,7 @@ buf_block_make_young(
buf_block_t* block) /* in: block to make younger */
{
if (buf_pool->freed_page_clock >= block->freed_page_clock
+ 1 + (buf_pool->curr_size / 1024)) {
+ 1 + (buf_pool->curr_size / 1024)) {
/* There has been freeing activity in the LRU list:
best to move to the head of the LRU list */
@ -1118,11 +1141,11 @@ buf_page_get_gen(
ut_ad(mtr);
ut_ad((rw_latch == RW_S_LATCH)
|| (rw_latch == RW_X_LATCH)
|| (rw_latch == RW_NO_LATCH));
|| (rw_latch == RW_X_LATCH)
|| (rw_latch == RW_NO_LATCH));
ut_ad((mode != BUF_GET_NO_LATCH) || (rw_latch == RW_NO_LATCH));
ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL)
|| (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
|| (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
#ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside() || ibuf_page(space, offset));
#endif
@ -1136,7 +1159,7 @@ loop:
block = buf_block_align(guess);
if ((offset != block->offset) || (space != block->space)
|| (block->state != BUF_BLOCK_FILE_PAGE)) {
|| (block->state != BUF_BLOCK_FILE_PAGE)) {
block = NULL;
}
@ -1229,12 +1252,12 @@ loop:
if (mode == BUF_GET_NOWAIT) {
if (rw_latch == RW_S_LATCH) {
success = rw_lock_s_lock_func_nowait(&(block->lock),
file, line);
file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
} else {
ut_ad(rw_latch == RW_X_LATCH);
success = rw_lock_x_lock_func_nowait(&(block->lock),
file, line);
file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
}
@ -1331,8 +1354,8 @@ buf_page_optimistic_get_func(
/* If AWE is used, block may have a different frame now, e.g., NULL */
if (UNIV_UNLIKELY(block->state != BUF_BLOCK_FILE_PAGE)
|| UNIV_UNLIKELY(block->frame != guess)) {
exit_func:
|| UNIV_UNLIKELY(block->frame != guess)) {
exit_func:
mutex_exit(&(buf_pool->mutex));
return(FALSE);
@ -1357,11 +1380,11 @@ buf_page_optimistic_get_func(
if (rw_latch == RW_S_LATCH) {
success = rw_lock_s_lock_func_nowait(&(block->lock),
file, line);
file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
} else {
success = rw_lock_x_lock_func_nowait(&(block->lock),
file, line);
file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
}
@ -1414,7 +1437,7 @@ buf_page_optimistic_get_func(
read-ahead */
buf_read_ahead_linear(buf_frame_get_space_id(guess),
buf_frame_get_page_no(guess));
buf_frame_get_page_no(guess));
}
#ifdef UNIV_IBUF_DEBUG
@ -1482,11 +1505,11 @@ buf_page_get_known_nowait(
if (rw_latch == RW_S_LATCH) {
success = rw_lock_s_lock_func_nowait(&(block->lock),
file, line);
file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
} else {
success = rw_lock_x_lock_func_nowait(&(block->lock),
file, line);
file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
}
@ -1519,7 +1542,7 @@ buf_page_get_known_nowait(
#ifdef UNIV_IBUF_DEBUG
ut_a((mode == BUF_KEEP_OLD)
|| (ibuf_count_get(block->space, block->offset) == 0));
|| (ibuf_count_get(block->space, block->offset) == 0));
#endif
buf_pool->n_page_gets++;
@ -1598,7 +1621,8 @@ buf_page_init(
if (buf_page_hash_get(space, offset)) {
fprintf(stderr,
"InnoDB: Error: page %lu %lu already found from the hash table\n",
"InnoDB: Error: page %lu %lu already found"
" in the hash table\n",
(ulong) space,
(ulong) offset);
#ifdef UNIV_DEBUG
@ -1611,7 +1635,7 @@ buf_page_init(
}
HASH_INSERT(buf_block_t, hash, buf_pool->page_hash,
buf_page_address_fold(space, offset), block);
buf_page_address_fold(space, offset), block);
block->freed_page_clock = 0;
@ -1686,27 +1710,28 @@ 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;
}
if (*err == DB_TABLESPACE_DELETED
|| NULL != buf_page_hash_get(space, offset)) {
|| NULL != buf_page_hash_get(space, offset)) {
/* The page belongs to a space which has been deleted or is
being deleted, or the page is already in buf_pool, return */
/* The page belongs to a space which has been
deleted or is being deleted, or the page is
already in buf_pool, return */
mutex_exit(&(buf_pool->mutex));
buf_block_free(block);
mutex_exit(&(buf_pool->mutex));
buf_block_free(block);
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
mtr_commit(&mtr);
}
mtr_commit(&mtr);
}
return(NULL);
}
return(NULL);
}
ut_ad(block);
@ -1866,23 +1891,24 @@ buf_page_io_complete(
/* If this page is not uninitialized and not in the
doublewrite buffer, then the page number and space id
should be the same as in block. */
ulint read_page_no = mach_read_from_4((block->frame)
+ FIL_PAGE_OFFSET);
ulint read_space_id = mach_read_from_4((block->frame)
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
ulint read_page_no = mach_read_from_4
(block->frame + FIL_PAGE_OFFSET);
ulint read_space_id = mach_read_from_4
(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
if (!block->space && trx_doublewrite_page_inside(
block->offset)) {
if (!block->space
&& trx_doublewrite_page_inside(block->offset)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: reading page %lu\n"
"InnoDB: which is in the doublewrite buffer!\n",
" InnoDB: Error: reading page %lu\n"
"InnoDB: which is in the"
" doublewrite buffer!\n",
(ulong) block->offset);
} else if (!read_space_id && !read_page_no) {
/* This is likely an uninitialized page. */
} else if ((block->space && block->space != read_space_id)
|| block->offset != read_page_no) {
|| block->offset != read_page_no) {
/* We did not compare space_id to read_space_id
if block->space == 0, because the field on the
page may contain garbage in MySQL < 4.1.1,
@ -1890,59 +1916,77 @@ buf_page_io_complete(
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: space id and page n:o stored in the page\n"
"InnoDB: read in are %lu:%lu, should be %lu:%lu!\n",
" InnoDB: Error: space id and page n:o"
" stored in the page\n"
"InnoDB: read in are %lu:%lu,"
" should be %lu:%lu!\n",
(ulong) read_space_id, (ulong) read_page_no,
(ulong) block->space, (ulong) block->offset);
}
/* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */
to the 4 first bytes of the page end lsn field */
if (buf_page_is_corrupted(block->frame)) {
fprintf(stderr,
"InnoDB: Database page corruption on disk or a failed\n"
"InnoDB: file read of page %lu.\n", (ulong) block->offset);
"InnoDB: Database page corruption on disk"
" or a failed\n"
"InnoDB: file read of page %lu.\n",
(ulong) block->offset);
fputs(
"InnoDB: You may have to recover from a backup.\n", stderr);
"InnoDB: You may have to recover"
" from a backup.\n", stderr);
buf_page_print(block->frame);
fprintf(stderr,
"InnoDB: Database page corruption on disk or a failed\n"
"InnoDB: file read of page %lu.\n", (ulong) block->offset);
"InnoDB: Database page corruption on disk"
" or a failed\n"
"InnoDB: file read of page %lu.\n",
(ulong) block->offset);
fputs(
"InnoDB: You may have to recover from a backup.\n", stderr);
"InnoDB: You may have to recover"
" from a backup.\n", stderr);
fputs(
"InnoDB: It is also possible that your operating\n"
"InnoDB: system has corrupted its own file cache\n"
"InnoDB: and rebooting your computer removes the\n"
"InnoDB: error.\n"
"InnoDB: If the corrupt page is an index page\n"
"InnoDB: you can also try to fix the corruption\n"
"InnoDB: by dumping, dropping, and reimporting\n"
"InnoDB: the corrupt table. You can use CHECK\n"
"InnoDB: TABLE to scan your table for corruption.\n"
"InnoDB: See also "
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
"InnoDB: It is also possible that"
" your operating\n"
"InnoDB: system has corrupted its"
" own file cache\n"
"InnoDB: and rebooting your computer"
" removes the\n"
"InnoDB: error.\n"
"InnoDB: If the corrupt page is an index page\n"
"InnoDB: you can also try to"
" fix the corruption\n"
"InnoDB: by dumping, dropping,"
" and reimporting\n"
"InnoDB: the corrupt table."
" You can use CHECK\n"
"InnoDB: TABLE to scan your"
" table for corruption.\n"
"InnoDB: See also"
" http://dev.mysql.com/doc/refman/5.1/en/"
"forcing-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
fputs(
"InnoDB: Ending processing because of a corrupt database page.\n",
stderr);
"InnoDB: Ending processing because of"
" a corrupt database page.\n",
stderr);
exit(1);
}
}
if (recv_recovery_is_on()) {
recv_recover_page(FALSE, TRUE, block->frame,
block->space, block->offset);
block->space, block->offset);
}
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);
}
}
@ -2058,25 +2102,25 @@ buf_validate(void)
if (block->state == BUF_BLOCK_FILE_PAGE) {
ut_a(buf_page_hash_get(block->space,
block->offset) == block);
block->offset) == block);
n_page++;
#ifdef UNIV_IBUF_DEBUG
ut_a((block->io_fix == BUF_IO_READ)
|| ibuf_count_get(block->space, block->offset)
== 0);
|| ibuf_count_get(block->space, block->offset)
== 0);
#endif
if (block->io_fix == BUF_IO_WRITE) {
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) {
BUF_FLUSH_LIST) {
n_list_flush++;
} else if (block->flush_type ==
BUF_FLUSH_SINGLE_PAGE) {
BUF_FLUSH_SINGLE_PAGE) {
n_single_flush++;
} else {
ut_error;
@ -2085,14 +2129,14 @@ buf_validate(void)
} else if (block->io_fix == BUF_IO_READ) {
ut_a(rw_lock_is_locked(&(block->lock),
RW_LOCK_EX));
RW_LOCK_EX));
}
n_lru++;
if (ut_dulint_cmp(block->oldest_modification,
ut_dulint_zero) > 0) {
n_flush++;
ut_dulint_zero) > 0) {
n_flush++;
}
} else if (block->state == BUF_BLOCK_NOT_USED) {
@ -2101,14 +2145,16 @@ buf_validate(void)
}
if (n_lru + n_free > buf_pool->curr_size) {
fprintf(stderr, "n LRU %lu, n free %lu\n", (ulong) n_lru, (ulong) n_free);
fprintf(stderr, "n LRU %lu, n free %lu\n",
(ulong) n_lru, (ulong) n_free);
ut_error;
}
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
fprintf(stderr, "Free list len %lu, free blocks %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->free), (ulong) n_free);
(ulong) UT_LIST_GET_LEN(buf_pool->free),
(ulong) n_free);
ut_error;
}
ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush);
@ -2233,9 +2279,9 @@ Returns the number of latched pages in the buffer pool. */
ulint
buf_get_latched_pages_number(void)
{
buf_block_t* block;
ulint i;
ulint fixed_pages_number = 0;
buf_block_t* block;
ulint i;
ulint fixed_pages_number = 0;
mutex_enter(&(buf_pool->mutex));
@ -2243,9 +2289,10 @@ buf_get_latched_pages_number(void)
block = buf_pool_get_nth_block(buf_pool, i);
if (((block->buf_fix_count != 0) || (block->io_fix != 0)) &&
block->magic_n == BUF_BLOCK_MAGIC_N )
if (((block->buf_fix_count != 0) || (block->io_fix != 0))
&& block->magic_n == BUF_BLOCK_MAGIC_N) {
fixed_pages_number++;
}
}
mutex_exit(&(buf_pool->mutex));
@ -2261,9 +2308,9 @@ buf_get_n_pending_ios(void)
/*=======================*/
{
return(buf_pool->n_pend_reads
+ buf_pool->n_flush[BUF_FLUSH_LRU]
+ buf_pool->n_flush[BUF_FLUSH_LIST]
+ buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
+ buf_pool->n_flush[BUF_FLUSH_LRU]
+ buf_pool->n_flush[BUF_FLUSH_LIST]
+ buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
}
/*************************************************************************
@ -2280,7 +2327,7 @@ buf_get_modified_ratio_pct(void)
ratio = (100 * UT_LIST_GET_LEN(buf_pool->flush_list))
/ (1 + UT_LIST_GET_LEN(buf_pool->LRU)
+ UT_LIST_GET_LEN(buf_pool->free));
+ UT_LIST_GET_LEN(buf_pool->free));
/* 1 + is there to avoid division by zero */
@ -2308,12 +2355,14 @@ buf_print_io(
if (srv_use_awe) {
fprintf(stderr,
"AWE: Buffer pool memory frames %lu\n",
(ulong) buf_pool->n_frames);
"AWE: Buffer pool memory frames %lu\n",
(ulong) buf_pool->n_frames);
fprintf(stderr,
"AWE: Database pages and free buffers mapped in frames %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
"AWE: Database pages and free buffers"
" mapped in frames %lu\n",
(ulong)
UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
}
fprintf(file,
"Buffer pool size %lu\n"
@ -2328,14 +2377,14 @@ buf_print_io(
(ulong) UT_LIST_GET_LEN(buf_pool->flush_list),
(ulong) buf_pool->n_pend_reads,
(ulong) buf_pool->n_flush[BUF_FLUSH_LRU]
+ buf_pool->init_flush[BUF_FLUSH_LRU],
+ buf_pool->init_flush[BUF_FLUSH_LRU],
(ulong) buf_pool->n_flush[BUF_FLUSH_LIST]
+ buf_pool->init_flush[BUF_FLUSH_LIST],
+ buf_pool->init_flush[BUF_FLUSH_LIST],
(ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
current_time = time(NULL);
time_elapsed = 0.001 + difftime(current_time,
buf_pool->last_printout_time);
buf_pool->last_printout_time);
buf_pool->last_printout_time = current_time;
fprintf(file,
@ -2353,19 +2402,21 @@ buf_print_io(
if (srv_use_awe) {
fprintf(file, "AWE: %.2f page remaps/s\n",
(buf_pool->n_pages_awe_remapped
- buf_pool->n_pages_awe_remapped_old)
(buf_pool->n_pages_awe_remapped
- buf_pool->n_pages_awe_remapped_old)
/ time_elapsed);
}
if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) {
fprintf(file, "Buffer pool hit rate %lu / 1000\n",
(ulong) (1000 -
((1000 * (buf_pool->n_pages_read - buf_pool->n_pages_read_old))
/ (buf_pool->n_page_gets - buf_pool->n_page_gets_old))));
(ulong)
(1000 - ((1000 * (buf_pool->n_pages_read
- buf_pool->n_pages_read_old))
/ (buf_pool->n_page_gets
- buf_pool->n_page_gets_old))));
} else {
fputs("No buffer pool page gets since the last printout\n",
file);
file);
}
buf_pool->n_page_gets_old = buf_pool->n_page_gets;
@ -2416,7 +2467,8 @@ buf_all_freed(void)
fprintf(stderr,
"Page %lu %lu still fixed or dirty\n",
(ulong) block->space, (ulong) block->offset);
(ulong) block->space,
(ulong) block->offset);
ut_error;
}
}
@ -2441,8 +2493,8 @@ buf_pool_check_no_pending_io(void)
mutex_enter(&(buf_pool->mutex));
if (buf_pool->n_pend_reads + buf_pool->n_flush[BUF_FLUSH_LRU]
+ buf_pool->n_flush[BUF_FLUSH_LIST]
+ buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]) {
+ buf_pool->n_flush[BUF_FLUSH_LIST]
+ buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]) {
ret = FALSE;
} else {
ret = TRUE;

View file

@ -55,10 +55,10 @@ buf_flush_insert_into_flush_list(
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
|| (ut_dulint_cmp(
(UT_LIST_GET_FIRST(buf_pool->flush_list))
->oldest_modification,
block->oldest_modification) <= 0));
|| (ut_dulint_cmp(
(UT_LIST_GET_FIRST(buf_pool->flush_list))
->oldest_modification,
block->oldest_modification) <= 0));
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
@ -86,7 +86,7 @@ buf_flush_insert_sorted_into_flush_list(
b = UT_LIST_GET_FIRST(buf_pool->flush_list);
while (b && (ut_dulint_cmp(b->oldest_modification,
block->oldest_modification) > 0)) {
block->oldest_modification) > 0)) {
prev_b = b;
b = UT_LIST_GET_NEXT(flush_list, b);
}
@ -95,7 +95,7 @@ buf_flush_insert_sorted_into_flush_list(
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
} else {
UT_LIST_INSERT_AFTER(flush_list, buf_pool->flush_list, prev_b,
block);
block);
}
ut_ad(buf_flush_validate_low());
@ -118,7 +118,8 @@ buf_flush_ready_for_replace(
if (block->state != BUF_BLOCK_FILE_PAGE) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: buffer block state %lu in the LRU list!\n",
" InnoDB: Error: buffer block state %lu"
" in the LRU list!\n",
(ulong)block->state);
ut_print_buf(stderr, block, sizeof(buf_block_t));
@ -126,8 +127,8 @@ buf_flush_ready_for_replace(
}
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
|| (block->buf_fix_count != 0)
|| (block->io_fix != 0)) {
|| (block->buf_fix_count != 0)
|| (block->io_fix != 0)) {
return(FALSE);
}
@ -152,7 +153,7 @@ buf_flush_ready_for_flush(
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
&& (block->io_fix == 0)) {
&& (block->io_fix == 0)) {
if (flush_type != BUF_FLUSH_LRU) {
return(TRUE);
@ -202,10 +203,10 @@ buf_flush_write_complete(
}
/* fprintf(stderr, "n pending flush %lu\n",
buf_pool->n_flush[block->flush_type]); */
buf_pool->n_flush[block->flush_type]); */
if ((buf_pool->n_flush[block->flush_type] == 0)
&& (buf_pool->init_flush[block->flush_type] == FALSE)) {
&& (buf_pool->init_flush[block->flush_type] == FALSE)) {
/* The running flush batch has ended */
@ -255,27 +256,33 @@ buf_flush_buffered_writes(void)
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n"
"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
"InnoDB: before posting to the doublewrite buffer.\n");
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written"
" seems corrupt!\n"
"InnoDB: The lsn fields do not match!"
" Noticed in the buffer pool\n"
"InnoDB: before posting to the"
" doublewrite buffer.\n");
}
if (block->check_index_page_at_flush
&& !page_simple_validate(block->frame)) {
&& !page_simple_validate(block->frame)) {
buf_page_print(block->frame);
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Apparent corruption of an index page n:o %lu in space %lu\n"
"InnoDB: to be written to data file. We intentionally crash server\n"
"InnoDB: to prevent corrupt data from ending up in data\n"
"InnoDB: files.\n",
(ulong) block->offset, (ulong) block->space);
" InnoDB: Apparent corruption of an"
" index page n:o %lu in space %lu\n"
"InnoDB: to be written to data file."
" We intentionally crash server\n"
"InnoDB: to prevent corrupt data"
" from ending up in data\n"
"InnoDB: files.\n",
(ulong) block->offset, (ulong) block->space);
ut_error;
}
@ -292,47 +299,54 @@ buf_flush_buffered_writes(void)
}
fil_io(OS_FILE_WRITE,
TRUE, TRX_SYS_SPACE,
trx_doublewrite->block1, 0, len,
(void*)trx_doublewrite->write_buf, NULL);
TRUE, TRX_SYS_SPACE,
trx_doublewrite->block1, 0, len,
(void*)trx_doublewrite->write_buf, NULL);
write_buf = trx_doublewrite->write_buf;
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len; len2 += UNIV_PAGE_SIZE) {
if (mach_read_from_4(write_buf + len2 + FIL_PAGE_LSN + 4)
!= mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
!= mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n"
"InnoDB: The lsn fields do not match! Noticed in the doublewrite block1.\n");
" InnoDB: ERROR: The page to be written"
" seems corrupt!\n"
"InnoDB: The lsn fields do not match!"
" Noticed in the doublewrite block1.\n");
}
}
if (trx_doublewrite->first_free > TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
len = (trx_doublewrite->first_free
- TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE;
- TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE;
fil_io(OS_FILE_WRITE,
TRUE, TRX_SYS_SPACE,
trx_doublewrite->block2, 0, len,
(void*)(trx_doublewrite->write_buf
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE),
NULL);
TRUE, TRX_SYS_SPACE,
trx_doublewrite->block2, 0, len,
(void*)(trx_doublewrite->write_buf
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
* UNIV_PAGE_SIZE),
NULL);
write_buf = trx_doublewrite->write_buf
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len;
len2 += UNIV_PAGE_SIZE) {
len2 += UNIV_PAGE_SIZE) {
if (mach_read_from_4(write_buf + len2
+ FIL_PAGE_LSN + 4)
!= mach_read_from_4(write_buf + len2
+ UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ FIL_PAGE_LSN + 4)
!= mach_read_from_4(write_buf + len2
+ UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM
+ 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n"
"InnoDB: The lsn fields do not match! Noticed in the doublewrite block2.\n");
" InnoDB: ERROR: The page to be"
" written seems corrupt!\n"
"InnoDB: The lsn fields do not match!"
" Noticed in"
" the doublewrite block2.\n");
}
}
}
@ -349,14 +363,18 @@ buf_flush_buffered_writes(void)
block = trx_doublewrite->buf_block_arr[i];
if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n"
"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
"InnoDB: after posting and flushing the doublewrite buffer.\n"
"InnoDB: Page buf fix count %lu, io fix %lu, state %lu\n",
" InnoDB: ERROR: The page to be written"
" seems corrupt!\n"
"InnoDB: The lsn fields do not match!"
" Noticed in the buffer pool\n"
"InnoDB: after posting and flushing"
" the doublewrite buffer.\n"
"InnoDB: Page buf fix count %lu,"
" io fix %lu, state %lu\n",
(ulong)block->buf_fix_count,
(ulong)block->io_fix,
(ulong)block->state);
@ -364,8 +382,8 @@ buf_flush_buffered_writes(void)
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block);
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block);
}
/* Wake possible simulated aio thread to actually post the
@ -405,7 +423,7 @@ try_again:
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (trx_doublewrite->first_free
>= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
>= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
mutex_exit(&(trx_doublewrite->mutex));
buf_flush_buffered_writes();
@ -414,15 +432,15 @@ try_again:
}
ut_memcpy(trx_doublewrite->write_buf
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
block->frame, UNIV_PAGE_SIZE);
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
block->frame, UNIV_PAGE_SIZE);
trx_doublewrite->buf_block_arr[trx_doublewrite->first_free] = block;
trx_doublewrite->first_free++;
if (trx_doublewrite->first_free
>= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
>= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
mutex_exit(&(trx_doublewrite->mutex));
buf_flush_buffered_writes();
@ -448,7 +466,7 @@ buf_flush_init_for_writing(
mach_write_to_8(page + FIL_PAGE_LSN, newest_lsn);
mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
newest_lsn);
newest_lsn);
/* Write the page number and the space id */
mach_write_to_4(page + FIL_PAGE_OFFSET, page_no);
@ -457,8 +475,9 @@ buf_flush_init_for_writing(
/* Store the new formula checksum */
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums ?
buf_calc_page_new_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
srv_use_checksums
? buf_calc_page_new_checksum(page)
: BUF_NO_CHECKSUM_MAGIC);
/* We overwrite the first 4 bytes of the end lsn field to store
the old formula checksum. Since it depends also on the field
@ -466,8 +485,9 @@ buf_flush_init_for_writing(
new formula checksum. */
mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
srv_use_checksums ?
buf_calc_page_old_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
srv_use_checksums
? buf_calc_page_old_checksum(page)
: BUF_NO_CHECKSUM_MAGIC);
}
/************************************************************************
@ -494,20 +514,21 @@ buf_flush_write_block_low(
if (!univ_log_debug_warned) {
univ_log_debug_warned = TRUE;
fputs(
"Warning: cannot force log to disk if UNIV_LOG_DEBUG is defined!\n"
"Crash recovery will not work!\n",
stderr);
"Warning: cannot force log to disk if"
" UNIV_LOG_DEBUG is defined!\n"
"Crash recovery will not work!\n",
stderr);
}
#else
/* Force the log to the disk before writing the modified block */
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
#endif
buf_flush_init_for_writing(block->frame, block->newest_modification,
block->space, block->offset);
block->space, block->offset);
if (!srv_use_doublewrite_buf || !trx_doublewrite) {
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block);
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block);
} else {
buf_flush_post_to_doublewrite_buf(block);
}
@ -532,7 +553,7 @@ buf_flush_try_page(
ibool locked;
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST
|| flush_type == BUF_FLUSH_SINGLE_PAGE);
|| flush_type == BUF_FLUSH_SINGLE_PAGE);
mutex_enter(&(buf_pool->mutex));
@ -541,7 +562,7 @@ buf_flush_try_page(
ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
if (flush_type == BUF_FLUSH_LIST
&& block && buf_flush_ready_for_flush(block, flush_type)) {
&& block && buf_flush_ready_for_flush(block, flush_type)) {
block->io_fix = BUF_IO_WRITE;
@ -600,7 +621,7 @@ buf_flush_try_page(
return(1);
} else if (flush_type == BUF_FLUSH_LRU && block
&& buf_flush_ready_for_flush(block, flush_type)) {
&& buf_flush_ready_for_flush(block, flush_type)) {
/* VERY IMPORTANT:
Because any thread may call the LRU flush, even when owning
@ -647,7 +668,7 @@ buf_flush_try_page(
return(1);
} else if (flush_type == BUF_FLUSH_SINGLE_PAGE && block
&& buf_flush_ready_for_flush(block, flush_type)) {
&& buf_flush_ready_for_flush(block, flush_type)) {
block->io_fix = BUF_IO_WRITE;
@ -680,9 +701,10 @@ buf_flush_try_page(
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
fprintf(stderr,
"Flushing single page space %lu, page no %lu \n",
(ulong) block->space,
(ulong) block->offset);
"Flushing single page space %lu,"
" page no %lu \n",
(ulong) block->space,
(ulong) block->offset);
}
#endif /* UNIV_DEBUG */
@ -739,7 +761,7 @@ buf_flush_try_neighbors(
ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
if (block && flush_type == BUF_FLUSH_LRU && i != offset
&& !block->old) {
&& !block->old) {
/* We avoid flushing 'non-old' blocks in an LRU flush,
because the flushed blocks are soon freed */
@ -748,7 +770,7 @@ buf_flush_try_neighbors(
}
if (block && buf_flush_ready_for_flush(block, flush_type)
&& (i == offset || block->buf_fix_count == 0)) {
&& (i == offset || block->buf_fix_count == 0)) {
/* We only try to flush those neighbors != offset
where the buf fix count is zero, as we then know that
we probably can latch the page without a semaphore
@ -806,13 +828,13 @@ buf_flush_batch(
ibool found;
ut_ad((flush_type == BUF_FLUSH_LRU)
|| (flush_type == BUF_FLUSH_LIST));
|| (flush_type == BUF_FLUSH_LIST));
ut_ad((flush_type != BUF_FLUSH_LIST)
|| sync_thread_levels_empty_gen(TRUE));
|| sync_thread_levels_empty_gen(TRUE));
mutex_enter(&(buf_pool->mutex));
if ((buf_pool->n_flush[flush_type] > 0)
|| (buf_pool->init_flush[flush_type] == TRUE)) {
|| (buf_pool->init_flush[flush_type] == TRUE)) {
/* There is already a flush batch of the same type running */
@ -840,8 +862,8 @@ buf_flush_batch(
block = UT_LIST_GET_LAST(buf_pool->flush_list);
if (!block
|| (ut_dulint_cmp(block->oldest_modification,
lsn_limit) >= 0)) {
|| (ut_dulint_cmp(block->oldest_modification,
lsn_limit) >= 0)) {
/* We have flushed enough */
break;
@ -900,7 +922,7 @@ buf_flush_batch(
(buf_pool->init_flush)[flush_type] = FALSE;
if ((buf_pool->n_flush[flush_type] == 0)
&& (buf_pool->init_flush[flush_type] == FALSE)) {
&& (buf_pool->init_flush[flush_type] == FALSE)) {
/* The running flush batch has ended */
@ -914,7 +936,7 @@ buf_flush_batch(
#ifdef UNIV_DEBUG
if (buf_debug_prints && page_count > 0) {
ut_a(flush_type == BUF_FLUSH_LRU
|| flush_type == BUF_FLUSH_LIST);
|| flush_type == BUF_FLUSH_LIST);
fprintf(stderr, flush_type == BUF_FLUSH_LRU
? "Flushed %lu pages in LRU flush\n"
: "Flushed %lu pages in flush list flush\n",
@ -923,7 +945,7 @@ buf_flush_batch(
#endif /* UNIV_DEBUG */
if (page_count != ULINT_UNDEFINED)
srv_buf_pool_flushed+= page_count;
srv_buf_pool_flushed+= page_count;
return(page_count);
}
@ -963,9 +985,9 @@ buf_flush_LRU_recommendation(void)
block = UT_LIST_GET_LAST(buf_pool->LRU);
while ((block != NULL)
&& (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN
+ BUF_FLUSH_EXTRA_MARGIN)
&& (distance < BUF_LRU_FREE_SEARCH_LEN)) {
&& (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN
+ BUF_FLUSH_EXTRA_MARGIN)
&& (distance < BUF_LRU_FREE_SEARCH_LEN)) {
if (buf_flush_ready_for_replace(block)) {
n_replaceable++;
@ -984,7 +1006,7 @@ buf_flush_LRU_recommendation(void)
}
return(BUF_FLUSH_FREE_BLOCK_MARGIN + BUF_FLUSH_EXTRA_MARGIN
- n_replaceable);
- n_replaceable);
}
/*************************************************************************
@ -1005,7 +1027,7 @@ buf_flush_free_margin(void)
if (n_to_flush > 0) {
n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush,
ut_dulint_zero);
ut_dulint_zero);
if (n_flushed == ULINT_UNDEFINED) {
/* There was an LRU type flush batch already running;
let us wait for it to end */
@ -1039,7 +1061,7 @@ buf_flush_validate_low(void)
if (block) {
ut_a(ut_dulint_cmp(om, block->oldest_modification)
>= 0);
>= 0);
}
}

View file

@ -89,7 +89,7 @@ scan_again:
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (block->space == id
&& (block->buf_fix_count > 0 || block->io_fix != 0)) {
&& (block->buf_fix_count > 0 || block->io_fix != 0)) {
/* We cannot remove this page during this scan yet;
maybe the system is currently reading it in, or
@ -104,9 +104,9 @@ scan_again:
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
printf(
"Dropping space %lu page %lu\n",
(ulong) block->space,
(ulong) block->offset);
"Dropping space %lu page %lu\n",
(ulong) block->space,
(ulong) block->offset);
}
#endif
if (block->is_hashed) {
@ -118,19 +118,19 @@ scan_again:
an S-latch on the page */
btr_search_drop_page_hash_when_freed(id,
page_no);
page_no);
goto scan_again;
}
if (0 != ut_dulint_cmp(block->oldest_modification,
ut_dulint_zero)) {
ut_dulint_zero)) {
/* Remove from the flush list of modified
blocks */
block->oldest_modification = ut_dulint_zero;
UT_LIST_REMOVE(flush_list,
buf_pool->flush_list, block);
buf_pool->flush_list, block);
}
/* Remove from the LRU list */
@ -216,7 +216,8 @@ buf_LRU_search_and_free_block(
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
fprintf(stderr,
"Putting space %lu page %lu to free list\n",
"Putting space %lu page %lu"
" to free list\n",
(ulong) block->space,
(ulong) block->offset);
}
@ -246,8 +247,8 @@ buf_LRU_search_and_free_block(
distance++;
if (!freed && n_iterations <= 10
&& distance > 100 + (n_iterations * buf_pool->curr_size)
/ 10) {
&& distance > 100 + (n_iterations * buf_pool->curr_size)
/ 10) {
buf_pool->LRU_flush_ended = 0;
mutex_exit(&(buf_pool->mutex));
@ -309,7 +310,7 @@ buf_LRU_buf_pool_running_out(void)
mutex_enter(&(buf_pool->mutex));
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 4) {
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 4) {
ret = TRUE;
}
@ -340,23 +341,28 @@ loop:
mutex_enter(&(buf_pool->mutex));
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 20) {
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 20) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: over 95 percent of the buffer pool is occupied by\n"
"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
"InnoDB: transactions do not set too many row locks.\n"
"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n"
"InnoDB: the buffer pool bigger?\n"
"InnoDB: We intentionally generate a seg fault to print a stack trace\n"
"InnoDB: on Linux!\n",
(ulong)(buf_pool->curr_size / (1024 * 1024 / UNIV_PAGE_SIZE)));
" InnoDB: ERROR: over 95 percent of the buffer pool"
" is occupied by\n"
"InnoDB: lock heaps or the adaptive hash index!"
" Check that your\n"
"InnoDB: transactions do not set too many row locks.\n"
"InnoDB: Your buffer pool size is %lu MB."
" Maybe you should make\n"
"InnoDB: the buffer pool bigger?\n"
"InnoDB: We intentionally generate a seg fault"
" to print a stack trace\n"
"InnoDB: on Linux!\n",
(ulong) (buf_pool->curr_size
/ (1024 * 1024 / UNIV_PAGE_SIZE)));
ut_error;
} else if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 3) {
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 3) {
if (!buf_lru_switched_on_innodb_mon) {
@ -366,14 +372,20 @@ loop:
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: WARNING: over 67 percent of the buffer pool is occupied by\n"
"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
"InnoDB: transactions do not set too many row locks.\n"
"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n"
"InnoDB: the buffer pool bigger?\n"
"InnoDB: Starting the InnoDB Monitor to print diagnostics, including\n"
"InnoDB: lock heap and hash index sizes.\n",
(ulong) (buf_pool->curr_size / (1024 * 1024 / UNIV_PAGE_SIZE)));
" InnoDB: WARNING: over 67 percent of"
" the buffer pool is occupied by\n"
"InnoDB: lock heaps or the adaptive"
" hash index! Check that your\n"
"InnoDB: transactions do not set too many"
" row locks.\n"
"InnoDB: Your buffer pool size is %lu MB."
" Maybe you should make\n"
"InnoDB: the buffer pool bigger?\n"
"InnoDB: Starting the InnoDB Monitor to print"
" diagnostics, including\n"
"InnoDB: lock heap and hash index sizes.\n",
(ulong) (buf_pool->curr_size
/ (1024 * 1024 / UNIV_PAGE_SIZE)));
buf_lru_switched_on_innodb_mon = TRUE;
srv_print_innodb_monitor = TRUE;
@ -405,7 +417,8 @@ loop:
/* Remove from the list of mapped pages */
UT_LIST_REMOVE(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
buf_pool->awe_LRU_free_mapped,
block);
} else {
/* We map the page to a frame; second param
FALSE below because we do not want it to be
@ -440,18 +453,25 @@ loop:
if (n_iterations > 30) {
ut_print_timestamp(stderr);
fprintf(stderr,
"InnoDB: Warning: difficult to find free blocks from\n"
"InnoDB: the buffer pool (%lu search iterations)! Consider\n"
"InnoDB: increasing the buffer pool size.\n"
"InnoDB: It is also possible that in your Unix version\n"
"InnoDB: fsync is very slow, or completely frozen inside\n"
"InnoDB: the OS kernel. Then upgrading to a newer version\n"
"InnoDB: of your operating system may help. Look at the\n"
"InnoDB: number of fsyncs in diagnostic info below.\n"
"InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n"
"InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n"
"InnoDB: Starting InnoDB Monitor to print further\n"
"InnoDB: diagnostics to the standard output.\n",
"InnoDB: Warning: difficult to find free blocks from\n"
"InnoDB: the buffer pool (%lu search iterations)!"
" Consider\n"
"InnoDB: increasing the buffer pool size.\n"
"InnoDB: It is also possible that"
" in your Unix version\n"
"InnoDB: fsync is very slow, or"
" completely frozen inside\n"
"InnoDB: the OS kernel. Then upgrading to"
" a newer version\n"
"InnoDB: of your operating system may help."
" Look at the\n"
"InnoDB: number of fsyncs in diagnostic info below.\n"
"InnoDB: Pending flushes (fsync) log: %lu;"
" buffer pool: %lu\n"
"InnoDB: %lu OS file reads, %lu OS file writes,"
" %lu OS fsyncs\n"
"InnoDB: Starting InnoDB Monitor to print further\n"
"InnoDB: diagnostics to the standard output.\n",
(ulong) n_iterations,
(ulong) fil_n_pending_log_flushes,
(ulong) fil_n_pending_tablespace_flushes,
@ -522,20 +542,20 @@ 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 = 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 = 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
fall out of the LRU list */
fall out of the LRU list */
return;
}
}
@ -613,7 +633,7 @@ buf_LRU_remove_block(
/* Remove from the list of mapped pages */
UT_LIST_REMOVE(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
buf_pool->awe_LRU_free_mapped, block);
}
/* If the LRU list is so short that LRU_old not defined, return */
@ -672,7 +692,7 @@ buf_LRU_add_block_to_end_low(
/* Add to the list of mapped pages */
UT_LIST_ADD_LAST(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
buf_pool->awe_LRU_free_mapped, block);
}
if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
@ -729,7 +749,7 @@ buf_LRU_add_block_low(
TRUE */
UT_LIST_ADD_FIRST(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
buf_pool->awe_LRU_free_mapped, block);
}
if (!old || (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN)) {
@ -740,7 +760,7 @@ buf_LRU_add_block_low(
block->freed_page_clock = buf_pool->freed_page_clock;
} else {
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, buf_pool->LRU_old,
block);
block);
buf_pool->LRU_old_len++;
/* We copy the LRU position field of the previous block
@ -822,7 +842,7 @@ buf_LRU_block_free_non_file_page(
ut_ad(block);
ut_a((block->state == BUF_BLOCK_MEMORY)
|| (block->state == BUF_BLOCK_READY_FOR_USE));
|| (block->state == BUF_BLOCK_READY_FOR_USE));
ut_a(block->n_pointers == 0);
ut_a(!block->in_free_list);
@ -840,7 +860,7 @@ buf_LRU_block_free_non_file_page(
/* Add to the list of mapped pages */
UT_LIST_ADD_FIRST(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, block);
buf_pool->awe_LRU_free_mapped, block);
}
}
@ -875,16 +895,21 @@ buf_LRU_block_remove_hashed_page(
if (block != buf_page_hash_get(block->space, block->offset)) {
fprintf(stderr,
"InnoDB: Error: page %lu %lu not found from the hash table\n",
"InnoDB: Error: page %lu %lu not found"
" in the hash table\n",
(ulong) block->space,
(ulong) block->offset);
if (buf_page_hash_get(block->space, block->offset)) {
fprintf(stderr,
"InnoDB: From 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*) block);
"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*) block);
}
#ifdef UNIV_DEBUG
@ -897,8 +922,8 @@ buf_LRU_block_remove_hashed_page(
}
HASH_DELETE(buf_block_t, hash, buf_pool->page_hash,
buf_page_address_fold(block->space, block->offset),
block);
buf_page_address_fold(block->space, block->offset),
block);
block->state = BUF_BLOCK_REMOVE_HASH;
}
@ -1009,7 +1034,8 @@ buf_LRU_print(void)
ut_ad(buf_pool);
mutex_enter(&(buf_pool->mutex));
fprintf(stderr, "Pool ulint clock %lu\n", (ulong) buf_pool->ulint_clock);
fprintf(stderr, "Pool ulint clock %lu\n",
(ulong) buf_pool->ulint_clock);
block = UT_LIST_GET_FIRST(buf_pool->LRU);
@ -1033,7 +1059,7 @@ buf_LRU_print(void)
}
if (ut_dulint_cmp(block->oldest_modification,
ut_dulint_zero) > 0) {
ut_dulint_zero) > 0) {
fputs("modif. ", stderr);
}
@ -1042,7 +1068,8 @@ buf_LRU_print(void)
fprintf(stderr, "LRU pos %lu type %lu index id %lu ",
(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);
if (++len == 10) {

View file

@ -81,15 +81,16 @@ buf_read_page_low(
mode = mode & ~OS_AIO_SIMULATED_WAKE_LATER;
if (trx_doublewrite && space == TRX_SYS_SPACE
&& ( (offset >= trx_doublewrite->block1
&& offset < trx_doublewrite->block1
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
|| (offset >= trx_doublewrite->block2
&& offset < trx_doublewrite->block2
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) {
&& ( (offset >= trx_doublewrite->block1
&& offset < trx_doublewrite->block1
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
|| (offset >= trx_doublewrite->block2
&& offset < trx_doublewrite->block2
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: trying to read doublewrite buffer page %lu\n",
" InnoDB: Warning: trying to read"
" doublewrite buffer page %lu\n",
(ulong) offset);
return(0);
@ -111,7 +112,7 @@ buf_read_page_low(
pool for read, then DISCARD cannot proceed until the read has
completed */
block = buf_page_init_for_read(err, mode, space, tablespace_version,
offset);
offset);
if (block == NULL) {
return(0);
@ -121,17 +122,17 @@ buf_read_page_low(
if (buf_debug_prints) {
fprintf(stderr,
"Posting read request for page %lu, sync %lu\n",
(ulong) offset,
(ulong) sync);
(ulong) offset,
(ulong) sync);
}
#endif
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
*err = fil_io(OS_FILE_READ | wake_later,
sync, space,
offset, 0, UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block);
sync, space,
offset, 0, UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block);
ut_a(*err == DB_SUCCESS);
if (sync) {
@ -196,9 +197,9 @@ buf_read_ahead_random(
tablespace_version = fil_space_get_version(space);
low = (offset / BUF_READ_AHEAD_RANDOM_AREA)
* BUF_READ_AHEAD_RANDOM_AREA;
* BUF_READ_AHEAD_RANDOM_AREA;
high = (offset / BUF_READ_AHEAD_RANDOM_AREA + 1)
* BUF_READ_AHEAD_RANDOM_AREA;
* BUF_READ_AHEAD_RANDOM_AREA;
if (high > fil_space_get_size(space)) {
high = fil_space_get_size(space);
@ -213,7 +214,7 @@ buf_read_ahead_random(
mutex_enter(&(buf_pool->mutex));
if (buf_pool->n_pend_reads >
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
mutex_exit(&(buf_pool->mutex));
return(0);
@ -226,8 +227,8 @@ buf_read_ahead_random(
block = buf_page_hash_get(space, i);
if ((block)
&& (block->LRU_position > LRU_recent_limit)
&& block->accessed) {
&& (block->LRU_position > LRU_recent_limit)
&& block->accessed) {
recent_blocks++;
}
@ -256,15 +257,18 @@ buf_read_ahead_random(
mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(i)) {
count += buf_read_page_low(&err, FALSE, ibuf_mode
| OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, i);
count += buf_read_page_low
(&err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: in random readahead trying to access tablespace\n"
"InnoDB: %lu page no. %lu,\n"
"InnoDB: but the tablespace does not exist or is just being dropped.\n",
" InnoDB: Warning: in random"
" readahead trying to access\n"
"InnoDB: tablespace %lu page %lu,\n"
"InnoDB: but the tablespace does not"
" exist or is just being dropped.\n",
(ulong) space, (ulong) i);
}
}
@ -280,8 +284,8 @@ buf_read_ahead_random(
if (buf_debug_prints && (count > 0)) {
fprintf(stderr,
"Random read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset,
(ulong) count);
(ulong) space, (ulong) offset,
(ulong) count);
}
#endif /* UNIV_DEBUG */
@ -317,14 +321,16 @@ buf_read_page(
switches: hence TRUE */
count2 = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
tablespace_version, offset);
tablespace_version, offset);
srv_buf_pool_reads+= count2;
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: trying to access tablespace %lu page no. %lu,\n"
"InnoDB: but the tablespace does not exist or is just being dropped.\n",
(ulong) space, (ulong) offset);
" InnoDB: Error: trying to access"
" tablespace %lu page no. %lu,\n"
"InnoDB: but the tablespace does not exist"
" or is just being dropped.\n",
(ulong) space, (ulong) offset);
}
/* Flush pages from the end of the LRU list if necessary */
@ -395,9 +401,9 @@ buf_read_ahead_linear(
}
low = (offset / BUF_READ_AHEAD_LINEAR_AREA)
* BUF_READ_AHEAD_LINEAR_AREA;
* BUF_READ_AHEAD_LINEAR_AREA;
high = (offset / BUF_READ_AHEAD_LINEAR_AREA + 1)
* BUF_READ_AHEAD_LINEAR_AREA;
* BUF_READ_AHEAD_LINEAR_AREA;
if ((offset != low) && (offset != high - 1)) {
/* This is not a border page of the area: return */
@ -421,7 +427,7 @@ buf_read_ahead_linear(
}
if (buf_pool->n_pend_reads >
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
mutex_exit(&(buf_pool->mutex));
return(0);
@ -447,9 +453,9 @@ buf_read_ahead_linear(
fail_count++;
} else if (pred_block
&& (ut_ulint_cmp(block->LRU_position,
pred_block->LRU_position)
!= asc_or_desc)) {
&& (ut_ulint_cmp(block->LRU_position,
pred_block->LRU_position)
!= asc_or_desc)) {
/* Accesses not in the right order */
fail_count++;
@ -458,7 +464,7 @@ buf_read_ahead_linear(
}
if (fail_count > BUF_READ_AHEAD_LINEAR_AREA -
BUF_READ_AHEAD_LINEAR_THRESHOLD) {
BUF_READ_AHEAD_LINEAR_THRESHOLD) {
/* Too many failures: return */
mutex_exit(&(buf_pool->mutex));
@ -506,9 +512,9 @@ buf_read_ahead_linear(
}
low = (new_offset / BUF_READ_AHEAD_LINEAR_AREA)
* BUF_READ_AHEAD_LINEAR_AREA;
* BUF_READ_AHEAD_LINEAR_AREA;
high = (new_offset / BUF_READ_AHEAD_LINEAR_AREA + 1)
* BUF_READ_AHEAD_LINEAR_AREA;
* BUF_READ_AHEAD_LINEAR_AREA;
if ((new_offset != low) && (new_offset != high - 1)) {
/* This is not a border page of the area: return */
@ -543,16 +549,19 @@ buf_read_ahead_linear(
aio mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(i)) {
count += buf_read_page_low(&err, FALSE, ibuf_mode
| OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, i);
count += buf_read_page_low
(&err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: in linear readahead trying to access tablespace\n"
"InnoDB: %lu page no. %lu,\n"
"InnoDB: but the tablespace does not exist or is just being dropped.\n",
(ulong) space, (ulong) i);
" InnoDB: Warning: in"
" linear readahead trying to access\n"
"InnoDB: tablespace %lu page %lu,\n"
"InnoDB: but the tablespace does not"
" exist or is just being dropped.\n",
(ulong) space, (ulong) i);
}
}
}
@ -569,8 +578,8 @@ buf_read_ahead_linear(
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) {
fprintf(stderr,
"LINEAR read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset, (ulong) count);
"LINEAR read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset, (ulong) count);
}
#endif /* UNIV_DEBUG */
@ -607,25 +616,23 @@ buf_read_ibuf_merge_pages(
ut_a(n_stored < UNIV_PAGE_SIZE);
#endif
while (buf_pool->n_pend_reads >
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
os_thread_sleep(500000);
}
for (i = 0; i < n_stored; i++) {
if ((i + 1 == n_stored) && sync) {
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE,
space_ids[i], space_versions[i], page_nos[i]);
} else {
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE,
space_ids[i], space_versions[i], page_nos[i]);
}
buf_read_page_low(&err,
(i + 1 == n_stored) && sync,
BUF_READ_ANY_PAGE,
space_ids[i], space_versions[i],
page_nos[i]);
if (err == DB_TABLESPACE_DELETED) {
/* We have deleted or are deleting the single-table
tablespace: remove the entries for that page */
ibuf_merge_or_delete_for_page(NULL, space_ids[i],
page_nos[i], FALSE);
page_nos[i], FALSE);
}
}
@ -638,7 +645,7 @@ buf_read_ibuf_merge_pages(
if (buf_debug_prints) {
fprintf(stderr,
"Ibuf merge read-ahead space %lu pages %lu\n",
(ulong) space_ids[0], (ulong) n_stored);
(ulong) space_ids[0], (ulong) n_stored);
}
#endif /* UNIV_DEBUG */
}
@ -679,11 +686,14 @@ buf_read_recv_pages(
if (count > 100) {
fprintf(stderr,
"InnoDB: Error: InnoDB has waited for 50 seconds for pending\n"
"InnoDB: reads to the buffer pool to be finished.\n"
"InnoDB: Number of pending reads %lu, pending pread calls %lu\n",
(ulong) buf_pool->n_pend_reads,
(ulong)os_file_n_pending_preads);
"InnoDB: Error: InnoDB has waited for"
" 50 seconds for pending\n"
"InnoDB: reads to the buffer pool to"
" be finished.\n"
"InnoDB: Number of pending reads %lu,"
" pending pread calls %lu\n",
(ulong) buf_pool->n_pend_reads,
(ulong)os_file_n_pending_preads);
os_aio_print_debug = TRUE;
}
@ -692,12 +702,14 @@ buf_read_recv_pages(
os_aio_print_debug = FALSE;
if ((i + 1 == n_stored) && sync) {
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
tablespace_version, page_nos[i]);
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE,
space, tablespace_version,
page_nos[i]);
} else {
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE
| OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, page_nos[i]);
| OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version,
page_nos[i]);
}
}
@ -709,7 +721,8 @@ buf_read_recv_pages(
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
fprintf(stderr,
"Recovery applies read-ahead pages %lu\n", (ulong) n_stored);
"Recovery applies read-ahead pages %lu\n",
(ulong) n_stored);
}
#endif /* UNIV_DEBUG */
}

View file

@ -189,10 +189,10 @@ dfield_check_typed_no_assert(
dfield_t* field) /* in: data field */
{
if (dfield_get_type(field)->mtype > DATA_MYSQL
|| dfield_get_type(field)->mtype < DATA_VARCHAR) {
|| dfield_get_type(field)->mtype < DATA_VARCHAR) {
fprintf(stderr,
"InnoDB: Error: data field type %lu, len %lu\n",
"InnoDB: Error: data field type %lu, len %lu\n",
(ulong) dfield_get_type(field)->mtype,
(ulong) dfield_get_len(field));
return(FALSE);
@ -215,9 +215,9 @@ dtuple_check_typed_no_assert(
if (dtuple_get_n_fields(tuple) > REC_MAX_N_FIELDS) {
fprintf(stderr,
"InnoDB: Error: index entry has %lu fields\n",
"InnoDB: Error: index entry has %lu fields\n",
(ulong) dtuple_get_n_fields(tuple));
dump:
dump:
fputs("InnoDB: Tuple contents: ", stderr);
dtuple_print(stderr, tuple);
putc('\n', stderr);
@ -247,10 +247,10 @@ dfield_check_typed(
dfield_t* field) /* in: data field */
{
if (dfield_get_type(field)->mtype > DATA_MYSQL
|| dfield_get_type(field)->mtype < DATA_VARCHAR) {
|| dfield_get_type(field)->mtype < DATA_VARCHAR) {
fprintf(stderr,
"InnoDB: Error: data field type %lu, len %lu\n",
"InnoDB: Error: data field type %lu, len %lu\n",
(ulong) dfield_get_type(field)->mtype,
(ulong) dfield_get_len(field));
@ -319,8 +319,8 @@ dtuple_validate(
for (j = 0; j < len; j++) {
data_dummy += *data; /* fool the compiler not
to optimize out this
code */
to optimize out this
code */
data++;
}
}
@ -518,14 +518,15 @@ dtuple_convert_big_rec(
if (UNIV_UNLIKELY(size > 1000000000)) {
fprintf(stderr,
"InnoDB: Warning: tuple size very big: %lu\n", (ulong) size);
"InnoDB: Warning: tuple size very big: %lu\n",
(ulong) size);
fputs("InnoDB: Tuple contents: ", stderr);
dtuple_print(stderr, entry);
putc('\n', stderr);
}
heap = mem_heap_create(size + dtuple_get_n_fields(entry)
* sizeof(big_rec_field_t) + 1000);
* sizeof(big_rec_field_t) + 1000);
vector = mem_heap_alloc(heap, sizeof(big_rec_t));
@ -539,13 +540,13 @@ dtuple_convert_big_rec(
n_fields = 0;
while (rec_get_converted_size(index, entry)
>= ut_min(page_get_free_space_of_empty(
dict_table_is_comp(index->table)) / 2,
REC_MAX_DATA_SIZE)) {
>= ut_min(page_get_free_space_of_empty
(dict_table_is_comp(index->table)) / 2,
REC_MAX_DATA_SIZE)) {
longest = 0;
for (i = dict_index_get_n_unique_in_tree(index);
i < dtuple_get_n_fields(entry); i++) {
i < dtuple_get_n_fields(entry); i++) {
/* Skip over fields which already are externally
stored */
@ -565,7 +566,7 @@ dtuple_convert_big_rec(
dfield = dtuple_get_nth_field(entry, i);
if (dfield->len != UNIV_SQL_NULL &&
dfield->len > longest) {
dfield->len > longest) {
longest = dfield->len;
@ -582,7 +583,7 @@ dtuple_convert_big_rec(
#endif
if (longest < BTR_EXTERN_FIELD_REF_SIZE + 10
+ DICT_MAX_INDEX_COL_LEN) {
+ DICT_MAX_INDEX_COL_LEN) {
/* Cannot shorten more */
mem_heap_free(heap);
@ -607,24 +608,24 @@ dtuple_convert_big_rec(
ut_a(dfield->len > DICT_MAX_INDEX_COL_LEN);
vector->fields[n_fields].len = dfield->len
- DICT_MAX_INDEX_COL_LEN;
- DICT_MAX_INDEX_COL_LEN;
vector->fields[n_fields].data = mem_heap_alloc(heap,
vector->fields[n_fields].len);
vector->fields[n_fields].data = mem_heap_alloc
(heap, vector->fields[n_fields].len);
/* Copy data (from the end of field) to big rec vector */
ut_memcpy(vector->fields[n_fields].data,
((byte*)dfield->data) + dfield->len
- vector->fields[n_fields].len,
vector->fields[n_fields].len);
((byte*)dfield->data) + dfield->len
- vector->fields[n_fields].len,
vector->fields[n_fields].len);
dfield->len = dfield->len - vector->fields[n_fields].len
+ BTR_EXTERN_FIELD_REF_SIZE;
+ BTR_EXTERN_FIELD_REF_SIZE;
/* Set the extern field reference in dfield to zero */
memset(((byte*)dfield->data)
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
0, BTR_EXTERN_FIELD_REF_SIZE);
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
0, BTR_EXTERN_FIELD_REF_SIZE);
n_fields++;
}
@ -651,15 +652,15 @@ dtuple_convert_back_big_rec(
for (i = 0; i < vector->n_fields; i++) {
dfield = dtuple_get_nth_field(entry,
vector->fields[i].field_no);
vector->fields[i].field_no);
/* Copy data from big rec vector */
ut_memcpy(((byte*)dfield->data)
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
vector->fields[i].data,
vector->fields[i].len);
dfield->len = dfield->len + vector->fields[i].len
- BTR_EXTERN_FIELD_REF_SIZE;
- BTR_EXTERN_FIELD_REF_SIZE;
}
mem_heap_free(vector->heap);

View file

@ -67,9 +67,9 @@ dtype_get_at_most_n_mbchars(
if (dtype->mbminlen != dtype->mbmaxlen) {
ut_a(!(prefix_len % dtype->mbmaxlen));
return(innobase_get_at_most_n_mbchars(
dtype_get_charset_coll(dtype->prtype),
prefix_len, data_len, str));
return(innobase_get_at_most_n_mbchars
(dtype_get_charset_coll(dtype->prtype),
prefix_len, data_len, str));
}
if (prefix_len < data_len) {
@ -98,8 +98,8 @@ dtype_is_string_type(
ulint mtype) /* in: InnoDB main data type code: DATA_CHAR, ... */
{
if (mtype <= DATA_BLOB
|| mtype == DATA_MYSQL
|| mtype == DATA_VARMYSQL) {
|| mtype == DATA_MYSQL
|| mtype == DATA_VARMYSQL) {
return(TRUE);
}
@ -120,8 +120,8 @@ dtype_is_binary_string_type(
ulint prtype) /* in: precise type */
{
if ((mtype == DATA_FIXBINARY)
|| (mtype == DATA_BINARY)
|| (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE))) {
|| (mtype == DATA_BINARY)
|| (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE))) {
return(TRUE);
}
@ -143,7 +143,7 @@ dtype_is_non_binary_string_type(
ulint prtype) /* in: precise type */
{
if (dtype_is_string_type(mtype) == TRUE
&& dtype_is_binary_string_type(mtype, prtype) == FALSE) {
&& dtype_is_binary_string_type(mtype, prtype) == FALSE) {
return(TRUE);
}
@ -258,9 +258,9 @@ dtype_print(
len = type->len;
if ((type->mtype == DATA_SYS)
|| (type->mtype == DATA_VARCHAR)
|| (type->mtype == DATA_CHAR)) {
putc(' ', stderr);
|| (type->mtype == DATA_VARCHAR)
|| (type->mtype == DATA_CHAR)) {
putc(' ', stderr);
if (prtype == DATA_ROW_ID) {
fputs("DATA_ROW_ID", stderr);
len = DATA_ROW_ID_LEN;
@ -317,9 +317,9 @@ dtype_get_max_size(
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
return(type->len);
return(type->len);
case DATA_BLOB:
return(ULINT_MAX);
return(ULINT_MAX);
default:
ut_error;
}

View file

@ -38,7 +38,7 @@ dict_hdr_get(
ut_ad(mtr);
header = DICT_HDR + buf_page_get(DICT_HDR_SPACE, DICT_HDR_PAGE_NO,
RW_X_LATCH, mtr);
RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(header, SYNC_DICT_HEADER);
#endif /* UNIV_SYNC_DEBUG */
@ -59,7 +59,7 @@ dict_hdr_get_new_id(
mtr_t mtr;
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID)
|| (type == DICT_HDR_MIX_ID));
|| (type == DICT_HDR_MIX_ID));
mtr_start(&mtr);
@ -122,7 +122,7 @@ dict_hdr_create(
/* Create the dictionary header file block in a new, allocated file
segment in the system tablespace */
page = fseg_create(DICT_HDR_SPACE, 0,
DICT_HDR + DICT_HDR_FSEG_HEADER, mtr);
DICT_HDR + DICT_HDR_FSEG_HEADER, mtr);
hdr_page_no = buf_frame_get_page_no(page);
@ -133,70 +133,70 @@ dict_hdr_create(
/* Start counting row, table, index, and tree ids from
DICT_HDR_FIRST_ID */
mlog_write_dulint(dict_header + DICT_HDR_ROW_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
mlog_write_dulint(dict_header + DICT_HDR_TABLE_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
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);
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);
/* Create the B-tree roots for the clustered indexes of the basic
system tables */
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_TABLES_ID, FALSE, mtr);
DICT_HDR_SPACE, DICT_TABLES_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
}
mlog_write_ulint(dict_header + DICT_HDR_TABLES, root_page_no,
MLOG_4BYTES, mtr);
MLOG_4BYTES, mtr);
/*--------------------------*/
root_page_no = btr_create(DICT_UNIQUE, DICT_HDR_SPACE,
DICT_TABLE_IDS_ID, FALSE, mtr);
DICT_TABLE_IDS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
}
mlog_write_ulint(dict_header + DICT_HDR_TABLE_IDS, root_page_no,
MLOG_4BYTES, mtr);
MLOG_4BYTES, mtr);
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_COLUMNS_ID, FALSE, mtr);
DICT_HDR_SPACE, DICT_COLUMNS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
}
mlog_write_ulint(dict_header + DICT_HDR_COLUMNS, root_page_no,
MLOG_4BYTES, mtr);
MLOG_4BYTES, mtr);
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_INDEXES_ID, FALSE, mtr);
DICT_HDR_SPACE, DICT_INDEXES_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
}
mlog_write_ulint(dict_header + DICT_HDR_INDEXES, root_page_no,
MLOG_4BYTES, mtr);
MLOG_4BYTES, mtr);
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_FIELDS_ID, FALSE, mtr);
DICT_HDR_SPACE, DICT_FIELDS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
}
mlog_write_ulint(dict_header + DICT_HDR_FIELDS, root_page_no,
MLOG_4BYTES, mtr);
MLOG_4BYTES, mtr);
/*--------------------------*/
return(TRUE);
@ -236,11 +236,11 @@ 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 */
@ -262,23 +262,27 @@ dict_boot(void)
dict_sys->sys_tables = table;
index = dict_mem_index_create("SYS_TABLES", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 1);
DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 1);
dict_mem_index_add_field(index, "NAME", 0);
index->id = DICT_TABLES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint(
dict_hdr + DICT_HDR_TABLES, MLOG_4BYTES, &mtr));
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_TABLES,
MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
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);
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));
success = dict_index_add_to_cache(table, index,
mtr_read_ulint
(dict_hdr + DICT_HDR_TABLE_IDS,
MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0);
@ -297,14 +301,16 @@ dict_boot(void)
dict_sys->sys_columns = table;
index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "TABLE_ID", 0);
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));
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0);
@ -333,14 +339,16 @@ dict_boot(void)
dict_sys->sys_indexes = table;
index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "TABLE_ID", 0);
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));
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0);
@ -354,14 +362,16 @@ dict_boot(void)
dict_sys->sys_fields = table;
index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "INDEX_ID", 0);
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));
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr));
ut_a(success);
mtr_commit(&mtr);

View file

@ -69,7 +69,7 @@ dict_create_sys_tables_tuple(
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, table->n_def
| ((table->flags & DICT_TF_COMPACT) << 31));
| ((table->flags & DICT_TF_COMPACT) << 31));
dfield_set_data(dfield, ptr, 4);
/* 5: TYPE -----------------------------*/
dfield = dtuple_get_nth_field(entry, 3);
@ -222,8 +222,8 @@ 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 += dtype_get_min_size(dict_col_get_type
(&table->cols[i]));
}
if (row_len > BTR_PAGE_MAX_REC_SIZE) {
return(DB_TOO_BIG_RECORD);
@ -236,7 +236,7 @@ dict_build_table_def_step(
- page 1 is an ibuf bitmap page,
- page 2 is the first inode page,
- 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 */
@ -251,9 +251,9 @@ dict_build_table_def_step(
is_path = FALSE;
}
error = fil_create_new_single_table_tablespace(
&(table->space), path_or_name, is_path,
FIL_IBD_FILE_INITIAL_SIZE);
error = fil_create_new_single_table_tablespace
(&table->space, path_or_name, is_path,
FIL_IBD_FILE_INITIAL_SIZE);
if (error != DB_SUCCESS) {
return(error);
@ -285,7 +285,7 @@ dict_build_col_def_step(
dtuple_t* row;
row = dict_create_sys_columns_tuple(node->table, node->col_no,
node->heap);
node->heap);
ins_node_set_new_row(node->col_def, row);
return(DB_SUCCESS);
@ -450,7 +450,7 @@ dict_create_sys_fields_tuple(
dfield = dtuple_get_nth_field(entry, 2);
dfield_set_data(dfield, field->name,
ut_strlen(field->name));
ut_strlen(field->name));
/*---------------------------------*/
dict_table_copy_types(entry, sys_fields);
@ -528,7 +528,7 @@ dict_build_index_def_step(
node->table = table;
ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
|| (index->type & DICT_CLUSTERED));
|| (index->type & DICT_CLUSTERED));
index->id = dict_hdr_get_new_id(DICT_HDR_INDEX_ID);
@ -600,19 +600,19 @@ dict_create_index_tree_step(
search_tuple = dict_create_search_tuple(node->ind_row, node->heap);
btr_pcur_open(UT_LIST_GET_FIRST(sys_indexes->indexes),
search_tuple, PAGE_CUR_L, BTR_MODIFY_LEAF,
&pcur, &mtr);
search_tuple, PAGE_CUR_L, BTR_MODIFY_LEAF,
&pcur, &mtr);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
node->page_no = btr_create(index->type, index->space, index->id,
dict_table_is_comp(table), &mtr);
dict_table_is_comp(table), &mtr);
/* printf("Created a new index tree in space %lu root page %lu\n",
index->space, index->page_no); */
index->space, index->page_no); */
page_rec_write_index_page_no(btr_pcur_get_rec(&pcur),
DICT_SYS_INDEXES_PAGE_NO_FIELD,
node->page_no, &mtr);
DICT_SYS_INDEXES_PAGE_NO_FIELD,
node->page_no, &mtr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@ -657,7 +657,7 @@ dict_drop_index_tree(
}
ptr = rec_get_nth_field_old(rec,
DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
ut_ad(len == 4);
@ -680,11 +680,12 @@ dict_drop_index_tree(
record: this mini-transaction marks the B-tree totally freed */
/* printf("Dropping index tree in space %lu root page %lu\n", space,
root_page_no); */
root_page_no); */
btr_free_root(space, root_page_no, mtr);
page_rec_write_index_page_no(rec,
DICT_SYS_INDEXES_PAGE_NO_FIELD, FIL_NULL, mtr);
DICT_SYS_INDEXES_PAGE_NO_FIELD,
FIL_NULL, mtr);
}
/***********************************************************************
@ -732,7 +733,7 @@ dict_truncate_index_tree(
}
ptr = rec_get_nth_field_old(rec,
DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
ut_ad(len == 4);
@ -749,7 +750,7 @@ dict_truncate_index_tree(
}
ptr = rec_get_nth_field_old(rec,
DICT_SYS_INDEXES_TYPE_FIELD, &len);
DICT_SYS_INDEXES_TYPE_FIELD, &len);
ut_ad(len == 4);
type = mach_read_from_4(ptr);
@ -767,8 +768,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
@ -776,7 +777,7 @@ dict_truncate_index_tree(
inconsistent state in case it crashes between the mtr_commit()
below and the following mtr_commit() call. */
page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
FIL_NULL, mtr);
FIL_NULL, mtr);
/* We will need to commit the mini-transaction in order to avoid
deadlocks in the btr_create() call, because otherwise we would
@ -788,8 +789,8 @@ dict_truncate_index_tree(
/* Find the index corresponding to this SYS_INDEXES record. */
for (index = UT_LIST_GET_FIRST(table->indexes);
index;
index = UT_LIST_GET_NEXT(indexes, index)) {
index;
index = UT_LIST_GET_NEXT(indexes, index)) {
if (!ut_dulint_cmp(index->id, index_id)) {
break;
}
@ -834,11 +835,11 @@ tab_create_graph_create(
node->heap = mem_heap_create(256);
node->tab_def = ins_node_create(INS_DIRECT, dict_sys->sys_tables,
heap);
heap);
node->tab_def->common.parent = node;
node->col_def = ins_node_create(INS_DIRECT, dict_sys->sys_columns,
heap);
heap);
node->col_def->common.parent = node;
node->commit_node = commit_node_create(heap);
@ -871,11 +872,11 @@ ind_create_graph_create(
node->heap = mem_heap_create(256);
node->ind_def = ins_node_create(INS_DIRECT,
dict_sys->sys_indexes, heap);
dict_sys->sys_indexes, heap);
node->ind_def->common.parent = node;
node->field_def = ins_node_create(INS_DIRECT,
dict_sys->sys_fields, heap);
dict_sys->sys_fields, heap);
node->field_def->common.parent = node;
node->commit_node = commit_node_create(heap);
@ -1088,7 +1089,7 @@ dict_create_index_step(
if (node->state == INDEX_ADD_TO_CACHE) {
success = dict_index_add_to_cache(node->table, node->index,
node->page_no);
node->page_no);
ut_a(success);
@ -1136,8 +1137,8 @@ dict_create_or_check_foreign_constraint_tables(void)
table2 = dict_table_get_low("SYS_FOREIGN_COLS");
if (table1 && table2
&& UT_LIST_GET_LEN(table1->indexes) == 3
&& UT_LIST_GET_LEN(table2->indexes) == 1) {
&& UT_LIST_GET_LEN(table1->indexes) == 3
&& UT_LIST_GET_LEN(table2->indexes) == 1) {
/* Foreign constraint system tables have already been
created, and they are ok */
@ -1157,13 +1158,15 @@ dict_create_or_check_foreign_constraint_tables(void)
if (table1) {
fprintf(stderr,
"InnoDB: dropping incompletely created SYS_FOREIGN table\n");
"InnoDB: dropping incompletely created"
" SYS_FOREIGN table\n");
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
}
if (table2) {
fprintf(stderr,
"InnoDB: dropping incompletely created SYS_FOREIGN_COLS table\n");
"InnoDB: dropping incompletely created"
" SYS_FOREIGN_COLS table\n");
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
}
@ -1181,19 +1184,25 @@ dict_create_or_check_foreign_constraint_tables(void)
design. */
error = que_eval_sql(NULL,
"PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
"BEGIN\n"
"CREATE TABLE\n"
"SYS_FOREIGN(ID CHAR, FOR_NAME CHAR, REF_NAME CHAR, N_COLS INT);\n"
"CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN (ID);\n"
"CREATE INDEX FOR_IND ON SYS_FOREIGN (FOR_NAME);\n"
"CREATE INDEX REF_IND ON SYS_FOREIGN (REF_NAME);\n"
"CREATE TABLE\n"
"SYS_FOREIGN_COLS(ID CHAR, POS INT, FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n"
"CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN_COLS (ID, POS);\n"
"COMMIT WORK;\n"
"END;\n"
, FALSE, trx);
"PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
"BEGIN\n"
"CREATE TABLE\n"
"SYS_FOREIGN(ID CHAR, FOR_NAME CHAR,"
" REF_NAME CHAR, N_COLS INT);\n"
"CREATE UNIQUE CLUSTERED INDEX ID_IND"
" ON SYS_FOREIGN (ID);\n"
"CREATE INDEX FOR_IND"
" ON SYS_FOREIGN (FOR_NAME);\n"
"CREATE INDEX REF_IND"
" ON SYS_FOREIGN (REF_NAME);\n"
"CREATE TABLE\n"
"SYS_FOREIGN_COLS(ID CHAR, POS INT,"
" FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n"
"CREATE UNIQUE CLUSTERED INDEX ID_IND"
" ON SYS_FOREIGN_COLS (ID, POS);\n"
"COMMIT WORK;\n"
"END;\n"
, FALSE, trx);
if (error != DB_SUCCESS) {
fprintf(stderr, "InnoDB: error %lu in creation\n",
@ -1201,10 +1210,11 @@ dict_create_or_check_foreign_constraint_tables(void)
ut_a(error == DB_OUT_OF_FILE_SPACE);
fprintf(stderr, "InnoDB: creation failed\n");
fprintf(stderr, "InnoDB: tablespace is full\n");
fprintf(stderr,
"InnoDB: dropping incompletely created SYS_FOREIGN tables\n");
"InnoDB: creation failed\n"
"InnoDB: tablespace is full\n"
"InnoDB: dropping incompletely created"
" SYS_FOREIGN tables\n");
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
@ -1220,7 +1230,8 @@ dict_create_or_check_foreign_constraint_tables(void)
if (error == DB_SUCCESS) {
fprintf(stderr,
"InnoDB: Foreign key constraint system tables created\n");
"InnoDB: Foreign key constraint system tables"
" created\n");
}
return(error);
@ -1249,22 +1260,22 @@ dict_foreign_eval_sql(
rewind(ef);
ut_print_timestamp(ef);
fputs(" Error in foreign key constraint creation for table ",
ef);
ef);
ut_print_name(ef, trx, TRUE, table->name);
fputs(".\nA foreign key constraint of name ", ef);
ut_print_name(ef, trx, FALSE, foreign->id);
fputs("\nalready exists."
" (Note that internally InnoDB adds 'databasename/'\n"
"in front of the user-defined constraint name).\n",
ef);
" (Note that internally InnoDB adds 'databasename/'\n"
"in front of the user-defined constraint name).\n",
ef);
fputs("Note that InnoDB's FOREIGN KEY system tables store\n"
"constraint names as case-insensitive, with the\n"
"MySQL standard latin1_swedish_ci collation. If you\n"
"create tables or databases whose names differ only in\n"
"the character case, then collisions in constraint\n"
"names can occur. Workaround: name your constraints\n"
"explicitly with unique names.\n",
ef);
"constraint names as case-insensitive, with the\n"
"MySQL standard latin1_swedish_ci collation. If you\n"
"create tables or databases whose names differ only in\n"
"the character case, then collisions in constraint\n"
"names can occur. Workaround: name your constraints\n"
"explicitly with unique names.\n",
ef);
mutex_exit(&dict_foreign_err_mutex);
@ -1279,10 +1290,11 @@ dict_foreign_eval_sql(
mutex_enter(&dict_foreign_err_mutex);
ut_print_timestamp(ef);
fputs(" Internal error in foreign key constraint creation"
" for table ", ef);
" for table ", ef);
ut_print_name(ef, trx, TRUE, table->name);
fputs(".\n"
"See the MySQL .err log in the datadir for more information.\n", ef);
"See the MySQL .err log in the datadir"
" for more information.\n", ef);
mutex_exit(&dict_foreign_err_mutex);
return(error);
@ -1311,18 +1323,18 @@ dict_create_add_foreign_field_to_dictionary(
pars_info_add_int4_literal(info, "pos", field_nr);
pars_info_add_str_literal(info, "for_col_name",
foreign->foreign_col_names[field_nr]);
foreign->foreign_col_names[field_nr]);
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(info,
"PROCEDURE P () IS\n"
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);
"END;\n",
table, foreign, trx));
}
/************************************************************************
@ -1362,18 +1374,18 @@ dict_create_add_foreign_to_dictionary(
pars_info_add_str_literal(info, "for_name", table->name);
pars_info_add_str_literal(info, "ref_name",
foreign->referenced_table_name);
foreign->referenced_table_name);
pars_info_add_int4_literal(info, "n_cols",
foreign->n_fields + (foreign->type << 24));
foreign->n_fields + (foreign->type << 24));
error = dict_foreign_eval_sql(info,
"PROCEDURE P () IS\n"
"BEGIN\n"
"INSERT INTO SYS_FOREIGN VALUES"
"(:id, :for_name, :ref_name, :n_cols);\n"
"END;\n"
, table, foreign, trx);
"PROCEDURE P () IS\n"
"BEGIN\n"
"INSERT INTO SYS_FOREIGN VALUES"
"(:id, :for_name, :ref_name, :n_cols);\n"
"END;\n"
, table, foreign, trx);
if (error != DB_SUCCESS) {
@ -1381,8 +1393,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) {
@ -1391,11 +1403,11 @@ dict_create_add_foreign_to_dictionary(
}
error = dict_foreign_eval_sql(NULL,
"PROCEDURE P () IS\n"
"BEGIN\n"
"COMMIT WORK;\n"
"END;\n"
, table, foreign, trx);
"PROCEDURE P () IS\n"
"BEGIN\n"
"COMMIT WORK;\n"
"END;\n"
, table, foreign, trx);
return(error);
}
@ -1428,7 +1440,8 @@ dict_create_add_foreigns_to_dictionary(
if (NULL == dict_table_get_low("SYS_FOREIGN")) {
fprintf(stderr,
"InnoDB: table SYS_FOREIGN not found from internal data dictionary\n");
"InnoDB: table SYS_FOREIGN not found"
" in internal data dictionary\n");
return(DB_ERROR);
}
@ -1437,8 +1450,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) {

File diff suppressed because it is too large Load diff

View file

@ -67,7 +67,7 @@ dict_get_first_table_name_in_db(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
BTR_SEARCH_LEAF, &pcur, &mtr);
loop:
rec = btr_pcur_get_rec(&pcur);
@ -84,7 +84,7 @@ loop:
field = rec_get_nth_field_old(rec, 0, &len);
if (len < strlen(name)
|| ut_memcmp(name, field, strlen(name)) != 0) {
|| ut_memcmp(name, field, strlen(name)) != 0) {
/* Not found */
btr_pcur_close(&pcur);
@ -144,7 +144,7 @@ dict_print(void)
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
TRUE, &mtr);
TRUE, &mtr);
loop:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
@ -238,7 +238,7 @@ dict_check_tablespaces_and_store_max_id(
ut_a(!dict_table_is_comp(sys_tables));
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
TRUE, &mtr);
TRUE, &mtr);
loop:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
@ -254,7 +254,7 @@ loop:
known space id */
/* printf("Biggest space id in data dictionary %lu\n",
max_space_id); */
max_space_id); */
fil_set_max_space_id_if_bigger(max_space_id);
mutex_exit(&(dict_sys->mutex));
@ -284,7 +284,7 @@ loop:
exists; print a warning to the .err log if not */
fil_space_for_table_exists_in_mem(space_id, name,
FALSE, TRUE, TRUE);
FALSE, TRUE, TRUE);
}
if (space_id != 0 && !in_crash_recovery) {
@ -292,7 +292,7 @@ loop:
object and check that the .ibd file exists. */
fil_open_single_table_tablespace(FALSE, space_id,
name);
name);
}
mem_free(name);
@ -355,7 +355,7 @@ dict_load_columns(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < table->n_cols - DATA_N_SYS_COLS; i++) {
rec = btr_pcur_get_rec(&pcur);
@ -372,9 +372,8 @@ dict_load_columns(
ut_ad(len == 4);
ut_a(i == mach_read_from_4(field));
ut_a(0 == ut_strcmp("NAME",
dict_field_get_col(
dict_index_get_nth_field(sys_index, 4))->name));
ut_a(!strcmp("NAME", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &len);
name = mem_heap_strdupl(heap, (char*) field, len);
@ -386,36 +385,37 @@ dict_load_columns(
prtype = mach_read_from_4(field);
if (dtype_get_charset_coll(prtype) == 0
&& dtype_is_string_type(mtype)) {
&& dtype_is_string_type(mtype)) {
/* The table was created with < 4.1.2. */
if (dtype_is_binary_string_type(mtype, prtype)) {
/* 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(0 == ut_strcmp("PREC",
dict_field_get_col(
dict_index_get_nth_field(sys_index, 8))->name));
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);
dict_mem_table_add_col(table, name, mtype, prtype, col_len,
prec);
prec);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
@ -488,7 +488,7 @@ dict_load_fields(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < index->n_fields; i++) {
rec = btr_pcur_get_rec(&pcur);
@ -516,24 +516,24 @@ dict_load_fields(
pos_and_prefix_len = mach_read_from_4(field);
ut_a((pos_and_prefix_len & 0xFFFFUL) == i
|| (pos_and_prefix_len & 0xFFFF0000UL) == (i << 16));
|| (pos_and_prefix_len & 0xFFFF0000UL) == (i << 16));
if ((i == 0 && pos_and_prefix_len > 0)
|| (pos_and_prefix_len & 0xFFFF0000UL) > 0) {
|| (pos_and_prefix_len & 0xFFFF0000UL) > 0) {
prefix_len = pos_and_prefix_len & 0xFFFFUL;
} else {
prefix_len = 0;
}
ut_a(0 == ut_strcmp("COL_NAME",
dict_field_get_col(
dict_index_get_nth_field(sys_index, 4))->name));
ut_a(!strcmp("COL_NAME", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &len);
dict_mem_index_add_field(index,
mem_heap_strdupl(heap, (char*) field, len), prefix_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);
}
@ -579,7 +579,7 @@ dict_load_indexes(
#endif /* UNIV_SYNC_DEBUG */
if ((ut_dulint_get_high(table->id) == 0)
&& (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
&& (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
is_sys_table = TRUE;
} else {
is_sys_table = FALSE;
@ -601,7 +601,7 @@ dict_load_indexes(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
BTR_SEARCH_LEAF, &pcur, &mtr);
for (;;) {
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
@ -619,7 +619,7 @@ dict_load_indexes(
if (rec_get_deleted_flag(rec, 0)) {
dict_load_report_deleted_index(table->name,
ULINT_UNDEFINED);
ULINT_UNDEFINED);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@ -631,9 +631,8 @@ dict_load_indexes(
ut_ad(len == 8);
id = mach_read_from_8(field);
ut_a(0 == ut_strcmp("NAME",
dict_field_get_col(
dict_index_get_nth_field(sys_index, 4))->name));
ut_a(!strcmp("NAME", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &name_len);
name_buf = mem_heap_strdupl(heap, (char*) field, name_len);
@ -647,9 +646,8 @@ dict_load_indexes(
field = rec_get_nth_field_old(rec, 7, &len);
space = mach_read_from_4(field);
ut_a(0 == ut_strcmp("PAGE_NO",
dict_field_get_col(
dict_index_get_nth_field(sys_index, 8))->name));
ut_a(!strcmp("PAGE_NO", dict_field_get_col
(dict_index_get_nth_field(sys_index, 8))->name));
field = rec_get_nth_field_old(rec, 8, &len);
page_no = mach_read_from_4(field);
@ -657,8 +655,9 @@ dict_load_indexes(
if (page_no == FIL_NULL) {
fprintf(stderr,
"InnoDB: Error: trying to load index %s for table %s\n"
"InnoDB: but the index tree has been freed!\n",
"InnoDB: Error: trying to load index %s"
" for table %s\n"
"InnoDB: but the index tree has been freed!\n",
name_buf, table->name);
btr_pcur_close(&pcur);
@ -668,11 +667,13 @@ dict_load_indexes(
}
if ((type & DICT_CLUSTERED) == 0
&& NULL == dict_table_get_first_index(table)) {
&& NULL == dict_table_get_first_index(table)) {
fprintf(stderr,
"InnoDB: Error: trying to load index %s for table %s\n"
"InnoDB: but the first index is not clustered!\n",
"InnoDB: Error: trying to load index %s"
" for table %s\n"
"InnoDB: but the first index"
" is not clustered!\n",
name_buf, table->name);
btr_pcur_close(&pcur);
@ -682,17 +683,17 @@ dict_load_indexes(
}
if (is_sys_table
&& ((type & DICT_CLUSTERED)
&& ((type & DICT_CLUSTERED)
|| ((table == dict_sys->sys_tables)
&& (name_len == (sizeof "ID_IND") - 1)
&& (0 == ut_memcmp(name_buf, "ID_IND",
name_len))))) {
&& (name_len == (sizeof "ID_IND") - 1)
&& (0 == ut_memcmp(name_buf, "ID_IND",
name_len))))) {
/* The index was created in memory already at booting
of the database server */
} else {
index = dict_mem_index_create(table->name, name_buf,
space, type, n_fields);
space, type, n_fields);
index->id = id;
dict_load_fields(table, index, heap);
@ -762,13 +763,13 @@ dict_load_table(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
|| rec_get_deleted_flag(rec, 0)) {
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
err_exit:
err_exit:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
@ -784,9 +785,8 @@ dict_load_table(
goto err_exit;
}
ut_a(0 == ut_strcmp("SPACE",
dict_field_get_col(
dict_index_get_nth_field(sys_index, 9))->name));
ut_a(!strcmp("SPACE", dict_field_get_col
(dict_index_get_nth_field(sys_index, 9))->name));
field = rec_get_nth_field_old(rec, 9, &len);
space = mach_read_from_4(field);
@ -794,7 +794,7 @@ dict_load_table(
/* Check if the tablespace exists and has the right name */
if (space != 0) {
if (fil_space_for_table_exists_in_mem(space, name, FALSE,
FALSE, FALSE)) {
FALSE, FALSE)) {
/* Ok; (if we did a crash recovery then the tablespace
can already be in the memory cache) */
} else {
@ -804,12 +804,13 @@ dict_load_table(
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: error: space object of table %s,\n"
"InnoDB: space id %lu did not exist in memory. Retrying an open.\n",
name, (ulong)space);
" InnoDB: error: space object of table %s,\n"
"InnoDB: space id %lu did not exist in memory."
" Retrying an open.\n",
name, (ulong)space);
/* Try to open the tablespace */
if (!fil_open_single_table_tablespace(TRUE,
space, name)) {
space, name)) {
/* We failed to find a sensible tablespace
file */
@ -818,9 +819,8 @@ dict_load_table(
}
}
ut_a(0 == ut_strcmp("N_COLS",
dict_field_get_col(
dict_index_get_nth_field(sys_index, 4))->name));
ut_a(!strcmp("N_COLS", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &len);
n_cols = mach_read_from_4(field);
@ -833,13 +833,12 @@ dict_load_table(
}
table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL,
flags);
flags);
table->ibd_file_missing = ibd_file_missing;
ut_a(0 == ut_strcmp("ID",
dict_field_get_col(
dict_index_get_nth_field(sys_index, 3))->name));
ut_a(!strcmp("ID", dict_field_get_col
(dict_index_get_nth_field(sys_index, 3))->name));
field = rec_get_nth_field_old(rec, 3, &len);
table->id = mach_read_from_8(field);
@ -863,7 +862,7 @@ dict_load_table(
dict_load_indexes(table, heap);
err = dict_load_foreigns(table->name, TRUE);
/*
#if 0
if (err != DB_SUCCESS) {
mutex_enter(&dict_foreign_err_mutex);
@ -871,16 +870,22 @@ dict_load_table(
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: could not make a foreign key definition to match\n"
"InnoDB: the foreign key table or the referenced table!\n"
"InnoDB: The data dictionary of InnoDB is corrupt. You may need to drop\n"
"InnoDB: and recreate the foreign key table or the referenced table.\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
"InnoDB: Latest foreign key error printout:\n%s\n", dict_foreign_err_buf);
" InnoDB: Error: could not make a foreign key"
" definition to match\n"
"InnoDB: the foreign key table"
" or the referenced table!\n"
"InnoDB: The data dictionary of InnoDB is corrupt."
" You may need to drop\n"
"InnoDB: and recreate the foreign key table"
" or the referenced table.\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n"
"InnoDB: Latest foreign key error printout:\n%s\n",
dict_foreign_err_buf);
mutex_exit(&dict_foreign_err_mutex);
}
*/
#endif /* 0 */
mem_heap_free(heap);
return(table);
@ -920,8 +925,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);
@ -935,11 +940,11 @@ dict_load_table_on_id(
dict_index_copy_types(tuple, sys_table_ids, 1);
btr_pcur_open_on_user_rec(sys_table_ids, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
|| rec_get_deleted_flag(rec, 0)) {
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
btr_pcur_close(&pcur);
@ -1027,11 +1032,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");
@ -1045,7 +1050,7 @@ dict_load_foreign_cols(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < foreign->n_fields; i++) {
rec = btr_pcur_get_rec(&pcur);
@ -1067,7 +1072,7 @@ dict_load_foreign_cols(
field = rec_get_nth_field_old(rec, 5, &len);
foreign->referenced_col_names[i] =
mem_heap_strdupl(foreign->heap, (char*) field, len);
mem_heap_strdupl(foreign->heap, (char*) field, len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
@ -1085,7 +1090,8 @@ dict_load_foreign(
/* out: DB_SUCCESS or error code */
const char* id, /* in: foreign constraint id as a
null-terminated string */
ibool check_charsets)/* in: TRUE=check charset compatibility */
ibool check_charsets)
/* in: TRUE=check charset compatibility */
{
dict_foreign_t* foreign;
dict_table_t* sys_foreign;
@ -1118,11 +1124,11 @@ dict_load_foreign(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
|| rec_get_deleted_flag(rec, 0)) {
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
fprintf(stderr,
@ -1239,7 +1245,8 @@ dict_load_foreigns(
/* No foreign keys defined yet in this database */
fprintf(stderr,
"InnoDB: Error: no foreign key system tables in the database\n");
"InnoDB: Error: no foreign key system tables"
" in the database\n");
return(DB_ERROR);
}
@ -1250,8 +1257,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);
@ -1262,7 +1269,7 @@ start_load:
dict_index_copy_types(tuple, sec_index, 1);
btr_pcur_open_on_user_rec(sec_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
BTR_SEARCH_LEAF, &pcur, &mtr);
loop:
rec = btr_pcur_get_rec(&pcur);
@ -1283,8 +1290,8 @@ loop:
charset-collation, in a case-insensitive way. */
if (0 != cmp_data_data(dfield_get_type(dfield),
dfield_get_data(dfield), dfield_get_len(dfield),
field, len)) {
dfield_get_data(dfield), dfield_get_len(dfield),
field, len)) {
goto load_next_index;
}

View file

@ -65,7 +65,7 @@ dict_mem_table_create(
table->cached = FALSE;
table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS)
* sizeof(dict_col_t));
* sizeof(dict_col_t));
UT_LIST_INIT(table->indexes);
table->auto_inc_lock = mem_heap_alloc(heap, lock_get_size());
@ -177,9 +177,9 @@ dict_mem_index_create(
index->n_def = index->n_nullable = 0;
index->n_fields = n_fields;
index->fields = mem_heap_alloc(heap, 1 + n_fields
* sizeof(dict_field_t));
/* The '1 +' above prevents allocation
of an empty mem block */
* sizeof(dict_field_t));
/* The '1 +' above prevents allocation
of an empty mem block */
index->stat_n_diff_key_vals = NULL;
index->cached = FALSE;

View file

@ -44,7 +44,7 @@ eval_node_alloc_val_buf(
byte* data;
ut_ad(que_node_get_type(node) == QUE_NODE_SYMBOL
|| que_node_get_type(node) == QUE_NODE_FUNC);
|| que_node_get_type(node) == QUE_NODE_FUNC);
dfield = que_node_get_val(node);
@ -81,7 +81,7 @@ eval_node_free_val_buf(
byte* data;
ut_ad(que_node_get_type(node) == QUE_NODE_SYMBOL
|| que_node_get_type(node) == QUE_NODE_FUNC);
|| que_node_get_type(node) == QUE_NODE_FUNC);
dfield = que_node_get_val(node);
@ -115,7 +115,7 @@ eval_cmp(
arg2 = que_node_get_next(arg1);
res = cmp_dfield_dfield(que_node_get_val(arg1),
que_node_get_val(arg2));
que_node_get_val(arg2));
val = TRUE;
func = cmp_node->func;
@ -317,7 +317,7 @@ eval_predefined_2(
if (!eval_node_get_ibool_val(arg1)) {
fputs("SQL assertion fails in a stored procedure!\n",
stderr);
stderr);
}
ut_a(eval_node_get_ibool_val(arg1));
@ -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;
}
@ -385,7 +385,7 @@ eval_notfound(
if (cursor->token_type == SYM_LIT) {
ut_ad(ut_memcmp(dfield_get_data(que_node_get_val(cursor)),
"SQL", 3) == 0);
"SQL", 3) == 0);
sel_node = cursor->sym_table->query_graph->last_sel_node;
} else {
@ -466,7 +466,7 @@ eval_replstr(
len2 = (ulint)eval_node_get_int_val(arg4);
if ((dfield_get_len(que_node_get_val(arg1)) < len1 + len2)
|| (dfield_get_len(que_node_get_val(arg2)) < len2)) {
|| (dfield_get_len(que_node_get_val(arg2)) < len2)) {
ut_error;
}
@ -741,19 +741,20 @@ eval_predefined(
uint_val = (ulint) int_val;
}
for (tmp = int_len; uint_val > 0; uint_val /= 10) {
data[--tmp] = (byte) ('0' + (byte)(uint_val % 10));
data[--tmp] = (byte)
('0' + (byte)(uint_val % 10));
}
}
dfield_set_len((dfield_t*) que_node_get_val(func_node),
int_len);
int_len);
return;
} else if (func == PARS_TO_NUMBER_TOKEN) {
int_val = atoi((char*)
dfield_get_data(que_node_get_val(arg1)));
dfield_get_data(que_node_get_val(arg1)));
} else if (func == PARS_SYSDATE_TOKEN) {
int_val = (lint)ut_time();
@ -793,9 +794,9 @@ eval_func(
values, except for eval_cmp and notfound */
if ((dfield_get_len(que_node_get_val(arg)) == UNIV_SQL_NULL)
&& (class != PARS_FUNC_CMP)
&& (func != PARS_NOTFOUND_TOKEN)
&& (func != PARS_PRINTF_TOKEN)) {
&& (class != PARS_FUNC_CMP)
&& (func != PARS_NOTFOUND_TOKEN)
&& (func != PARS_PRINTF_TOKEN)) {
ut_error;
}

View file

@ -51,7 +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
@ -104,7 +105,7 @@ while_step(
ut_ad(que_node_get_type(node) == QUE_NODE_WHILE);
ut_ad((thr->prev_node == que_node_get_parent(node))
|| (que_node_get_next(thr->prev_node) == NULL));
|| (que_node_get_next(thr->prev_node) == NULL));
/* Evaluate the condition */
@ -192,8 +193,8 @@ for_step(
loop_var_value = eval_node_get_int_val(node->loop_start_limit);
node->loop_end_value = eval_node_get_int_val(
node->loop_end_limit);
node->loop_end_value
= eval_node_get_int_val(node->loop_end_limit);
}
/* Check if we should do another loop */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -33,9 +33,9 @@ flst_add_to_empty(
ut_ad(mtr && base && node);
ut_ad(base != node);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
len = flst_get_len(base, mtr);
ut_a(len == 0);
@ -72,9 +72,9 @@ flst_add_last(
ut_ad(mtr && base && node);
ut_ad(base != node);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
len = flst_get_len(base, mtr);
last_addr = flst_get_last(base, mtr);
@ -86,7 +86,7 @@ flst_add_last(
last_node = buf_frame_align(node) + last_addr.boffset;
} else {
last_node = fut_get_ptr(space, last_addr, RW_X_LATCH,
mtr);
mtr);
}
flst_insert_after(base, last_node, node, mtr);
@ -115,9 +115,9 @@ flst_add_first(
ut_ad(mtr && base && node);
ut_ad(base != node);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
len = flst_get_len(base, mtr);
first_addr = flst_get_first(base, mtr);
@ -127,10 +127,10 @@ flst_add_first(
if (len != 0) {
if (first_addr.page == node_addr.page) {
first_node = buf_frame_align(node)
+ first_addr.boffset;
+ first_addr.boffset;
} else {
first_node = fut_get_ptr(space, first_addr,
RW_X_LATCH, mtr);
RW_X_LATCH, mtr);
}
flst_insert_before(base, node, first_node, mtr);
@ -163,11 +163,11 @@ flst_insert_after(
ut_ad(base != node2);
ut_ad(node2 != node1);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node1),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
buf_ptr_get_fsp_addr(node1, &space, &node1_addr);
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
@ -218,11 +218,11 @@ flst_insert_before(
ut_ad(base != node3);
ut_ad(node2 != node3);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node3),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
buf_ptr_get_fsp_addr(node3, &space, &node3_addr);
@ -270,9 +270,9 @@ flst_remove(
ut_ad(mtr && node2 && base);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
@ -288,7 +288,7 @@ flst_remove(
node1 = buf_frame_align(node2) + node1_addr.boffset;
} else {
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH,
mtr);
mtr);
}
ut_ad(node1 != node2);
@ -307,7 +307,7 @@ flst_remove(
node3 = buf_frame_align(node2) + node3_addr.boffset;
} else {
node3 = fut_get_ptr(space, node3_addr, RW_X_LATCH,
mtr);
mtr);
}
ut_ad(node2 != node3);
@ -347,9 +347,9 @@ flst_cut_end(
ut_ad(mtr && node2 && base);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(n_nodes > 0);
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
@ -365,7 +365,7 @@ flst_cut_end(
node1 = buf_frame_align(node2) + node1_addr.boffset;
} else {
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH,
mtr);
mtr);
}
flst_write_addr(node1 + FLST_NEXT, fil_addr_null, mtr);
@ -402,9 +402,9 @@ flst_truncate_end(
ut_ad(mtr && node2 && base);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
if (n_nodes == 0) {
ut_ad(fil_addr_is_null(flst_get_next_addr(node2, mtr)));
@ -446,7 +446,7 @@ flst_validate(
ut_ad(base);
ut_ad(mtr_memo_contains(mtr1, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
/* We use two mini-transaction handles: the first is used to
lock the base node, and prevent other threads from modifying the
@ -504,7 +504,7 @@ flst_print(
ut_ad(base && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
frame = buf_frame_align(base);
len = flst_get_len(base, mtr);

View file

@ -310,8 +310,9 @@ ha_validate(
if (hash_calc_hash(node->fold, table) != i) {
ut_print_timestamp(stderr);
fprintf(stderr,
"InnoDB: Error: hash table node fold value %lu does not\n"
"InnoDB: match with the cell number %lu.\n",
"InnoDB: Error: hash table node"
" fold value %lu does not\n"
"InnoDB: match the cell number %lu.\n",
(ulong) node->fold, (ulong) i);
ok = FALSE;
@ -363,6 +364,7 @@ ha_print_info(
n_bufs++;
}
fprintf(file, ", node heap has %lu buffer(s)\n", (ulong) n_bufs);
fprintf(file, ", node heap has %lu buffer(s)\n",
(ulong) n_bufs);
}
}

File diff suppressed because it is too large Load diff

View file

@ -109,7 +109,7 @@ btr_page_set_level(
ut_ad(level <= BTR_MAX_NODE_LEVEL);
mlog_write_ulint(page + PAGE_HEADER + PAGE_LEVEL, level,
MLOG_2BYTES, mtr);
MLOG_2BYTES, mtr);
}
/************************************************************
@ -124,9 +124,9 @@ btr_page_get_next(
{
ut_ad(page && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX)
|| mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_S_FIX));
MTR_MEMO_PAGE_X_FIX)
|| mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_S_FIX));
return(mach_read_from_4(page + FIL_PAGE_NEXT));
}
@ -194,7 +194,7 @@ btr_node_ptr_get_child_page_no(
/* The child address is in the last field */
field = rec_get_nth_field(rec, offsets,
rec_offs_n_fields(offsets) - 1, &len);
rec_offs_n_fields(offsets) - 1, &len);
ut_ad(len == 4);
@ -202,7 +202,8 @@ btr_node_ptr_get_child_page_no(
if (UNIV_UNLIKELY(page_no == 0)) {
fprintf(stderr,
"InnoDB: a nonsensical page number 0 in a node ptr record at offset %lu\n",
"InnoDB: a nonsensical page number 0"
" in a node ptr record at offset %lu\n",
(ulong) ut_align_offset(rec, UNIV_PAGE_SIZE));
buf_page_print(buf_frame_align(rec));
}
@ -221,13 +222,13 @@ btr_leaf_page_release(
mtr_t* mtr) /* in: mtr */
{
ut_ad(!mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_MODIFY));
MTR_MEMO_MODIFY));
if (latch_mode == BTR_SEARCH_LEAF) {
mtr_memo_release(mtr, buf_block_align(page),
MTR_MEMO_PAGE_S_FIX);
MTR_MEMO_PAGE_S_FIX);
} else {
ut_ad(latch_mode == BTR_MODIFY_LEAF);
mtr_memo_release(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX);
MTR_MEMO_PAGE_X_FIX);
}
}

View file

@ -583,9 +583,11 @@ to know struct size! */
struct btr_cur_struct {
dict_index_t* index; /* index where positioned */
page_cur_t page_cur; /* page cursor */
page_t* left_page; /* this field is used to store a pointer
to the left neighbor page, in the cases
BTR_SEARCH_PREV and BTR_MODIFY_PREV */
page_t* left_page; /* this field is used to store
a pointer to the left neighbor
page, in the cases
BTR_SEARCH_PREV and
BTR_MODIFY_PREV */
/*------------------------------*/
que_thr_t* thr; /* this field is only used when
btr_cur_search_... is called for an

View file

@ -101,8 +101,8 @@ btr_cur_compress_recommendation(
page = btr_cur_get_page(cursor);
if ((page_get_data_size(page) < BTR_CUR_PAGE_COMPRESS_LIMIT)
|| ((btr_page_get_next(page, mtr) == FIL_NULL)
&& (btr_page_get_prev(page, mtr) == FIL_NULL))) {
|| ((btr_page_get_next(page, mtr) == FIL_NULL)
&& (btr_page_get_prev(page, mtr) == FIL_NULL))) {
/* The page fillfactor has dropped below a predefined
minimum value OR the level in the B-tree contains just
@ -110,7 +110,7 @@ btr_cur_compress_recommendation(
root page. */
if (dict_tree_get_page((cursor->index)->tree)
== buf_frame_get_page_no(page)) {
== buf_frame_get_page_no(page)) {
/* It is the root page */
@ -144,9 +144,9 @@ btr_cur_can_delete_without_compress(
page = btr_cur_get_page(cursor);
if ((page_get_data_size(page) - rec_size < BTR_CUR_PAGE_COMPRESS_LIMIT)
|| ((btr_page_get_next(page, mtr) == FIL_NULL)
&& (btr_page_get_prev(page, mtr) == FIL_NULL))
|| (page_get_n_recs(page) < 2)) {
|| ((btr_page_get_next(page, mtr) == FIL_NULL)
&& (btr_page_get_prev(page, mtr) == FIL_NULL))
|| (page_get_n_recs(page) < 2)) {
/* The page fillfactor will drop below a predefined
minimum value, OR the level in the B-tree contains just
@ -154,7 +154,7 @@ btr_cur_can_delete_without_compress(
compression if this is not the root page. */
if (dict_tree_get_page((cursor->index)->tree)
== buf_frame_get_page_no(page)) {
== buf_frame_get_page_no(page)) {
/* It is the root page */

View file

@ -20,7 +20,7 @@ btr_pcur_get_rel_pos(
ut_ad(cursor->old_rec);
ut_ad(cursor->old_stored == BTR_PCUR_OLD_STORED);
ut_ad(cursor->pos_state == BTR_PCUR_WAS_POSITIONED
|| cursor->pos_state == BTR_PCUR_IS_POSITIONED);
|| cursor->pos_state == BTR_PCUR_IS_POSITIONED);
return(cursor->rel_pos);
}
@ -120,7 +120,7 @@ btr_pcur_get_up_match(
btr_cur_t* btr_cursor;
ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED)
|| (cursor->pos_state == BTR_PCUR_IS_POSITIONED));
|| (cursor->pos_state == BTR_PCUR_IS_POSITIONED));
btr_cursor = btr_pcur_get_btr_cur(cursor);
@ -143,7 +143,7 @@ btr_pcur_get_low_match(
btr_cur_t* btr_cursor;
ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED)
|| (cursor->pos_state == BTR_PCUR_IS_POSITIONED));
|| (cursor->pos_state == BTR_PCUR_IS_POSITIONED));
btr_cursor = btr_pcur_get_btr_cur(cursor);
ut_ad(btr_cursor->low_match != ULINT_UNDEFINED);
@ -198,7 +198,7 @@ btr_pcur_is_on_user_rec(
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
if ((btr_pcur_is_before_first_on_page(cursor, mtr))
|| (btr_pcur_is_after_last_on_page(cursor, mtr))) {
|| (btr_pcur_is_after_last_on_page(cursor, mtr))) {
return(FALSE);
}
@ -491,7 +491,7 @@ btr_pcur_open(
btr_cursor = btr_pcur_get_btr_cur(cursor);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
btr_cursor, 0, mtr);
btr_cursor, 0, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->trx_if_known = NULL;
@ -533,7 +533,7 @@ btr_pcur_open_with_no_init(
btr_cursor = btr_pcur_get_btr_cur(cursor);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
btr_cursor, has_search_latch, mtr);
btr_cursor, has_search_latch, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
@ -568,7 +568,7 @@ btr_pcur_open_at_index_side(
}
btr_cur_open_at_index_side(from_left, index, latch_mode,
btr_pcur_get_btr_cur(pcur), mtr);
btr_pcur_get_btr_cur(pcur), mtr);
pcur->pos_state = BTR_PCUR_IS_POSITIONED;
pcur->old_stored = BTR_PCUR_OLD_NOT_STORED;
@ -595,7 +595,7 @@ btr_pcur_open_at_rnd_pos(
btr_pcur_init(cursor);
btr_cur_open_at_rnd_pos(index, latch_mode,
btr_pcur_get_btr_cur(cursor), mtr);
btr_pcur_get_btr_cur(cursor), mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;

View file

@ -156,8 +156,8 @@ improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */
NOTE! The following macros should be used instead of
buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and
RW_X_LATCH are allowed as LA! */
#define buf_page_optimistic_get(LA, BL, G, MC, MTR) buf_page_optimistic_get_func(\
LA, BL, G, MC, __FILE__, __LINE__, MTR)
#define buf_page_optimistic_get(LA, BL, G, MC, MTR) \
buf_page_optimistic_get_func(LA, BL, G, MC, __FILE__, __LINE__, MTR)
/************************************************************************
This is the general function used to get optimistic access to a database
page. */

View file

@ -28,7 +28,7 @@ buf_block_peek_if_too_old(
buf_block_t* block) /* in: block to make younger */
{
return(buf_pool->freed_page_clock >= block->freed_page_clock
+ 1 + (buf_pool->curr_size / 1024));
+ 1 + (buf_pool->curr_size / 1024));
}
/*************************************************************************
@ -82,8 +82,8 @@ buf_pool_is_block(
void* ptr) /* in: pointer to memory */
{
if ((buf_pool->blocks <= (buf_block_t*)ptr)
&& ((buf_block_t*)ptr < buf_pool->blocks
+ buf_pool->max_size)) {
&& ((buf_block_t*)ptr < buf_pool->blocks
+ buf_pool->max_size)) {
return(TRUE);
}
@ -151,7 +151,7 @@ buf_block_get_frame(
ut_ad(block < buf_pool->blocks + buf_pool->max_size);
ut_ad(block->state != BUF_BLOCK_NOT_USED);
ut_ad((block->state != BUF_BLOCK_FILE_PAGE)
|| (block->buf_fix_count > 0));
|| (block->buf_fix_count > 0));
return(block->frame);
}
@ -209,16 +209,19 @@ buf_block_align(
frame_zero = buf_pool->frame_zero;
if (UNIV_UNLIKELY((ulint)ptr < (ulint)frame_zero)
|| UNIV_UNLIKELY((ulint)ptr > (ulint)(buf_pool->high_end))) {
|| UNIV_UNLIKELY((ulint)ptr > (ulint)(buf_pool->high_end))) {
ut_print_timestamp(stderr);
fprintf(stderr,
"InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %p, end at %p\n"
"InnoDB: Probable reason is database corruption or memory\n"
"InnoDB: corruption. If this happens in an InnoDB database recovery, see\n"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
"InnoDB: how to force recovery.\n",
"InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %p, end at %p\n"
"InnoDB: Probable reason is database corruption"
" or memory\n"
"InnoDB: corruption. If this happens in an"
" InnoDB database recovery, see\n"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
"forcing-recovery.html\n"
"InnoDB: how to force recovery.\n",
ptr, frame_zero,
buf_pool->high_end);
ut_error;
@ -245,16 +248,19 @@ buf_frame_align(
frame = ut_align_down(ptr, UNIV_PAGE_SIZE);
if (UNIV_UNLIKELY((ulint)frame < (ulint)(buf_pool->frame_zero))
|| UNIV_UNLIKELY((ulint)frame >= (ulint)(buf_pool->high_end))) {
|| UNIV_UNLIKELY((ulint)frame >= (ulint)(buf_pool->high_end))) {
ut_print_timestamp(stderr);
fprintf(stderr,
"InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %p, end at %p\n"
"InnoDB: Probable reason is database corruption or memory\n"
"InnoDB: corruption. If this happens in an InnoDB database recovery, see\n"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
"InnoDB: how to force recovery.\n",
"InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %p, end at %p\n"
"InnoDB: Probable reason is database corruption"
" or memory\n"
"InnoDB: corruption. If this happens in an"
" InnoDB database recovery, see\n"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
"forcing-recovery.html\n"
"InnoDB: how to force recovery.\n",
ptr, buf_pool->frame_zero,
buf_pool->high_end);
ut_error;
@ -449,7 +455,7 @@ buf_frame_modify_clock_inc(
#ifdef UNIV_SYNC_DEBUG
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /*UNIV_SYNC_DEBUG */
UT_DULINT_INC(block->modify_clock);
@ -470,7 +476,7 @@ buf_block_modify_clock_inc(
{
#ifdef UNIV_SYNC_DEBUG
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /* UNIV_SYNC_DEBUG */
UT_DULINT_INC(block->modify_clock);
@ -490,7 +496,7 @@ buf_block_get_modify_clock(
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /* UNIV_SYNC_DEBUG */
return(block->modify_clock);
@ -551,7 +557,7 @@ buf_page_hash_get(
fold = buf_page_address_fold(space, offset);
HASH_SEARCH(hash, buf_pool->page_hash, fold, block,
(block->space == space) && (block->offset == offset));
(block->space == space) && (block->offset == offset));
ut_a(block == NULL || block->state == BUF_BLOCK_FILE_PAGE);
return(block);
@ -580,9 +586,9 @@ buf_page_get_release_on_io(
buf_frame_t* frame;
frame = buf_page_get_gen(space, offset, rw_latch, guess,
BUF_GET_IF_IN_POOL,
__FILE__, __LINE__,
mtr);
BUF_GET_IF_IN_POOL,
__FILE__, __LINE__,
mtr);
if (frame != NULL) {
return(frame);

View file

@ -59,7 +59,7 @@ buf_flush_note_modification(
buf_flush_insert_into_flush_list(block);
} else {
ut_ad(ut_dulint_cmp(block->oldest_modification,
mtr->start_lsn) <= 0);
mtr->start_lsn) <= 0);
}
++srv_buf_pool_write_requests;
@ -99,7 +99,7 @@ buf_flush_recv_note_modification(
buf_flush_insert_sorted_into_flush_list(block);
} else {
ut_ad(ut_dulint_cmp(block->oldest_modification,
start_lsn) <= 0);
start_lsn) <= 0);
}
mutex_exit(&(buf_pool->mutex));

View file

@ -94,7 +94,8 @@ buf_read_recv_pages(
/* The size in pages of the area which the read-ahead algorithms read if
invoked */
#define BUF_READ_AHEAD_AREA ut_min(64, ut_2_power_up(buf_pool->curr_size / 32))
#define BUF_READ_AHEAD_AREA \
ut_min(64, ut_2_power_up(buf_pool->curr_size / 32))
/* Modes used in read-ahead */
#define BUF_READ_IBUF_PAGES_ONLY 131

View file

@ -52,7 +52,7 @@ dfield_get_data(
{
ut_ad(field);
ut_ad((field->len == UNIV_SQL_NULL)
|| (field->data != &data_error));
|| (field->data != &data_error));
return(field->data);
}
@ -69,7 +69,7 @@ dfield_get_len(
{
ut_ad(field);
ut_ad((field->len == UNIV_SQL_NULL)
|| (field->data != &data_error));
|| (field->data != &data_error));
return(field->len);
}
@ -146,9 +146,9 @@ dfield_datas_are_binary_equal(
len = field1->len;
if ((len != field2->len)
|| ((len != UNIV_SQL_NULL)
&& (0 != ut_memcmp(field1->data, field2->data,
len)))) {
|| ((len != UNIV_SQL_NULL)
&& (0 != ut_memcmp(field1->data, field2->data,
len)))) {
return(FALSE);
}
@ -262,7 +262,7 @@ dtuple_create(
ut_ad(heap);
tuple = (dtuple_t*) mem_heap_alloc(heap, sizeof(dtuple_t)
+ n_fields * sizeof(dfield_t));
+ n_fields * sizeof(dfield_t));
tuple->info_bits = 0;
tuple->n_fields = n_fields;
tuple->n_fields_cmp = n_fields;
@ -426,7 +426,7 @@ dtuple_contains_null(
for (i = 0; i < n; i++) {
if (dfield_get_len(dtuple_get_nth_field(tuple, i))
== UNIV_SQL_NULL) {
== UNIV_SQL_NULL) {
return(TRUE);
}

View file

@ -59,12 +59,12 @@ dtype_set_mblen(
if (dtype_is_string_type(type->mtype)) {
#ifndef UNIV_HOTBACKUP
innobase_get_cset_width(dtype_get_charset_coll(type->prtype),
&type->mbminlen, &type->mbmaxlen);
&type->mbminlen, &type->mbmaxlen);
ut_ad(type->mbminlen <= type->mbmaxlen);
#else /* !UNIV_HOTBACKUP */
#ifdef notdefined
printf("ibbackup: DEBUG: type->mtype=%lu, type->prtype=%lu\n",
type->mtype, type->prtype);
printf("ibbackup: DEBUG: type->mtype=%lu, type->prtype=%lu\n",
type->mtype, type->prtype);
#endif
ut_a(type->mtype <= DATA_BINARY);
#ifdef notdefined
@ -208,7 +208,7 @@ dtype_get_pad_char(
case DATA_FIXBINARY:
case DATA_BINARY:
if (UNIV_UNLIKELY(dtype_get_charset_coll(type->prtype)
== DATA_MYSQL_BINARY_CHARSET_COLL)) {
== DATA_MYSQL_BINARY_CHARSET_COLL)) {
/* Starting from 5.0.18, do not pad
VARBINARY or BINARY columns. */
return(ULINT_UNDEFINED);
@ -257,8 +257,8 @@ dtype_new_store_for_order_and_null_size(
}
/* In versions < 4.1.2 we had: if (type->prtype & DATA_NONLATIN1) {
buf[0] = buf[0] | 64;
}
buf[0] = buf[0] | 64;
}
*/
buf[1] = (byte)(type->prtype & 0xFFUL);
@ -296,7 +296,7 @@ dtype_read_for_order_and_null_size(
type->len = mach_read_from_2(buf + 2);
type->prtype = dtype_form_prtype(type->prtype,
data_mysql_default_charset_coll);
data_mysql_default_charset_coll);
dtype_set_mblen(type);
}
@ -368,80 +368,81 @@ dtype_get_fixed_size(
switch (mtype) {
case DATA_SYS:
#ifdef UNIV_DEBUG
switch (type->prtype & DATA_MYSQL_TYPE_MASK) {
default:
ut_ad(0);
return(0);
case DATA_ROW_ID:
ut_ad(type->len == DATA_ROW_ID_LEN);
break;
case DATA_TRX_ID:
ut_ad(type->len == DATA_TRX_ID_LEN);
break;
case DATA_ROLL_PTR:
ut_ad(type->len == DATA_ROLL_PTR_LEN);
break;
case DATA_MIX_ID:
ut_ad(type->len == DATA_MIX_ID_LEN);
break;
}
switch (type->prtype & DATA_MYSQL_TYPE_MASK) {
default:
ut_ad(0);
return(0);
case DATA_ROW_ID:
ut_ad(type->len == DATA_ROW_ID_LEN);
break;
case DATA_TRX_ID:
ut_ad(type->len == DATA_TRX_ID_LEN);
break;
case DATA_ROLL_PTR:
ut_ad(type->len == DATA_ROLL_PTR_LEN);
break;
case DATA_MIX_ID:
ut_ad(type->len == DATA_MIX_ID_LEN);
break;
}
#endif /* UNIV_DEBUG */
case DATA_CHAR:
case DATA_FIXBINARY:
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
return(dtype_get_len(type));
return(dtype_get_len(type));
case DATA_MYSQL:
if (type->prtype & DATA_BINARY_TYPE) {
return(dtype_get_len(type));
} else {
if (type->prtype & DATA_BINARY_TYPE) {
return(dtype_get_len(type));
} else {
#ifdef UNIV_HOTBACKUP
if (type->mbminlen == type->mbmaxlen) {
return(dtype_get_len(type));
}
#else /* UNIV_HOTBACKUP */
/* We play it safe here and ask MySQL for
mbminlen and mbmaxlen. Although
type->mbminlen and type->mbmaxlen are
initialized if and only if type->prtype
is (in one of the 3 functions in this file),
it could be that none of these functions
has been called. */
ulint mbminlen, mbmaxlen;
innobase_get_cset_width(
dtype_get_charset_coll(type->prtype),
&mbminlen, &mbmaxlen);
if (UNIV_UNLIKELY(type->mbminlen != mbminlen)
|| UNIV_UNLIKELY(type->mbmaxlen != mbmaxlen)) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: "
"mbminlen=%lu, "
"mbmaxlen=%lu, "
"type->mbminlen=%lu, "
"type->mbmaxlen=%lu\n",
(ulong) mbminlen,
(ulong) mbmaxlen,
(ulong) type->mbminlen,
(ulong) type->mbmaxlen);
}
if (mbminlen == mbmaxlen) {
return(dtype_get_len(type));
}
#endif /* !UNIV_HOTBACKUP */
if (type->mbminlen == type->mbmaxlen) {
return(dtype_get_len(type));
}
/* fall through for variable-length charsets */
#else /* UNIV_HOTBACKUP */
/* We play it safe here and ask MySQL for
mbminlen and mbmaxlen. Although
type->mbminlen and type->mbmaxlen are
initialized if and only if type->prtype
is (in one of the 3 functions in this file),
it could be that none of these functions
has been called. */
ulint mbminlen, mbmaxlen;
innobase_get_cset_width
(dtype_get_charset_coll(type->prtype),
&mbminlen, &mbmaxlen);
if (UNIV_UNLIKELY(type->mbminlen != mbminlen)
|| UNIV_UNLIKELY(type->mbmaxlen != mbmaxlen)) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: "
"mbminlen=%lu, "
"mbmaxlen=%lu, "
"type->mbminlen=%lu, "
"type->mbmaxlen=%lu\n",
(ulong) mbminlen,
(ulong) mbmaxlen,
(ulong) type->mbminlen,
(ulong) type->mbmaxlen);
}
if (mbminlen == mbmaxlen) {
return(dtype_get_len(type));
}
#endif /* !UNIV_HOTBACKUP */
}
/* fall through for variable-length charsets */
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
case DATA_BLOB:
return(0);
default: ut_error;
return(0);
default:
ut_error;
}
return(0);
@ -459,46 +460,46 @@ dtype_get_min_size(
switch (type->mtype) {
case DATA_SYS:
#ifdef UNIV_DEBUG
switch (type->prtype & DATA_MYSQL_TYPE_MASK) {
default:
ut_ad(0);
return(0);
case DATA_ROW_ID:
ut_ad(type->len == DATA_ROW_ID_LEN);
break;
case DATA_TRX_ID:
ut_ad(type->len == DATA_TRX_ID_LEN);
break;
case DATA_ROLL_PTR:
ut_ad(type->len == DATA_ROLL_PTR_LEN);
break;
case DATA_MIX_ID:
ut_ad(type->len == DATA_MIX_ID_LEN);
break;
}
switch (type->prtype & DATA_MYSQL_TYPE_MASK) {
default:
ut_ad(0);
return(0);
case DATA_ROW_ID:
ut_ad(type->len == DATA_ROW_ID_LEN);
break;
case DATA_TRX_ID:
ut_ad(type->len == DATA_TRX_ID_LEN);
break;
case DATA_ROLL_PTR:
ut_ad(type->len == DATA_ROLL_PTR_LEN);
break;
case DATA_MIX_ID:
ut_ad(type->len == DATA_MIX_ID_LEN);
break;
}
#endif /* UNIV_DEBUG */
case DATA_CHAR:
case DATA_FIXBINARY:
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
return(type->len);
return(type->len);
case DATA_MYSQL:
if ((type->prtype & DATA_BINARY_TYPE)
|| type->mbminlen == type->mbmaxlen) {
return(type->len);
}
/* this is a variable-length character set */
ut_a(type->mbminlen > 0);
ut_a(type->mbmaxlen > type->mbminlen);
ut_a(type->len % type->mbmaxlen == 0);
return(type->len * type->mbminlen / type->mbmaxlen);
if ((type->prtype & DATA_BINARY_TYPE)
|| type->mbminlen == type->mbmaxlen) {
return(type->len);
}
/* this is a variable-length character set */
ut_a(type->mbminlen > 0);
ut_a(type->mbmaxlen > type->mbminlen);
ut_a(type->len % type->mbmaxlen == 0);
return(type->len * type->mbminlen / type->mbmaxlen);
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
case DATA_BLOB:
return(0);
return(0);
default: ut_error;
}

View file

@ -108,7 +108,8 @@ dict_create(void);
#define DICT_HDR_TABLE_IDS 36 /* Root of the table index tree */
#define DICT_HDR_COLUMNS 40 /* Root of the column index tree */
#define DICT_HDR_INDEXES 44 /* Root of the index index tree */
#define DICT_HDR_FIELDS 48 /* Root of the index field index tree */
#define DICT_HDR_FIELDS 48 /* Root of the index field
index tree */
#define DICT_HDR_FSEG_HEADER 56 /* Segment header for the tablespace
segment into which the dictionary

View file

@ -163,7 +163,7 @@ dict_table_get_sys_col(
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
col = dict_table_get_nth_col(table, table->n_cols
- DATA_N_SYS_COLS + sys);
- DATA_N_SYS_COLS + sys);
ut_ad(col->type.mtype == DATA_SYS);
ut_ad(col->type.prtype == (sys | DATA_NOT_NULL));
@ -324,8 +324,8 @@ dict_index_get_sys_col_pos(
return(col->clust_pos);
}
return(dict_index_get_nth_col_pos(index,
dict_table_get_sys_col_no(index->table, type)));
return(dict_index_get_nth_col_pos
(index, dict_table_get_sys_col_no(index->table, type)));
}
/*************************************************************************
@ -366,8 +366,8 @@ dict_index_get_nth_type(
dict_index_t* index, /* in: index */
ulint pos) /* in: position of the field */
{
return(dict_col_get_type(dict_field_get_col(
dict_index_get_nth_field(index, pos))));
return(dict_col_get_type(dict_field_get_col
(dict_index_get_nth_field(index, pos))));
}
/************************************************************************
@ -380,8 +380,8 @@ dict_index_get_nth_col_no(
dict_index_t* index, /* in: index */
ulint pos) /* in: position of the field */
{
return(dict_col_get_no(dict_field_get_col(
dict_index_get_nth_field(index, pos))));
return(dict_col_get_no(dict_field_get_col
(dict_index_get_nth_field(index, pos))));
}
/*************************************************************************
@ -514,7 +514,7 @@ dict_table_check_if_in_cache_low(
table_fold = ut_fold_string(table_name);
HASH_SEARCH(name_hash, dict_sys->table_hash, table_fold, table,
ut_strcmp(table->name, table_name) == 0);
ut_strcmp(table->name, table_name) == 0);
return(table);
}
@ -564,7 +564,7 @@ dict_table_get_on_id_low(
fold = ut_fold_dulint(table_id);
HASH_SEARCH(id_hash, dict_sys->table_id_hash, fold, table,
ut_dulint_cmp(table->id, table_id) == 0);
ut_dulint_cmp(table->id, table_id) == 0);
if (table == NULL) {
table = dict_load_table_on_id(table_id);
}

View file

@ -79,7 +79,7 @@ eval_sym(
column */
dfield_copy_data(que_node_get_val(sym_node),
que_node_get_val(sym_node->indirection));
que_node_get_val(sym_node->indirection));
}
}
@ -230,5 +230,5 @@ eval_node_copy_val(
dfield2 = que_node_get_val(node2);
eval_node_copy_and_alloc_val(node1, dfield_get_data(dfield2),
dfield_get_len(dfield2));
dfield_get_len(dfield2));
}

View file

@ -38,11 +38,11 @@ flst_write_addr(
{
ut_ad(faddr && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(faddr),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
mlog_write_ulint(faddr + FIL_ADDR_PAGE, addr.page, MLOG_4BYTES, mtr);
mlog_write_ulint(faddr + FIL_ADDR_BYTE, addr.boffset,
MLOG_2BYTES, mtr);
MLOG_2BYTES, mtr);
}
/************************************************************************
@ -61,7 +61,7 @@ flst_read_addr(
addr.page = mtr_read_ulint(faddr + FIL_ADDR_PAGE, MLOG_4BYTES, mtr);
addr.boffset = mtr_read_ulint(faddr + FIL_ADDR_BYTE, MLOG_2BYTES,
mtr);
mtr);
return(addr);
}
@ -75,7 +75,7 @@ flst_init(
mtr_t* mtr) /* in: mini-transaction handle */
{
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
mlog_write_ulint(base + FLST_LEN, 0, MLOG_4BYTES, mtr);
flst_write_addr(base + FLST_FIRST, fil_addr_null, mtr);
flst_write_addr(base + FLST_LAST, fil_addr_null, mtr);

View file

@ -80,7 +80,7 @@ ibuf_should_try(
decide */
{
if (!(index->type & DICT_CLUSTERED)
&& (ignore_sec_unique || !(index->type & DICT_UNIQUE))) {
&& (ignore_sec_unique || !(index->type & DICT_UNIQUE))) {
ibuf_flush_count++;
@ -165,8 +165,8 @@ ibuf_index_page_calc_free(
/* out: value for ibuf bitmap bits */
page_t* page) /* in: non-unique secondary index page */
{
return(ibuf_index_page_calc_free_bits(
page_get_max_insert_size_after_reorganize(page, 1)));
return(ibuf_index_page_calc_free_bits
(page_get_max_insert_size_after_reorganize(page, 1)));
}
/****************************************************************************
@ -201,7 +201,7 @@ ibuf_update_free_bits_if_full(
# error "ULINT32_UNDEFINED <= UNIV_PAGE_SIZE"
#endif
after = ibuf_index_page_calc_free_bits(max_ins_size
- increase);
- increase);
#ifdef UNIV_IBUF_DEBUG
ut_a(after <= ibuf_index_page_calc_free(page));
#endif

View file

@ -47,7 +47,7 @@ lock_rec_hash(
ulint page_no)/* in: page number */
{
return(hash_calc_hash(lock_rec_fold(space, page_no),
lock_sys->rec_hash));
lock_sys->rec_hash));
}
/*************************************************************************

View file

@ -33,7 +33,7 @@ log_block_get_flush_bit(
byte* log_block) /* in: log block */
{
if (LOG_BLOCK_FLUSH_BIT_MASK
& mach_read_from_4(log_block + LOG_BLOCK_HDR_NO)) {
& mach_read_from_4(log_block + LOG_BLOCK_HDR_NO)) {
return(TRUE);
}
@ -74,7 +74,7 @@ log_block_get_hdr_no(
byte* log_block) /* in: log block */
{
return(~LOG_BLOCK_FLUSH_BIT_MASK
& mach_read_from_4(log_block + LOG_BLOCK_HDR_NO));
& mach_read_from_4(log_block + LOG_BLOCK_HDR_NO));
}
/****************************************************************
@ -166,7 +166,7 @@ log_block_set_checkpoint_no(
dulint no) /* in: checkpoint no */
{
mach_write_to_4(log_block + LOG_BLOCK_CHECKPOINT_NO,
ut_dulint_get_low(no));
ut_dulint_get_low(no));
}
/****************************************************************
@ -227,7 +227,7 @@ log_block_get_checksum(
byte* log_block) /* in: log block */
{
return(mach_read_from_4(log_block + OS_FILE_LOG_BLOCK_SIZE
- LOG_BLOCK_CHECKSUM));
- LOG_BLOCK_CHECKSUM));
}
/****************************************************************
@ -240,8 +240,8 @@ log_block_set_checksum(
ulint checksum) /* in: checksum */
{
mach_write_to_4(log_block + OS_FILE_LOG_BLOCK_SIZE
- LOG_BLOCK_CHECKSUM,
checksum);
- LOG_BLOCK_CHECKSUM,
checksum);
}
/****************************************************************
@ -287,7 +287,7 @@ log_block_init_in_old_format(
log_block_set_hdr_no(log_block, no);
mach_write_to_4(log_block + OS_FILE_LOG_BLOCK_SIZE
- LOG_BLOCK_CHECKSUM, no);
- LOG_BLOCK_CHECKSUM, no);
log_block_set_data_len(log_block, LOG_BLOCK_HDR_SIZE);
log_block_set_first_rec_group(log_block, 0);
}
@ -333,8 +333,8 @@ log_reserve_and_write_fast(
ut_memcpy(log->buf + log->buf_free, str, len);
log_block_set_data_len(ut_align_down(log->buf + log->buf_free,
OS_FILE_LOG_BLOCK_SIZE),
data_len);
OS_FILE_LOG_BLOCK_SIZE),
data_len);
#ifdef UNIV_LOG_DEBUG
log->old_buf_free = log->buf_free;
log->old_lsn = log->lsn;
@ -349,7 +349,7 @@ log_reserve_and_write_fast(
#ifdef UNIV_LOG_DEBUG
log_check_log_recs(log->buf + log->old_buf_free,
log->buf_free - log->old_buf_free, log->old_lsn);
log->buf_free - log->old_buf_free, log->old_lsn);
#endif
return(lsn);
}

View file

@ -65,7 +65,7 @@ mach_read_from_2(
ut_ad(b);
return( ((ulint)(b[0]) << 8)
+ (ulint)(b[1])
);
);
}
/************************************************************
@ -131,7 +131,7 @@ mach_read_from_3(
return( ((ulint)(b[0]) << 16)
+ ((ulint)(b[1]) << 8)
+ (ulint)(b[2])
);
);
}
/***********************************************************
@ -146,22 +146,10 @@ mach_write_to_4(
{
ut_ad(b);
#if (0 == 1) && !defined(__STDC__) && defined(UNIV_INTEL) && (UNIV_WORD_SIZE == 4) && defined(UNIV_VISUALC)
/* We do not use this even on Intel, because unaligned accesses may
be slow */
__asm MOV EAX, n
__asm BSWAP EAX /* Intel is little-endian, must swap bytes */
__asm MOV n, EAX
*((ulint*)b) = n;
#else
b[0] = (byte)(n >> 24);
b[1] = (byte)(n >> 16);
b[2] = (byte)(n >> 8);
b[3] = (byte)n;
#endif
}
/************************************************************
@ -174,28 +162,12 @@ mach_read_from_4(
/* out: ulint integer */
byte* b) /* in: pointer to four bytes */
{
#if (0 == 1) && !defined(__STDC__) && defined(UNIV_INTEL) && (UNIV_WORD_SIZE == 4) && defined(UNIV_VISUALC)
/* We do not use this even on Intel, because unaligned accesses may
be slow */
ulint res;
ut_ad(b);
__asm MOV EDX, b
__asm MOV ECX, DWORD PTR [EDX]
__asm BSWAP ECX /* Intel is little-endian, must swap bytes */
__asm MOV res, ECX
return(res);
#else
ut_ad(b);
return( ((ulint)(b[0]) << 24)
+ ((ulint)(b[1]) << 16)
+ ((ulint)(b[2]) << 8)
+ (ulint)(b[3])
);
#endif
);
}
/*************************************************************
@ -492,7 +464,7 @@ mach_dulint_get_much_compressed_size(
}
return(1 + mach_get_compressed_size(ut_dulint_get_high(n))
+ mach_get_compressed_size(ut_dulint_get_low(n)));
+ mach_get_compressed_size(ut_dulint_get_low(n)));
}
/*************************************************************

View file

@ -77,7 +77,7 @@ void
mem_block_set_type(mem_block_t* block, ulint type)
{
ut_ad((type == MEM_HEAP_DYNAMIC) || (type == MEM_HEAP_BUFFER)
|| (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
|| (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
block->type = type;
}
@ -150,7 +150,7 @@ mem_heap_alloc(
block to the heap */
if (mem_block_get_len(block)
< mem_block_get_free(block) + MEM_SPACE_NEEDED(n)) {
< mem_block_get_free(block) + MEM_SPACE_NEEDED(n)) {
block = mem_heap_add_block(heap, n);
@ -228,12 +228,12 @@ mem_heap_free_heap_top(
/* Validate the heap and get its total allocated size */
mem_heap_validate_or_print(heap, NULL, FALSE, &error, &total_size,
NULL, NULL);
NULL, NULL);
ut_a(!error);
/* Get the size below top pointer */
mem_heap_validate_or_print(heap, old_top, FALSE, &error, &size, NULL,
NULL);
NULL);
ut_a(!error);
#endif
@ -242,7 +242,7 @@ mem_heap_free_heap_top(
while (block != NULL) {
if (((byte*)block + mem_block_get_free(block) >= old_top)
&& ((byte*)block <= old_top)) {
&& ((byte*)block <= old_top)) {
/* Found the right block */
break;
@ -281,7 +281,7 @@ mem_heap_free_heap_top(
one */
if ((heap != block) && (mem_block_get_free(block) ==
mem_block_get_start(block))) {
mem_block_get_start(block))) {
mem_heap_block_free(heap, block);
}
}
@ -354,7 +354,7 @@ mem_heap_free_top(
/* Subtract the free field of block */
mem_block_set_free(block, mem_block_get_free(block)
- MEM_SPACE_NEEDED(n));
- MEM_SPACE_NEEDED(n));
#ifdef UNIV_MEM_DEBUG
ut_ad(mem_block_get_start(block) <= mem_block_get_free(block));
@ -367,7 +367,7 @@ mem_heap_free_top(
one */
if ((heap != block) && (mem_block_get_free(block) ==
mem_block_get_start(block))) {
mem_block_get_start(block))) {
mem_heap_block_free(heap, block);
}
}
@ -407,10 +407,11 @@ mem_heap_create_func(
if (n > 0) {
block = mem_heap_create_block(NULL, n, init_block, type,
file_name, line);
file_name, line);
} else {
block = mem_heap_create_block(NULL, MEM_BLOCK_START_SIZE,
init_block, type, file_name, line);
init_block, type,
file_name, line);
}
if (block == NULL) {
@ -496,7 +497,7 @@ mem_alloc_func(
void* buf;
heap = mem_heap_create_func(n, NULL, MEM_HEAP_DYNAMIC, file_name,
line);
line);
/* Note that as we created the first block in the heap big enough
for the buffer requested by the caller, the buffer will be in the
@ -506,7 +507,7 @@ mem_alloc_func(
buf = mem_heap_alloc(heap, n);
ut_a((byte*)heap == (byte*)buf - MEM_BLOCK_HEADER_SIZE
- MEM_FIELD_HEADER_SIZE);
- MEM_FIELD_HEADER_SIZE);
return(buf);
}
@ -526,7 +527,7 @@ mem_free_func(
mem_heap_t* heap;
heap = (mem_heap_t*)((byte*)ptr - MEM_BLOCK_HEADER_SIZE
- MEM_FIELD_HEADER_SIZE);
- MEM_FIELD_HEADER_SIZE);
mem_heap_free_func(heap, file_name, line);
}

View file

@ -165,7 +165,7 @@ mlog_write_initial_log_record_fast(
ulint offset;
ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_X_FIX));
ut_ad(type <= MLOG_BIGGEST_TYPE);
ut_ad(ptr && log_ptr);
@ -182,9 +182,9 @@ mlog_write_initial_log_record_fast(
mtr->n_log_recs++;
#ifdef UNIV_LOG_DEBUG
/* fprintf(stderr,
"Adding to mtr log record type %lu space %lu page no %lu\n",
type, space, offset); */
/* fprintf(stderr,
"Adding to mtr log record type %lu space %lu page no %lu\n",
type, space, offset); */
#endif
#ifdef UNIV_DEBUG

View file

@ -70,7 +70,8 @@ flag value must give the length also! */
#define MLOG_PAGE_CREATE ((byte)19) /* create an index page */
#define MLOG_UNDO_INSERT ((byte)20) /* insert entry in an undo
log */
#define MLOG_UNDO_ERASE_END ((byte)21) /* erase an undo log page end */
#define MLOG_UNDO_ERASE_END ((byte)21) /* erase an undo log
page end */
#define MLOG_UNDO_INIT ((byte)22) /* initialize a page in an
undo log */
#define MLOG_UNDO_HDR_DISCARD ((byte)23) /* discard an update undo log

View file

@ -723,8 +723,10 @@ This function returns information about the specified file */
ibool
os_file_get_status(
/*===============*/
/* out: TRUE if stat information found */
/* out: TRUE if stat
information found */
const char* path, /* in: pathname of the file */
os_file_stat_t* stat_info); /* information of a file in a directory */
os_file_stat_t* stat_info); /* information of a file in a
directory */
#endif

View file

@ -162,11 +162,11 @@ page_cur_search(
ut_ad(dtuple_check_typed(tuple));
page_cur_search_with_match(page, index, tuple, mode,
&up_matched_fields,
&up_matched_bytes,
&low_matched_fields,
&low_matched_bytes,
cursor);
&up_matched_fields,
&up_matched_bytes,
&low_matched_fields,
&low_matched_bytes,
cursor);
return(low_matched_fields);
}
@ -205,6 +205,6 @@ page_cur_rec_insert(
mtr_t* mtr) /* in: mini-transaction handle */
{
return(page_cur_insert_rec_low(cursor, NULL, index, rec,
offsets, mtr));
offsets, mtr));
}

View file

@ -93,8 +93,8 @@ page_header_get_ptr(
ut_ad(page);
ut_ad((field == PAGE_FREE)
|| (field == PAGE_LAST_INSERT)
|| (field == PAGE_HEAP_TOP));
|| (field == PAGE_LAST_INSERT)
|| (field == PAGE_HEAP_TOP));
offs = page_header_get_field(page, field);
@ -122,8 +122,8 @@ page_header_set_ptr(
ut_ad(page);
ut_ad((field == PAGE_FREE)
|| (field == PAGE_LAST_INSERT)
|| (field == PAGE_HEAP_TOP));
|| (field == PAGE_LAST_INSERT)
|| (field == PAGE_HEAP_TOP));
if (ptr == NULL) {
offs = 0;
@ -149,7 +149,7 @@ page_header_reset_last_insert(
ut_ad(page && mtr);
mlog_write_ulint(page + PAGE_HEADER + PAGE_LAST_INSERT, 0,
MLOG_2BYTES, mtr);
MLOG_2BYTES, mtr);
}
/****************************************************************
@ -163,7 +163,7 @@ page_is_comp(
page_t* page) /* in: index page */
{
return(UNIV_EXPECT(page_header_get_field(page, PAGE_N_HEAP) & 0x8000,
0x8000));
0x8000));
}
/****************************************************************
@ -245,9 +245,9 @@ page_rec_is_user_rec_low(
ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START);
return(UNIV_LIKELY(offset != PAGE_NEW_SUPREMUM)
&& UNIV_LIKELY(offset != PAGE_NEW_INFIMUM)
&& UNIV_LIKELY(offset != PAGE_OLD_INFIMUM)
&& UNIV_LIKELY(offset != PAGE_OLD_SUPREMUM));
&& UNIV_LIKELY(offset != PAGE_NEW_INFIMUM)
&& UNIV_LIKELY(offset != PAGE_OLD_INFIMUM)
&& UNIV_LIKELY(offset != PAGE_OLD_SUPREMUM));
}
/****************************************************************
@ -263,7 +263,7 @@ page_rec_is_supremum_low(
ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START);
return(UNIV_UNLIKELY(offset == PAGE_NEW_SUPREMUM)
|| UNIV_UNLIKELY(offset == PAGE_OLD_SUPREMUM));
|| UNIV_UNLIKELY(offset == PAGE_OLD_SUPREMUM));
}
/****************************************************************
@ -279,7 +279,7 @@ page_rec_is_infimum_low(
ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START);
return(UNIV_UNLIKELY(offset == PAGE_NEW_INFIMUM)
|| UNIV_UNLIKELY(offset == PAGE_OLD_INFIMUM));
|| UNIV_UNLIKELY(offset == PAGE_OLD_INFIMUM));
}
/****************************************************************
@ -292,7 +292,7 @@ page_rec_is_user_rec(
const rec_t* rec) /* in: record */
{
return(page_rec_is_user_rec_low(
ut_align_offset(rec, UNIV_PAGE_SIZE)));
ut_align_offset(rec, UNIV_PAGE_SIZE)));
}
/****************************************************************
@ -305,7 +305,7 @@ page_rec_is_supremum(
const rec_t* rec) /* in: record */
{
return(page_rec_is_supremum_low(
ut_align_offset(rec, UNIV_PAGE_SIZE)));
ut_align_offset(rec, UNIV_PAGE_SIZE)));
}
/****************************************************************
@ -318,7 +318,7 @@ page_rec_is_infimum(
const rec_t* rec) /* in: record */
{
return(page_rec_is_infimum_low(
ut_align_offset(rec, UNIV_PAGE_SIZE)));
ut_align_offset(rec, UNIV_PAGE_SIZE)));
}
/*****************************************************************
@ -357,17 +357,17 @@ page_cmp_dtuple_rec_with_match(
rec_offset = ut_align_offset(rec, UNIV_PAGE_SIZE);
if (UNIV_UNLIKELY(rec_offset == PAGE_NEW_INFIMUM)
|| UNIV_UNLIKELY(rec_offset == PAGE_OLD_INFIMUM)) {
|| UNIV_UNLIKELY(rec_offset == PAGE_OLD_INFIMUM)) {
return(1);
}
if (UNIV_UNLIKELY(rec_offset == PAGE_NEW_SUPREMUM)
|| UNIV_UNLIKELY(rec_offset == PAGE_OLD_SUPREMUM)) {
|| UNIV_UNLIKELY(rec_offset == PAGE_OLD_SUPREMUM)) {
return(-1);
}
return(cmp_dtuple_rec_with_match(dtuple, rec, offsets,
matched_fields,
matched_bytes));
matched_fields,
matched_bytes));
}
/*****************************************************************
@ -430,8 +430,9 @@ page_dir_set_n_heap(
{
ut_ad(n_heap < 0x8000);
page_header_set_field(page, PAGE_N_HEAP, n_heap | (0x8000 &
page_header_get_field(page, PAGE_N_HEAP)));
page_header_set_field(page, PAGE_N_HEAP, n_heap
| (0x8000
& page_header_get_field(page, PAGE_N_HEAP)));
}
/*****************************************************************
@ -447,7 +448,7 @@ page_dir_get_nth_slot(
ut_ad(page_dir_get_n_slots(page) > n);
return(page + UNIV_PAGE_SIZE - PAGE_DIR
- (n + 1) * PAGE_DIR_SLOT_SIZE);
- (n + 1) * PAGE_DIR_SLOT_SIZE);
}
/******************************************************************
@ -535,7 +536,7 @@ page_dir_calc_reserved_space(
ulint n_recs) /* in: number of records */
{
return((PAGE_DIR_SLOT_SIZE * n_recs + PAGE_DIR_SLOT_MIN_N_OWNED - 1)
/ PAGE_DIR_SLOT_MIN_N_OWNED);
/ PAGE_DIR_SLOT_MIN_N_OWNED);
}
/****************************************************************
@ -558,13 +559,14 @@ page_rec_get_next(
if (UNIV_UNLIKELY(offs >= UNIV_PAGE_SIZE)) {
fprintf(stderr,
"InnoDB: Next record offset is nonsensical %lu in record at offset %lu\n"
"InnoDB: rec address %p, first buffer frame %p\n"
"InnoDB: buffer pool high end %p, buf fix count %lu\n",
(ulong)offs, (ulong)(rec - page),
rec, buf_pool->frame_zero,
buf_pool->high_end,
(ulong)buf_block_align(rec)->buf_fix_count);
"InnoDB: Next record offset is nonsensical %lu"
" in record at offset %lu\n"
"InnoDB: rec address %p, first buffer frame %p\n"
"InnoDB: buffer pool high end %p, buf fix count %lu\n",
(ulong)offs, (ulong)(rec - page),
(void*) rec, (void*) buf_pool->frame_zero,
(void*) buf_pool->high_end,
(ulong) buf_block_align(rec)->buf_fix_count);
buf_page_print(page);
ut_error;
@ -683,10 +685,10 @@ page_get_data_size(
ulint ret;
ret = (ulint)(page_header_get_field(page, PAGE_HEAP_TOP)
- (page_is_comp(page)
? PAGE_NEW_SUPREMUM_END
: PAGE_OLD_SUPREMUM_END)
- page_header_get_field(page, PAGE_GARBAGE));
- (page_is_comp(page)
? PAGE_NEW_SUPREMUM_END
: PAGE_OLD_SUPREMUM_END)
- page_header_get_field(page, PAGE_GARBAGE));
ut_ad(ret < UNIV_PAGE_SIZE);
@ -704,15 +706,15 @@ page_get_free_space_of_empty(
{
if (UNIV_LIKELY(comp)) {
return((ulint)(UNIV_PAGE_SIZE
- PAGE_NEW_SUPREMUM_END
- PAGE_DIR
- 2 * PAGE_DIR_SLOT_SIZE));
- PAGE_NEW_SUPREMUM_END
- PAGE_DIR
- 2 * PAGE_DIR_SLOT_SIZE));
}
return((ulint)(UNIV_PAGE_SIZE
- PAGE_OLD_SUPREMUM_END
- PAGE_DIR
- 2 * PAGE_DIR_SLOT_SIZE));
- PAGE_OLD_SUPREMUM_END
- PAGE_DIR
- 2 * PAGE_DIR_SLOT_SIZE));
}
/****************************************************************
@ -735,14 +737,16 @@ page_get_max_insert_size(
if (page_is_comp(page)) {
occupied = page_header_get_field(page, PAGE_HEAP_TOP)
- PAGE_NEW_SUPREMUM_END + page_dir_calc_reserved_space(
n_recs + page_dir_get_n_heap(page) - 2);
- PAGE_NEW_SUPREMUM_END
+ page_dir_calc_reserved_space
(n_recs + page_dir_get_n_heap(page) - 2);
free_space = page_get_free_space_of_empty(TRUE);
} else {
occupied = page_header_get_field(page, PAGE_HEAP_TOP)
- PAGE_OLD_SUPREMUM_END + page_dir_calc_reserved_space(
n_recs + page_dir_get_n_heap(page) - 2);
- PAGE_OLD_SUPREMUM_END
+ page_dir_calc_reserved_space
(n_recs + page_dir_get_n_heap(page) - 2);
free_space = page_get_free_space_of_empty(FALSE);
}
@ -819,7 +823,7 @@ page_mem_free(
garbage = page_header_get_field(page, PAGE_GARBAGE);
page_header_set_field(page, PAGE_GARBAGE,
garbage + rec_offs_size(offsets));
garbage + rec_offs_size(offsets));
}
#ifdef UNIV_MATERIALIZE

View file

@ -230,9 +230,9 @@ que_thr_peek_stop(
trx = graph->trx;
if (graph->state != QUE_FORK_ACTIVE
|| trx->que_state == TRX_QUE_LOCK_WAIT
|| (UT_LIST_GET_LEN(trx->signals) > 0
&& trx->que_state == TRX_QUE_RUNNING)) {
|| trx->que_state == TRX_QUE_LOCK_WAIT
|| (UT_LIST_GET_LEN(trx->signals) > 0
&& trx->que_state == TRX_QUE_RUNNING)) {
return(TRUE);
}
@ -250,7 +250,7 @@ que_graph_is_select(
que_t* graph) /* in: graph */
{
if (graph->fork_type == QUE_FORK_SELECT_SCROLL
|| graph->fork_type == QUE_FORK_SELECT_NON_SCROLL) {
|| graph->fork_type == QUE_FORK_SELECT_NON_SCROLL) {
return(TRUE);
}

View file

@ -69,8 +69,9 @@ read_view_sees_trx_id(
for (i = 0; i < n_ids; i++) {
cmp = ut_dulint_cmp(trx_id,
read_view_get_nth_trx_id(view, n_ids - i - 1));
cmp = ut_dulint_cmp
(trx_id,
read_view_get_nth_trx_id(view, n_ids - i - 1));
if (cmp <= 0) {
return(cmp < 0);
}

View file

@ -40,9 +40,10 @@ cmp_dfield_dfield(
{
ut_ad(dfield_check_typed(dfield1));
return(cmp_data_data(dfield_get_type(dfield1),
dfield_get_data(dfield1), dfield_get_len(dfield1),
dfield_get_data(dfield2), dfield_get_len(dfield2)));
return(cmp_data_data
(dfield_get_type(dfield1),
dfield_get_data(dfield1), dfield_get_len(dfield1),
dfield_get_data(dfield2), dfield_get_len(dfield2)));
}
/*****************************************************************
@ -65,5 +66,5 @@ cmp_rec_rec(
ulint match_b = 0;
return(cmp_rec_rec_with_match(rec1, rec2, offsets1, offsets2, index,
&match_f, &match_b));
&match_f, &match_b));
}

View file

@ -289,10 +289,10 @@ rec_get_next_offs(
(int16_t) field_value + ut_align_offset(...) < UNIV_PAGE_SIZE
*/
ut_ad((field_value >= 32768
? field_value - 65536
: field_value)
+ ut_align_offset(rec, UNIV_PAGE_SIZE)
< UNIV_PAGE_SIZE);
? field_value - 65536
: field_value)
+ ut_align_offset(rec, UNIV_PAGE_SIZE)
< UNIV_PAGE_SIZE);
#endif
if (field_value == 0) {
@ -336,7 +336,8 @@ rec_set_next_offs(
as a non-negative number */
field_value = (ulint)((lint)next
- (lint)ut_align_offset(rec, UNIV_PAGE_SIZE));
- (lint)ut_align_offset
(rec, UNIV_PAGE_SIZE));
field_value &= REC_NEXT_MASK;
} else {
field_value = 0;
@ -363,7 +364,8 @@ rec_get_n_fields_old(
ut_ad(rec);
ret = rec_get_bit_field_2(rec, REC_OLD_N_FIELDS,
REC_OLD_N_FIELDS_MASK, REC_OLD_N_FIELDS_SHIFT);
REC_OLD_N_FIELDS_MASK,
REC_OLD_N_FIELDS_SHIFT);
ut_ad(ret <= REC_MAX_N_FIELDS);
ut_ad(ret > 0);
@ -385,7 +387,7 @@ rec_set_n_fields_old(
ut_ad(n_fields > 0);
rec_set_bit_field_2(rec, n_fields, REC_OLD_N_FIELDS,
REC_OLD_N_FIELDS_MASK, REC_OLD_N_FIELDS_SHIFT);
REC_OLD_N_FIELDS_MASK, REC_OLD_N_FIELDS_SHIFT);
}
/**********************************************************
@ -402,7 +404,7 @@ rec_get_status(
ut_ad(rec);
ret = rec_get_bit_field_1(rec, REC_NEW_STATUS,
REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT);
REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT);
ut_ad((ret & ~REC_NEW_STATUS_MASK) == 0);
return(ret);
@ -456,8 +458,8 @@ rec_get_n_owned(
ut_ad(rec);
ret = rec_get_bit_field_1(rec,
comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED,
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED,
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
ut_ad(ret <= REC_MAX_N_OWNED);
return(ret);
@ -477,8 +479,8 @@ rec_set_n_owned(
ut_ad(n_owned <= REC_MAX_N_OWNED);
rec_set_bit_field_1(rec, n_owned,
comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED,
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED,
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
}
/**********************************************************
@ -496,8 +498,8 @@ rec_get_info_bits(
ut_ad(rec);
ret = rec_get_bit_field_1(rec,
comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
ut_ad((ret & ~REC_INFO_BITS_MASK) == 0);
return(ret);
@ -517,8 +519,8 @@ rec_set_info_bits(
ut_ad((bits & ~REC_INFO_BITS_MASK) == 0);
rec_set_bit_field_1(rec, bits,
comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
}
/**********************************************************
@ -534,7 +536,7 @@ rec_set_status(
ut_ad((bits & ~REC_NEW_STATUS_MASK) == 0);
rec_set_bit_field_1(rec, bits, REC_NEW_STATUS,
REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT);
REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT);
}
/**********************************************************
@ -595,13 +597,15 @@ rec_get_deleted_flag(
ulint comp) /* in: nonzero=compact page format */
{
if (UNIV_EXPECT(comp, REC_OFFS_COMPACT)) {
return(UNIV_UNLIKELY(rec_get_bit_field_1(rec,
REC_NEW_INFO_BITS, REC_INFO_DELETED_FLAG,
REC_INFO_BITS_SHIFT)));
return(UNIV_UNLIKELY
(rec_get_bit_field_1(rec, REC_NEW_INFO_BITS,
REC_INFO_DELETED_FLAG,
REC_INFO_BITS_SHIFT)));
} else {
return(UNIV_UNLIKELY(rec_get_bit_field_1(rec,
REC_OLD_INFO_BITS, REC_INFO_DELETED_FLAG,
REC_INFO_BITS_SHIFT)));
return(UNIV_UNLIKELY
(rec_get_bit_field_1(rec, REC_OLD_INFO_BITS,
REC_INFO_DELETED_FLAG,
REC_INFO_BITS_SHIFT)));
}
}
@ -656,8 +660,8 @@ rec_get_heap_no(
ut_ad(rec);
ret = rec_get_bit_field_2(rec,
comp ? REC_NEW_HEAP_NO : REC_OLD_HEAP_NO,
REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
comp ? REC_NEW_HEAP_NO : REC_OLD_HEAP_NO,
REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
ut_ad(ret <= REC_MAX_HEAP_NO);
return(ret);
@ -676,8 +680,8 @@ rec_set_heap_no(
ut_ad(heap_no <= REC_MAX_HEAP_NO);
rec_set_bit_field_2(rec, heap_no,
comp ? REC_NEW_HEAP_NO : REC_OLD_HEAP_NO,
REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
comp ? REC_NEW_HEAP_NO : REC_OLD_HEAP_NO,
REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
}
/**********************************************************
@ -695,7 +699,7 @@ rec_get_1byte_offs_flag(
#endif
return(rec_get_bit_field_1(rec, REC_OLD_SHORT, REC_OLD_SHORT_MASK,
REC_OLD_SHORT_SHIFT));
REC_OLD_SHORT_SHIFT));
}
/**********************************************************
@ -713,7 +717,7 @@ rec_set_1byte_offs_flag(
ut_ad(flag <= TRUE);
rec_set_bit_field_1(rec, flag, REC_OLD_SHORT, REC_OLD_SHORT_MASK,
REC_OLD_SHORT_SHIFT);
REC_OLD_SHORT_SHIFT);
}
/**********************************************************
@ -814,7 +818,7 @@ rec_offs_n_fields(
ut_ad(n_fields > 0);
ut_ad(n_fields <= REC_MAX_N_FIELDS);
ut_ad(n_fields + REC_OFFS_HEADER_SIZE
<= rec_offs_get_n_alloc(offsets));
<= rec_offs_get_n_alloc(offsets));
return(n_fields);
}
@ -842,16 +846,16 @@ rec_offs_validate(
if (index) {
ulint max_n_fields;
ut_ad((ulint) index == offsets[3]);
max_n_fields = ut_max(
dict_index_get_n_fields(index),
dict_index_get_n_unique_in_tree(index) + 1);
max_n_fields = ut_max
(dict_index_get_n_fields(index),
dict_index_get_n_unique_in_tree(index) + 1);
if (comp && rec) {
switch (rec_get_status(rec)) {
case REC_STATUS_ORDINARY:
break;
case REC_STATUS_NODE_PTR:
max_n_fields =
dict_index_get_n_unique_in_tree(index) + 1;
max_n_fields = dict_index_get_n_unique_in_tree
(index) + 1;
break;
case REC_STATUS_INFIMUM:
case REC_STATUS_SUPREMUM:
@ -960,7 +964,7 @@ rec_offs_nth_extern(
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
return(UNIV_UNLIKELY(rec_offs_base(offsets)[1 + n]
& REC_OFFS_EXTERNAL));
& REC_OFFS_EXTERNAL));
}
/**********************************************************
@ -976,7 +980,7 @@ rec_offs_nth_sql_null(
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
return(UNIV_UNLIKELY(rec_offs_base(offsets)[1 + n]
& REC_OFFS_SQL_NULL));
& REC_OFFS_SQL_NULL));
}
/**********************************************************
@ -992,7 +996,7 @@ rec_offs_nth_size(
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
return((rec_offs_base(offsets)[1 + n] - rec_offs_base(offsets)[n])
& REC_OFFS_MASK);
& REC_OFFS_MASK);
}
/**********************************************************
@ -1129,7 +1133,7 @@ rec_1_get_field_start_offs(
}
return(rec_1_get_prev_field_end_info(rec, n)
& ~REC_1BYTE_SQL_NULL_MASK);
& ~REC_1BYTE_SQL_NULL_MASK);
}
/**********************************************************
@ -1152,7 +1156,7 @@ rec_2_get_field_start_offs(
}
return(rec_2_get_prev_field_end_info(rec, n)
& ~(REC_2BYTE_SQL_NULL_MASK | REC_2BYTE_EXTERN_MASK));
& ~(REC_2BYTE_SQL_NULL_MASK | REC_2BYTE_EXTERN_MASK));
}
/**********************************************************
@ -1282,7 +1286,7 @@ rec_offs_set_n_fields(
ut_ad(n_fields > 0);
ut_ad(n_fields <= REC_MAX_N_FIELDS);
ut_ad(n_fields + REC_OFFS_HEADER_SIZE
<= rec_offs_get_n_alloc(offsets));
<= rec_offs_get_n_alloc(offsets));
offsets[1] = n_fields;
}
@ -1302,7 +1306,7 @@ rec_offs_data_size(
ut_ad(rec_offs_validate(NULL, NULL, offsets));
size = rec_offs_base(offsets)[rec_offs_n_fields(offsets)]
& REC_OFFS_MASK;
& REC_OFFS_MASK;
ut_ad(size < UNIV_PAGE_SIZE);
return(size);
}
@ -1437,11 +1441,11 @@ rec_get_converted_size(
ut_ad(dtuple_check_typed(dtuple));
ut_ad(index->type & DICT_UNIVERSAL
|| dtuple_get_n_fields(dtuple) ==
(((dtuple_get_info_bits(dtuple) & REC_NEW_STATUS_MASK)
== REC_STATUS_NODE_PTR)
? dict_index_get_n_unique_in_tree(index) + 1
: dict_index_get_n_fields(index)));
|| dtuple_get_n_fields(dtuple) ==
(((dtuple_get_info_bits(dtuple) & REC_NEW_STATUS_MASK)
== REC_STATUS_NODE_PTR)
? dict_index_get_n_unique_in_tree(index) + 1
: dict_index_get_n_fields(index)));
if (dict_table_is_comp(index->table)) {
return(rec_get_converted_size_new(index, dtuple));
@ -1449,8 +1453,8 @@ rec_get_converted_size(
data_size = dtuple_get_data_size(dtuple);
extra_size = rec_get_converted_extra_size(
data_size, dtuple_get_n_fields(dtuple));
extra_size = rec_get_converted_extra_size
(data_size, dtuple_get_n_fields(dtuple));
return(data_size + extra_size);
}

View file

@ -602,9 +602,10 @@ struct row_prebuilt_struct {
selects */
dtuple_t* search_tuple; /* prebuilt dtuple used in selects */
byte row_id[DATA_ROW_ID_LEN];
/* if the clustered index was generated,
the row id of the last row fetched is
stored here */
/* if the clustered index was
generated, the row id of the
last row fetched is stored
here */
dtuple_t* clust_ref; /* prebuilt dtuple used in
sel/upd/del */
ulint select_lock_type;/* LOCK_NONE, LOCK_S, or LOCK_X */

View file

@ -58,7 +58,8 @@ struct purge_node_struct{
it */
dict_table_t* table; /* table where purge is done */
ulint cmpl_info;/* compiler analysis info of an update */
upd_t* update; /* update vector for a clustered index record */
upd_t* update; /* update vector for a clustered index
record */
dtuple_t* ref; /* NULL, or row reference to the next row to
handle */
dtuple_t* row; /* NULL, or a copy (also fields copied to

View file

@ -58,7 +58,7 @@ row_get_rec_trx_id(
return(trx_read_trx_id(rec + offset));
} else {
return(row_get_rec_sys_field(DATA_TRX_ID,
rec, index, offsets));
rec, index, offsets));
}
}
@ -84,7 +84,7 @@ row_get_rec_roll_ptr(
return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));
} else {
return(row_get_rec_sys_field(DATA_ROLL_PTR,
rec, index, offsets));
rec, index, offsets));
}
}
@ -110,7 +110,7 @@ row_set_rec_trx_id(
trx_write_trx_id(rec + offset, trx_id);
} else {
row_set_rec_sys_field(DATA_TRX_ID,
rec, index, offsets, trx_id);
rec, index, offsets, trx_id);
}
}
@ -136,7 +136,7 @@ row_set_rec_roll_ptr(
trx_write_roll_ptr(rec + offset + DATA_TRX_ID_LEN, roll_ptr);
} else {
row_set_rec_sys_field(DATA_ROLL_PTR,
rec, index, offsets, roll_ptr);
rec, index, offsets, roll_ptr);
}
}
@ -175,7 +175,7 @@ row_build_row_ref_fast(
if (field_no != ULINT_UNDEFINED) {
field = rec_get_nth_field(rec, offsets,
field_no, &len);
field_no, &len);
dfield_set_data(dfield, field, len);
}
}

View file

@ -298,15 +298,17 @@ struct sel_node_struct{
/* TRUE if the aggregate row has
already been fetched for the current
cursor */
ibool can_get_updated;/* this is TRUE if the select is in a
single-table explicit cursor which can
get updated within the stored procedure,
or in a searched update or delete;
NOTE that to determine of an explicit
cursor if it can get updated, the
parser checks from a stored procedure
if it contains positioned update or
delete statements */
ibool can_get_updated;/* this is TRUE if the select
is in a single-table explicit
cursor which can get updated
within the stored procedure,
or in a searched update or
delete; NOTE that to determine
of an explicit cursor if it
can get updated, the parser
checks from a stored procedure
if it contains positioned
update or delete statements */
sym_node_t* explicit_cursor;/* not NULL if an explicit cursor */
UT_LIST_BASE_NODE_T(sym_node_t)
copy_variables; /* variables whose values we have to

View file

@ -60,11 +60,11 @@ open_step(
if (node->op_type == ROW_SEL_OPEN_CURSOR) {
/* if (sel_node->state == SEL_NODE_CLOSED) { */
/* if (sel_node->state == SEL_NODE_CLOSED) { */
sel_node_reset_cursor(sel_node);
/* } else {
err = DB_ERROR;
sel_node_reset_cursor(sel_node);
/* } else {
err = DB_ERROR;
} */
} else {
if (sel_node->state != SEL_NODE_CLOSED) {

View file

@ -86,7 +86,8 @@ struct undo_node_struct{
clustered index record */
dict_table_t* table; /* table where undo is done */
ulint cmpl_info;/* compiler analysis of an update */
upd_t* update; /* update vector for a clustered index record */
upd_t* update; /* update vector for a clustered index
record */
dtuple_t* ref; /* row reference to the next row to handle */
dtuple_t* row; /* a copy (also fields copied to heap) of the
row to handle */

View file

@ -90,11 +90,11 @@ upd_field_set_field_no(
dict_index_name_print(stderr, trx, index);
fprintf(stderr, "\n"
"InnoDB: but index only has %lu fields\n",
(ulong) dict_index_get_n_fields(index));
(ulong) dict_index_get_n_fields(index));
}
dtype_copy(dfield_get_type(&(upd_field->new_val)),
dict_index_get_nth_type(index, field_no));
dict_index_get_nth_type(index, field_no));
}
/*************************************************************************
@ -114,7 +114,7 @@ row_upd_rec_sys_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!buf_block_align(rec)->is_hashed
|| rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|| rw_lock_own(&btr_search_latch, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
row_set_rec_trx_id(rec, index, offsets, trx->id);

View file

@ -61,9 +61,9 @@ Creates, or rather, initializes an rw-lock object in a specified memory
location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */
#define rw_lock_create(L, level) rw_lock_create_func((L), (level), __FILE__, __LINE__, #L)
#define rw_lock_create(L, level) \
rw_lock_create_func((L), (level), __FILE__, __LINE__, #L)
/*=====================*/
/**********************************************************************
Creates, or rather, initializes an rw-lock object in a specified memory
location (which must be appropriately aligned). The rw-lock is initialized

View file

@ -144,7 +144,7 @@ rw_lock_s_lock_low(
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, pass, RW_LOCK_SHARED, file_name,
line);
line);
#endif
lock->last_s_file_name = file_name;
lock->last_s_line = line;
@ -280,7 +280,7 @@ rw_lock_s_lock_func_nowait(
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, 0, RW_LOCK_SHARED, file_name,
line);
line);
#endif
lock->last_s_file_name = file_name;
@ -313,11 +313,11 @@ rw_lock_x_lock_func_nowait(
if (UNIV_UNLIKELY(rw_lock_get_reader_count(lock) != 0)) {
} else if (UNIV_LIKELY(rw_lock_get_writer(lock)
== RW_LOCK_NOT_LOCKED)) {
== RW_LOCK_NOT_LOCKED)) {
rw_lock_set_writer(lock, RW_LOCK_EX);
lock->writer_thread = curr_thread;
lock->pass = 0;
relock:
relock:
lock->writer_count++;
#ifdef UNIV_SYNC_DEBUG
@ -329,8 +329,8 @@ rw_lock_x_lock_func_nowait(
success = TRUE;
} else if (rw_lock_get_writer(lock) == RW_LOCK_EX
&& lock->pass == 0
&& os_thread_eq(lock->writer_thread, curr_thread)) {
&& lock->pass == 0
&& os_thread_eq(lock->writer_thread, curr_thread)) {
goto relock;
}
@ -373,7 +373,7 @@ rw_lock_s_unlock_func(
signal the object */
if (UNIV_UNLIKELY(lock->waiters)
&& lock->reader_count == 0) {
&& lock->reader_count == 0) {
sg = TRUE;
rw_lock_set_waiters(lock, 0);
@ -453,7 +453,7 @@ rw_lock_x_unlock_func(
/* If there may be waiters, signal the lock */
if (UNIV_UNLIKELY(lock->waiters)
&& lock->writer_count == 0) {
&& lock->writer_count == 0) {
sg = TRUE;
rw_lock_set_waiters(lock, 0);

View file

@ -39,8 +39,9 @@ location (which must be appropriately aligned). The mutex is initialized
in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */
#define mutex_create(M, level) mutex_create_func((M), (level), __FILE__, __LINE__, #M)
/*===================*/
#define mutex_create(M, level) \
mutex_create_func((M), (level), __FILE__, __LINE__, #M)
/**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory
location (which must be appropriately aligned). The mutex is initialized

View file

@ -66,25 +66,28 @@ mutex_test_and_set(
lw = &(mutex->lock_word);
__asm MOV ECX, lw
__asm MOV EDX, 1
__asm XCHG EDX, DWORD PTR [ECX]
__asm MOV res, EDX
__asm MOV EDX, 1
__asm XCHG EDX, DWORD PTR [ECX]
__asm MOV res, EDX
/* The fence below would prevent this thread from reading the data
structure protected by the mutex before the test-and-set operation is
committed, but the fence is apparently not needed:
/* The fence below would prevent this thread from
reading the data structure protected by the mutex
before the test-and-set operation is committed, but
the fence is apparently not needed:
In a posting to comp.arch newsgroup (August 10, 1997) Andy Glew said
that in P6 a LOCKed instruction like XCHG establishes a fence with
respect to memory reads and writes and thus an explicit fence is not
needed. In P5 he seemed to agree with a previous newsgroup poster that
LOCKed instructions serialize all instruction execution, and,
consequently, also memory operations. This is confirmed in Intel
Software Dev. Manual, Vol. 3. */
In a posting to comp.arch newsgroup (August 10, 1997)
Andy Glew said that in P6 a LOCKed instruction like
XCHG establishes a fence with respect to memory reads
and writes and thus an explicit fence is not
needed. In P5 he seemed to agree with a previous
newsgroup poster that LOCKed instructions serialize
all instruction execution, and, consequently, also
memory operations. This is confirmed in Intel Software
Dev. Manual, Vol. 3. */
/* mutex_fence(); */
/* mutex_fence(); */
return(res);
return(res);
#elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
ulint* lw;
ulint res;
@ -98,8 +101,8 @@ mutex_test_and_set(
code, and the second line tells the input to the asm code. */
asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" :
"=eax" (res), "=m" (*lw) :
"ecx" (lw));
"=eax" (res), "=m" (*lw) :
"ecx" (lw));
return(res);
#else
ibool ret;
@ -135,10 +138,10 @@ mutex_reset_lock_word(
lw = &(mutex->lock_word);
__asm MOV EDX, 0
__asm MOV ECX, lw
__asm XCHG EDX, DWORD PTR [ECX]
__asm MOV ECX, lw
__asm XCHG EDX, DWORD PTR [ECX]
#elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
ulint* lw;
ulint* lw;
lw = &(mutex->lock_word);
@ -147,11 +150,11 @@ mutex_reset_lock_word(
syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
asm volatile("movl $0, %%eax; xchgl (%%ecx), %%eax" :
"=m" (*lw) :
"ecx" (lw) :
"eax"); /* gcc does not seem to understand that our asm code
resets eax: tell it explicitly that after the third
':' */
"=m" (*lw) :
"ecx" (lw) :
"eax"); /* gcc does not seem to understand
that our asm code resets eax: tell it
explicitly that after the third ':' */
#else
mutex->lock_word = 0;
@ -167,8 +170,8 @@ mutex_get_lock_word(
/*================*/
mutex_t* mutex) /* in: mutex */
{
volatile ulint* ptr; /* declared volatile to ensure that
lock_word is loaded from memory */
volatile ulint* ptr; /* declared volatile to ensure that
lock_word is loaded from memory */
ut_ad(mutex);
ptr = &(mutex->lock_word);
@ -185,8 +188,8 @@ mutex_get_waiters(
/* out: value to set */
mutex_t* mutex) /* in: mutex */
{
volatile ulint* ptr; /* declared volatile to ensure that
the value is read from memory */
volatile ulint* ptr; /* declared volatile to ensure that
the value is read from memory */
ut_ad(mutex);
ptr = &(mutex->waiters);
@ -252,10 +255,10 @@ mutex_enter_func(
the atomic test_and_set; we could peek, and possibly save time. */
#ifndef UNIV_HOTBACKUP
mutex->count_using++;
mutex->count_using++;
#endif /* UNIV_HOTBACKUP */
if (!mutex_test_and_set(mutex)) {
if (!mutex_test_and_set(mutex)) {
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif

View file

@ -77,7 +77,7 @@ trx_undo_rec_copy(
trx_undo_rec_t* rec_copy;
len = mach_read_from_2(undo_rec) + buf_frame_align(undo_rec)
- undo_rec;
- undo_rec;
rec_copy = mem_heap_alloc(heap, len);
ut_memcpy(rec_copy, undo_rec, len);

View file

@ -67,12 +67,13 @@ trx_rsegf_get_nth_undo(
{
if (UNIV_UNLIKELY(n >= TRX_RSEG_N_SLOTS)) {
fprintf(stderr,
"InnoDB: Error: trying to get slot %lu of rseg\n", (unsigned long) n);
"InnoDB: Error: trying to get slot %lu of rseg\n",
(ulong) n);
ut_error;
}
return(mtr_read_ulint(rsegf + TRX_RSEG_UNDO_SLOTS +
n * TRX_RSEG_SLOT_SIZE, MLOG_4BYTES, mtr));
n * TRX_RSEG_SLOT_SIZE, MLOG_4BYTES, mtr));
}
/*******************************************************************
@ -88,12 +89,13 @@ trx_rsegf_set_nth_undo(
{
if (UNIV_UNLIKELY(n >= TRX_RSEG_N_SLOTS)) {
fprintf(stderr,
"InnoDB: Error: trying to set slot %lu of rseg\n", (unsigned long) n);
"InnoDB: Error: trying to set slot %lu of rseg\n",
(ulong) n);
ut_error;
}
mlog_write_ulint(rsegf + TRX_RSEG_UNDO_SLOTS + n * TRX_RSEG_SLOT_SIZE,
page_no, MLOG_4BYTES, mtr);
page_no, MLOG_4BYTES, mtr);
}
/********************************************************************

View file

@ -100,7 +100,7 @@ trx_sysf_get(
ut_ad(mtr);
header = TRX_SYS + buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
RW_X_LATCH, mtr);
RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(header, SYNC_TRX_SYS_HEADER);
@ -128,8 +128,8 @@ trx_sysf_rseg_get_space(
ut_ad(i < TRX_SYS_N_RSEGS);
return(mtr_read_ulint(sys_header + TRX_SYS_RSEGS
+ i * TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_SPACE, MLOG_4BYTES, mtr));
+ i * TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_SPACE, MLOG_4BYTES, mtr));
}
/*********************************************************************
@ -152,8 +152,8 @@ trx_sysf_rseg_get_page_no(
ut_ad(i < TRX_SYS_N_RSEGS);
return(mtr_read_ulint(sys_header + TRX_SYS_RSEGS
+ i * TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_PAGE_NO, MLOG_4BYTES, mtr));
+ i * TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_PAGE_NO, MLOG_4BYTES, mtr));
}
/*********************************************************************
@ -175,10 +175,10 @@ trx_sysf_rseg_set_space(
ut_ad(i < TRX_SYS_N_RSEGS);
mlog_write_ulint(sys_header + TRX_SYS_RSEGS
+ i * TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_SPACE,
space,
MLOG_4BYTES, mtr);
+ i * TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_SPACE,
space,
MLOG_4BYTES, mtr);
}
/*********************************************************************
@ -201,10 +201,10 @@ trx_sysf_rseg_set_page_no(
ut_ad(i < TRX_SYS_N_RSEGS);
mlog_write_ulint(sys_header + TRX_SYS_RSEGS
+ i * TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_PAGE_NO,
page_no,
MLOG_4BYTES, mtr);
+ i * TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_PAGE_NO,
page_no,
MLOG_4BYTES, mtr);
}
/*********************************************************************
@ -328,7 +328,7 @@ trx_is_active(
trx = trx_get_on_id(trx_id);
if (trx && (trx->conc_state == TRX_ACTIVE ||
trx->conc_state == TRX_PREPARED)) {
trx->conc_state == TRX_PREPARED)) {
return(TRUE);
}
@ -358,7 +358,7 @@ trx_sys_get_new_trx_id(void)
repeatedly started! */
if (ut_dulint_get_low(trx_sys->max_trx_id)
% TRX_SYS_TRX_ID_WRITE_MARGIN == 0) {
% TRX_SYS_TRX_ID_WRITE_MARGIN == 0) {
trx_sys_flush_max_trx_id();
}

View file

@ -670,9 +670,11 @@ struct trx_struct{
error, or empty. */
};
#define TRX_MAX_N_THREADS 32 /* maximum number of concurrent
threads running a single operation of
a transaction, e.g., a parallel query */
#define TRX_MAX_N_THREADS 32 /* maximum number of
concurrent threads running a
single operation of a
transaction, e.g., a parallel
query */
/* Transaction types */
#define TRX_USER 1 /* normal user transaction */
#define TRX_PURGE 2 /* purge transaction: this is not

View file

@ -94,5 +94,5 @@ trx_new_rec_locks_contain(
dict_index_t* index) /* in: index */
{
return(trx->new_rec_locks[0] == index
|| trx->new_rec_locks[1] == index);
|| trx->new_rec_locks[1] == index);
}

View file

@ -26,7 +26,7 @@ trx_undo_build_roll_ptr(
ibool is_insert, /* in: TRUE if insert undo log */
ulint rseg_id, /* in: rollback segment id */
ulint page_no, /* in: page number */
ulint offset); /* in: offset of the undo entry within page */
ulint offset); /* in: offset of the undo entry within page */
/***************************************************************************
Decodes a roll pointer dulint. */
UNIV_INLINE
@ -96,7 +96,7 @@ trx_undo_page_get_prev_rec(
/* out: pointer to record, NULL if none */
trx_undo_rec_t* rec, /* in: undo log record */
ulint page_no,/* in: undo log header page number */
ulint offset); /* in: undo log header offset on page */
ulint offset);/* in: undo log header offset on page */
/**********************************************************************
Returns the next undo log record on the page in the specified log, or
NULL if none exists. */
@ -107,7 +107,7 @@ trx_undo_page_get_next_rec(
/* out: pointer to record, NULL if none */
trx_undo_rec_t* rec, /* in: undo log record */
ulint page_no,/* in: undo log header page number */
ulint offset); /* in: undo log header offset on page */
ulint offset);/* in: undo log header offset on page */
/**********************************************************************
Returns the last undo record on the page in the specified undo log, or
NULL if none exists. */
@ -129,7 +129,7 @@ trx_undo_page_get_first_rec(
/* out: pointer to record, NULL if none */
page_t* undo_page,/* in: undo log page */
ulint page_no,/* in: undo log header page number */
ulint offset); /* in: undo log header offset on page */
ulint offset);/* in: undo log header offset on page */
/***************************************************************************
Gets the previous record in an undo log. */

View file

@ -61,7 +61,7 @@ trx_undo_decode_roll_ptr(
*rseg_id = (high / (256 * 256)) % 128;
*page_no = (high % (256 * 256)) * 256 * 256
+ (low / 256) / 256;
+ (low / 256) / 256;
}
/***************************************************************************
@ -179,7 +179,7 @@ trx_undo_page_get_start(
if (page_no == buf_frame_get_page_no(undo_page)) {
start = mach_read_from_2(offset + undo_page
+ TRX_UNDO_LOG_START);
+ TRX_UNDO_LOG_START);
} else {
start = TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE;
}
@ -210,11 +210,11 @@ trx_undo_page_get_end(
if (end == 0) {
end = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_FREE);
+ TRX_UNDO_PAGE_FREE);
}
} else {
end = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_FREE);
+ TRX_UNDO_PAGE_FREE);
}
return(end);

View file

@ -144,7 +144,8 @@ struct xa_switch_t {
on this list */
#define XA_RBPROTO XA_RBBASE+5 /* A protocol error occurred in the
resource manager */
#define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long */
#define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took
too long */
#define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */
#define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the
rollback codes */

View file

@ -62,7 +62,7 @@ ut_conv_dulint_to_longlong(
dulint d) /* in: dulint */
{
return((ib_longlong)d.low
+ (((ib_longlong)d.high) << 32));
+ (((ib_longlong)d.high) << 32));
}
/***********************************************************

View file

@ -72,7 +72,7 @@ ut_rnd_gen_ulint(void)
n_bits = 8 * sizeof(ulint);
ut_rnd_ulint_counter =
UT_RND1 * ut_rnd_ulint_counter + UT_RND2;
UT_RND1 * ut_rnd_ulint_counter + UT_RND2;
rnd = ut_rnd_gen_next_ulint(ut_rnd_ulint_counter);
@ -151,7 +151,7 @@ ut_fold_ulint_pair(
ulint n2) /* in: ulint */
{
return(((((n1 ^ n2 ^ UT_HASH_RANDOM_MASK2) << 8) + n1)
^ UT_HASH_RANDOM_MASK) + n2);
^ UT_HASH_RANDOM_MASK) + n2);
}
/*****************************************************************
@ -164,7 +164,7 @@ ut_fold_dulint(
dulint d) /* in: dulint */
{
return(ut_fold_ulint_pair(ut_dulint_get_low(d),
ut_dulint_get_high(d)));
ut_dulint_get_high(d)));
}
/*****************************************************************

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -104,7 +104,7 @@ ulint
mem_field_trailer_get_check(byte* field)
{
return(mach_read_from_4(field +
mem_field_header_get_len(field)));
mem_field_header_get_len(field)));
}
/**********************************************************************
@ -337,7 +337,8 @@ mem_hash_remove(
if (node == NULL) {
fprintf(stderr,
"Memory heap or buffer freed in %s line %lu did not exist.\n",
"Memory heap or buffer freed in %s line %lu"
" did not exist.\n",
file_name, (ulong) line);
ut_error;
}
@ -349,18 +350,20 @@ mem_hash_remove(
/* Validate the heap which will be freed */
mem_heap_validate_or_print(node->heap, NULL, FALSE, &error, &size,
NULL, NULL);
NULL, NULL);
if (error) {
fprintf(stderr,
"Inconsistency in memory heap or buffer n:o %lu created\n"
"in %s line %lu and tried to free in %s line %lu.\n"
"Hex dump of 400 bytes around memory heap first block start:\n",
"Inconsistency in memory heap or"
" buffer n:o %lu created\n"
"in %s line %lu and tried to free in %s line %lu.\n"
"Hex dump of 400 bytes around memory heap"
" first block start:\n",
node->nth_heap, node->file_name, (ulong) node->line,
file_name, (ulong) line);
ut_print_buf(stderr, (byte*)node->heap - 200, 400);
fputs("\nDump of the mem heap:\n", stderr);
mem_heap_validate_or_print(node->heap, NULL, TRUE, &error,
&size, NULL, NULL);
&size, NULL, NULL);
ut_error;
}
@ -441,10 +444,12 @@ mem_heap_validate_or_print(
phys_len += mem_block_get_len(block);
if ((block->type == MEM_HEAP_BUFFER)
&& (mem_block_get_len(block) > UNIV_PAGE_SIZE)) {
&& (mem_block_get_len(block) > UNIV_PAGE_SIZE)) {
fprintf(stderr,
"InnoDB: Error: mem block %p length %lu > UNIV_PAGE_SIZE\n", (void*) block,
"InnoDB: Error: mem block %p"
" length %lu > UNIV_PAGE_SIZE\n",
(void*) block,
(ulong) mem_block_get_len(block));
/* error */
@ -482,14 +487,18 @@ mem_heap_validate_or_print(
check_field = mem_field_header_get_check(user_field);
if (check_field !=
mem_field_trailer_get_check(user_field)) {
mem_field_trailer_get_check(user_field)) {
/* error */
fprintf(stderr,
"InnoDB: Error: block %lx mem field %lx len %lu\n"
"InnoDB: header check field is %lx but trailer %lx\n", (ulint)block,
(ulint)field, len, check_field,
mem_field_trailer_get_check(user_field));
"InnoDB: Error: block %lx mem"
" field %lx len %lu\n"
"InnoDB: header check field is"
" %lx but trailer %lx\n",
(ulint)block,
(ulint)field, len, check_field,
mem_field_trailer_get_check
(user_field));
return;
}
@ -511,9 +520,12 @@ mem_heap_validate_or_print(
/* error */
fprintf(stderr,
"InnoDB: Error: block %lx end of mem fields %lx\n"
"InnoDB: but block free at %lx\n", (ulint)block, (ulint)field,
(ulint)((byte*)block + mem_block_get_free(block)));
"InnoDB: Error: block %lx end of"
" mem fields %lx\n"
"InnoDB: but block free at %lx\n",
(ulint)block, (ulint)field,
(ulint)((byte*)block
+ mem_block_get_free(block)));
return;
}
@ -554,11 +566,12 @@ mem_heap_print(
ut_ad(mem_heap_check(heap));
mem_heap_validate_or_print(heap, NULL, TRUE, &error,
&us_size, &phys_size, &n_blocks);
&us_size, &phys_size, &n_blocks);
fprintf(stderr,
"\nheap type: %lu; size: user size %lu; physical size %lu; blocks %lu.\n",
(ulong) heap->type, (ulong) us_size,
(ulong) phys_size, (ulong) n_blocks);
"\nheap type: %lu; size: user size %lu;"
" physical size %lu; blocks %lu.\n",
(ulong) heap->type, (ulong) us_size,
(ulong) phys_size, (ulong) n_blocks);
ut_a(!error);
}
@ -593,7 +606,7 @@ mem_heap_validate(
ut_ad(mem_heap_check(heap));
mem_heap_validate_or_print(heap, NULL, FALSE, &error, &us_size,
&phys_size, &n_blocks);
&phys_size, &n_blocks);
if (error) {
mem_heap_print(heap);
}
@ -670,14 +683,17 @@ mem_validate_no_assert(void)
n_heaps++;
mem_heap_validate_or_print(node->heap, NULL,
FALSE, &error, &allocated_mem,
&ph_size, &n_blocks);
FALSE, &error,
&allocated_mem,
&ph_size, &n_blocks);
if (error) {
fprintf(stderr,
"\nERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"
"Inconsistency in memory heap or buffer created\n"
"in %s line %lu.\n",
"\nERROR!!!!!!!!!!!!!!!!!!!"
"!!!!!!!!!!!!!!!!!!!!!!!\n\n"
"Inconsistency in memory heap"
" or buffer created\n"
"in %s line %lu.\n",
node->file_name, node->line);
mutex_exit(&mem_hash_mutex);
@ -741,7 +757,8 @@ mem_analyze_corruption(
fputs("InnoDB: Apparent memory corruption: mem dump ", stderr);
ut_print_buf(stderr, (byte*)ptr - 250, 500);
fputs("\nInnoDB: Scanning backward trying to find previous allocated mem blocks\n", stderr);
fputs("\nInnoDB: Scanning backward trying to find"
" previous allocated mem blocks\n", stderr);
p = (byte*)ptr;
dist = 0;
@ -752,18 +769,26 @@ mem_analyze_corruption(
if (*((ulint*)p) == MEM_BLOCK_MAGIC_N) {
fprintf(stderr,
"Mem block at - %lu, file %s, line %lu\n",
(ulong) dist, (p + sizeof(ulint)),
(ulong) (*(ulint*)(p + 8 + sizeof(ulint))));
"Mem block at - %lu,"
" file %s, line %lu\n",
(ulong) dist,
(p + sizeof(ulint)),
(ulong)
(*(ulint*)(p + 8
+ sizeof(ulint))));
break;
}
if (*((ulint*)p) == MEM_FREED_BLOCK_MAGIC_N) {
fprintf(stderr,
"Freed mem block at - %lu, file %s, line %lu\n",
(ulong) dist, (p + sizeof(ulint)),
(ulong) (*(ulint*)(p + 8 + sizeof(ulint))));
"Freed mem block at - %lu,"
" file %s, line %lu\n",
(ulong) dist,
(p + sizeof(ulint)),
(ulong)
(*(ulint*)(p + 8
+ sizeof(ulint))));
break;
}
@ -778,7 +803,8 @@ mem_analyze_corruption(
}
fprintf(stderr,
"InnoDB: Scanning forward trying to find next allocated mem blocks\n");
"InnoDB: Scanning forward trying to find next"
" allocated mem blocks\n");
p = (byte*)ptr;
dist = 0;
@ -789,18 +815,26 @@ mem_analyze_corruption(
if (*((ulint*)p) == MEM_BLOCK_MAGIC_N) {
fprintf(stderr,
"Mem block at + %lu, file %s, line %lu\n",
(ulong) dist, (p + sizeof(ulint)),
(ulong) (*(ulint*)(p + 8 + sizeof(ulint))));
"Mem block at + %lu, file %s,"
" line %lu\n",
(ulong) dist,
(p + sizeof(ulint)),
(ulong)
(*(ulint*)(p + 8
+ sizeof(ulint))));
break;
}
if (*((ulint*)p) == MEM_FREED_BLOCK_MAGIC_N) {
fprintf(stderr,
"Freed mem block at + %lu, file %s, line %lu\n",
(ulong) dist, (p + sizeof(ulint)),
(ulong) (*(ulint*)(p + 8 + sizeof(ulint))));
"Freed mem block at + %lu,"
" file %s, line %lu\n",
(ulong) dist,
(p + sizeof(ulint)),
(ulong)
(*(ulint*)(p + 8
+ sizeof(ulint))));
break;
}
@ -878,33 +912,34 @@ mem_print_info_low(
}
mem_heap_validate_or_print(node->heap, NULL,
FALSE, &error, &allocated_mem,
&ph_size, &n_blocks);
FALSE, &error, &allocated_mem,
&ph_size, &n_blocks);
total_allocated_mem += allocated_mem;
fprintf(outfile,
"%lu: file %s line %lu of size %lu phys.size %lu with %lu blocks, type %lu\n",
node->nth_heap, node->file_name, node->line,
allocated_mem, ph_size, n_blocks,
(node->heap)->type);
next_heap:
"%lu: file %s line %lu of size %lu phys.size %lu"
" with %lu blocks, type %lu\n",
node->nth_heap, node->file_name, node->line,
allocated_mem, ph_size, n_blocks,
(node->heap)->type);
next_heap:
node = UT_LIST_GET_NEXT(all_list, node);
}
fprintf(outfile, "\n");
fprintf(outfile, "Current allocated memory : %lu\n",
mem_current_allocated_memory);
mem_current_allocated_memory);
fprintf(outfile, "Current allocated heaps and buffers : %lu\n",
n_heaps);
n_heaps);
fprintf(outfile, "Cumulative allocated memory : %lu\n",
mem_total_allocated_memory);
mem_total_allocated_memory);
fprintf(outfile, "Maximum allocated memory : %lu\n",
mem_max_allocated_memory);
mem_max_allocated_memory);
fprintf(outfile, "Cumulative created heaps and buffers : %lu\n",
mem_n_created_heaps);
mem_n_created_heaps);
fprintf(outfile, "Cumulative number of allocations : %lu\n",
mem_n_allocations);
mem_n_allocations);
mem_last_print_info = mem_n_created_heaps;
@ -912,9 +947,9 @@ mem_print_info_low(
mem_pool_print_info(outfile, mem_comm_pool);
/* mem_validate(); */
/* mem_validate(); */
/* fclose(outfile); */
/* fclose(outfile); */
#endif
}

View file

@ -342,7 +342,7 @@ mem_heap_create_block(
ulint len;
ut_ad((type == MEM_HEAP_DYNAMIC) || (type == MEM_HEAP_BUFFER)
|| (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
|| (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
if (heap && heap->magic_n != MEM_BLOCK_MAGIC_N) {
mem_analyze_corruption(heap);
@ -463,7 +463,7 @@ mem_heap_add_block(
}
new_block = mem_heap_create_block(heap, new_size, NULL, heap->type,
heap->file_name, heap->line);
heap->file_name, heap->line);
if (new_block == NULL) {
return(NULL);

View file

@ -145,7 +145,7 @@ mem_area_set_size(
ulint size) /* in: size */
{
area->size_and_free = (area->size_and_free & MEM_AREA_FREE)
| size;
| size;
}
/************************************************************************
@ -176,7 +176,7 @@ mem_area_set_free(
# error "TRUE != MEM_AREA_FREE"
#endif
area->size_and_free = (area->size_and_free & ~MEM_AREA_FREE)
| free;
| free;
}
/************************************************************************
@ -276,10 +276,12 @@ mem_pool_fill_free_list(
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: mem pool free list %lu length is %lu\n"
"InnoDB: though the list is empty!\n",
(ulong) i + 1,
(ulong) UT_LIST_GET_LEN(pool->free_list[i + 1]));
" InnoDB: Error: mem pool free list %lu"
" length is %lu\n"
"InnoDB: though the list is empty!\n",
(ulong) i + 1,
(ulong)
UT_LIST_GET_LEN(pool->free_list[i + 1]));
}
ret = mem_pool_fill_free_list(i + 1, pool);
@ -358,8 +360,9 @@ mem_area_alloc(
if (!mem_area_get_free(area)) {
fprintf(stderr,
"InnoDB: Error: Removing element from mem pool free list %lu though the\n"
"InnoDB: element is not marked free!\n",
"InnoDB: Error: Removing element from mem pool"
" free list %lu though the\n"
"InnoDB: element is not marked free!\n",
(ulong) n);
mem_analyze_corruption(area);
@ -370,7 +373,8 @@ mem_area_alloc(
if (mem_area_get_free(area)) {
fprintf(stderr,
"InnoDB: Probably a race condition because now the area is marked free!\n");
"InnoDB: Probably a race condition"
" because now the area is marked free!\n");
}
ut_error;
@ -378,8 +382,9 @@ mem_area_alloc(
if (UT_LIST_GET_LEN(pool->free_list[n]) == 0) {
fprintf(stderr,
"InnoDB: Error: Removing element from mem pool free list %lu\n"
"InnoDB: though the list length is 0!\n",
"InnoDB: Error: Removing element from mem pool"
" free list %lu\n"
"InnoDB: though the list length is 0!\n",
(ulong) n);
mem_analyze_corruption(area);
@ -471,8 +476,9 @@ mem_area_free(
if (mem_area_get_free(area)) {
fprintf(stderr,
"InnoDB: Error: Freeing element to mem pool free list though the\n"
"InnoDB: element is marked free!\n");
"InnoDB: Error: Freeing element to mem pool"
" free list though the\n"
"InnoDB: element is marked free!\n");
mem_analyze_corruption(area);
ut_error;
@ -482,8 +488,9 @@ mem_area_free(
if (size == 0) {
fprintf(stderr,
"InnoDB: Error: Mem area size is 0. Possibly a memory overrun of the\n"
"InnoDB: previous allocated area!\n");
"InnoDB: Error: Mem area size is 0. Possibly a"
" memory overrun of the\n"
"InnoDB: previous allocated area!\n");
mem_analyze_corruption(area);
ut_error;
@ -494,13 +501,15 @@ mem_area_free(
ulint next_size;
next_size = mem_area_get_size(
(mem_area_t*)(((byte*)area) + size));
next_size = mem_area_get_size
((mem_area_t*)(((byte*)area) + size));
if (ut_2_power_up(next_size) != next_size) {
fprintf(stderr,
"InnoDB: Error: Memory area size %lu, next area size %lu not a power of 2!\n"
"InnoDB: Possibly a memory overrun of the buffer being freed here.\n",
(ulong) size, (ulong) next_size);
"InnoDB: Error: Memory area size %lu,"
" next area size %lu not a power of 2!\n"
"InnoDB: Possibly a memory overrun of"
" the buffer being freed here.\n",
(ulong) size, (ulong) next_size);
mem_analyze_corruption(area);
ut_error;
@ -517,7 +526,7 @@ mem_area_free(
ut_a(mem_n_threads_inside == 1);
if (buddy && mem_area_get_free(buddy)
&& (size == mem_area_get_size(buddy))) {
&& (size == mem_area_get_size(buddy))) {
/* The buddy is in a free list */
@ -591,7 +600,7 @@ mem_pool_validate(
buddy = mem_area_get_buddy(area, ut_2_exp(i), pool);
ut_a(!buddy || !mem_area_get_free(buddy)
|| (ut_2_exp(i) != mem_area_get_size(buddy)));
|| (ut_2_exp(i) != mem_area_get_size(buddy)));
area = UT_LIST_GET_NEXT(free_list, area);
@ -627,9 +636,10 @@ mem_pool_print_info(
if (UT_LIST_GET_LEN(pool->free_list[i]) > 0) {
fprintf(outfile,
"Free list length %lu for blocks of size %lu\n",
(ulong) UT_LIST_GET_LEN(pool->free_list[i]),
(ulong) ut_2_exp(i));
"Free list length %lu for"
" blocks of size %lu\n",
(ulong) UT_LIST_GET_LEN(pool->free_list[i]),
(ulong) ut_2_exp(i));
}
}

View file

@ -59,7 +59,8 @@ mlog_write_initial_log_record(
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
"InnoDB: Error: trying to write to"
" a stray memory location %p\n", (void*) ptr);
ut_error;
}
@ -222,7 +223,8 @@ mlog_write_ulint(
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
"InnoDB: Error: trying to write to"
" a stray memory location %p\n", (void*) ptr);
ut_error;
}
@ -266,9 +268,11 @@ mlog_write_dulint(
{
byte* log_ptr;
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
if (UNIV_UNLIKELY(ptr < buf_pool->frame_zero)
|| UNIV_UNLIKELY(ptr >= buf_pool->high_end)) {
fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
"InnoDB: Error: trying to write to"
" a stray memory location %p\n", (void*) ptr);
ut_error;
}
@ -285,7 +289,7 @@ mlog_write_dulint(
}
log_ptr = mlog_write_initial_log_record_fast(ptr, MLOG_8BYTES,
log_ptr, mtr);
log_ptr, mtr);
mach_write_to_2(log_ptr, ptr - buf_frame_align(ptr));
log_ptr += 2;
@ -310,9 +314,10 @@ mlog_write_string(
byte* log_ptr;
if (UNIV_UNLIKELY(ptr < buf_pool->frame_zero)
|| UNIV_UNLIKELY(ptr >= buf_pool->high_end)) {
|| UNIV_UNLIKELY(ptr >= buf_pool->high_end)) {
fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
"InnoDB: Error: trying to write to"
" a stray memory location %p\n", (void*) ptr);
ut_error;
}
ut_ad(ptr && mtr);
@ -329,7 +334,7 @@ mlog_write_string(
}
log_ptr = mlog_write_initial_log_record_fast(ptr, MLOG_WRITE_STRING,
log_ptr, mtr);
log_ptr, mtr);
mach_write_to_2(log_ptr, ptr - buf_frame_align(ptr));
log_ptr += 2;
@ -415,7 +420,7 @@ mlog_open_and_write_index(
return(NULL); /* logging is disabled */
}
log_ptr = mlog_write_initial_log_record_fast(rec, type,
log_ptr, mtr);
log_ptr, mtr);
log_end = log_ptr + 11 + size;
} else {
ulint i;
@ -433,7 +438,7 @@ mlog_open_and_write_index(
}
log_end = log_ptr + alloc;
log_ptr = mlog_write_initial_log_record_fast(rec, type,
log_ptr, mtr);
log_ptr, mtr);
mach_write_to_2(log_ptr, n);
log_ptr += 2;
mach_write_to_2(log_ptr,
@ -447,7 +452,8 @@ mlog_open_and_write_index(
type = dict_col_get_type(dict_field_get_col(field));
len = field->fixed_len;
ut_ad(len < 0x7fff);
if (len == 0 && (dtype_get_len(type) > 255
if (len == 0
&& (dtype_get_len(type) > 255
|| dtype_get_mtype(type) == DATA_BLOB)) {
/* variable-length field
with maximum length > 255 */
@ -519,9 +525,9 @@ mlog_parse_index(
n = n_uniq = 1;
}
table = dict_mem_table_create("LOG_DUMMY", DICT_HDR_SPACE, n,
comp ? DICT_TF_COMPACT : 0);
comp ? DICT_TF_COMPACT : 0);
ind = dict_mem_index_create("LOG_DUMMY", "LOG_DUMMY",
DICT_HDR_SPACE, 0, n);
DICT_HDR_SPACE, 0, n);
ind->table = table;
ind->n_uniq = n_uniq;
if (n_uniq != n) {
@ -535,14 +541,14 @@ mlog_parse_index(
/* The high-order bit of len is the NOT NULL flag;
the rest is 0 or 0x7fff for variable-length fields,
and 1..0x7ffe for fixed-length fields. */
dict_mem_table_add_col(table, "DUMMY",
((len + 1) & 0x7fff) <= 1
? DATA_BINARY
: DATA_FIXBINARY,
len & 0x8000 ? DATA_NOT_NULL : 0,
len & 0x7fff, 0);
dict_index_add_col(ind,
dict_table_get_nth_col(table, i), 0);
dict_mem_table_add_col
(table, "DUMMY",
((len + 1) & 0x7fff) <= 1
? DATA_BINARY : DATA_FIXBINARY,
len & 0x8000 ? DATA_NOT_NULL : 0,
len & 0x7fff, 0);
dict_index_add_col
(ind, dict_table_get_nth_col(table, i), 0);
}
ptr += 2;
}

View file

@ -90,7 +90,7 @@ mtr_memo_pop_all(
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_COMMITTING); /* Currently only used in
commit */
commit */
memo = &(mtr->memo);
offset = dyn_array_get_data_size(memo);
@ -126,13 +126,14 @@ mtr_log_reserve_and_write(
if (mtr->n_log_recs > 1) {
mlog_catenate_ulint(mtr, MLOG_MULTI_REC_END, MLOG_1BYTE);
} else {
*first_data = (byte)((ulint)*first_data | MLOG_SINGLE_REC_FLAG);
*first_data = (byte)((ulint)*first_data
| MLOG_SINGLE_REC_FLAG);
}
if (mlog->heap == NULL) {
mtr->end_lsn = log_reserve_and_write_fast(first_data,
dyn_block_get_used(mlog),
&(mtr->start_lsn), &success);
mtr->end_lsn = log_reserve_and_write_fast
(first_data, dyn_block_get_used(mlog),
&(mtr->start_lsn), &success);
if (success) {
return;
@ -150,7 +151,7 @@ mtr_log_reserve_and_write(
while (block != NULL) {
log_write_low(dyn_block_get_data(block),
dyn_block_get_used(block));
dyn_block_get_used(block));
block = dyn_array_get_next_block(mlog, block);
}
} else {
@ -284,9 +285,9 @@ mtr_read_ulint(
{
ut_ad(mtr->state == MTR_ACTIVE);
ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr),
MTR_MEMO_PAGE_S_FIX) ||
mtr_memo_contains(mtr, buf_block_align(ptr),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_S_FIX) ||
mtr_memo_contains(mtr, buf_block_align(ptr),
MTR_MEMO_PAGE_X_FIX));
if (type == MLOG_1BYTE) {
return(mach_read_from_1(ptr));
} else if (type == MLOG_2BYTES) {
@ -311,9 +312,9 @@ mtr_read_dulint(
ut_ad(mtr->state == MTR_ACTIVE);
ut_ad(ptr && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr),
MTR_MEMO_PAGE_S_FIX) ||
mtr_memo_contains(mtr, buf_block_align(ptr),
MTR_MEMO_PAGE_X_FIX));
MTR_MEMO_PAGE_S_FIX) ||
mtr_memo_contains(mtr, buf_block_align(ptr),
MTR_MEMO_PAGE_X_FIX));
return(mach_read_from_8(ptr));
}
@ -326,7 +327,8 @@ mtr_print(
mtr_t* mtr) /* in: mtr */
{
fprintf(stderr,
"Mini-transaction handle: memo size %lu bytes log size %lu bytes\n",
"Mini-transaction handle: memo size %lu bytes"
" log size %lu bytes\n",
(ulong) dyn_array_get_data_size(&(mtr->memo)),
(ulong) dyn_array_get_data_size(&(mtr->log)));
}

File diff suppressed because it is too large Load diff

View file

@ -90,8 +90,8 @@ os_awe_enable_lock_pages_in_mem(void)
#elif defined(__WIN2000__)
struct {
DWORD Count;
LUID_AND_ATTRIBUTES Privilege[1];
DWORD Count;
LUID_AND_ATTRIBUTES Privilege[1];
} Info;
HANDLE hProcess;
HANDLE Token;
@ -102,7 +102,7 @@ os_awe_enable_lock_pages_in_mem(void)
/* Open the token of the current process */
Result = OpenProcessToken(hProcess,
TOKEN_ADJUST_PRIVILEGES, &Token);
TOKEN_ADJUST_PRIVILEGES, &Token);
if (Result != TRUE) {
fprintf(stderr,
"InnoDB: AWE: Cannot open process token, error %lu\n",
@ -118,10 +118,11 @@ os_awe_enable_lock_pages_in_mem(void)
privilege */
Result = LookupPrivilegeValue(NULL, SE_LOCK_MEMORY_NAME,
&(Info.Privilege[0].Luid));
&(Info.Privilege[0].Luid));
if (Result != TRUE) {
fprintf(stderr,
"InnoDB: AWE: Cannot get local privilege value for %s, error %lu.\n",
"InnoDB: AWE: Cannot get local privilege"
" value for %s, error %lu.\n",
SE_LOCK_MEMORY_NAME, (ulint)GetLastError());
return(FALSE);
@ -130,23 +131,29 @@ os_awe_enable_lock_pages_in_mem(void)
/* Try to adjust the privilege */
Result = AdjustTokenPrivileges(Token, FALSE,
(PTOKEN_PRIVILEGES)&Info,
0, NULL, NULL);
(PTOKEN_PRIVILEGES)&Info,
0, NULL, NULL);
/* Check the result */
if (Result != TRUE) {
fprintf(stderr,
"InnoDB: AWE: Cannot adjust process token privileges, error %u.\n",
"InnoDB: AWE: Cannot adjust process token privileges,"
" error %u.\n",
GetLastError());
return(FALSE);
} else if (GetLastError() != ERROR_SUCCESS) {
fprintf(stderr,
"InnoDB: AWE: Cannot enable SE_LOCK_MEMORY privilege, error %lu.\n"
"InnoDB: In Windows XP Home you cannot use AWE. In Windows 2000 and XP\n"
"InnoDB: Professional you must go to the Control Panel, to\n"
"InnoDB: Security Settings, to Local Policies, and enable\n"
"InnoDB: the 'lock pages in memory' privilege for the user who runs\n"
"InnoDB: the MySQL server.\n", GetLastError());
"InnoDB: AWE: Cannot enable SE_LOCK_MEMORY privilege,"
" error %lu.\n"
"InnoDB: In Windows XP Home you cannot use AWE."
" In Windows 2000 and XP\n"
"InnoDB: Professional you must go to the"
" Control Panel, to\n"
"InnoDB: Security Settings, to Local Policies,"
" and enable\n"
"InnoDB: the 'lock pages in memory' privilege"
" for the user who runs\n"
"InnoDB: the MySQL server.\n", GetLastError());
return(FALSE);
}
@ -157,7 +164,8 @@ os_awe_enable_lock_pages_in_mem(void)
#else
#ifdef __WIN__
fprintf(stderr,
"InnoDB: AWE: Error: to use AWE you must use a ...-nt MySQL executable.\n");
"InnoDB: AWE: Error: to use AWE you must use"
" a ...-nt MySQL executable.\n");
#endif
return(FALSE);
#endif
@ -178,12 +186,12 @@ os_awe_allocate_physical_mem(
ulint n_megabytes) /* in: number of megabytes to allocate */
{
#ifdef UNIV_SIMULATE_AWE
os_awe_simulate_page_info = ut_malloc(sizeof(os_awe_t) *
n_megabytes * ((1024 * 1024) / OS_AWE_X86_PAGE_SIZE));
os_awe_simulate_page_info = ut_malloc
(sizeof(os_awe_t) * n_megabytes
* ((1024 * 1024) / OS_AWE_X86_PAGE_SIZE));
os_awe_simulate_mem = ut_align(ut_malloc(
4096 + 1024 * 1024 * n_megabytes),
4096);
os_awe_simulate_mem
= ut_align(ut_malloc(4096 + 1024 * 1024 * n_megabytes), 4096);
os_awe_simulate_mem_size = n_megabytes * 1024 * 1024;
*page_info = os_awe_simulate_page_info;
@ -204,8 +212,9 @@ os_awe_allocate_physical_mem(
if (n_megabytes > 64 * 1024) {
fprintf(stderr,
"InnoDB: AWE: Error: tried to allocate %lu MB.\n"
"InnoDB: AWE cannot allocate more than 64 GB in any computer.\n", n_megabytes);
"InnoDB: AWE: Error: tried to allocate %lu MB.\n"
"InnoDB: AWE cannot allocate more than"
" 64 GB in any computer.\n", n_megabytes);
return(FALSE);
}
@ -214,8 +223,10 @@ os_awe_allocate_physical_mem(
if ((ulint)OS_AWE_X86_PAGE_SIZE != (ulint)sSysInfo.dwPageSize) {
fprintf(stderr,
"InnoDB: AWE: Error: this computer has a page size of %lu.\n"
"InnoDB: Should be 4096 bytes for InnoDB AWE support to work.\n",
"InnoDB: AWE: Error: this computer has a page size"
" of %lu.\n"
"InnoDB: Should be 4096 bytes for"
" InnoDB AWE support to work.\n",
(ulint)sSysInfo.dwPageSize);
return(FALSE);
@ -233,7 +244,8 @@ os_awe_allocate_physical_mem(
if (*page_info == NULL) {
fprintf(stderr,
"InnoDB: AWE: Failed to allocate page info array from process heap, error %lu\n",
"InnoDB: AWE: Failed to allocate page info"
" array from process heap, error %lu\n",
(ulint)GetLastError());
return(FALSE);
@ -259,10 +271,11 @@ os_awe_allocate_physical_mem(
defined, see the note at the start of this file */
bResult = AllocateUserPhysicalPages(GetCurrentProcess(),
&NumberOfPages, *page_info);
&NumberOfPages, *page_info);
if (bResult != TRUE) {
fprintf(stderr,
"InnoDB: AWE: Cannot allocate physical pages, error %lu.\n",
"InnoDB: AWE: Cannot allocate physical pages,"
" error %lu.\n",
(ulint)GetLastError());
return(FALSE);
@ -270,14 +283,19 @@ os_awe_allocate_physical_mem(
if (NumberOfPagesInitial != NumberOfPages) {
fprintf(stderr,
"InnoDB: AWE: Error: allocated only %lu pages of %lu requested.\n"
"InnoDB: Check that you have enough free RAM.\n"
"InnoDB: In Windows XP Professional and 2000 Professional\n"
"InnoDB: Windows PAE size is max 4 GB. In 2000 and .NET\n"
"InnoDB: Advanced Servers and 2000 Datacenter Server it is 32 GB,\n"
"InnoDB: and in .NET Datacenter Server it is 64 GB.\n"
"InnoDB: A Microsoft web page said that the processor must be an Intel\n"
"InnoDB: processor.\n",
"InnoDB: AWE: Error: allocated only %lu pages"
" of %lu requested.\n"
"InnoDB: Check that you have enough free RAM.\n"
"InnoDB: In Windows XP Professional and"
" 2000 Professional\n"
"InnoDB: Windows PAE size is max 4 GB."
" In 2000 and .NET\n"
"InnoDB: Advanced Servers and 2000 Datacenter Server"
" it is 32 GB,\n"
"InnoDB: and in .NET Datacenter Server it is 64 GB.\n"
"InnoDB: A Microsoft web page said that"
" the processor must be an Intel\n"
"InnoDB: processor.\n",
(ulint)NumberOfPages,
(ulint)NumberOfPagesInitial);
@ -285,7 +303,8 @@ os_awe_allocate_physical_mem(
}
fprintf(stderr,
"InnoDB: Using Address Windowing Extensions (AWE); allocated %lu MB\n",
"InnoDB: Using Address Windowing Extensions (AWE);"
" allocated %lu MB\n",
n_megabytes);
return(TRUE);
@ -328,17 +347,19 @@ os_awe_allocate_virtual_mem_window(
if (size > (ulint)0x7FFFFFFFUL) {
fprintf(stderr,
"InnoDB: AWE: Cannot allocate %lu bytes of virtual memory\n", size);
"InnoDB: AWE: Cannot allocate %lu bytes"
" of virtual memory\n", size);
return(NULL);
}
ptr = VirtualAlloc(NULL, (SIZE_T)size, MEM_RESERVE | MEM_PHYSICAL,
PAGE_READWRITE);
PAGE_READWRITE);
if (ptr == NULL) {
fprintf(stderr,
"InnoDB: AWE: Cannot allocate %lu bytes of virtual memory, error %lu\n",
size, (ulint)GetLastError());
"InnoDB: AWE: Cannot allocate %lu bytes"
" of virtual memory, error %lu\n",
size, (ulint)GetLastError());
return(NULL);
}
@ -391,13 +412,13 @@ os_awe_map_physical_mem_to_window(
ut_a(ptr < os_awe_simulate_window + os_awe_simulate_window_size);
ut_a(page_info >= os_awe_simulate_page_info);
ut_a(page_info < os_awe_simulate_page_info +
(os_awe_simulate_mem_size / 4096));
(os_awe_simulate_mem_size / 4096));
/* First look if some other 'physical pages' are mapped at ptr,
and copy them back to where they were if yes */
map = os_awe_simulate_map
+ ((ulint)(ptr - os_awe_simulate_window)) / 4096;
+ ((ulint)(ptr - os_awe_simulate_window)) / 4096;
page = ptr;
for (i = 0; i < n_mem_pages; i++) {
@ -412,15 +433,15 @@ os_awe_map_physical_mem_to_window(
assume page_info is a segment of the array we created at the start */
phys_page = os_awe_simulate_mem
+ (ulint)(page_info - os_awe_simulate_page_info)
* 4096;
+ (ulint)(page_info - os_awe_simulate_page_info)
* 4096;
ut_memcpy(ptr, phys_page, n_mem_pages * 4096);
/* Update the map */
map = os_awe_simulate_map
+ ((ulint)(ptr - os_awe_simulate_window)) / 4096;
+ ((ulint)(ptr - os_awe_simulate_window)) / 4096;
for (i = 0; i < n_mem_pages; i++) {
*map = phys_page;
@ -439,29 +460,34 @@ os_awe_map_physical_mem_to_window(
if (!(ptr >= os_awe_window)) {
fprintf(stderr,
"InnoDB: AWE: Error: trying to map to address %lx but AWE window start %lx\n",
(ulint)ptr, (ulint)os_awe_window);
"InnoDB: AWE: Error: trying to map to address %lx"
" but AWE window start %lx\n",
(ulint)ptr, (ulint)os_awe_window);
ut_a(0);
}
if (!(ptr <= os_awe_window + os_awe_window_size - UNIV_PAGE_SIZE)) {
fprintf(stderr,
"InnoDB: AWE: Error: trying to map to address %lx but AWE window end %lx\n",
(ulint)ptr, (ulint)os_awe_window + os_awe_window_size);
"InnoDB: AWE: Error: trying to map to address %lx"
" but AWE window end %lx\n",
(ulint)ptr, (ulint)os_awe_window + os_awe_window_size);
ut_a(0);
}
if (!(page_info >= os_awe_page_info)) {
fprintf(stderr,
"InnoDB: AWE: Error: trying to map page info at %lx but array start %lx\n",
(ulint)page_info, (ulint)os_awe_page_info);
"InnoDB: AWE: Error: trying to map page info"
" at %lx but array start %lx\n",
(ulint)page_info, (ulint)os_awe_page_info);
ut_a(0);
}
if (!(page_info <= os_awe_page_info + (os_awe_n_pages - 4))) {
fprintf(stderr,
"InnoDB: AWE: Error: trying to map page info at %lx but array end %lx\n",
(ulint)page_info, (ulint)(os_awe_page_info + os_awe_n_pages));
"InnoDB: AWE: Error: trying to map page info"
" at %lx but array end %lx\n",
(ulint)page_info,
(ulint)(os_awe_page_info + os_awe_n_pages));
ut_a(0);
}
@ -470,9 +496,10 @@ os_awe_map_physical_mem_to_window(
if (bResult != TRUE) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: AWE: Mapping of %lu physical pages to address %lx failed,\n"
"InnoDB: error %lu.\n"
"InnoDB: Cannot continue operation.\n",
" InnoDB: AWE: Mapping of %lu physical pages"
" to address %lx failed,\n"
"InnoDB: error %lu.\n"
"InnoDB: Cannot continue operation.\n",
n_mem_pages, (ulint)ptr, (ulint)GetLastError());
exit(1);
}
@ -517,7 +544,7 @@ os_mem_alloc_nocache(
void* ptr;
ptr = VirtualAlloc(NULL, n, MEM_COMMIT,
PAGE_READWRITE | PAGE_NOCACHE);
PAGE_READWRITE | PAGE_NOCACHE);
ut_a(ptr);
return(ptr);
@ -541,47 +568,50 @@ os_mem_alloc_large(
the memory cannot be allocated */
{
#ifdef HAVE_LARGE_PAGES
ulint size;
int shmid;
void *ptr = NULL;
struct shmid_ds buf;
ulint size;
int shmid;
void *ptr = NULL;
struct shmid_ds buf;
if (!os_use_large_pages || !os_large_page_size) {
goto skip;
}
if (!os_use_large_pages || !os_large_page_size) {
goto skip;
}
#ifdef UNIV_LINUX
/* Align block size to os_large_page_size */
size = ((n - 1) & ~(os_large_page_size - 1)) + os_large_page_size;
/* Align block size to os_large_page_size */
size = ((n - 1) & ~(os_large_page_size - 1)) + os_large_page_size;
shmid = shmget(IPC_PRIVATE, (size_t)size, SHM_HUGETLB | SHM_R | SHM_W);
if (shmid < 0) {
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to allocate"
" %lu bytes. errno %d\n", n, errno);
} else {
ptr = shmat(shmid, NULL, 0);
if (ptr == (void *)-1) {
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to"
" attach shared memory segment, errno %d\n", errno);
}
shmid = shmget(IPC_PRIVATE, (size_t)size, SHM_HUGETLB | SHM_R | SHM_W);
if (shmid < 0) {
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to allocate"
" %lu bytes. errno %d\n", n, errno);
} else {
ptr = shmat(shmid, NULL, 0);
if (ptr == (void *)-1) {
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to"
" attach shared memory segment, errno %d\n",
errno);
}
/* Remove the shared memory segment so that it will be
automatically freed after memory is detached or process exits */
shmctl(shmid, IPC_RMID, &buf);
}
/* Remove the shared memory segment so that it will be
automatically freed after memory is detached or
process exits */
shmctl(shmid, IPC_RMID, &buf);
}
#endif
if (ptr) {
if (set_to_zero) {
if (ptr) {
if (set_to_zero) {
#ifdef UNIV_SET_MEM_TO_ZERO
memset(ptr, '\0', size);
memset(ptr, '\0', size);
#endif
}
}
return(ptr);
}
return(ptr);
}
fprintf(stderr, "InnoDB HugeTLB: Warning: Using conventional memory pool\n");
fprintf(stderr, "InnoDB HugeTLB: Warning: Using conventional"
" memory pool\n");
skip:
#endif /* HAVE_LARGE_PAGES */
@ -597,16 +627,16 @@ os_mem_free_large(
void *ptr) /* in: number of bytes */
{
#ifdef HAVE_LARGE_PAGES
if (os_use_large_pages && os_large_page_size
if (os_use_large_pages && os_large_page_size
#ifdef UNIV_LINUX
&& !shmdt(ptr)
&& !shmdt(ptr)
#endif
) {
return;
}
) {
return;
}
#endif
ut_free(ptr);
ut_free(ptr);
}
/********************************************************************
@ -632,11 +662,12 @@ os_process_set_priority_boost(
# error "TRUE != 1"
#endif
/* Does not do anything currently!
/* Does not do anything currently!
SetProcessPriorityBoost(GetCurrentProcess(), no_boost);
*/
fputs("Warning: process priority boost setting currently not functional!\n",
stderr);
*/
fputs("Warning: process priority boost setting"
" currently not functional!\n",
stderr);
#else
UT_NOT_USED(do_boost);
#endif

View file

@ -90,8 +90,8 @@ os_sync_free(void)
while (mutex) {
if (mutex == os_sync_mutex) {
/* Set the flag to FALSE so that we do not try to
reserve os_sync_mutex any more in remaining freeing
operations in shutdown */
reserve os_sync_mutex any more in remaining freeing
operations in shutdown */
os_sync_mutex_inited = FALSE;
}
@ -118,14 +118,15 @@ os_event_create(
event = ut_malloc(sizeof(struct os_event_struct));
event->handle = CreateEvent(NULL,/* No security attributes */
TRUE, /* Manual reset */
FALSE, /* Initial state nonsignaled */
(LPCTSTR) name);
event->handle = CreateEvent(NULL, /* No security attributes */
TRUE, /* Manual reset */
FALSE, /* Initial state nonsignaled */
(LPCTSTR) name);
if (!event->handle) {
fprintf(stderr,
"InnoDB: Could not create a Windows event semaphore; Windows error %lu\n",
(ulong) GetLastError());
"InnoDB: Could not create a Windows event semaphore;"
" Windows error %lu\n",
(ulong) GetLastError());
}
#else /* Unix */
os_event_t event;
@ -138,7 +139,7 @@ os_event_create(
#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10)
ut_a(0 == pthread_cond_init(&(event->cond_var),
pthread_condattr_default));
pthread_condattr_default));
#else
ut_a(0 == pthread_cond_init(&(event->cond_var), NULL));
#endif
@ -174,15 +175,16 @@ os_event_create_auto(
event = ut_malloc(sizeof(struct os_event_struct));
event->handle = CreateEvent(NULL,/* No security attributes */
FALSE, /* Auto-reset */
FALSE, /* Initial state nonsignaled */
(LPCTSTR) name);
event->handle = CreateEvent(NULL, /* No security attributes */
FALSE, /* Auto-reset */
FALSE, /* Initial state nonsignaled */
(LPCTSTR) name);
if (!event->handle) {
fprintf(stderr,
"InnoDB: Could not create a Windows auto event semaphore; Windows error %lu\n",
(ulong) GetLastError());
"InnoDB: Could not create a Windows auto"
" event semaphore; Windows error %lu\n",
(ulong) GetLastError());
}
/* Put to the list of events */
@ -320,7 +322,7 @@ os_event_wait(
for (;;) {
if (event->is_set == TRUE
|| event->signal_count != old_signal_count) {
|| event->signal_count != old_signal_count) {
os_fast_mutex_unlock(&(event->os_mutex));
@ -409,9 +411,9 @@ os_event_wait_multiple(
ut_a(n > 0);
index = WaitForMultipleObjects((DWORD) n, native_event_array,
FALSE, /* Wait for any 1 event */
INFINITE); /* Infinite wait time
limit */
FALSE, /* Wait for any 1 event */
INFINITE); /* Infinite wait time
limit */
ut_a(index >= WAIT_OBJECT_0); /* NOTE: Pointless comparision */
ut_a(index < WAIT_OBJECT_0 + n);
@ -439,8 +441,8 @@ os_mutex_create(
os_mutex_t mutex_str;
mutex = CreateMutex(NULL, /* No security attributes */
FALSE, /* Initial state: no owner */
(LPCTSTR) name);
FALSE, /* Initial state: no owner */
(LPCTSTR) name);
ut_a(mutex);
#else
os_fast_mutex_t* mutex;
@ -638,10 +640,11 @@ os_fast_mutex_free(
if (ret != 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: error: return value %lu when calling\n"
"InnoDB: pthread_mutex_destroy().\n", (ulint)ret);
" InnoDB: error: return value %lu when calling\n"
"InnoDB: pthread_mutex_destroy().\n", (ulint)ret);
fprintf(stderr,
"InnoDB: Byte contents of the pthread mutex at %p:\n", (void*) fast_mutex);
"InnoDB: Byte contents of the pthread mutex at %p:\n",
(void*) fast_mutex);
ut_print_buf(stderr, fast_mutex, sizeof(os_fast_mutex_t));
fprintf(stderr, "\n");
}

View file

@ -107,11 +107,11 @@ os_thread_create(
os_mutex_exit(os_sync_mutex);
thread = CreateThread(NULL, /* no security attributes */
0, /* default size stack */
(LPTHREAD_START_ROUTINE)start_f,
arg,
0, /* thread runs immediately */
&win_thread_id);
0, /* default size stack */
(LPTHREAD_START_ROUTINE)start_f,
arg,
0, /* thread runs immediately */
&win_thread_id);
if (srv_set_thread_priorities) {
@ -142,21 +142,23 @@ os_thread_create(
AIX is always big enough. An empirical test on AIX-4.3 suggested
the size was 96 kB, though. */
ret = pthread_attr_setstacksize(&attr,
(size_t)(PTHREAD_STACK_MIN + 32 * 1024));
ret = pthread_attr_setstacksize
(&attr, (size_t)(PTHREAD_STACK_MIN + 32 * 1024));
if (ret) {
fprintf(stderr,
"InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
exit(1);
fprintf(stderr,
"InnoDB: Error: pthread_attr_setstacksize"
" returned %d\n", ret);
exit(1);
}
#endif
#ifdef __NETWARE__
ret = pthread_attr_setstacksize(&attr,
(size_t) NW_THD_STACKSIZE);
if (ret) {
fprintf(stderr,
"InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
exit(1);
fprintf(stderr,
"InnoDB: Error: pthread_attr_setstacksize"
" returned %d\n", ret);
exit(1);
}
#endif
os_mutex_enter(os_sync_mutex);
@ -169,9 +171,9 @@ os_thread_create(
ret = pthread_create(&pthread, &attr, start_f, arg);
#endif
if (ret) {
fprintf(stderr,
"InnoDB: Error: pthread_create returned %d\n", ret);
exit(1);
fprintf(stderr,
"InnoDB: Error: pthread_create returned %d\n", ret);
exit(1);
}
#if !(defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10))
@ -220,7 +222,7 @@ os_thread_join(
/*===========*/
os_thread_id_t thread_id) /* in: id of the thread to join */
{
return(pthread_join(thread_id, NULL));
return(pthread_join(thread_id, NULL));
}
#endif
/*********************************************************************

View file

@ -66,29 +66,29 @@ page_cur_try_search_shortcut(
rec = page_header_get_ptr(page, PAGE_LAST_INSERT);
offsets = rec_get_offsets(rec, index, offsets,
dtuple_get_n_fields(tuple), &heap);
dtuple_get_n_fields(tuple), &heap);
ut_ad(rec);
ut_ad(page_rec_is_user_rec(rec));
ut_pair_min(&low_match, &low_bytes,
*ilow_matched_fields, *ilow_matched_bytes,
*iup_matched_fields, *iup_matched_bytes);
*ilow_matched_fields, *ilow_matched_bytes,
*iup_matched_fields, *iup_matched_bytes);
up_match = low_match;
up_bytes = low_bytes;
if (page_cmp_dtuple_rec_with_match(tuple, rec, offsets,
&low_match, &low_bytes) < 0) {
&low_match, &low_bytes) < 0) {
goto exit_func;
}
next_rec = page_rec_get_next(rec);
offsets = rec_get_offsets(next_rec, index, offsets,
dtuple_get_n_fields(tuple), &heap);
dtuple_get_n_fields(tuple), &heap);
if (page_cmp_dtuple_rec_with_match(tuple, next_rec, offsets,
&up_match, &up_bytes) >= 0) {
&up_match, &up_bytes) >= 0) {
goto exit_func;
}
@ -96,11 +96,11 @@ page_cur_try_search_shortcut(
#ifdef UNIV_SEARCH_DEBUG
page_cur_search_with_match(page, index, tuple, PAGE_CUR_DBG,
iup_matched_fields,
iup_matched_bytes,
ilow_matched_fields,
ilow_matched_bytes,
&cursor2);
iup_matched_fields,
iup_matched_bytes,
ilow_matched_fields,
ilow_matched_bytes,
&cursor2);
ut_a(cursor2.rec == cursor->rec);
if (next_rec != page_get_supremum_rec(page)) {
@ -163,20 +163,20 @@ page_cur_rec_field_extends(
rec_f = rec_get_nth_field(rec, offsets, n, &rec_f_len);
if (type->mtype == DATA_VARCHAR
|| type->mtype == DATA_CHAR
|| type->mtype == DATA_FIXBINARY
|| type->mtype == DATA_BINARY
|| type->mtype == DATA_BLOB
|| type->mtype == DATA_VARMYSQL
|| type->mtype == DATA_MYSQL) {
|| type->mtype == DATA_CHAR
|| type->mtype == DATA_FIXBINARY
|| type->mtype == DATA_BINARY
|| type->mtype == DATA_BLOB
|| type->mtype == DATA_VARMYSQL
|| type->mtype == DATA_MYSQL) {
if (dfield_get_len(dfield) != UNIV_SQL_NULL
&& rec_f_len != UNIV_SQL_NULL
&& rec_f_len >= dfield_get_len(dfield)
&& 0 == cmp_data_data_slow(type,
dfield_get_data(dfield),
dfield_get_len(dfield),
rec_f, dfield_get_len(dfield))) {
&& rec_f_len != UNIV_SQL_NULL
&& rec_f_len >= dfield_get_len(dfield)
&& !cmp_data_data_slow(type,
dfield_get_data(dfield),
dfield_get_len(dfield),
rec_f, dfield_get_len(dfield))) {
return(TRUE);
}
@ -236,7 +236,7 @@ page_cur_search_with_match(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_ad(page && tuple && iup_matched_fields && iup_matched_bytes
&& ilow_matched_fields && ilow_matched_bytes && cursor);
&& ilow_matched_fields && ilow_matched_bytes && cursor);
ut_ad(dtuple_validate(tuple));
ut_ad(dtuple_check_typed(tuple));
#ifdef UNIV_DEBUG
@ -246,23 +246,24 @@ page_cur_search_with_match(
# ifdef PAGE_CUR_LE_OR_EXTENDS
if (mode != PAGE_CUR_LE_OR_EXTENDS)
# endif /* PAGE_CUR_LE_OR_EXTENDS */
ut_ad((mode == PAGE_CUR_L) || (mode == PAGE_CUR_LE)
|| (mode == PAGE_CUR_G) || (mode == PAGE_CUR_GE));
ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE
|| mode == PAGE_CUR_G || mode == PAGE_CUR_GE);
#endif /* UNIV_DEBUG */
page_check_dir(page);
#ifdef PAGE_CUR_ADAPT
if ((page_header_get_field(page, PAGE_LEVEL) == 0)
&& (mode == PAGE_CUR_LE)
&& (page_header_get_field(page, PAGE_N_DIRECTION) > 3)
&& (page_header_get_ptr(page, PAGE_LAST_INSERT))
&& (page_header_get_field(page, PAGE_DIRECTION) == PAGE_RIGHT)) {
&& (mode == PAGE_CUR_LE)
&& (page_header_get_field(page, PAGE_N_DIRECTION) > 3)
&& (page_header_get_ptr(page, PAGE_LAST_INSERT))
&& (page_header_get_field(page, PAGE_DIRECTION) == PAGE_RIGHT)) {
if (page_cur_try_search_shortcut(page, index, tuple,
iup_matched_fields, iup_matched_bytes,
ilow_matched_fields, ilow_matched_bytes,
cursor)) {
if (page_cur_try_search_shortcut
(page, index, tuple,
iup_matched_fields, iup_matched_bytes,
ilow_matched_fields, ilow_matched_bytes,
cursor)) {
return;
}
}
@ -306,11 +307,12 @@ page_cur_search_with_match(
mid_rec = page_dir_slot_get_rec(slot);
ut_pair_min(&cur_matched_fields, &cur_matched_bytes,
low_matched_fields, low_matched_bytes,
up_matched_fields, up_matched_bytes);
low_matched_fields, low_matched_bytes,
up_matched_fields, up_matched_bytes);
offsets = rec_get_offsets(mid_rec, index, offsets,
dtuple_get_n_fields_cmp(tuple), &heap);
dtuple_get_n_fields_cmp(tuple),
&heap);
cmp = cmp_dtuple_rec_with_match(tuple, mid_rec, offsets,
&cur_matched_fields,
@ -321,11 +323,11 @@ low_slot_match:
low_matched_fields = cur_matched_fields;
low_matched_bytes = cur_matched_bytes;
} else if (UNIV_LIKELY(cmp /* == -1 */)) {
} else if (UNIV_EXPECT(cmp, -1)) {
#ifdef PAGE_CUR_LE_OR_EXTENDS
if (mode == PAGE_CUR_LE_OR_EXTENDS
&& page_cur_rec_field_extends(tuple, mid_rec,
offsets, cur_matched_fields)) {
&& page_cur_rec_field_extends
(tuple, mid_rec, offsets, cur_matched_fields)) {
goto low_slot_match;
}
@ -339,7 +341,7 @@ up_slot_match:
#ifdef PAGE_CUR_LE_OR_EXTENDS
|| mode == PAGE_CUR_LE_OR_EXTENDS
#endif /* PAGE_CUR_LE_OR_EXTENDS */
) {
) {
goto low_slot_match;
} else {
@ -361,11 +363,12 @@ up_slot_match:
mid_rec = page_rec_get_next(low_rec);
ut_pair_min(&cur_matched_fields, &cur_matched_bytes,
low_matched_fields, low_matched_bytes,
up_matched_fields, up_matched_bytes);
low_matched_fields, low_matched_bytes,
up_matched_fields, up_matched_bytes);
offsets = rec_get_offsets(mid_rec, index, offsets,
dtuple_get_n_fields_cmp(tuple), &heap);
dtuple_get_n_fields_cmp(tuple),
&heap);
cmp = cmp_dtuple_rec_with_match(tuple, mid_rec, offsets,
&cur_matched_fields,
@ -376,11 +379,11 @@ low_rec_match:
low_matched_fields = cur_matched_fields;
low_matched_bytes = cur_matched_bytes;
} else if (UNIV_LIKELY(cmp /* == -1 */)) {
} else if (UNIV_EXPECT(cmp, -1)) {
#ifdef PAGE_CUR_LE_OR_EXTENDS
if (mode == PAGE_CUR_LE_OR_EXTENDS
&& page_cur_rec_field_extends(tuple, mid_rec,
offsets, cur_matched_fields)) {
&& page_cur_rec_field_extends
(tuple, mid_rec, offsets, cur_matched_fields)) {
goto low_rec_match;
}
@ -393,7 +396,7 @@ up_rec_match:
#ifdef PAGE_CUR_LE_OR_EXTENDS
|| mode == PAGE_CUR_LE_OR_EXTENDS
#endif /* PAGE_CUR_LE_OR_EXTENDS */
) {
) {
goto low_rec_match;
} else {
@ -410,10 +413,10 @@ up_rec_match:
dbg_matched_bytes = 0;
offsets = rec_get_offsets(low_rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
dbg_cmp = page_cmp_dtuple_rec_with_match(tuple, low_rec, offsets,
&dbg_matched_fields,
&dbg_matched_bytes);
&dbg_matched_fields,
&dbg_matched_bytes);
if (mode == PAGE_CUR_G) {
ut_a(dbg_cmp >= 0);
} else if (mode == PAGE_CUR_GE) {
@ -434,10 +437,10 @@ up_rec_match:
dbg_matched_bytes = 0;
offsets = rec_get_offsets(up_rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
dbg_cmp = page_cmp_dtuple_rec_with_match(tuple, up_rec, offsets,
&dbg_matched_fields,
&dbg_matched_bytes);
&dbg_matched_fields,
&dbg_matched_bytes);
if (mode == PAGE_CUR_G) {
ut_a(dbg_cmp == -1);
} else if (mode == PAGE_CUR_GE) {
@ -533,7 +536,7 @@ page_cur_insert_rec_write_log(
ut_a(rec_size < UNIV_PAGE_SIZE);
ut_ad(buf_frame_align(insert_rec) == buf_frame_align(cursor_rec));
ut_ad(!page_rec_is_comp(insert_rec)
== !dict_table_is_comp(index->table));
== !dict_table_is_comp(index->table));
comp = page_rec_is_comp(insert_rec);
{
@ -548,9 +551,9 @@ page_cur_insert_rec_write_log(
*ins_offs_ = (sizeof ins_offs_) / sizeof *ins_offs_;
cur_offs = rec_get_offsets(cursor_rec, index, cur_offs_,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
ins_offs = rec_get_offsets(insert_rec, index, ins_offs_,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
extra_size = rec_offs_extra_size(ins_offs);
cur_extra_size = rec_offs_extra_size(cur_offs);
@ -583,9 +586,10 @@ page_cur_insert_rec_write_log(
ins_ptr++;
cur_ptr++;
} else if ((i < extra_size)
&& (i >= extra_size - (comp
? REC_N_NEW_EXTRA_BYTES
: REC_N_OLD_EXTRA_BYTES))) {
&& (i >= extra_size
- (comp
? REC_N_NEW_EXTRA_BYTES
: REC_N_OLD_EXTRA_BYTES))) {
i = extra_size;
ins_ptr = insert_rec;
cur_ptr = cursor_rec;
@ -598,9 +602,11 @@ page_cur_insert_rec_write_log(
if (mtr_get_log_mode(mtr) != MTR_LOG_SHORT_INSERTS) {
log_ptr = mlog_open_and_write_index(mtr, insert_rec, index,
comp
? MLOG_COMP_REC_INSERT : MLOG_REC_INSERT,
2 + 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN);
comp
? MLOG_COMP_REC_INSERT
: MLOG_REC_INSERT,
2 + 5 + 1 + 5 + 5
+ MLOG_BUF_MARGIN);
if (!log_ptr) {
/* Logging in mtr is switched off during crash
@ -611,7 +617,7 @@ page_cur_insert_rec_write_log(
log_end = &log_ptr[2 + 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN];
/* Write the cursor rec offset as a 2-byte ulint */
mach_write_to_2(log_ptr, cursor_rec
- buf_frame_align(cursor_rec));
- buf_frame_align(cursor_rec));
log_ptr += 2;
} else {
log_ptr = mlog_open(mtr, 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN);
@ -624,9 +630,9 @@ page_cur_insert_rec_write_log(
}
if ((rec_get_info_and_status_bits(insert_rec, comp) !=
rec_get_info_and_status_bits(cursor_rec, comp))
|| (extra_size != cur_extra_size)
|| (rec_size != cur_rec_size)) {
rec_get_info_and_status_bits(cursor_rec, comp))
|| (extra_size != cur_extra_size)
|| (rec_size != cur_rec_size)) {
extra_info_yes = 1;
} else {
@ -636,11 +642,12 @@ page_cur_insert_rec_write_log(
/* Write the record end segment length and the extra info storage
flag */
log_ptr += mach_write_compressed(log_ptr, 2 * (rec_size - i)
+ extra_info_yes);
+ extra_info_yes);
if (extra_info_yes) {
/* Write the info bits */
mach_write_to_1(log_ptr,
rec_get_info_and_status_bits(insert_rec, comp));
mach_write_to_1
(log_ptr,
rec_get_info_and_status_bits(insert_rec, comp));
log_ptr++;
/* Write the record origin offset */
@ -786,11 +793,11 @@ page_cur_parse_insert_rec(
}
offsets = rec_get_offsets(cursor_rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
if (extra_info_yes == 0) {
info_and_status_bits = rec_get_info_and_status_bits(
cursor_rec, page_is_comp(page));
info_and_status_bits = rec_get_info_and_status_bits
(cursor_rec, page_is_comp(page));
origin_offset = rec_offs_extra_size(offsets);
mismatch_index = rec_offs_size(offsets) - end_seg_len;
}
@ -827,12 +834,12 @@ page_cur_parse_insert_rec(
ut_memcpy(buf + mismatch_index, ptr, end_seg_len);
rec_set_info_and_status_bits(buf + origin_offset, page_is_comp(page),
info_and_status_bits);
info_and_status_bits);
page_cur_position(cursor_rec, &cursor);
offsets = rec_get_offsets(buf + origin_offset, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
page_cur_rec_insert(&cursor, buf + origin_offset, index, offsets, mtr);
if (buf != buf1) {
@ -868,9 +875,11 @@ page_cur_insert_rec_low(
byte* insert_buf = NULL;
ulint rec_size;
byte* page; /* the relevant page */
rec_t* last_insert; /* cursor position at previous insert */
rec_t* last_insert; /* cursor position at previous
insert */
rec_t* insert_rec; /* inserted record */
ulint heap_no; /* heap number of the inserted record */
ulint heap_no; /* heap number of the inserted
record */
rec_t* current_rec; /* current record after which the
new record is inserted */
rec_t* next_rec; /* next record after current before
@ -899,7 +908,7 @@ page_cur_insert_rec_low(
} else {
if (!offsets) {
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
}
ut_ad(rec_offs_validate(rec, index, offsets));
rec_size = rec_offs_size(offsets);
@ -918,9 +927,9 @@ page_cur_insert_rec_low(
/* 3. Create the record */
if (tuple != NULL) {
insert_rec = rec_convert_dtuple_to_rec(insert_buf,
index, tuple);
index, tuple);
offsets = rec_get_offsets(insert_rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
} else {
insert_rec = rec_copy(insert_buf, rec, offsets);
ut_ad(rec_offs_validate(rec, index, offsets));
@ -953,26 +962,30 @@ page_cur_insert_rec_low(
last_insert = page_header_get_ptr(page, PAGE_LAST_INSERT);
ut_ad(!last_insert || !comp
|| rec_get_node_ptr_flag(last_insert)
== rec_get_node_ptr_flag(insert_rec));
|| rec_get_node_ptr_flag(last_insert)
== rec_get_node_ptr_flag(insert_rec));
if (last_insert == NULL) {
page_header_set_field(page, PAGE_DIRECTION, PAGE_NO_DIRECTION);
page_header_set_field(page, PAGE_N_DIRECTION, 0);
} else if ((last_insert == current_rec)
&& (page_header_get_field(page, PAGE_DIRECTION) != PAGE_LEFT)) {
&& (page_header_get_field(page, PAGE_DIRECTION)
!= PAGE_LEFT)) {
page_header_set_field(page, PAGE_DIRECTION, PAGE_RIGHT);
page_header_set_field(page, PAGE_N_DIRECTION,
page_header_get_field(page, PAGE_N_DIRECTION) + 1);
page_header_get_field
(page, PAGE_N_DIRECTION) + 1);
} else if ((page_rec_get_next(insert_rec) == last_insert)
&& (page_header_get_field(page, PAGE_DIRECTION) != PAGE_RIGHT)) {
&& (page_header_get_field(page, PAGE_DIRECTION)
!= PAGE_RIGHT)) {
page_header_set_field(page, PAGE_DIRECTION, PAGE_LEFT);
page_header_set_field(page, PAGE_N_DIRECTION,
page_header_get_field(page, PAGE_N_DIRECTION) + 1);
page_header_get_field
(page, PAGE_N_DIRECTION) + 1);
} else {
page_header_set_field(page, PAGE_DIRECTION, PAGE_NO_DIRECTION);
page_header_set_field(page, PAGE_N_DIRECTION, 0);
@ -997,7 +1010,7 @@ page_cur_insert_rec_low(
/* 9. Write log record of the insert */
page_cur_insert_rec_write_log(insert_rec, rec_size, current_rec,
index, mtr);
index, mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@ -1022,9 +1035,9 @@ page_copy_rec_list_to_created_page_write_log(
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
log_ptr = mlog_open_and_write_index(mtr, page, index,
page_is_comp(page)
? MLOG_COMP_LIST_END_COPY_CREATED
: MLOG_LIST_END_COPY_CREATED, 4);
page_is_comp(page)
? MLOG_COMP_LIST_END_COPY_CREATED
: MLOG_LIST_END_COPY_CREATED, 4);
ut_a(log_ptr);
mlog_close(mtr, log_ptr + 4);
@ -1069,7 +1082,7 @@ page_parse_copy_rec_list_to_created_page(
while (ptr < rec_end) {
ptr = page_cur_parse_insert_rec(TRUE, ptr, end_ptr,
index, page, mtr);
index, page, mtr);
}
ut_a(ptr == rec_end);
@ -1130,11 +1143,11 @@ page_copy_rec_list_end_to_created_page(
in the debug version */
page_dir_set_n_slots(new_page, UNIV_PAGE_SIZE / 2);
page_header_set_ptr(new_page, PAGE_HEAP_TOP,
new_page + UNIV_PAGE_SIZE - 1);
new_page + UNIV_PAGE_SIZE - 1);
#endif
log_ptr = page_copy_rec_list_to_created_page_write_log(new_page,
index, mtr);
index, mtr);
log_data_len = dyn_array_get_data_size(&(mtr->log));
@ -1155,7 +1168,7 @@ page_copy_rec_list_end_to_created_page(
/* should be do ... until, comment by Jani */
while (rec != page_get_supremum_rec(page)) {
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
insert_rec = rec_copy(heap_top, rec, offsets);
rec_set_next_offs(prev_rec, comp, insert_rec - new_page);
@ -1185,13 +1198,13 @@ page_copy_rec_list_end_to_created_page(
}
page_cur_insert_rec_write_log(insert_rec, rec_size, prev_rec,
index, mtr);
index, mtr);
prev_rec = insert_rec;
rec = page_rec_get_next(rec);
}
if ((slot_index > 0) && (count + 1
+ (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2
+ (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2
<= PAGE_DIR_SLOT_MAX_N_OWNED)) {
/* We can merge the two last dir slots. This operation is
here to make this function imitate exactly the equivalent
@ -1218,7 +1231,7 @@ page_copy_rec_list_end_to_created_page(
mach_write_to_4(log_ptr, log_data_len);
rec_set_next_offs(insert_rec, comp,
comp ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM);
comp ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM);
slot = page_dir_get_nth_slot(new_page, 1 + slot_index);
@ -1254,9 +1267,9 @@ page_cur_delete_rec_write_log(
ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
log_ptr = mlog_open_and_write_index(mtr, rec, index,
page_rec_is_comp(rec)
? MLOG_COMP_REC_DELETE
: MLOG_REC_DELETE, 2);
page_rec_is_comp(rec)
? MLOG_COMP_REC_DELETE
: MLOG_REC_DELETE, 2);
if (!log_ptr) {
/* Logging in mtr is switched off during crash recovery:
@ -1306,8 +1319,9 @@ page_cur_parse_delete_rec(
page_cur_position(rec, &cursor);
page_cur_delete_rec(&cursor, index,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap), mtr);
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),
mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@ -1390,7 +1404,7 @@ page_cur_delete_rec(
page_rec_set_next(prev_rec, next_rec);
page_header_set_field(page, PAGE_N_RECS,
(ulint)(page_get_n_recs(page) - 1));
(ulint)(page_get_n_recs(page) - 1));
/* 4. If the deleted record is pointed to by a dir slot, update the
record pointer in slot. In the following if-clause we assume that

View file

@ -104,9 +104,10 @@ page_dir_find_owner_slot(
if (UNIV_UNLIKELY(slot == first_slot)) {
fprintf(stderr,
"InnoDB: Probable data corruption on page %lu\n"
"InnoDB: Original record ",
(ulong) buf_frame_get_page_no(page));
"InnoDB: Probable data corruption on"
" page %lu\n"
"InnoDB: Original record ",
(ulong) buf_frame_get_page_no(page));
if (page_is_comp(page)) {
fputs("(compact record)", stderr);
@ -115,17 +116,17 @@ page_dir_find_owner_slot(
}
fputs("\n"
"InnoDB: on that page.\n"
"InnoDB: Cannot find the dir slot for record ",
stderr);
"InnoDB: on that page.\n"
"InnoDB: Cannot find the dir slot for record ",
stderr);
if (page_is_comp(page)) {
fputs("(compact record)", stderr);
} else {
rec_print_old(stderr, page
+ mach_decode_2(rec_offs_bytes));
+ mach_decode_2(rec_offs_bytes));
}
fputs("\n"
"InnoDB: on that page!\n", stderr);
"InnoDB: on that page!\n", stderr);
buf_page_print(page);
@ -163,7 +164,7 @@ page_dir_slot_check(
ut_a(page_rec_check(page_dir_slot_get_rec(slot)));
n_owned = rec_get_n_owned(page_dir_slot_get_rec(slot),
page_is_comp(page));
page_is_comp(page));
if (slot == page_dir_get_nth_slot(page, 0)) {
ut_a(n_owned == 1);
@ -242,17 +243,17 @@ page_mem_alloc(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
if (rec_offs_size(offsets) >= need) {
page_header_set_ptr(page, PAGE_FREE,
page_rec_get_next(rec));
page_rec_get_next(rec));
garbage = page_header_get_field(page, PAGE_GARBAGE);
ut_ad(garbage >= need);
page_header_set_field(page, PAGE_GARBAGE,
garbage - need);
garbage - need);
*heap_no = rec_get_heap_no(rec, page_is_comp(page));
@ -297,8 +298,9 @@ page_create_write_log(
mtr_t* mtr, /* in: mini-transaction handle */
ulint comp) /* in: nonzero=compact page format */
{
mlog_write_initial_log_record(frame,
comp ? MLOG_COMP_PAGE_CREATE : MLOG_PAGE_CREATE, mtr);
mlog_write_initial_log_record(frame, comp
? MLOG_COMP_PAGE_CREATE
: MLOG_PAGE_CREATE, mtr);
}
/***************************************************************
@ -379,7 +381,7 @@ page_create(
dfield_set_data(field, "infimum", 8);
dtype_set(dfield_get_type(field),
DATA_VARCHAR, DATA_ENGLISH | DATA_NOT_NULL, 8, 0);
DATA_VARCHAR, DATA_ENGLISH | DATA_NOT_NULL, 8, 0);
/* Set the corresponding physical record to its place in the page
record heap */
@ -388,12 +390,12 @@ page_create(
infimum_rec = rec_convert_dtuple_to_rec(heap_top, index, tuple);
ut_a(infimum_rec ==
page + (comp ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
page + (comp ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
rec_set_n_owned(infimum_rec, comp, 1);
rec_set_heap_no(infimum_rec, comp, 0);
offsets = rec_get_offsets(infimum_rec, index, NULL,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
heap_top = rec_get_end(infimum_rec, offsets);
@ -405,22 +407,22 @@ page_create(
dfield_set_data(field, "supremum", comp ? 8 : 9);
dtype_set(dfield_get_type(field),
DATA_VARCHAR, DATA_ENGLISH | DATA_NOT_NULL, comp ? 8 : 9, 0);
DATA_VARCHAR, DATA_ENGLISH | DATA_NOT_NULL, comp ? 8 : 9, 0);
supremum_rec = rec_convert_dtuple_to_rec(heap_top, index, tuple);
ut_a(supremum_rec ==
page + (comp ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM));
page + (comp ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM));
rec_set_n_owned(supremum_rec, comp, 1);
rec_set_heap_no(supremum_rec, comp, 1);
offsets = rec_get_offsets(supremum_rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
heap_top = rec_get_end(supremum_rec, offsets);
ut_ad(heap_top ==
page + (comp ? PAGE_NEW_SUPREMUM_END : PAGE_OLD_SUPREMUM_END));
page + (comp ? PAGE_NEW_SUPREMUM_END : PAGE_OLD_SUPREMUM_END));
mem_heap_free(heap);
@ -437,7 +439,7 @@ page_create(
page_header_set_field(page, PAGE_N_RECS, 0);
page_set_max_trx_id(page, ut_dulint_zero);
memset(heap_top, 0, UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START
- (heap_top - page));
- (heap_top - page));
/* 5. SET POINTERS IN RECORDS AND DIR SLOTS */
@ -486,11 +488,11 @@ page_copy_rec_list_end_no_locks(
}
ut_a((ibool)!!page_is_comp(new_page)
== dict_table_is_comp(index->table));
== dict_table_is_comp(index->table));
ut_a(page_is_comp(new_page) == page_is_comp(page));
ut_a(mach_read_from_2(new_page + UNIV_PAGE_SIZE - 10) == (ulint)
(page_is_comp(new_page)
? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
(page_is_comp(new_page)
? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
page_cur_set_before_first(new_page, &cur2);
@ -504,9 +506,9 @@ page_copy_rec_list_end_no_locks(
break;
}
offsets = rec_get_offsets(cur1_rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
if (UNIV_UNLIKELY(!page_cur_rec_insert(&cur2, cur1_rec, index,
offsets, mtr))) {
offsets, mtr))) {
/* Track an assertion failure reported on the mailing
list on June 18th, 2003 */
@ -515,7 +517,8 @@ page_copy_rec_list_end_no_locks(
ut_print_timestamp(stderr);
fprintf(stderr,
"InnoDB: rec offset %lu, cur1 offset %lu, cur2 offset %lu\n",
"InnoDB: rec offset %lu, cur1 offset %lu,"
" cur2 offset %lu\n",
(ulong)(rec - page),
(ulong)(page_cur_get_rec(&cur1) - page),
(ulong)(page_cur_get_rec(&cur2) - new_page));
@ -548,10 +551,10 @@ page_copy_rec_list_end(
{
if (page_dir_get_n_heap(new_page) == 2) {
page_copy_rec_list_end_to_created_page(new_page, page, rec,
index, mtr);
index, mtr);
} else {
page_copy_rec_list_end_no_locks(new_page, page, rec,
index, mtr);
index, mtr);
}
/* Update the lock table, MAX_TRX_ID, and possible hash index */
@ -604,9 +607,9 @@ page_copy_rec_list_start(
rec_t* ins_rec;
rec_t* cur1_rec = page_cur_get_rec(&cur1);
offsets = rec_get_offsets(cur1_rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
ins_rec = page_cur_rec_insert(&cur2, cur1_rec, index,
offsets, mtr);
offsets, mtr);
ut_a(ins_rec);
page_cur_move_to_next(&cur1);
@ -640,9 +643,9 @@ page_delete_rec_list_write_log(
{
byte* log_ptr;
ut_ad(type == MLOG_LIST_END_DELETE
|| type == MLOG_LIST_START_DELETE
|| type == MLOG_COMP_LIST_END_DELETE
|| type == MLOG_COMP_LIST_START_DELETE);
|| type == MLOG_LIST_START_DELETE
|| type == MLOG_COMP_LIST_END_DELETE
|| type == MLOG_COMP_LIST_START_DELETE);
log_ptr = mlog_open_and_write_index(mtr, rec, index, type, 2);
if (log_ptr) {
@ -672,9 +675,9 @@ page_parse_delete_rec_list(
ulint offset;
ut_ad(type == MLOG_LIST_END_DELETE
|| type == MLOG_LIST_START_DELETE
|| type == MLOG_COMP_LIST_END_DELETE
|| type == MLOG_COMP_LIST_START_DELETE);
|| type == MLOG_LIST_START_DELETE
|| type == MLOG_COMP_LIST_END_DELETE
|| type == MLOG_COMP_LIST_START_DELETE);
/* Read the record offset as a 2-byte ulint */
@ -694,9 +697,10 @@ page_parse_delete_rec_list(
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
if (type == MLOG_LIST_END_DELETE
|| type == MLOG_COMP_LIST_END_DELETE) {
|| type == MLOG_COMP_LIST_END_DELETE) {
page_delete_rec_list_end(page, page + offset, index,
ULINT_UNDEFINED, ULINT_UNDEFINED, mtr);
ULINT_UNDEFINED,
ULINT_UNDEFINED, mtr);
} else {
page_delete_rec_list_start(page, page + offset, index, mtr);
}
@ -750,8 +754,9 @@ page_delete_rec_list_end(
rec = page_rec_get_next(rec);
}
page_delete_rec_list_write_log(rec, index,
comp ? MLOG_COMP_LIST_END_DELETE : MLOG_LIST_END_DELETE, mtr);
page_delete_rec_list_write_log(rec, index, comp
? MLOG_COMP_LIST_END_DELETE
: MLOG_LIST_END_DELETE, mtr);
if (rec == sup) {
@ -775,10 +780,10 @@ page_delete_rec_list_end(
while (rec2 != sup) {
ulint s;
offsets = rec_get_offsets(rec2, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
s = rec_offs_size(offsets);
ut_ad(rec2 - page + s - rec_offs_extra_size(offsets)
< UNIV_PAGE_SIZE);
< UNIV_PAGE_SIZE);
ut_ad(size + s < UNIV_PAGE_SIZE);
size += s;
n_recs++;
@ -828,11 +833,11 @@ page_delete_rec_list_end(
page_rec_set_next(last_rec, free);
page_header_set_ptr(page, PAGE_FREE, rec);
page_header_set_field(page, PAGE_GARBAGE,
size + page_header_get_field(page, PAGE_GARBAGE));
page_header_set_field(page, PAGE_GARBAGE, size
+ page_header_get_field(page, PAGE_GARBAGE));
page_header_set_field(page, PAGE_N_RECS,
(ulint)(page_get_n_recs(page) - n_recs));
(ulint)(page_get_n_recs(page) - n_recs));
}
/*****************************************************************
@ -880,7 +885,7 @@ page_delete_rec_list_start(
while (page_cur_get_rec(&cur1) != rec) {
offsets = rec_get_offsets(page_cur_get_rec(&cur1), index,
offsets, ULINT_UNDEFINED, &heap);
offsets, ULINT_UNDEFINED, &heap);
page_cur_delete_rec(&cur1, index, offsets, mtr);
}
@ -922,7 +927,8 @@ page_move_rec_list_end(
ut_ad(new_data_size >= old_data_size);
page_delete_rec_list_end(page, split_rec, index,
new_n_recs - old_n_recs, new_data_size - old_data_size, mtr);
new_n_recs - old_n_recs,
new_data_size - old_data_size, mtr);
}
/*****************************************************************
@ -1002,7 +1008,7 @@ page_dir_delete_slots(
slot = page_dir_get_nth_slot(page, start + n);
page_dir_slot_set_n_owned(slot,
sum_owned + page_dir_slot_get_n_owned(slot));
sum_owned + page_dir_slot_get_n_owned(slot));
/* 3. Destroy start and other slots by copying slots */
for (i = start + n; i < n_slots; i++) {
@ -1314,7 +1320,8 @@ page_dir_print(
"PAGE DIRECTORY\n"
"Page address %p\n"
"Directory stack top at offs: %lu; number of slots: %lu\n",
page, (ulong)(page_dir_get_nth_slot(page, n - 1) - page), (ulong) n);
page, (ulong)(page_dir_get_nth_slot(page, n - 1) - page),
(ulong) n);
for (i = 0; i < n; i++) {
slot = page_dir_get_nth_slot(page, i);
if ((i == pr_n) && (i < n - pr_n)) {
@ -1322,9 +1329,11 @@ page_dir_print(
}
if ((i < pr_n) || (i >= n - pr_n)) {
fprintf(stderr,
"Contents of slot: %lu: n_owned: %lu, rec offs: %lu\n",
(ulong) i, (ulong) page_dir_slot_get_n_owned(slot),
(ulong)(page_dir_slot_get_rec(slot) - page));
"Contents of slot: %lu: n_owned: %lu,"
" rec offs: %lu\n",
(ulong) i,
(ulong) page_dir_slot_get_n_owned(slot),
(ulong)(page_dir_slot_get_rec(slot) - page));
}
}
fprintf(stderr, "Total of %lu records\n"
@ -1364,7 +1373,7 @@ page_print_list(
count = 0;
for (;;) {
offsets = rec_get_offsets(cur.rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
page_rec_print(cur.rec, offsets);
if (count == pr_n) {
@ -1386,7 +1395,7 @@ page_print_list(
if (count + pr_n >= n_recs) {
offsets = rec_get_offsets(cur.rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
page_rec_print(cur.rec, offsets);
}
count++;
@ -1478,15 +1487,15 @@ page_rec_validate(
if (!(n_owned <= PAGE_DIR_SLOT_MAX_N_OWNED)) {
fprintf(stderr,
"InnoDB: Dir slot of rec %lu, n owned too big %lu\n",
(ulong)(rec - page), (ulong) n_owned);
(ulong)(rec - page), (ulong) n_owned);
return(FALSE);
}
if (!(heap_no < page_dir_get_n_heap(page))) {
fprintf(stderr,
"InnoDB: Heap no of rec %lu too big %lu %lu\n",
(ulong)(rec - page), (ulong) heap_no,
(ulong) page_dir_get_n_heap(page));
"InnoDB: Heap no of rec %lu too big %lu %lu\n",
(ulong)(rec - page), (ulong) heap_no,
(ulong) page_dir_get_n_heap(page));
return(FALSE);
}
@ -1508,18 +1517,20 @@ page_check_dir(
n_slots = page_dir_get_n_slots(page);
if (page_dir_slot_get_rec(page_dir_get_nth_slot(page, 0))
!= page_get_infimum_rec(page)) {
!= page_get_infimum_rec(page)) {
fprintf(stderr,
"InnoDB: Page directory corruption: supremum not pointed to\n");
"InnoDB: Page directory corruption:"
" infimum not pointed to\n");
buf_page_print(page);
}
if (page_dir_slot_get_rec(page_dir_get_nth_slot(page, n_slots - 1))
!= page_get_supremum_rec(page)) {
!= page_get_supremum_rec(page)) {
fprintf(stderr,
"InnoDB: Page directory corruption: supremum not pointed to\n");
"InnoDB: Page directory corruption:"
" supremum not pointed to\n");
buf_page_print(page);
}
}
@ -1553,7 +1564,8 @@ page_simple_validate(
if (n_slots > UNIV_PAGE_SIZE / 4) {
fprintf(stderr,
"InnoDB: Nonsensical number %lu of page dir slots\n", (ulong) n_slots);
"InnoDB: Nonsensical number %lu of page dir slots\n",
(ulong) n_slots);
goto func_exit;
}
@ -1563,9 +1575,12 @@ page_simple_validate(
if (rec_heap_top > page_dir_get_nth_slot(page, n_slots - 1)) {
fprintf(stderr,
"InnoDB: Record heap and dir overlap on a page, heap top %lu, dir %lu\n",
(ulong)(page_header_get_ptr(page, PAGE_HEAP_TOP) - page),
(ulong)(page_dir_get_nth_slot(page, n_slots - 1) - page));
"InnoDB: Record heap and dir overlap on a page,"
" heap top %lu, dir %lu\n",
(ulong)
(page_header_get_ptr(page, PAGE_HEAP_TOP) - page),
(ulong)
(page_dir_get_nth_slot(page, n_slots - 1) - page));
goto func_exit;
}
@ -1585,8 +1600,10 @@ page_simple_validate(
if (rec > rec_heap_top) {
fprintf(stderr,
"InnoDB: Record %lu is above rec heap top %lu\n",
(ulong)(rec - page), (ulong)(rec_heap_top - page));
"InnoDB: Record %lu is above"
" rec heap top %lu\n",
(ulong)(rec - page),
(ulong)(rec_heap_top - page));
goto func_exit;
}
@ -1596,17 +1613,19 @@ page_simple_validate(
if (rec_get_n_owned(rec, comp) != own_count) {
fprintf(stderr,
"InnoDB: Wrong owned count %lu, %lu, rec %lu\n",
(ulong) rec_get_n_owned(rec, comp),
(ulong) own_count,
(ulong)(rec - page));
"InnoDB: Wrong owned count %lu, %lu,"
" rec %lu\n",
(ulong) rec_get_n_owned(rec, comp),
(ulong) own_count,
(ulong)(rec - page));
goto func_exit;
}
if (page_dir_slot_get_rec(slot) != rec) {
fprintf(stderr,
"InnoDB: Dir slot does not point to right rec %lu\n",
"InnoDB: Dir slot does not point"
" to right rec %lu\n",
(ulong)(rec - page));
goto func_exit;
@ -1626,11 +1645,12 @@ page_simple_validate(
}
if (rec_get_next_offs(rec, comp) < FIL_PAGE_DATA
|| rec_get_next_offs(rec, comp) >= UNIV_PAGE_SIZE) {
|| rec_get_next_offs(rec, comp) >= UNIV_PAGE_SIZE) {
fprintf(stderr,
"InnoDB: Next record offset nonsensical %lu for rec %lu\n",
(ulong) rec_get_next_offs(rec, comp),
(ulong)(rec - page));
"InnoDB: Next record offset"
" nonsensical %lu for rec %lu\n",
(ulong) rec_get_next_offs(rec, comp),
(ulong)(rec - page));
goto func_exit;
}
@ -1639,8 +1659,9 @@ page_simple_validate(
if (count > UNIV_PAGE_SIZE) {
fprintf(stderr,
"InnoDB: Page record list appears to be circular %lu\n",
(ulong) count);
"InnoDB: Page record list appears"
" to be circular %lu\n",
(ulong) count);
goto func_exit;
}
@ -1662,8 +1683,8 @@ page_simple_validate(
if (page_header_get_field(page, PAGE_N_RECS) + 2 != count + 1) {
fprintf(stderr, "InnoDB: n recs wrong %lu %lu\n",
(ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
(ulong) (count + 1));
(ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
(ulong) (count + 1));
goto func_exit;
}
@ -1673,18 +1694,21 @@ page_simple_validate(
while (rec != NULL) {
if (rec < page + FIL_PAGE_DATA
|| rec >= page + UNIV_PAGE_SIZE) {
|| rec >= page + UNIV_PAGE_SIZE) {
fprintf(stderr,
"InnoDB: Free list record has a nonsensical offset %lu\n",
(ulong)(rec - page));
"InnoDB: Free list record has"
" a nonsensical offset %lu\n",
(ulong) (rec - page));
goto func_exit;
}
if (rec > rec_heap_top) {
fprintf(stderr,
"InnoDB: Free list record %lu is above rec heap top %lu\n",
(ulong)(rec - page), (ulong)(rec_heap_top - page));
"InnoDB: Free list record %lu"
" is above rec heap top %lu\n",
(ulong) (rec - page),
(ulong) (rec_heap_top - page));
goto func_exit;
}
@ -1693,7 +1717,8 @@ page_simple_validate(
if (count > UNIV_PAGE_SIZE) {
fprintf(stderr,
"InnoDB: Page free list appears to be circular %lu\n",
"InnoDB: Page free list appears"
" to be circular %lu\n",
(ulong) count);
goto func_exit;
}
@ -1704,8 +1729,8 @@ page_simple_validate(
if (page_dir_get_n_heap(page) != count + 1) {
fprintf(stderr, "InnoDB: N heap is wrong %lu, %lu\n",
(ulong) page_dir_get_n_heap(page),
(ulong) (count + 1));
(ulong) page_dir_get_n_heap(page),
(ulong) (count + 1));
goto func_exit;
}
@ -1767,13 +1792,13 @@ page_validate(
n_slots = page_dir_get_n_slots(page);
if (!(page_header_get_ptr(page, PAGE_HEAP_TOP) <=
page_dir_get_nth_slot(page, n_slots - 1))) {
page_dir_get_nth_slot(page, n_slots - 1))) {
fputs("InnoDB: Record heap and dir overlap on a page ",
stderr);
stderr);
dict_index_name_print(stderr, NULL, index);
fprintf(stderr, ", %p, %p\n",
page_header_get_ptr(page, PAGE_HEAP_TOP),
page_header_get_ptr(page, PAGE_HEAP_TOP),
page_dir_get_nth_slot(page, n_slots - 1));
goto func_exit;
@ -1792,12 +1817,12 @@ page_validate(
for (;;) {
rec = cur.rec;
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
if (comp && page_rec_is_user_rec(rec)
&& rec_get_node_ptr_flag(rec)
!= (ibool)
(btr_page_get_level_low(page) != 0)) {
&& rec_get_node_ptr_flag(rec)
!= (ibool)
(btr_page_get_level_low(page) != 0)) {
fputs("InnoDB: node_ptr flag mismatch\n", stderr);
goto func_exit;
}
@ -1809,9 +1834,10 @@ page_validate(
/* Check that the records are in the ascending order */
if ((count >= 2) && (!page_cur_is_after_last(&cur))) {
if (!(1 == cmp_rec_rec(rec, old_rec,
offsets, old_offsets, index))) {
offsets, old_offsets, index))) {
fprintf(stderr,
"InnoDB: Records in wrong order on page %lu ",
"InnoDB: Records in wrong order"
" on page %lu ",
(ulong) buf_frame_get_page_no(page));
dict_index_name_print(stderr, NULL, index);
fputs("\nInnoDB: previous record ", stderr);
@ -1836,7 +1862,7 @@ page_validate(
/* No other record may overlap this */
fputs("InnoDB: Record overlaps another\n",
stderr);
stderr);
goto func_exit;
}
@ -1847,16 +1873,17 @@ page_validate(
/* This is a record pointed to by a dir slot */
if (rec_get_n_owned(rec, comp) != own_count) {
fprintf(stderr,
"InnoDB: Wrong owned count %lu, %lu\n",
(ulong) rec_get_n_owned(rec, comp),
(ulong) own_count);
"InnoDB: Wrong owned count %lu, %lu\n",
(ulong) rec_get_n_owned(rec, comp),
(ulong) own_count);
goto func_exit;
}
if (page_dir_slot_get_rec(slot) != rec) {
fputs(
"InnoDB: Dir slot does not point to right rec\n",
stderr);
"InnoDB: Dir slot does not"
" point to right rec\n",
stderr);
goto func_exit;
}
@ -1874,7 +1901,7 @@ page_validate(
}
if (rec_get_next_offs(rec, comp) < FIL_PAGE_DATA
|| rec_get_next_offs(rec, comp) >= UNIV_PAGE_SIZE) {
|| rec_get_next_offs(rec, comp) >= UNIV_PAGE_SIZE) {
fprintf(stderr,
"InnoDB: Next record offset wrong %lu\n",
(ulong) rec_get_next_offs(rec, comp));
@ -1906,14 +1933,14 @@ page_validate(
if (page_header_get_field(page, PAGE_N_RECS) + 2 != count + 1) {
fprintf(stderr, "InnoDB: n recs wrong %lu %lu\n",
(ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
(ulong) (count + 1));
(ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
(ulong) (count + 1));
goto func_exit;
}
if (data_size != page_get_data_size(page)) {
fprintf(stderr,
"InnoDB: Summed data size %lu, returned by func %lu\n",
"InnoDB: Summed data size %lu, returned by func %lu\n",
(ulong) data_size, (ulong) page_get_data_size(page));
goto func_exit;
}
@ -1923,7 +1950,7 @@ page_validate(
while (rec != NULL) {
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
if (!page_rec_validate(rec, offsets)) {
goto func_exit;
@ -1936,7 +1963,8 @@ page_validate(
if (buf[offs + i] != 0) {
fputs(
"InnoDB: Record overlaps another in free list\n", stderr);
"InnoDB: Record overlaps another"
" in free list\n", stderr);
goto func_exit;
}
@ -1959,7 +1987,7 @@ func_exit:
mem_heap_free(heap);
if (ret == FALSE) {
func_exit2:
func_exit2:
fprintf(stderr, "InnoDB: Apparent corruption in page %lu in ",
(ulong) buf_frame_get_page_no(page));
dict_index_name_print(stderr, NULL, index);

View file

@ -86,7 +86,7 @@ opt_check_exp_determined_before(
while (arg) {
if (!opt_check_exp_determined_before(arg, sel_node,
nth_table)) {
nth_table)) {
return(FALSE);
}
@ -148,10 +148,10 @@ opt_look_for_col_in_comparison_before(
ut_ad(search_cond);
ut_a((search_cond->func == '<')
|| (search_cond->func == '>')
|| (search_cond->func == '=')
|| (search_cond->func == PARS_GE_TOKEN)
|| (search_cond->func == PARS_LE_TOKEN));
|| (search_cond->func == '>')
|| (search_cond->func == '=')
|| (search_cond->func == PARS_GE_TOKEN)
|| (search_cond->func == PARS_LE_TOKEN));
table = sel_node_get_nth_plan(sel_node, nth_table)->table;
@ -160,10 +160,10 @@ opt_look_for_col_in_comparison_before(
return(NULL);
} else if ((cmp_type == OPT_COMPARISON)
&& (search_cond->func != '<')
&& (search_cond->func != '>')
&& (search_cond->func != PARS_GE_TOKEN)
&& (search_cond->func != PARS_LE_TOKEN)) {
&& (search_cond->func != '<')
&& (search_cond->func != '>')
&& (search_cond->func != PARS_GE_TOKEN)
&& (search_cond->func != PARS_LE_TOKEN)) {
return(NULL);
}
@ -174,8 +174,8 @@ opt_look_for_col_in_comparison_before(
sym_node = arg;
if ((sym_node->token_type == SYM_COLUMN)
&& (sym_node->table == table)
&& (sym_node->col_no == col_no)) {
&& (sym_node->table == table)
&& (sym_node->col_no == col_no)) {
/* sym_node contains the desired column id */
@ -185,7 +185,7 @@ opt_look_for_col_in_comparison_before(
exp = que_node_get_next(arg);
if (opt_check_exp_determined_before(exp, sel_node,
nth_table)) {
nth_table)) {
*op = search_cond->func;
return(exp);
@ -200,11 +200,11 @@ opt_look_for_col_in_comparison_before(
sym_node = arg;
if ((sym_node->token_type == SYM_COLUMN)
&& (sym_node->table == table)
&& (sym_node->col_no == col_no)) {
&& (sym_node->table == table)
&& (sym_node->col_no == col_no)) {
if (opt_check_exp_determined_before(exp, sel_node,
nth_table)) {
nth_table)) {
*op = opt_invert_cmp_op(search_cond->func);
return(exp);
@ -253,7 +253,8 @@ opt_look_for_col_in_cond_before(
new_cond = search_cond->args;
exp = opt_look_for_col_in_cond_before(cmp_type, col_no,
new_cond, sel_node, nth_table, op);
new_cond, sel_node,
nth_table, op);
if (exp) {
return(exp);
@ -262,12 +263,14 @@ opt_look_for_col_in_cond_before(
new_cond = que_node_get_next(new_cond);
exp = opt_look_for_col_in_cond_before(cmp_type, col_no,
new_cond, sel_node, nth_table, op);
new_cond, sel_node,
nth_table, op);
return(exp);
}
exp = opt_look_for_col_in_comparison_before(cmp_type, col_no,
search_cond, sel_node, nth_table, op);
search_cond, sel_node,
nth_table, op);
if (exp == NULL) {
return(NULL);
@ -281,7 +284,8 @@ opt_look_for_col_in_cond_before(
return(NULL);
} else if (!sel_node->asc && ((*op == '>') || (*op == PARS_GE_TOKEN))) {
} else if (!sel_node->asc
&& ((*op == '>') || (*op == PARS_GE_TOKEN))) {
return(NULL);
}
@ -329,9 +333,9 @@ opt_calc_index_goodness(
col_no = dict_index_get_nth_col_no(index, j);
exp = opt_look_for_col_in_cond_before(OPT_EQUAL, col_no,
sel_node->search_cond,
sel_node, nth_table, &op);
exp = opt_look_for_col_in_cond_before
(OPT_EQUAL, col_no, sel_node->search_cond,
sel_node, nth_table, &op);
if (exp) {
/* The value for this column is exactly known already
at this stage of the join */
@ -342,9 +346,9 @@ opt_calc_index_goodness(
} else {
/* Look for non-equality comparisons */
exp = opt_look_for_col_in_cond_before(OPT_COMPARISON,
col_no, sel_node->search_cond,
sel_node, nth_table, &op);
exp = opt_look_for_col_in_cond_before
(OPT_COMPARISON, col_no, sel_node->search_cond,
sel_node, nth_table, &op);
if (exp) {
index_plan[j] = exp;
*last_op = op;
@ -488,15 +492,15 @@ opt_check_order_by(
if (i < sel_node->n_tables - 1) {
ut_a(dict_index_get_n_unique(plan->index)
<= plan->n_exact_match);
<= plan->n_exact_match);
} else {
ut_a(plan->table == order_table);
ut_a((dict_index_get_n_unique(plan->index)
<= plan->n_exact_match)
|| (dict_index_get_nth_col_no(plan->index,
plan->n_exact_match)
== order_col_no));
<= plan->n_exact_match)
|| (dict_index_get_nth_col_no(plan->index,
plan->n_exact_match)
== order_col_no));
}
}
}
@ -541,7 +545,7 @@ opt_search_plan_for_table(
/* should be do ... until ? comment by Jani */
while (index) {
goodness = opt_calc_index_goodness(index, sel_node, i,
index_plan, &last_op);
index_plan, &last_op);
if (goodness > best_goodness) {
best_index = index;
@ -549,7 +553,7 @@ opt_search_plan_for_table(
n_fields = opt_calc_n_fields_from_goodness(goodness);
ut_memcpy(best_index_plan, index_plan,
n_fields * sizeof(void*));
n_fields * sizeof(void*));
best_last_op = last_op;
}
@ -565,14 +569,14 @@ opt_search_plan_for_table(
plan->n_exact_match = 0;
} else {
plan->tuple = dtuple_create(pars_sym_tab_global->heap,
n_fields);
n_fields);
dict_index_copy_types(plan->tuple, plan->index, n_fields);
plan->tuple_exps = mem_heap_alloc(pars_sym_tab_global->heap,
n_fields * sizeof(void*));
n_fields * sizeof(void*));
ut_memcpy(plan->tuple_exps, best_index_plan,
n_fields * sizeof(void*));
n_fields * sizeof(void*));
if (best_last_op == '=') {
plan->n_exact_match = n_fields;
} else {
@ -580,11 +584,11 @@ opt_search_plan_for_table(
}
plan->mode = opt_op_to_search_mode(sel_node->asc,
best_last_op);
best_last_op);
}
if ((best_index->type & DICT_CLUSTERED)
&& (plan->n_exact_match >= dict_index_get_n_unique(best_index))) {
&& (plan->n_exact_match >= dict_index_get_n_unique(best_index))) {
plan->unique_search = TRUE;
} else {
@ -660,7 +664,7 @@ opt_classify_comparison(
the testing is necessary when the cursor is reversed. */
if ((n_fields > plan->n_exact_match)
&& opt_is_arg(plan->tuple_exps[n_fields - 1], cond)) {
&& opt_is_arg(plan->tuple_exps[n_fields - 1], cond)) {
return(OPT_SCROLL_COND);
}
@ -671,11 +675,10 @@ opt_classify_comparison(
access the table, it is classified as OPT_END_COND */
if ((dict_index_get_n_fields(plan->index) > plan->n_exact_match)
&& opt_look_for_col_in_comparison_before(
OPT_COMPARISON,
dict_index_get_nth_col_no(plan->index,
plan->n_exact_match),
cond, sel_node, i, &op)) {
&& opt_look_for_col_in_comparison_before
(OPT_COMPARISON,
dict_index_get_nth_col_no(plan->index, plan->n_exact_match),
cond, sel_node, i, &op)) {
if (sel_node->asc && ((op == '<') || (op == PARS_LE_TOKEN))) {
@ -763,7 +766,7 @@ opt_normalize_cmp_conds(
sym_node = arg2;
if ((sym_node->token_type == SYM_COLUMN)
&& (sym_node->table == table)) {
&& (sym_node->table == table)) {
/* Switch the order of the arguments */
@ -803,7 +806,7 @@ opt_determine_and_normalize_test_conds(
opt_find_test_conds(sel_node, i, sel_node->search_cond);
opt_normalize_cmp_conds(UT_LIST_GET_FIRST(plan->end_conds),
plan->table);
plan->table);
ut_a(UT_LIST_GET_LEN(plan->end_conds) >= plan->n_exact_match);
}
@ -846,7 +849,7 @@ opt_find_all_cols(
while (arg) {
opt_find_all_cols(copy_val, index, col_list, plan,
arg);
arg);
arg = que_node_get_next(arg);
}
@ -900,10 +903,8 @@ opt_find_all_cols(
/* Fill in the field_no fields in sym_node */
sym_node->field_nos[SYM_CLUST_FIELD_NO]
= dict_index_get_nth_col_pos(
dict_table_get_first_index(index->table),
sym_node->col_no);
sym_node->field_nos[SYM_CLUST_FIELD_NO] = dict_index_get_nth_col_pos
(dict_table_get_first_index(index->table), sym_node->col_no);
if (!(index->type & DICT_CLUSTERED)) {
ut_a(plan);
@ -963,7 +964,7 @@ opt_find_copy_cols(
plan = sel_node_get_nth_plan(sel_node, i);
opt_find_all_cols(TRUE, plan->index, &(plan->columns), plan,
search_cond);
search_cond);
}
}
@ -998,7 +999,7 @@ opt_classify_cols(
while (exp) {
opt_find_all_cols(TRUE, plan->index, &(plan->columns), plan,
exp);
exp);
exp = que_node_get_next(exp);
}
@ -1008,7 +1009,7 @@ opt_classify_cols(
columns: therefore FALSE */
opt_find_all_cols(FALSE, plan->index, &(plan->columns), plan,
sel_node->search_cond);
sel_node->search_cond);
}
/***********************************************************************
@ -1069,10 +1070,11 @@ opt_clust_access(
tables, and they should not contain column prefix indexes. */
if (dict_index_get_nth_field(index, pos)->prefix_len != 0
|| dict_index_get_nth_field(clust_index, i)
->prefix_len != 0) {
|| dict_index_get_nth_field(clust_index, i)
->prefix_len != 0) {
fprintf(stderr,
"InnoDB: Error in pars0opt.c: table %s has prefix_len != 0\n",
"InnoDB: Error in pars0opt.c:"
" table %s has prefix_len != 0\n",
index->table_name);
}
@ -1098,7 +1100,7 @@ opt_search_plan(
ulint i;
sel_node->plans = mem_heap_alloc(pars_sym_tab_global->heap,
sel_node->n_tables * sizeof(plan_t));
sel_node->n_tables * sizeof(plan_t));
/* Analyze the search condition to find out what we know at each
join stage about the conditions that the columns of a table should

View file

@ -156,7 +156,7 @@ pars_func_low(
node->args = arg;
UT_LIST_ADD_LAST(func_node_list, pars_sym_tab_global->func_node_list,
node);
node);
return(node);
}
@ -241,17 +241,17 @@ pars_resolve_func_data_type(
func = node->func;
if ((func == PARS_SUM_TOKEN)
|| (func == '+') || (func == '-') || (func == '*')
|| (func == '/') || (func == '+')) {
|| (func == '+') || (func == '-') || (func == '*')
|| (func == '/') || (func == '+')) {
/* Inherit the data type from the first argument (which must
not be the SQL null literal whose type is DATA_ERROR) */
dtype_copy(que_node_get_data_type(node),
que_node_get_data_type(arg));
que_node_get_data_type(arg));
ut_a(dtype_get_mtype(que_node_get_data_type(node))
== DATA_INT);
== DATA_INT);
} else if (func == PARS_COUNT_TOKEN) {
ut_a(arg);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
@ -259,33 +259,33 @@ pars_resolve_func_data_type(
} else if (func == PARS_TO_CHAR_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
DATA_ENGLISH, 0, 0);
DATA_ENGLISH, 0, 0);
} else if (func == PARS_TO_BINARY_TOKEN) {
if (dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT) {
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
DATA_ENGLISH, 0, 0);
DATA_ENGLISH, 0, 0);
} else {
dtype_set(que_node_get_data_type(node), DATA_BINARY,
0, 0, 0);
0, 0, 0);
}
} else if (func == PARS_TO_NUMBER_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);
== DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
} else if (func == PARS_BINARY_TO_NUMBER_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);
== DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
} else if (func == PARS_LENGTH_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);
== DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
} else if (func == PARS_INSTR_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);
== DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
} else if (func == PARS_SYSDATE_TOKEN) {
@ -293,12 +293,12 @@ pars_resolve_func_data_type(
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
} else if ((func == PARS_SUBSTR_TOKEN)
|| (func == PARS_CONCAT_TOKEN)) {
|| (func == PARS_CONCAT_TOKEN)) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);
== DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
DATA_ENGLISH, 0, 0);
DATA_ENGLISH, 0, 0);
} else if ((func == '>') || (func == '<') || (func == '=')
|| (func == PARS_GE_TOKEN)
@ -321,7 +321,7 @@ pars_resolve_func_data_type(
ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
DATA_ENGLISH, 0, 0);
DATA_ENGLISH, 0, 0);
} else {
ut_error;
}
@ -379,18 +379,18 @@ pars_resolve_exp_variables_and_types(
while (node) {
if (node->resolved
&& ((node->token_type == SYM_VAR)
|| (node->token_type == SYM_CURSOR)
|| (node->token_type == SYM_FUNCTION))
&& node->name
&& (sym_node->name_len == node->name_len)
&& (ut_memcmp(sym_node->name, node->name,
node->name_len) == 0)) {
&& ((node->token_type == SYM_VAR)
|| (node->token_type == SYM_CURSOR)
|| (node->token_type == SYM_FUNCTION))
&& node->name
&& (sym_node->name_len == node->name_len)
&& (ut_memcmp(sym_node->name, node->name,
node->name_len) == 0)) {
/* Found a variable or a cursor declared with
the same name */
/* Found a variable or a cursor declared with
the same name */
break;
break;
}
node = UT_LIST_GET_NEXT(sym_list, node);
@ -398,7 +398,7 @@ pars_resolve_exp_variables_and_types(
if (!node) {
fprintf(stderr, "PARSER ERROR: Unresolved identifier %s\n",
sym_node->name);
sym_node->name);
}
ut_a(node);
@ -410,11 +410,11 @@ pars_resolve_exp_variables_and_types(
if (select_node) {
UT_LIST_ADD_LAST(col_var_list, select_node->copy_variables,
sym_node);
sym_node);
}
dfield_set_type(que_node_get_val(sym_node),
que_node_get_data_type(node));
que_node_get_data_type(node));
}
/*************************************************************************
@ -493,8 +493,8 @@ pars_resolve_exp_columns(
col = dict_table_get_nth_col(table, i);
if ((sym_node->name_len == ut_strlen(col->name))
&& (0 == ut_memcmp(sym_node->name, col->name,
sym_node->name_len))) {
&& (0 == ut_memcmp(sym_node->name, col->name,
sym_node->name_len))) {
/* Found */
sym_node->resolved = TRUE;
sym_node->token_type = SYM_COLUMN;
@ -607,12 +607,11 @@ pars_select_all_columns(
col = dict_table_get_nth_col(table, i);
col_node = sym_tab_add_id(pars_sym_tab_global,
(byte*)col->name,
ut_strlen(col->name));
(byte*)col->name,
ut_strlen(col->name));
select_node->select_list
= que_node_list_add_last(
select_node->select_list,
col_node);
= que_node_list_add_last
(select_node->select_list, col_node);
}
table_node = que_node_get_next(table_node);
@ -715,14 +714,14 @@ pars_select_statement(
if (select_node->into_list) {
ut_a(que_node_list_get_len(select_node->into_list)
== que_node_list_get_len(select_node->select_list));
== que_node_list_get_len(select_node->select_list));
}
UT_LIST_INIT(select_node->copy_variables);
pars_resolve_exp_list_columns(table_list, select_node->select_list);
pars_resolve_exp_list_variables_and_types(select_node,
select_node->select_list);
select_node->select_list);
pars_check_aggregate(select_node);
select_node->search_cond = search_cond;
@ -806,7 +805,7 @@ pars_function_declaration(
/* Check that the function exists. */
ut_a(pars_info_get_user_func(pars_sym_tab_global->info,
sym_node->name));
sym_node->name));
return(sym_node);
}
@ -849,7 +848,7 @@ pars_column_assignment(
col_assign_node_t* node;
node = mem_heap_alloc(pars_sym_tab_global->heap,
sizeof(col_assign_node_t));
sizeof(col_assign_node_t));
node->common.type = QUE_NODE_COL_ASSIGNMENT;
node->col = column;
@ -890,15 +889,15 @@ pars_process_assign_list(
pars_resolve_exp_variables_and_types(NULL, assign_node->val);
/* ut_a(dtype_get_mtype(dfield_get_type(
que_node_get_val(assign_node->col)))
== dtype_get_mtype(dfield_get_type(
que_node_get_val(assign_node->val)))); */
que_node_get_val(assign_node->col)))
== dtype_get_mtype(dfield_get_type(
que_node_get_val(assign_node->val)))); */
/* Add to the update node all the columns found in assignment
values as columns to copy: therefore, TRUE */
opt_find_all_cols(TRUE, clust_index, &(node->columns), NULL,
assign_node->val);
assign_node->val);
n_assigns++;
assign_node = que_node_get_next(assign_node);
@ -915,15 +914,13 @@ pars_process_assign_list(
col_sym = assign_node->col;
upd_field_set_field_no(upd_field,
dict_index_get_nth_col_pos(clust_index,
col_sym->col_no),
clust_index, NULL);
upd_field_set_field_no(upd_field, dict_index_get_nth_col_pos
(clust_index, col_sym->col_no),
clust_index, NULL);
upd_field->exp = assign_node->val;
if (!dtype_is_fixed_size(
dict_index_get_nth_type(clust_index,
upd_field->field_no))) {
if (!dtype_is_fixed_size(dict_index_get_nth_type
(clust_index, upd_field->field_no))) {
changes_field_size = 0;
}
@ -980,7 +977,7 @@ pars_update_statement(
sel_node = pars_select_list(NULL, NULL);
pars_select_statement(sel_node, table_sym, search_cond, NULL,
&pars_share_token, NULL);
&pars_share_token, NULL);
node->searched_update = TRUE;
sel_node->common.parent = node;
}
@ -1027,8 +1024,8 @@ pars_update_statement(
}
if (!node->is_delete && node->searched_update
&& (node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE)
&& (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
&& (node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE)
&& (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
/* The select node can perform the update in-place */
@ -1070,10 +1067,10 @@ pars_insert_statement(
pars_retrieve_table_def(table_sym);
node = ins_node_create(ins_type, table_sym->table,
pars_sym_tab_global->heap);
pars_sym_tab_global->heap);
row = dtuple_create(pars_sym_tab_global->heap,
dict_table_get_n_cols(node->table));
dict_table_get_n_cols(node->table));
dict_table_copy_types(row, table_sym->table);
@ -1085,7 +1082,7 @@ pars_insert_statement(
select->common.parent = node;
ut_a(que_node_list_get_len(select->select_list)
== dict_table_get_n_user_cols(table_sym->table));
== dict_table_get_n_user_cols(table_sym->table));
}
node->values_list = values_list;
@ -1094,7 +1091,7 @@ pars_insert_statement(
pars_resolve_exp_list_variables_and_types(NULL, values_list);
ut_a(que_node_list_get_len(values_list)
== dict_table_get_n_user_cols(table_sym->table));
== dict_table_get_n_user_cols(table_sym->table));
}
return(node);
@ -1134,17 +1131,17 @@ pars_set_dfield_type(
ut_a(len == 0);
dtype_set(dfield_get_type(dfield), DATA_VARCHAR,
DATA_ENGLISH | flags, 0, 0);
DATA_ENGLISH | flags, 0, 0);
} else if (type == &pars_binary_token) {
ut_a(len != 0);
dtype_set(dfield_get_type(dfield), DATA_FIXBINARY,
DATA_BINARY_TYPE | flags, len, 0);
DATA_BINARY_TYPE | flags, len, 0);
} else if (type == &pars_blob_token) {
ut_a(len == 0);
dtype_set(dfield_get_type(dfield), DATA_BLOB,
DATA_BINARY_TYPE | flags, 0, 0);
DATA_BINARY_TYPE | flags, 0, 0);
} else {
ut_error;
}
@ -1382,7 +1379,7 @@ pars_return_statement(void)
return_node_t* node;
node = mem_heap_alloc(pars_sym_tab_global->heap,
sizeof(return_node_t));
sizeof(return_node_t));
node->common.type = QUE_NODE_RETURN;
return(node);
@ -1401,7 +1398,7 @@ pars_assignment_statement(
assign_node_t* node;
node = mem_heap_alloc(pars_sym_tab_global->heap,
sizeof(assign_node_t));
sizeof(assign_node_t));
node->common.type = QUE_NODE_ASSIGNMENT;
node->var = var;
@ -1411,7 +1408,7 @@ pars_assignment_statement(
pars_resolve_exp_variables_and_types(NULL, val);
ut_a(dtype_get_mtype(dfield_get_type(que_node_get_val(var)))
== dtype_get_mtype(dfield_get_type(que_node_get_val(val))));
== dtype_get_mtype(dfield_get_type(que_node_get_val(val))));
return(node);
}
@ -1467,7 +1464,7 @@ pars_fetch_statement(
pars_resolve_exp_variables_and_types(NULL, user_func);
node->func = pars_info_get_user_func(pars_sym_tab_global->info,
user_func->name);
user_func->name);
ut_a(node->func);
node->into_list = NULL;
@ -1481,8 +1478,8 @@ pars_fetch_statement(
if (into_list) {
ut_a(que_node_list_get_len(into_list)
== que_node_list_get_len(
node->cursor_def->select_list));
== que_node_list_get_len(
node->cursor_def->select_list));
}
return(node);
@ -1530,7 +1527,7 @@ pars_row_printf_statement(
row_printf_node_t* node;
node = mem_heap_alloc(pars_sym_tab_global->heap,
sizeof(row_printf_node_t));
sizeof(row_printf_node_t));
node->common.type = QUE_NODE_ROW_PRINTF;
node->sel_node = sel_node;
@ -1587,7 +1584,7 @@ pars_column_def(
}
pars_set_dfield_type(que_node_get_val(sym_node), type, len2,
is_unsigned != NULL, is_not_null != NULL);
is_unsigned != NULL, is_not_null != NULL);
return(sym_node);
}
@ -1636,8 +1633,8 @@ pars_create_table(
dtype = dfield_get_type(que_node_get_val(column));
dict_mem_table_add_col(table, column->name, dtype->mtype,
dtype->prtype, dtype->len,
dtype->prec);
dtype->prtype, dtype->len,
dtype->prec);
column->resolved = TRUE;
column->token_type = SYM_COLUMN;
@ -1686,7 +1683,7 @@ pars_create_index(
}
index = dict_mem_index_create(table_sym->name, index_sym->name, 0,
ind_type, n_fields);
ind_type, n_fields);
column = column_list;
while (column) {
@ -1787,7 +1784,7 @@ pars_get_lex_chars(
int len;
len = pars_sym_tab_global->string_len
- pars_sym_tab_global->next_char_pos;
- pars_sym_tab_global->next_char_pos;
if (len == 0) {
#ifdef YYDEBUG
/* fputs("SQL string ends\n", stderr); */
@ -1809,13 +1806,13 @@ pars_get_lex_chars(
}
fwrite(pars_sym_tab_global->sql_string +
pars_sym_tab_global->next_char_pos,
1, len, stderr);
pars_sym_tab_global->next_char_pos,
1, len, stderr);
}
#endif /* UNIV_SQL_DEBUG */
ut_memcpy(buf, pars_sym_tab_global->sql_string +
pars_sym_tab_global->next_char_pos, len);
pars_sym_tab_global->next_char_pos, len);
*result = len;
pars_sym_tab_global->next_char_pos += len;
@ -1862,8 +1859,8 @@ pars_sql(
pars_sym_tab_global = sym_tab_create(heap);
pars_sym_tab_global->string_len = strlen(str);
pars_sym_tab_global->sql_string = mem_heap_dup(heap, str,
pars_sym_tab_global->string_len + 1);
pars_sym_tab_global->sql_string = mem_heap_dup
(heap, str, pars_sym_tab_global->string_len + 1);
pars_sym_tab_global->next_char_pos = 0;
pars_sym_tab_global->info = info;
@ -1998,7 +1995,7 @@ pars_info_add_str_literal(
const char* str) /* in: string */
{
pars_info_add_literal(info, name, str, strlen(str),
DATA_VARCHAR, DATA_ENGLISH);
DATA_VARCHAR, DATA_ENGLISH);
}
/********************************************************************

View file

@ -209,7 +209,7 @@ que_thr_create(
thr->run_node = NULL;
thr->resource = 0;
thr->lock_state = QUE_THR_LOCK_NOLOCK;
thr->lock_state = QUE_THR_LOCK_NOLOCK;
UT_LIST_ADD_LAST(thrs, parent->thrs, thr);
@ -243,8 +243,8 @@ que_thr_end_wait(
#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
|| (thr->state == QUE_THR_SIG_REPLY_WAIT));
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
|| (thr->state == QUE_THR_SIG_REPLY_WAIT));
ut_ad(thr->run_node);
thr->prev_node = thr->run_node;
@ -285,8 +285,8 @@ que_thr_end_wait_no_next_thr(
#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
|| (thr->state == QUE_THR_SIG_REPLY_WAIT));
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
|| (thr->state == QUE_THR_SIG_REPLY_WAIT));
was_active = thr->is_active;
@ -345,7 +345,8 @@ que_fork_start_command(
there may be several to choose from */
/*---------------------------------------------------------------
First we try to find a query thread in the QUE_THR_COMMAND_WAIT state */
First we try to find a query thread in the QUE_THR_COMMAND_WAIT state
*/
thr = UT_LIST_GET_FIRST(fork->thrs);
@ -531,7 +532,8 @@ que_graph_free_recursive(
if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr,
"que_thr struct appears corrupt; magic n %lu\n",
"que_thr struct appears corrupt;"
" magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption(thr);
ut_error;
@ -644,7 +646,7 @@ que_graph_free_recursive(
break;
default:
fprintf(stderr,
"que_node struct appears corrupt; type %lu\n",
"que_node struct appears corrupt; type %lu\n",
(unsigned long) que_node_get_type(node));
mem_analyze_corruption(node);
ut_error;
@ -702,7 +704,7 @@ que_graph_try_free(
sess = (graph->trx)->sess;
if ((graph->state == QUE_FORK_BEING_FREED)
&& (graph->n_active_thrs == 0)) {
&& (graph->n_active_thrs == 0)) {
UT_LIST_REMOVE(graphs, sess->graphs, graph);
que_graph_free(graph);
@ -831,7 +833,7 @@ que_thr_dec_refer_count(
running the thread */
/* fputs("!!!!!!!! Wait already ended: continue thr\n",
stderr); */
stderr); */
if (next_thr && *next_thr == NULL) {
/* Normally srv_suspend_mysql_thread resets
@ -944,13 +946,13 @@ que_thr_stop(
thr->state = QUE_THR_LOCK_WAIT;
} else if (trx->error_state != DB_SUCCESS
&& trx->error_state != DB_LOCK_WAIT) {
&& trx->error_state != DB_LOCK_WAIT) {
/* Error handling built for the MySQL interface */
thr->state = QUE_THR_COMPLETED;
} else if (UT_LIST_GET_LEN(trx->signals) > 0
&& graph->fork_type != QUE_FORK_ROLLBACK) {
&& graph->fork_type != QUE_FORK_ROLLBACK) {
thr->state = QUE_THR_SUSPENDED;
} else {
@ -982,7 +984,7 @@ que_thr_stop_for_mysql(
if (thr->state == QUE_THR_RUNNING) {
if (trx->error_state != DB_SUCCESS
&& trx->error_state != DB_LOCK_WAIT) {
&& trx->error_state != DB_LOCK_WAIT) {
/* Error handling built for the MySQL interface */
thr->state = QUE_THR_COMPLETED;
@ -1022,7 +1024,7 @@ que_thr_move_to_run_state_for_mysql(
{
if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr,
"que_thr struct appears corrupt; magic n %lu\n",
"que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption(thr);
@ -1059,7 +1061,7 @@ que_thr_stop_for_mysql_no_error(
if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr,
"que_thr struct appears corrupt; magic n %lu\n",
"que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption(thr);
@ -1165,7 +1167,8 @@ que_node_print_info(
str = "UNKNOWN NODE TYPE";
}
fprintf(stderr, "Node type %lu: %s, address %p\n", (ulong) type, str, node);
fprintf(stderr, "Node type %lu: %s, address %p\n",
(ulong) type, str, (void*) node);
}
/**************************************************************************
@ -1204,7 +1207,7 @@ que_thr_step(
#endif
if (type & QUE_NODE_CONTROL_STAT) {
if ((thr->prev_node != que_node_get_parent(node))
&& que_node_get_next(thr->prev_node)) {
&& que_node_get_next(thr->prev_node)) {
/* The control statements, like WHILE, always pass the
control to the next child statement if there is any
@ -1224,7 +1227,7 @@ que_thr_step(
if (thr->prev_node == que_node_get_parent(node)) {
trx->last_sql_stat_start.least_undo_no
= trx->undo_no;
= trx->undo_no;
}
proc_step(thr);
@ -1251,9 +1254,9 @@ que_thr_step(
} else if (type == QUE_NODE_LOCK) {
ut_error;
/*
/*
thr = que_lock_step(thr);
*/
*/
} else if (type == QUE_NODE_THR) {
thr = que_thr_node_step(thr);
} else if (type == QUE_NODE_COMMIT) {

View file

@ -175,7 +175,7 @@ read_view_oldest_copy_or_open_new(
n = old_view->n_trx_ids;
if (ut_dulint_cmp(old_view->creator_trx_id,
ut_dulint_create(0,0)) != 0) {
ut_dulint_create(0,0)) != 0) {
n++;
} else {
needs_insert = FALSE;
@ -189,19 +189,19 @@ read_view_oldest_copy_or_open_new(
i = 0;
while (i < n) {
if (needs_insert
&& (i >= old_view->n_trx_ids
|| ut_dulint_cmp(old_view->creator_trx_id,
read_view_get_nth_trx_id(old_view, i))
> 0)) {
&& (i >= old_view->n_trx_ids
|| ut_dulint_cmp(old_view->creator_trx_id,
read_view_get_nth_trx_id(old_view, i))
> 0)) {
read_view_set_nth_trx_id(view_copy, i,
old_view->creator_trx_id);
old_view->creator_trx_id);
needs_insert = FALSE;
insert_done = 1;
} else {
read_view_set_nth_trx_id(view_copy, i,
read_view_get_nth_trx_id(old_view,
i - insert_done));
read_view_get_nth_trx_id
(old_view, i - insert_done));
}
i++;
@ -216,8 +216,8 @@ read_view_oldest_copy_or_open_new(
if (n > 0) {
/* The last active transaction has the smallest id: */
view_copy->up_limit_id = read_view_get_nth_trx_id(
view_copy, n - 1);
view_copy->up_limit_id = read_view_get_nth_trx_id
(view_copy, n - 1);
} else {
view_copy->up_limit_id = old_view->up_limit_id;
}
@ -267,8 +267,8 @@ read_view_open_now(
while (trx) {
if (ut_dulint_cmp(trx->id, cr_trx_id) != 0
&& (trx->conc_state == TRX_ACTIVE
|| trx->conc_state == TRX_PREPARED)) {
&& (trx->conc_state == TRX_ACTIVE
|| trx->conc_state == TRX_PREPARED)) {
read_view_set_nth_trx_id(view, n, trx->id);
@ -362,16 +362,16 @@ read_view_print(
}
fprintf(stderr, "Read view low limit trx n:o %lu %lu\n",
(ulong) ut_dulint_get_high(view->low_limit_no),
(ulong) ut_dulint_get_low(view->low_limit_no));
(ulong) ut_dulint_get_high(view->low_limit_no),
(ulong) ut_dulint_get_low(view->low_limit_no));
fprintf(stderr, "Read view up limit trx id %lu %lu\n",
(ulong) ut_dulint_get_high(view->up_limit_id),
(ulong) ut_dulint_get_low(view->up_limit_id));
(ulong) ut_dulint_get_high(view->up_limit_id),
(ulong) ut_dulint_get_low(view->up_limit_id));
fprintf(stderr, "Read view low limit trx id %lu %lu\n",
(ulong) ut_dulint_get_high(view->low_limit_id),
(ulong) ut_dulint_get_low(view->low_limit_id));
(ulong) ut_dulint_get_high(view->low_limit_id),
(ulong) ut_dulint_get_low(view->low_limit_id));
fprintf(stderr, "Read view individually stored trx ids:\n");
@ -379,8 +379,10 @@ read_view_print(
for (i = 0; i < n_ids; i++) {
fprintf(stderr, "Read view trx id %lu %lu\n",
(ulong) ut_dulint_get_high(read_view_get_nth_trx_id(view, i)),
(ulong) ut_dulint_get_low(read_view_get_nth_trx_id(view, i)));
(ulong) ut_dulint_get_high
(read_view_get_nth_trx_id(view, i)),
(ulong) ut_dulint_get_low
(read_view_get_nth_trx_id(view, i)));
}
}
@ -412,15 +414,14 @@ read_cursor_view_create_for_mysql(
curview->heap = heap;
/* Drop cursor tables from consideration when evaluating the need of
auto-commit */
auto-commit */
curview->n_mysql_tables_in_use = cr_trx->n_mysql_tables_in_use;
cr_trx->n_mysql_tables_in_use = 0;
mutex_enter(&kernel_mutex);
curview->read_view = read_view_create_low(
UT_LIST_GET_LEN(trx_sys->trx_list),
curview->heap);
curview->read_view = read_view_create_low
(UT_LIST_GET_LEN(trx_sys->trx_list), curview->heap);
view = curview->read_view;
view->creator_trx_id = cr_trx->id;
@ -442,7 +443,7 @@ read_cursor_view_create_for_mysql(
while (trx) {
if (trx->conc_state == TRX_ACTIVE
|| trx->conc_state == TRX_PREPARED) {
|| trx->conc_state == TRX_PREPARED) {
read_view_set_nth_trx_id(view, n, trx->id);
@ -494,7 +495,7 @@ read_cursor_view_close_for_mysql(
ut_a(curview->heap);
/* Add cursor's tables to the global count of active tables that
belong to this transaction */
belong to this transaction */
trx->n_mysql_tables_in_use += curview->n_mysql_tables_in_use;
mutex_enter(&kernel_mutex);

View file

@ -104,21 +104,21 @@ cmp_types_are_equal(
ibool check_charsets) /* in: whether to check charsets */
{
if (dtype_is_non_binary_string_type(type1->mtype, type1->prtype)
&& dtype_is_non_binary_string_type(type2->mtype, type2->prtype)) {
&& dtype_is_non_binary_string_type(type2->mtype, type2->prtype)) {
/* Both are non-binary string types: they can be compared if
and only if the charset-collation is the same */
if (check_charsets) {
return(dtype_get_charset_coll(type1->prtype)
== dtype_get_charset_coll(type2->prtype));
== dtype_get_charset_coll(type2->prtype));
} else {
return(TRUE);
}
}
if (dtype_is_binary_string_type(type1->mtype, type1->prtype)
&& dtype_is_binary_string_type(type2->mtype, type2->prtype)) {
&& dtype_is_binary_string_type(type2->mtype, type2->prtype)) {
/* Both are binary string types: they can be compared */
@ -131,8 +131,8 @@ cmp_types_are_equal(
}
if (type1->mtype == DATA_INT
&& (type1->prtype & DATA_UNSIGNED)
!= (type2->prtype & DATA_UNSIGNED)) {
&& (type1->prtype & DATA_UNSIGNED)
!= (type2->prtype & DATA_UNSIGNED)) {
/* The storage format of an unsigned integer is different
from a signed integer: in a signed integer we OR
@ -257,18 +257,19 @@ cmp_whole_field(
case DATA_MYSQL:
case DATA_BLOB:
if (data_type == DATA_BLOB
&& 0 != (type->prtype & DATA_BINARY_TYPE)) {
&& 0 != (type->prtype & DATA_BINARY_TYPE)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: comparing a binary BLOB with a character set sensitive\n"
"InnoDB: comparison!\n");
" InnoDB: Error: comparing a binary BLOB"
" with a character set sensitive\n"
"InnoDB: comparison!\n");
}
return(innobase_mysql_cmp(
(int)(type->prtype & DATA_MYSQL_TYPE_MASK),
(uint)dtype_get_charset_coll(type->prtype),
a, a_length, b, b_length));
return(innobase_mysql_cmp
((int)(type->prtype & DATA_MYSQL_TYPE_MASK),
(uint)dtype_get_charset_coll(type->prtype),
a, a_length, b, b_length));
default:
fprintf(stderr,
"InnoDB: unknown type number %lu\n",
@ -322,14 +323,14 @@ cmp_data_data_slow(
}
if (cur_type->mtype >= DATA_FLOAT
|| (cur_type->mtype == DATA_BLOB
&& 0 == (cur_type->prtype & DATA_BINARY_TYPE)
&& dtype_get_charset_coll(cur_type->prtype) !=
DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
|| (cur_type->mtype == DATA_BLOB
&& 0 == (cur_type->prtype & DATA_BINARY_TYPE)
&& dtype_get_charset_coll(cur_type->prtype) !=
DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
return(cmp_whole_field(cur_type,
data1, (unsigned) len1,
data2, (unsigned) len2));
data1, (unsigned) len1,
data2, (unsigned) len2));
}
/* Compare then the fields */
@ -372,8 +373,8 @@ cmp_data_data_slow(
}
if (cur_type->mtype <= DATA_CHAR
|| (cur_type->mtype == DATA_BLOB
&& 0 == (cur_type->prtype & DATA_BINARY_TYPE))) {
|| (cur_type->mtype == DATA_BLOB
&& 0 == (cur_type->prtype & DATA_BINARY_TYPE))) {
data1_byte = cmp_collate(data1_byte);
data2_byte = cmp_collate(data2_byte);
@ -381,12 +382,12 @@ cmp_data_data_slow(
if (data1_byte > data2_byte) {
return(1);
return(1);
} else if (data1_byte < data2_byte) {
return(-1);
return(-1);
}
next_byte:
next_byte:
/* Next byte */
cur_bytes++;
data1++;
@ -465,7 +466,7 @@ cmp_dtuple_rec_with_match(
if (cur_bytes == 0 && cur_field == 0) {
ulint rec_info = rec_get_info_bits(rec,
rec_offs_comp(offsets));
rec_offs_comp(offsets));
ulint tup_info = dtuple_get_info_bits(dtuple);
if (rec_info & REC_INFO_MIN_REC_FLAG) {
@ -488,7 +489,7 @@ cmp_dtuple_rec_with_match(
dtuple_f_len = dfield_get_len(dtuple_field);
rec_b_ptr = rec_get_nth_field(rec, offsets,
cur_field, &rec_f_len);
cur_field, &rec_f_len);
/* If we have matched yet 0 bytes, it may be that one or
both the fields are SQL null, or the record or dtuple may be
@ -524,16 +525,16 @@ cmp_dtuple_rec_with_match(
}
if (cur_type->mtype >= DATA_FLOAT
|| (cur_type->mtype == DATA_BLOB
&& 0 == (cur_type->prtype & DATA_BINARY_TYPE)
&& dtype_get_charset_coll(cur_type->prtype) !=
DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
|| (cur_type->mtype == DATA_BLOB
&& 0 == (cur_type->prtype & DATA_BINARY_TYPE)
&& dtype_get_charset_coll(cur_type->prtype) !=
DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
ret = cmp_whole_field(
cur_type,
dfield_get_data(dtuple_field),
(unsigned) dtuple_f_len,
rec_b_ptr, (unsigned) rec_f_len);
cur_type,
dfield_get_data(dtuple_field),
(unsigned) dtuple_f_len,
rec_b_ptr, (unsigned) rec_f_len);
if (ret != 0) {
cur_bytes = 0;
@ -548,7 +549,7 @@ cmp_dtuple_rec_with_match(
rec_b_ptr = rec_b_ptr + cur_bytes;
dtuple_b_ptr = (byte*)dfield_get_data(dtuple_field)
+ cur_bytes;
+ cur_bytes;
/* Compare then the fields */
for (;;) {
@ -590,9 +591,9 @@ cmp_dtuple_rec_with_match(
}
if (cur_type->mtype <= DATA_CHAR
|| (cur_type->mtype == DATA_BLOB
&& 0 ==
(cur_type->prtype & DATA_BINARY_TYPE))) {
|| (cur_type->mtype == DATA_BLOB
&& 0 ==
(cur_type->prtype & DATA_BINARY_TYPE))) {
rec_byte = cmp_collate(rec_byte);
dtuple_byte = cmp_collate(dtuple_byte);
@ -608,14 +609,14 @@ cmp_dtuple_rec_with_match(
goto order_resolved;
}
}
next_byte:
next_byte:
/* Next byte */
cur_bytes++;
rec_b_ptr++;
dtuple_b_ptr++;
}
next_field:
next_field:
cur_field++;
cur_bytes = 0;
}
@ -627,10 +628,10 @@ cmp_dtuple_rec_with_match(
order_resolved:
ut_ad((ret >= - 1) && (ret <= 1));
ut_ad(ret == cmp_debug_dtuple_rec_with_match(dtuple, rec, offsets,
matched_fields));
matched_fields));
ut_ad(*matched_fields == cur_field); /* In the debug version, the
above cmp_debug_... sets
*matched_fields to a value */
above cmp_debug_... sets
*matched_fields to a value */
*matched_fields = cur_field;
*matched_bytes = cur_bytes;
@ -662,7 +663,7 @@ cmp_dtuple_rec(
ut_ad(rec_offs_validate(rec, NULL, offsets));
return(cmp_dtuple_rec_with_match(dtuple, rec, offsets,
&matched_fields, &matched_bytes));
&matched_fields, &matched_bytes));
}
/******************************************************************
@ -690,15 +691,15 @@ cmp_dtuple_is_prefix_of_rec(
}
cmp_dtuple_rec_with_match(dtuple, rec, offsets,
&matched_fields, &matched_bytes);
&matched_fields, &matched_bytes);
if (matched_fields == n_fields) {
return(TRUE);
}
if (matched_fields == n_fields - 1
&& matched_bytes == dfield_get_len(
dtuple_get_nth_field(dtuple, n_fields - 1))) {
&& matched_bytes == dfield_get_len
(dtuple_get_nth_field(dtuple, n_fields - 1))) {
return(TRUE);
}
@ -768,25 +769,25 @@ cmp_rec_rec_with_match(
if (index->type & DICT_UNIVERSAL) {
cur_type = dtype_binary;
} else {
cur_type = dict_col_get_type(
dict_field_get_col(
dict_index_get_nth_field(index, cur_field)));
cur_type = dict_col_get_type
(dict_field_get_col(dict_index_get_nth_field
(index, cur_field)));
}
rec1_b_ptr = rec_get_nth_field(rec1, offsets1,
cur_field, &rec1_f_len);
cur_field, &rec1_f_len);
rec2_b_ptr = rec_get_nth_field(rec2, offsets2,
cur_field, &rec2_f_len);
cur_field, &rec2_f_len);
if (cur_bytes == 0) {
if (cur_field == 0) {
/* Test if rec is the predefined minimum
record */
if (rec_get_info_bits(rec1, comp)
& REC_INFO_MIN_REC_FLAG) {
& REC_INFO_MIN_REC_FLAG) {
if (rec_get_info_bits(rec2, comp)
& REC_INFO_MIN_REC_FLAG) {
& REC_INFO_MIN_REC_FLAG) {
ret = 0;
} else {
ret = -1;
@ -804,7 +805,7 @@ cmp_rec_rec_with_match(
}
if (rec_offs_nth_extern(offsets1, cur_field)
|| rec_offs_nth_extern(offsets2, cur_field)) {
|| rec_offs_nth_extern(offsets2, cur_field)) {
/* We do not compare to an externally
stored field */
@ -814,7 +815,7 @@ cmp_rec_rec_with_match(
}
if (rec1_f_len == UNIV_SQL_NULL
|| rec2_f_len == UNIV_SQL_NULL) {
|| rec2_f_len == UNIV_SQL_NULL) {
if (rec1_f_len == rec2_f_len) {
@ -836,14 +837,16 @@ cmp_rec_rec_with_match(
}
if (cur_type->mtype >= DATA_FLOAT
|| (cur_type->mtype == DATA_BLOB
&& 0 == (cur_type->prtype & DATA_BINARY_TYPE)
&& dtype_get_charset_coll(cur_type->prtype) !=
DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
|| (cur_type->mtype == DATA_BLOB
&& 0 == (cur_type->prtype & DATA_BINARY_TYPE)
&& dtype_get_charset_coll(cur_type->prtype) !=
DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
ret = cmp_whole_field(cur_type,
rec1_b_ptr, (unsigned) rec1_f_len,
rec2_b_ptr, (unsigned) rec2_f_len);
rec1_b_ptr,
(unsigned) rec1_f_len,
rec2_b_ptr,
(unsigned) rec2_f_len);
if (ret != 0) {
cur_bytes = 0;
@ -898,9 +901,9 @@ cmp_rec_rec_with_match(
}
if (cur_type->mtype <= DATA_CHAR
|| (cur_type->mtype == DATA_BLOB
&& 0 ==
(cur_type->prtype & DATA_BINARY_TYPE))) {
|| (cur_type->mtype == DATA_BLOB
&& 0 ==
(cur_type->prtype & DATA_BINARY_TYPE))) {
rec1_byte = cmp_collate(rec1_byte);
rec2_byte = cmp_collate(rec2_byte);
@ -913,7 +916,7 @@ cmp_rec_rec_with_match(
ret = 1;
goto order_resolved;
}
next_byte:
next_byte:
/* Next byte */
cur_bytes++;
@ -921,7 +924,7 @@ cmp_rec_rec_with_match(
rec2_b_ptr++;
}
next_field:
next_field:
cur_field++;
cur_bytes = 0;
}
@ -995,7 +998,7 @@ cmp_debug_dtuple_rec_with_match(
if (cur_field == 0) {
if (rec_get_info_bits(rec, rec_offs_comp(offsets))
& REC_INFO_MIN_REC_FLAG) {
& REC_INFO_MIN_REC_FLAG) {
ret = !(dtuple_get_info_bits(dtuple)
& REC_INFO_MIN_REC_FLAG);
@ -1022,7 +1025,7 @@ cmp_debug_dtuple_rec_with_match(
dtuple_f_len = dfield_get_len(dtuple_field);
rec_f_data = rec_get_nth_field(rec, offsets,
cur_field, &rec_f_len);
cur_field, &rec_f_len);
if (rec_offs_nth_extern(offsets, cur_field)) {
/* We do not compare to an externally stored field */
@ -1033,7 +1036,7 @@ cmp_debug_dtuple_rec_with_match(
}
ret = cmp_data_data(cur_type, dtuple_f_data, dtuple_f_len,
rec_f_data, rec_f_len);
rec_f_data, rec_f_len);
if (ret != 0) {
goto order_resolved;
}

View file

@ -202,9 +202,9 @@ rec_init_offsets(
}
field = dict_index_get_nth_field(index, i);
if (!(dtype_get_prtype(dict_col_get_type(
dict_field_get_col(field)))
& DATA_NOT_NULL)) {
if (!(dtype_get_prtype(dict_col_get_type
(dict_field_get_col(field)))
& DATA_NOT_NULL)) {
/* nullable field => read the null flag */
if (UNIV_UNLIKELY(!(byte) null_mask)) {
@ -226,12 +226,12 @@ rec_init_offsets(
if (UNIV_UNLIKELY(!field->fixed_len)) {
/* Variable-length field: read the length */
dtype_t* type = dict_col_get_type(
dict_field_get_col(field));
dtype_t* type = dict_col_get_type
(dict_field_get_col(field));
len = *lens--;
if (UNIV_UNLIKELY(dtype_get_len(type) > 255)
|| UNIV_UNLIKELY(dtype_get_mtype(type)
== DATA_BLOB)) {
|| UNIV_UNLIKELY(dtype_get_mtype(type)
== DATA_BLOB)) {
if (len & 0x80) {
/* 1exxxxxxx xxxxxxxx */
len <<= 8;
@ -239,9 +239,9 @@ rec_init_offsets(
offs += len & 0x3fff;
if (UNIV_UNLIKELY(len
& 0x4000)) {
& 0x4000)) {
len = offs
| REC_OFFS_EXTERNAL;
| REC_OFFS_EXTERNAL;
} else {
len = offs;
}
@ -254,7 +254,7 @@ rec_init_offsets(
} else {
len = offs += field->fixed_len;
}
resolved:
resolved:
rec_offs_base(offsets)[i + 1] = len;
} while (++i < rec_offs_n_fields(offsets));
@ -323,7 +323,7 @@ rec_get_offsets_func(
if (dict_table_is_comp(index->table)) {
switch (UNIV_EXPECT(rec_get_status(rec),
REC_STATUS_ORDINARY)) {
REC_STATUS_ORDINARY)) {
case REC_STATUS_ORDINARY:
n = dict_index_get_n_fields(index);
break;
@ -350,10 +350,11 @@ rec_get_offsets_func(
size = n + (1 + REC_OFFS_HEADER_SIZE);
if (UNIV_UNLIKELY(!offsets) ||
UNIV_UNLIKELY(rec_offs_get_n_alloc(offsets) < size)) {
UNIV_UNLIKELY(rec_offs_get_n_alloc(offsets) < size)) {
if (!*heap) {
*heap = mem_heap_create_func(size * sizeof(ulint),
NULL, MEM_HEAP_DYNAMIC, file, line);
NULL, MEM_HEAP_DYNAMIC,
file, line);
}
offsets = mem_heap_alloc(*heap, size * sizeof(ulint));
rec_offs_set_n_alloc(offsets, size);
@ -385,7 +386,7 @@ rec_get_nth_field_old(
if (n > REC_MAX_N_FIELDS) {
fprintf(stderr, "Error: trying to access field %lu in rec\n",
(ulong) n);
(ulong) n);
ut_error;
}
@ -418,7 +419,7 @@ rec_get_nth_field_old(
}
next_os = next_os & ~(REC_2BYTE_SQL_NULL_MASK
| REC_2BYTE_EXTERN_MASK);
| REC_2BYTE_EXTERN_MASK);
}
*len = next_os - os;
@ -440,7 +441,7 @@ rec_get_converted_size_new(
dtuple_t* dtuple) /* in: data tuple */
{
ulint size = REC_N_NEW_EXTRA_BYTES
+ (index->n_nullable + 7) / 8;
+ (index->n_nullable + 7) / 8;
dict_field_t* field;
dtype_t* type;
ulint i;
@ -474,7 +475,7 @@ rec_get_converted_size_new(
field = dict_index_get_nth_field(index, i);
type = dict_col_get_type(dict_field_get_col(field));
ut_ad(len != UNIV_SQL_NULL ||
!(dtype_get_prtype(type) & DATA_NOT_NULL));
!(dtype_get_prtype(type) & DATA_NOT_NULL));
if (len == UNIV_SQL_NULL) {
/* No length is stored for NULL fields. */
@ -482,12 +483,13 @@ rec_get_converted_size_new(
}
ut_ad(len <= dtype_get_len(type)
|| dtype_get_mtype(type) == DATA_BLOB);
|| dtype_get_mtype(type) == DATA_BLOB);
ut_ad(!field->fixed_len || len == field->fixed_len);
if (field->fixed_len) {
} else if (len < 128 || (dtype_get_len(type) < 256
&& dtype_get_mtype(type) != DATA_BLOB)) {
} else if (len < 128
|| (dtype_get_len(type) < 256
&& dtype_get_mtype(type) != DATA_BLOB)) {
size++;
} else {
size += 2;
@ -564,7 +566,7 @@ rec_set_nth_field_extern_bit_old(
if (mtr) {
mlog_write_ulint(rec - REC_N_OLD_EXTRA_BYTES - 2 * (i + 1),
info, MLOG_2BYTES, mtr);
info, MLOG_2BYTES, mtr);
} else {
rec_2_set_field_end_info(rec, i, info);
}
@ -628,7 +630,7 @@ rec_set_nth_field_extern_bit_new(
}
lens--;
if (dtype_get_len(type) > 255
|| dtype_get_mtype(type) == DATA_BLOB) {
|| dtype_get_mtype(type) == DATA_BLOB) {
ulint len = lens[1];
if (len & 0x80) { /* 1exxxxxx: 2-byte length */
if (i == ith) {
@ -638,8 +640,9 @@ rec_set_nth_field_extern_bit_new(
/* toggle the extern bit */
len ^= 0x40;
if (mtr) {
mlog_write_ulint(lens + 1, len,
MLOG_1BYTE, mtr);
mlog_write_ulint
(lens + 1, len,
MLOG_1BYTE, mtr);
} else {
lens[1] = (byte) len;
}
@ -677,12 +680,12 @@ rec_set_field_extern_bits(
if (dict_table_is_comp(index->table)) {
for (i = 0; i < n_fields; i++) {
rec_set_nth_field_extern_bit_new(rec, index, vec[i],
TRUE, mtr);
TRUE, mtr);
}
} else {
for (i = 0; i < n_fields; i++) {
rec_set_nth_field_extern_bit_old(rec, vec[i],
TRUE, mtr);
TRUE, mtr);
}
}
}
@ -746,7 +749,7 @@ rec_convert_dtuple_to_rec_old(
/* Set the info bits of the record */
rec_set_info_bits(rec, FALSE,
dtuple_get_info_bits(dtuple) & REC_INFO_BITS_MASK);
dtuple_get_info_bits(dtuple) & REC_INFO_BITS_MASK);
/* Store the data and the offsets */
@ -764,8 +767,8 @@ rec_convert_dtuple_to_rec_old(
len = dfield_get_len(field);
if (len == UNIV_SQL_NULL) {
len = dtype_get_sql_null_size(
dfield_get_type(field));
len = dtype_get_sql_null_size
(dfield_get_type(field));
data_write_sql_null(rec + end_offset, len);
end_offset += len;
@ -792,8 +795,8 @@ rec_convert_dtuple_to_rec_old(
len = dfield_get_len(field);
if (len == UNIV_SQL_NULL) {
len = dtype_get_sql_null_size(
dfield_get_type(field));
len = dtype_get_sql_null_size
(dfield_get_type(field));
data_write_sql_null(rec + end_offset, len);
end_offset += len;
@ -840,7 +843,7 @@ rec_convert_dtuple_to_rec_new(
ulint null_mask = 1;
const ulint n_fields = dtuple_get_n_fields(dtuple);
const ulint status = dtuple_get_info_bits(dtuple)
& REC_NEW_STATUS_MASK;
& REC_NEW_STATUS_MASK;
ut_ad(dict_table_is_comp(index->table));
ut_ad(n_fields > 0);
@ -898,9 +901,10 @@ rec_convert_dtuple_to_rec_new(
ut_ad(len == fixed_len);
} else {
ut_ad(len <= dtype_get_len(type)
|| dtype_get_mtype(type) == DATA_BLOB);
|| dtype_get_mtype(type) == DATA_BLOB);
rec++;
if (len >= 128 && (dtype_get_len(type) >= 256
if (len >= 128
&& (dtype_get_len(type) >= 256
|| dtype_get_mtype(type) == DATA_BLOB)) {
rec++;
}
@ -918,7 +922,7 @@ init:
rec_set_status(rec, status);
rec_set_info_bits(rec, TRUE,
dtuple_get_info_bits(dtuple) & REC_INFO_BITS_MASK);
dtuple_get_info_bits(dtuple) & REC_INFO_BITS_MASK);
/* Store the data and the offsets */
@ -961,12 +965,13 @@ init:
ut_ad(len == fixed_len);
} else {
ut_ad(len <= dtype_get_len(type)
|| dtype_get_mtype(type) == DATA_BLOB);
if (len < 128 || (dtype_get_len(type) < 256
|| dtype_get_mtype(type) == DATA_BLOB);
if (len < 128
|| (dtype_get_len(type) < 256
&& dtype_get_mtype(type) != DATA_BLOB)) {
*lens-- = (byte) len;
}
else {
} else {
/* the extern bits will be set later */
ut_ad(len < 16384);
*lens-- = (byte) (len >> 8) | 0x80;
@ -1015,7 +1020,7 @@ rec_convert_dtuple_to_rec(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
offsets = rec_get_offsets(rec, index,
offsets_, ULINT_UNDEFINED, &heap);
offsets_, ULINT_UNDEFINED, &heap);
ut_ad(rec_validate(rec, offsets));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@ -1052,8 +1057,8 @@ rec_copy_prefix_to_dtuple(
ut_ad(rec_validate(rec, offsets));
ut_ad(dtuple_check_typed(tuple));
dtuple_set_info_bits(tuple,
rec_get_info_bits(rec, dict_table_is_comp(index->table)));
dtuple_set_info_bits(tuple, rec_get_info_bits
(rec, dict_table_is_comp(index->table)));
for (i = 0; i < n_fields; i++) {
@ -1143,7 +1148,8 @@ rec_copy_prefix_to_buf(
if (!dict_table_is_comp(index->table)) {
ut_ad(rec_validate_old(rec));
return(rec_copy_prefix_to_buf_old(rec, n_fields,
return(rec_copy_prefix_to_buf_old
(rec, n_fields,
rec_get_field_start_offs(rec, n_fields),
buf, buf_size));
}
@ -1196,7 +1202,7 @@ rec_copy_prefix_to_buf(
} else {
ulint len = *lens--;
if (dtype_get_len(type) > 255
|| dtype_get_mtype(type) == DATA_BLOB) {
|| dtype_get_mtype(type) == DATA_BLOB) {
if (len & 0x80) {
/* 1exxxxxx */
len &= 0x3f;
@ -1248,7 +1254,7 @@ rec_validate_old(
if ((n_fields == 0) || (n_fields > REC_MAX_N_FIELDS)) {
fprintf(stderr, "InnoDB: Error: record has %lu fields\n",
(ulong) n_fields);
(ulong) n_fields);
return(FALSE);
}
@ -1257,17 +1263,18 @@ rec_validate_old(
if (!((len < UNIV_PAGE_SIZE) || (len == UNIV_SQL_NULL))) {
fprintf(stderr,
"InnoDB: Error: record field %lu len %lu\n", (ulong) i,
(ulong) len);
"InnoDB: Error: record field %lu len %lu\n",
(ulong) i,
(ulong) len);
return(FALSE);
}
if (len != UNIV_SQL_NULL) {
len_sum += len;
sum += *(data + len -1); /* dereference the
end of the field to
cause a memory trap
if possible */
end of the field to
cause a memory trap
if possible */
} else {
len_sum += rec_get_nth_field_size(rec, i);
}
@ -1275,9 +1282,9 @@ rec_validate_old(
if (len_sum != rec_get_data_size_old(rec)) {
fprintf(stderr,
"InnoDB: Error: record len should be %lu, len %lu\n",
(ulong) len_sum,
rec_get_data_size_old(rec));
"InnoDB: Error: record len should be %lu, len %lu\n",
(ulong) len_sum,
rec_get_data_size_old(rec));
return(FALSE);
}
@ -1308,7 +1315,7 @@ rec_validate(
if ((n_fields == 0) || (n_fields > REC_MAX_N_FIELDS)) {
fprintf(stderr, "InnoDB: Error: record has %lu fields\n",
(ulong) n_fields);
(ulong) n_fields);
return(FALSE);
}
@ -1319,17 +1326,18 @@ rec_validate(
if (!((len < UNIV_PAGE_SIZE) || (len == UNIV_SQL_NULL))) {
fprintf(stderr,
"InnoDB: Error: record field %lu len %lu\n", (ulong) i,
(ulong) len);
"InnoDB: Error: record field %lu len %lu\n",
(ulong) i,
(ulong) len);
return(FALSE);
}
if (len != UNIV_SQL_NULL) {
len_sum += len;
sum += *(data + len -1); /* dereference the
end of the field to
cause a memory trap
if possible */
end of the field to
cause a memory trap
if possible */
} else if (!rec_offs_comp(offsets)) {
len_sum += rec_get_nth_field_size(rec, i);
}
@ -1337,9 +1345,9 @@ rec_validate(
if (len_sum != (ulint)(rec_get_end(rec, offsets) - rec)) {
fprintf(stderr,
"InnoDB: Error: record len should be %lu, len %lu\n",
(ulong) len_sum,
(ulong) (rec_get_end(rec, offsets) - rec));
"InnoDB: Error: record len should be %lu, len %lu\n",
(ulong) len_sum,
(ulong) (rec_get_end(rec, offsets) - rec));
return(FALSE);
}
@ -1477,8 +1485,9 @@ rec_print(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
rec_print_new(file, rec, rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap));
rec_print_new(file, rec,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}

View file

@ -120,7 +120,7 @@ ins_node_create_entry_list(
while (index != NULL) {
entry = row_build_index_entry(node->row, index,
node->entry_sys_heap);
node->entry_sys_heap);
UT_LIST_ADD_LAST(tuple_list, node->entry_list, entry);
index = dict_table_get_next_index(index);
@ -242,7 +242,7 @@ row_ins_sec_index_entry_by_modify(
ut_ad((cursor->index->type & DICT_CLUSTERED) == 0);
ut_ad(rec_get_deleted_flag(rec,
dict_table_is_comp(cursor->index->table)));
dict_table_is_comp(cursor->index->table)));
/* We know that in the alphabetical ordering, entry and rec are
identified. But in their binary form there may be differences if
@ -251,8 +251,8 @@ row_ins_sec_index_entry_by_modify(
heap = mem_heap_create(1024);
update = row_upd_build_sec_rec_difference_binary(cursor->index,
entry, rec, thr_get_trx(thr), heap);
update = row_upd_build_sec_rec_difference_binary
(cursor->index, entry, rec, thr_get_trx(thr), heap);
if (mode == BTR_MODIFY_LEAF) {
/* Try an optimistic updating of the record, keeping changes
within the page */
@ -272,7 +272,8 @@ row_ins_sec_index_entry_by_modify(
}
err = btr_cur_pessimistic_update(BTR_KEEP_SYS_FLAG, cursor,
&dummy_big_rec, update, 0, thr, mtr);
&dummy_big_rec, update,
0, thr, mtr);
}
func_exit:
mem_heap_free(heap);
@ -315,7 +316,7 @@ row_ins_clust_index_entry_by_modify(
rec = btr_cur_get_rec(cursor);
ut_ad(rec_get_deleted_flag(rec,
dict_table_is_comp(cursor->index->table)));
dict_table_is_comp(cursor->index->table)));
heap = mem_heap_create(1024);
@ -324,13 +325,14 @@ row_ins_clust_index_entry_by_modify(
roll_ptr */
update = row_upd_build_difference_binary(cursor->index, entry, ext_vec,
n_ext_vec, rec, thr_get_trx(thr), heap);
n_ext_vec, rec,
thr_get_trx(thr), heap);
if (mode == BTR_MODIFY_LEAF) {
/* Try optimistic updating of the record, keeping changes
within the page */
err = btr_cur_optimistic_update(0, cursor, update, 0, thr,
mtr);
mtr);
if (err == DB_OVERFLOW || err == DB_UNDERFLOW) {
err = DB_FAIL;
}
@ -343,7 +345,7 @@ row_ins_clust_index_entry_by_modify(
goto func_exit;
}
err = btr_cur_pessimistic_update(0, cursor, big_rec, update,
0, thr, mtr);
0, thr, mtr);
}
func_exit:
mem_heap_free(heap);
@ -468,10 +470,9 @@ row_ins_cascade_calc_update_vec(
for (i = 0; i < foreign->n_fields; i++) {
parent_field_no = dict_table_get_nth_col_pos(
parent_table,
dict_index_get_nth_col_no(
parent_index, i));
parent_field_no = dict_table_get_nth_col_pos
(parent_table,
dict_index_get_nth_col_no(parent_index, i));
for (j = 0; j < parent_update->n_fields; j++) {
parent_ufield = parent_update->fields + j;
@ -486,9 +487,10 @@ row_ins_cascade_calc_update_vec(
ufield = update->fields + n_fields_updated;
ufield->field_no =
dict_table_get_nth_col_pos(table,
dict_index_get_nth_col_no(index, i));
ufield->field_no
= dict_table_get_nth_col_pos
(table,
dict_index_get_nth_col_no(index, i));
ufield->exp = NULL;
ufield->new_val = parent_ufield->new_val;
@ -499,7 +501,7 @@ row_ins_cascade_calc_update_vec(
updated as NULL */
if (ufield->new_val.len == UNIV_SQL_NULL
&& (type->prtype & DATA_NOT_NULL)) {
&& (type->prtype & DATA_NOT_NULL)) {
return(ULINT_UNDEFINED);
}
@ -508,11 +510,10 @@ row_ins_cascade_calc_update_vec(
column, do not allow the update */
if (ufield->new_val.len != UNIV_SQL_NULL
&& dtype_get_at_most_n_mbchars(
type, dtype_get_len(type),
ufield->new_val.len,
ufield->new_val.data)
< ufield->new_val.len) {
&& dtype_get_at_most_n_mbchars
(type, dtype_get_len(type),
ufield->new_val.len, ufield->new_val.data)
< ufield->new_val.len) {
return(ULINT_UNDEFINED);
}
@ -525,14 +526,14 @@ row_ins_cascade_calc_update_vec(
min_size = dtype_get_min_size(type);
if (min_size
&& ufield->new_val.len != UNIV_SQL_NULL
&& ufield->new_val.len < min_size) {
&& ufield->new_val.len != UNIV_SQL_NULL
&& ufield->new_val.len < min_size) {
char* pad_start;
const char* pad_end;
ufield->new_val.data =
mem_heap_alloc(heap,
min_size);
min_size);
pad_start =
((char*) ufield->new_val.data)
+ ufield->new_val.len;
@ -541,18 +542,18 @@ row_ins_cascade_calc_update_vec(
+ min_size;
ufield->new_val.len = min_size;
ut_memcpy(ufield->new_val.data,
parent_ufield->new_val.data,
parent_ufield->new_val.len);
parent_ufield->new_val.data,
parent_ufield->new_val.len);
switch (UNIV_EXPECT(
dtype_get_mbminlen(type), 1)) {
switch (UNIV_EXPECT(dtype_get_mbminlen
(type), 1)) {
default:
ut_error;
case 1:
if (UNIV_UNLIKELY(
dtype_get_charset_coll(
dtype_get_prtype(type))
== DATA_MYSQL_BINARY_CHARSET_COLL)) {
if (UNIV_UNLIKELY
(dtype_get_charset_coll
(dtype_get_prtype(type))
== DATA_MYSQL_BINARY_CHARSET_COLL)) {
/* Do not pad BINARY
columns. */
return(ULINT_UNDEFINED);
@ -560,12 +561,12 @@ row_ins_cascade_calc_update_vec(
/* space=0x20 */
memset(pad_start, 0x20,
pad_end - pad_start);
pad_end - pad_start);
break;
case 2:
/* space=0x0020 */
ut_a(!(ufield->new_val.len
% 2));
% 2));
ut_a(!(min_size % 2));
do {
*pad_start++ = 0x00;
@ -602,10 +603,9 @@ row_ins_set_detailed(
if (os_file_set_eof(srv_misc_tmpfile)) {
ut_print_name(srv_misc_tmpfile, trx, TRUE,
foreign->foreign_table_name);
dict_print_info_on_foreign_key_in_create_format(
srv_misc_tmpfile,
trx, foreign, FALSE);
foreign->foreign_table_name);
dict_print_info_on_foreign_key_in_create_format
(srv_misc_tmpfile, trx, foreign, FALSE);
trx_set_detailed_error_from_file(trx, srv_misc_tmpfile);
} else {
trx_set_detailed_error(trx, "temp file operation failed");
@ -646,7 +646,7 @@ row_ins_foreign_report_err(
ut_print_name(ef, trx, TRUE, foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign,
TRUE);
TRUE);
putc('\n', ef);
fputs(errstr, ef);
fputs(" in parent table, in index ", ef);
@ -671,7 +671,7 @@ row_ins_foreign_report_err(
}
/*************************************************************************
Reports a foreign key error to dict_foreign_err_buf when we are trying
Reports a foreign key error to dict_foreign_err_file when we are trying
to add an index entry to a child table. Note that the adding may be the result
of an update, too. */
static
@ -699,7 +699,7 @@ row_ins_foreign_report_add_err(
ut_print_name(ef, trx, TRUE, foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign,
TRUE);
TRUE);
fputs("\nTrying to add in child table, in index ", ef);
ut_print_name(ef, trx, FALSE, foreign->foreign_index->name);
if (entry) {
@ -806,25 +806,25 @@ row_ins_foreign_check_on_constraint(
node = thr->run_node;
if (node->is_delete && 0 == (foreign->type &
(DICT_FOREIGN_ON_DELETE_CASCADE
| DICT_FOREIGN_ON_DELETE_SET_NULL))) {
(DICT_FOREIGN_ON_DELETE_CASCADE
| DICT_FOREIGN_ON_DELETE_SET_NULL))) {
row_ins_foreign_report_err("Trying to delete",
thr, foreign,
btr_pcur_get_rec(pcur), entry);
thr, foreign,
btr_pcur_get_rec(pcur), entry);
return(DB_ROW_IS_REFERENCED);
}
if (!node->is_delete && 0 == (foreign->type &
(DICT_FOREIGN_ON_UPDATE_CASCADE
| DICT_FOREIGN_ON_UPDATE_SET_NULL))) {
(DICT_FOREIGN_ON_UPDATE_CASCADE
| DICT_FOREIGN_ON_UPDATE_SET_NULL))) {
/* This is an UPDATE */
row_ins_foreign_report_err("Trying to update",
thr, foreign,
btr_pcur_get_rec(pcur), entry);
thr, foreign,
btr_pcur_get_rec(pcur), entry);
return(DB_ROW_IS_REFERENCED);
}
@ -835,8 +835,8 @@ row_ins_foreign_check_on_constraint(
operation. */
node->cascade_heap = mem_heap_create(128);
node->cascade_node = row_create_update_node_for_mysql(
table, node->cascade_heap);
node->cascade_node = row_create_update_node_for_mysql
(table, node->cascade_heap);
que_node_set_parent(node->cascade_node, node);
}
@ -852,7 +852,7 @@ row_ins_foreign_check_on_constraint(
cascade->foreign = foreign;
if (node->is_delete
&& (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)) {
&& (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)) {
cascade->is_delete = TRUE;
} else {
cascade->is_delete = FALSE;
@ -861,7 +861,7 @@ row_ins_foreign_check_on_constraint(
/* We have to make the update vector longer */
cascade->update = upd_create(foreign->n_fields,
node->cascade_heap);
node->cascade_heap);
cascade->update_n_fields = foreign->n_fields;
}
}
@ -875,16 +875,18 @@ row_ins_foreign_check_on_constraint(
of the parent table in an inconsistent state! */
if (!cascade->is_delete
&& row_ins_cascade_ancestor_updates_table(cascade, table)) {
&& row_ins_cascade_ancestor_updates_table(cascade, table)) {
/* We do not know if this would break foreign key
constraints, but play safe and return an error */
err = DB_ROW_IS_REFERENCED;
row_ins_foreign_report_err(
"Trying an update, possibly causing a cyclic cascaded update\n"
"in the child table,", thr, foreign, btr_pcur_get_rec(pcur), entry);
row_ins_foreign_report_err
("Trying an update, possibly causing a cyclic"
" cascaded update\n"
"in the child table,", thr, foreign,
btr_pcur_get_rec(pcur), entry);
goto nonstandard_exit_func;
}
@ -892,9 +894,9 @@ row_ins_foreign_check_on_constraint(
if (row_ins_cascade_n_ancestors(cascade) >= 15) {
err = DB_ROW_IS_REFERENCED;
row_ins_foreign_report_err(
"Trying a too deep cascaded delete or update\n",
thr, foreign, btr_pcur_get_rec(pcur), entry);
row_ins_foreign_report_err
("Trying a too deep cascaded delete or update\n",
thr, foreign, btr_pcur_get_rec(pcur), entry);
goto nonstandard_exit_func;
}
@ -920,30 +922,31 @@ row_ins_foreign_check_on_constraint(
tmp_heap = mem_heap_create(256);
ref = row_build_row_ref(ROW_COPY_POINTERS, index, rec,
tmp_heap);
tmp_heap);
btr_pcur_open_with_no_init(clust_index, ref,
PAGE_CUR_LE, BTR_SEARCH_LEAF,
cascade->pcur, 0, mtr);
PAGE_CUR_LE, BTR_SEARCH_LEAF,
cascade->pcur, 0, mtr);
clust_rec = btr_pcur_get_rec(cascade->pcur);
if (!page_rec_is_user_rec(clust_rec)
|| btr_pcur_get_low_match(cascade->pcur)
< dict_index_get_n_unique(clust_index)) {
|| btr_pcur_get_low_match(cascade->pcur)
< dict_index_get_n_unique(clust_index)) {
fputs(
"InnoDB: error in cascade of a foreign key op\n"
"InnoDB: ", stderr);
"InnoDB: error in cascade of a foreign key op\n"
"InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index);
fputs("\n"
"InnoDB: record ", stderr);
"InnoDB: record ", stderr);
rec_print(stderr, rec, index);
fputs("\n"
"InnoDB: clustered record ", stderr);
"InnoDB: clustered record ", stderr);
rec_print(stderr, clust_rec, clust_index);
fputs("\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
"InnoDB: Submit a detailed bug report to"
" http://bugs.mysql.com\n", stderr);
err = DB_SUCCESS;
@ -960,8 +963,9 @@ row_ins_foreign_check_on_constraint(
we already have a normal shared lock on the appropriate
gap if the search criterion was not unique */
err = lock_clust_rec_read_check_and_lock_alt(0, clust_rec,
clust_index, LOCK_X, LOCK_REC_NOT_GAP, thr);
err = lock_clust_rec_read_check_and_lock_alt
(0, clust_rec, clust_index,
LOCK_X, LOCK_REC_NOT_GAP, thr);
}
if (err != DB_SUCCESS) {
@ -979,9 +983,9 @@ row_ins_foreign_check_on_constraint(
}
if ((node->is_delete
&& (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL))
|| (!node->is_delete
&& (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL))) {
&& (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL))
|| (!node->is_delete
&& (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL))) {
/* Build the appropriate update vector which sets
foreign->n_fields first fields in rec to SQL NULL */
@ -993,8 +997,8 @@ row_ins_foreign_check_on_constraint(
for (i = 0; i < foreign->n_fields; i++) {
(update->fields + i)->field_no
= dict_table_get_nth_col_pos(table,
dict_index_get_nth_col_no(index, i));
= dict_table_get_nth_col_pos
(table, dict_index_get_nth_col_no(index, i));
(update->fields + i)->exp = NULL;
(update->fields + i)->new_val.len = UNIV_SQL_NULL;
(update->fields + i)->new_val.data = NULL;
@ -1003,7 +1007,7 @@ row_ins_foreign_check_on_constraint(
}
if (!node->is_delete
&& (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) {
&& (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) {
/* Build the appropriate update vector which sets changing
foreign->n_fields first fields in rec to new values */
@ -1011,15 +1015,18 @@ row_ins_foreign_check_on_constraint(
upd_vec_heap = mem_heap_create(256);
n_to_update = row_ins_cascade_calc_update_vec(node, foreign,
upd_vec_heap);
upd_vec_heap);
if (n_to_update == ULINT_UNDEFINED) {
err = DB_ROW_IS_REFERENCED;
row_ins_foreign_report_err(
"Trying a cascaded update where the updated value in the child\n"
"table would not fit in the length of the column, or the value would\n"
"be NULL and the column is declared as not NULL in the child table,",
thr, foreign, btr_pcur_get_rec(pcur), entry);
row_ins_foreign_report_err
("Trying a cascaded update where the"
" updated value in the child\n"
"table would not fit in the length"
" of the column, or the value would\n"
"be NULL and the column is"
" declared as not NULL in the child table,",
thr, foreign, btr_pcur_get_rec(pcur), entry);
goto nonstandard_exit_func;
}
@ -1054,12 +1061,13 @@ row_ins_foreign_check_on_constraint(
cascade->state = UPD_NODE_UPDATE_CLUSTERED;
err = row_update_cascade_for_mysql(thr, cascade,
foreign->foreign_table);
foreign->foreign_table);
if (foreign->foreign_table->n_foreign_key_checks_running == 0) {
fprintf(stderr,
"InnoDB: error: table %s has the counter 0 though there is\n"
"InnoDB: a FOREIGN KEY check running on it.\n",
"InnoDB: error: table %s has the counter 0"
" though there is\n"
"InnoDB: a FOREIGN KEY check running on it.\n",
foreign->foreign_table->name);
}
@ -1127,11 +1135,11 @@ row_ins_set_shared_rec_lock(
ut_ad(rec_offs_validate(rec, index, offsets));
if (index->type & DICT_CLUSTERED) {
err = lock_clust_rec_read_check_and_lock(0,
rec, index, offsets, LOCK_S, type, thr);
err = lock_clust_rec_read_check_and_lock
(0, rec, index, offsets, LOCK_S, type, thr);
} else {
err = lock_sec_rec_read_check_and_lock(0,
rec, index, offsets, LOCK_S, type, thr);
err = lock_sec_rec_read_check_and_lock
(0, rec, index, offsets, LOCK_S, type, thr);
}
return(err);
@ -1158,11 +1166,11 @@ row_ins_set_exclusive_rec_lock(
ut_ad(rec_offs_validate(rec, index, offsets));
if (index->type & DICT_CLUSTERED) {
err = lock_clust_rec_read_check_and_lock(0,
rec, index, offsets, LOCK_X, type, thr);
err = lock_clust_rec_read_check_and_lock
(0, rec, index, offsets, LOCK_X, type, thr);
} else {
err = lock_sec_rec_read_check_and_lock(0,
rec, index, offsets, LOCK_X, type, thr);
err = lock_sec_rec_read_check_and_lock
(0, rec, index, offsets, LOCK_X, type, thr);
}
return(err);
@ -1226,8 +1234,8 @@ run_again:
for example */
for (i = 0; i < foreign->n_fields; i++) {
if (UNIV_SQL_NULL == dfield_get_len(
dtuple_get_nth_field(entry, i))) {
if (UNIV_SQL_NULL == dfield_get_len
(dtuple_get_nth_field(entry, i))) {
goto exit_func;
}
@ -1278,19 +1286,20 @@ run_again:
trx_print(ef, trx, 600);
fputs("Foreign key constraint fails for table ", ef);
ut_print_name(ef, trx, TRUE,
foreign->foreign_table_name);
foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef,
trx, foreign, TRUE);
dict_print_info_on_foreign_key_in_create_format
(ef, trx, foreign, TRUE);
fputs("\nTrying to add to index ", ef);
ut_print_name(ef, trx, FALSE,
foreign->foreign_index->name);
foreign->foreign_index->name);
fputs(" tuple:\n", ef);
dtuple_print(ef, entry);
fputs("\nBut the parent table ", ef);
ut_print_name(ef, trx, TRUE,
foreign->referenced_table_name);
fputs("\nor its .ibd file does not currently exist!\n", ef);
foreign->referenced_table_name);
fputs("\nor its .ibd file does"
" not currently exist!\n", ef);
mutex_exit(&dict_foreign_err_mutex);
err = DB_NO_REFERENCED_ROW;
@ -1322,7 +1331,7 @@ run_again:
dtuple_set_n_fields_cmp(entry, foreign->n_fields);
btr_pcur_open(check_index, entry, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
BTR_SEARCH_LEAF, &pcur, &mtr);
/* Scan index records and check if there is a matching record */
@ -1337,12 +1346,13 @@ run_again:
}
offsets = rec_get_offsets(rec, check_index,
offsets, ULINT_UNDEFINED, &heap);
offsets, ULINT_UNDEFINED, &heap);
if (rec == page_get_supremum_rec(page)) {
err = row_ins_set_shared_rec_lock(LOCK_ORDINARY, rec,
check_index, offsets, thr);
err = row_ins_set_shared_rec_lock
(LOCK_ORDINARY, rec,
check_index, offsets, thr);
if (err != DB_SUCCESS) {
break;
@ -1355,10 +1365,10 @@ run_again:
if (cmp == 0) {
if (rec_get_deleted_flag(rec,
rec_offs_comp(offsets))) {
err = row_ins_set_shared_rec_lock(
LOCK_ORDINARY, rec,
check_index, offsets, thr);
rec_offs_comp(offsets))) {
err = row_ins_set_shared_rec_lock
(LOCK_ORDINARY, rec,
check_index, offsets, thr);
if (err != DB_SUCCESS) {
break;
@ -1368,9 +1378,9 @@ run_again:
a record because we can allow inserts
into gaps */
err = row_ins_set_shared_rec_lock(
LOCK_REC_NOT_GAP, rec,
check_index, offsets, thr);
err = row_ins_set_shared_rec_lock
(LOCK_REC_NOT_GAP, rec,
check_index, offsets, thr);
if (err != DB_SUCCESS) {
@ -1386,10 +1396,9 @@ run_again:
condition: check them in a separate
function */
err =
row_ins_foreign_check_on_constraint(
thr, foreign, &pcur, entry,
&mtr);
err = row_ins_foreign_check_on_constraint
(thr, foreign, &pcur,
entry, &mtr);
if (err != DB_SUCCESS) {
/* Since reporting a plain
"duplicate key" error
@ -1410,9 +1419,9 @@ run_again:
break;
}
} else {
row_ins_foreign_report_err(
"Trying to delete or update",
thr, foreign, rec, entry);
row_ins_foreign_report_err
("Trying to delete or update",
thr, foreign, rec, entry);
err = DB_ROW_IS_REFERENCED;
break;
@ -1421,8 +1430,8 @@ run_again:
}
if (cmp < 0) {
err = row_ins_set_shared_rec_lock(LOCK_GAP,
rec, check_index, offsets, thr);
err = row_ins_set_shared_rec_lock
(LOCK_GAP, rec, check_index, offsets, thr);
if (err != DB_SUCCESS) {
break;
@ -1430,8 +1439,8 @@ run_again:
if (check_ref) {
err = DB_NO_REFERENCED_ROW;
row_ins_foreign_report_add_err(
trx, foreign, rec, entry);
row_ins_foreign_report_add_err
(trx, foreign, rec, entry);
} else {
err = DB_SUCCESS;
}
@ -1446,8 +1455,8 @@ next_rec:
if (!moved) {
if (check_ref) {
rec = btr_pcur_get_rec(&pcur);
row_ins_foreign_report_add_err(
trx, foreign, rec, entry);
row_ins_foreign_report_add_err
(trx, foreign, rec, entry);
err = DB_NO_REFERENCED_ROW;
} else {
err = DB_SUCCESS;
@ -1529,7 +1538,7 @@ row_ins_check_foreign_constraints(
mutex_enter(&(dict_sys->mutex));
(foreign->referenced_table
->n_foreign_key_checks_running)++;
->n_foreign_key_checks_running)++;
mutex_exit(&(dict_sys->mutex));
}
@ -1539,16 +1548,16 @@ row_ins_check_foreign_constraints(
But the counter on the table protects the referenced
table from being dropped while the check is running. */
err = row_ins_check_foreign_constraint(TRUE, foreign,
table, entry, thr);
err = row_ins_check_foreign_constraint
(TRUE, foreign, table, entry, thr);
if (foreign->referenced_table) {
mutex_enter(&(dict_sys->mutex));
ut_a(foreign->referenced_table
->n_foreign_key_checks_running > 0);
->n_foreign_key_checks_running > 0);
(foreign->referenced_table
->n_foreign_key_checks_running)--;
->n_foreign_key_checks_running)--;
mutex_exit(&(dict_sys->mutex));
}
@ -1597,7 +1606,7 @@ row_ins_dupl_error_with_rec(
matched_bytes = 0;
cmp_dtuple_rec_with_match(entry, rec, offsets,
&matched_fields, &matched_bytes);
&matched_fields, &matched_bytes);
if (matched_fields < n_unique) {
@ -1610,8 +1619,8 @@ row_ins_dupl_error_with_rec(
if (!(index->type & DICT_CLUSTERED)) {
for (i = 0; i < n_unique; i++) {
if (UNIV_SQL_NULL == dfield_get_len(
dtuple_get_nth_field(entry, i))) {
if (UNIV_SQL_NULL == dfield_get_len
(dtuple_get_nth_field(entry, i))) {
return(FALSE);
}
@ -1658,8 +1667,8 @@ row_ins_scan_sec_index_for_duplicate(
since we define NULL != NULL in this case */
for (i = 0; i < n_unique; i++) {
if (UNIV_SQL_NULL == dfield_get_len(
dtuple_get_nth_field(entry, i))) {
if (UNIV_SQL_NULL == dfield_get_len
(dtuple_get_nth_field(entry, i))) {
return(DB_SUCCESS);
}
@ -1686,7 +1695,7 @@ row_ins_scan_sec_index_for_duplicate(
}
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
if (innobase_query_is_update()) {
@ -1695,12 +1704,12 @@ row_ins_scan_sec_index_for_duplicate(
duplicates ( REPLACE, LOAD DATAFILE REPLACE,
INSERT ON DUPLICATE KEY UPDATE). */
err = row_ins_set_exclusive_rec_lock(LOCK_ORDINARY,
rec, index, offsets, thr);
err = row_ins_set_exclusive_rec_lock
(LOCK_ORDINARY, rec, index, offsets, thr);
} else {
err = row_ins_set_shared_rec_lock(LOCK_ORDINARY,
rec, index, offsets, thr);
err = row_ins_set_shared_rec_lock
(LOCK_ORDINARY, rec, index, offsets, thr);
}
if (err != DB_SUCCESS) {
@ -1810,7 +1819,7 @@ row_ins_duplicate_error_in_clust(
if (!page_rec_is_infimum(rec)) {
offsets = rec_get_offsets(rec, cursor->index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
/* We set a lock on the possible duplicate: this
is needed in logical logging of MySQL to make
@ -1824,22 +1833,22 @@ row_ins_duplicate_error_in_clust(
duplicates ( REPLACE, LOAD DATAFILE REPLACE,
INSERT ON DUPLICATE KEY UPDATE). */
err = row_ins_set_exclusive_rec_lock(
LOCK_REC_NOT_GAP,rec,cursor->index,
offsets, thr);
err = row_ins_set_exclusive_rec_lock
(LOCK_REC_NOT_GAP, rec,
cursor->index, offsets, thr);
} else {
err = row_ins_set_shared_rec_lock(
LOCK_REC_NOT_GAP,rec, cursor->index,
offsets, thr);
err = row_ins_set_shared_rec_lock
(LOCK_REC_NOT_GAP, rec,
cursor->index, offsets, thr);
}
if (err != DB_SUCCESS) {
goto func_exit;
}
if (row_ins_dupl_error_with_rec(rec, entry,
cursor->index, offsets)) {
if (row_ins_dupl_error_with_rec
(rec, entry, cursor->index, offsets)) {
trx->error_info = cursor->index;
err = DB_DUPLICATE_KEY;
goto func_exit;
@ -1853,7 +1862,7 @@ row_ins_duplicate_error_in_clust(
if (!page_rec_is_supremum(rec)) {
offsets = rec_get_offsets(rec, cursor->index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
if (innobase_query_is_update()) {
@ -1862,22 +1871,22 @@ row_ins_duplicate_error_in_clust(
duplicates ( REPLACE, LOAD DATAFILE REPLACE,
INSERT ON DUPLICATE KEY UPDATE). */
err = row_ins_set_exclusive_rec_lock(
LOCK_REC_NOT_GAP, rec,
cursor->index, offsets, thr);
err = row_ins_set_exclusive_rec_lock
(LOCK_REC_NOT_GAP, rec,
cursor->index, offsets, thr);
} else {
err = row_ins_set_shared_rec_lock(
LOCK_REC_NOT_GAP, rec,
cursor->index, offsets, thr);
err = row_ins_set_shared_rec_lock
(LOCK_REC_NOT_GAP, rec,
cursor->index, offsets, thr);
}
if (err != DB_SUCCESS) {
goto func_exit;
}
if (row_ins_dupl_error_with_rec(rec, entry,
cursor->index, offsets)) {
if (row_ins_dupl_error_with_rec
(rec, entry, cursor->index, offsets)) {
trx->error_info = cursor->index;
err = DB_DUPLICATE_KEY;
goto func_exit;
@ -1885,7 +1894,7 @@ row_ins_duplicate_error_in_clust(
}
ut_a(!(cursor->index->type & DICT_CLUSTERED));
/* This should never happen */
/* This should never happen */
}
err = DB_SUCCESS;
@ -1999,8 +2008,8 @@ row_ins_index_entry_low(
}
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
mode | BTR_INSERT | ignore_sec_unique,
&cursor, 0, &mtr);
mode | BTR_INSERT | ignore_sec_unique,
&cursor, 0, &mtr);
if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
/* The insertion was made to the insert buffer already during
@ -2014,12 +2023,12 @@ row_ins_index_entry_low(
#ifdef UNIV_DEBUG
{
page_t* page = btr_cur_get_page(&cursor);
rec_t* first_rec = page_rec_get_next(
page_get_infimum_rec(page));
rec_t* first_rec = page_rec_get_next
(page_get_infimum_rec(page));
if (UNIV_LIKELY(first_rec != page_get_supremum_rec(page))) {
ut_a(rec_get_n_fields(first_rec, index)
== dtuple_get_n_fields(entry));
== dtuple_get_n_fields(entry));
}
}
#endif
@ -2027,22 +2036,22 @@ row_ins_index_entry_low(
n_unique = dict_index_get_n_unique(index);
if (index->type & DICT_UNIQUE && (cursor.up_match >= n_unique
|| cursor.low_match >= n_unique)) {
|| cursor.low_match >= n_unique)) {
if (index->type & DICT_CLUSTERED) {
/* Note that the following may return also
DB_LOCK_WAIT */
err = row_ins_duplicate_error_in_clust(&cursor,
entry, thr, &mtr);
err = row_ins_duplicate_error_in_clust
(&cursor, entry, thr, &mtr);
if (err != DB_SUCCESS) {
goto function_exit;
}
} else {
mtr_commit(&mtr);
err = row_ins_scan_sec_index_for_duplicate(index,
entry, thr);
err = row_ins_scan_sec_index_for_duplicate
(index, entry, thr);
mtr_start(&mtr);
if (err != DB_SUCCESS) {
@ -2057,8 +2066,9 @@ row_ins_index_entry_low(
continue the insertion. */
btr_cur_search_to_nth_level(index, 0, entry,
PAGE_CUR_LE, mode | BTR_INSERT,
&cursor, 0, &mtr);
PAGE_CUR_LE,
mode | BTR_INSERT,
&cursor, 0, &mtr);
}
}
@ -2076,21 +2086,19 @@ row_ins_index_entry_low(
}
if (index->type & DICT_CLUSTERED) {
err = row_ins_clust_index_entry_by_modify(mode,
&cursor, &big_rec,
entry,
ext_vec, n_ext_vec,
thr, &mtr);
err = row_ins_clust_index_entry_by_modify
(mode, &cursor, &big_rec, entry,
ext_vec, n_ext_vec, thr, &mtr);
} else {
err = row_ins_sec_index_entry_by_modify(mode, &cursor,
entry,
thr, &mtr);
err = row_ins_sec_index_entry_by_modify
(mode, &cursor, entry, thr, &mtr);
}
} else {
if (mode == BTR_MODIFY_LEAF) {
err = btr_cur_optimistic_insert(0, &cursor, entry,
&insert_rec, &big_rec, thr, &mtr);
err = btr_cur_optimistic_insert
(0, &cursor, entry,
&insert_rec, &big_rec, thr, &mtr);
} else {
ut_a(mode == BTR_MODIFY_TREE);
if (buf_LRU_buf_pool_running_out()) {
@ -2099,14 +2107,16 @@ row_ins_index_entry_low(
goto function_exit;
}
err = btr_cur_pessimistic_insert(0, &cursor, entry,
&insert_rec, &big_rec, thr, &mtr);
err = btr_cur_pessimistic_insert
(0, &cursor, entry,
&insert_rec, &big_rec, thr, &mtr);
}
if (err == DB_SUCCESS) {
if (ext_vec) {
rec_set_field_extern_bits(insert_rec, index,
ext_vec, n_ext_vec, &mtr);
ext_vec, n_ext_vec,
&mtr);
}
}
}
@ -2119,13 +2129,13 @@ function_exit:
mtr_start(&mtr);
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
BTR_MODIFY_TREE, &cursor, 0, &mtr);
BTR_MODIFY_TREE, &cursor, 0, &mtr);
rec = btr_cur_get_rec(&cursor);
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
err = btr_store_big_rec_extern_fields(index, rec,
offsets, big_rec, &mtr);
offsets, big_rec, &mtr);
if (modify) {
dtuple_big_rec_free(big_rec);
@ -2164,7 +2174,7 @@ row_ins_index_entry(
if (UT_LIST_GET_FIRST(index->table->foreign_list)) {
err = row_ins_check_foreign_constraints(index->table, index,
entry, thr);
entry, thr);
if (err != DB_SUCCESS) {
return(err);
@ -2174,7 +2184,7 @@ row_ins_index_entry(
/* Try first optimistic descent to the B-tree */
err = row_ins_index_entry_low(BTR_MODIFY_LEAF, index, entry,
ext_vec, n_ext_vec, thr);
ext_vec, n_ext_vec, thr);
if (err != DB_FAIL) {
return(err);
@ -2183,7 +2193,7 @@ row_ins_index_entry(
/* Try then pessimistic descent to the B-tree */
err = row_ins_index_entry_low(BTR_MODIFY_TREE, index, entry,
ext_vec, n_ext_vec, thr);
ext_vec, n_ext_vec, thr);
return(err);
}
@ -2217,14 +2227,14 @@ row_ins_index_entry_set_vals(
/* Check column prefix indexes */
if (ind_field->prefix_len > 0
&& dfield_get_len(row_field) != UNIV_SQL_NULL) {
&& dfield_get_len(row_field) != UNIV_SQL_NULL) {
cur_type = dict_col_get_type(
dict_field_get_col(ind_field));
cur_type = dict_col_get_type
(dict_field_get_col(ind_field));
field->len = dtype_get_at_most_n_mbchars(cur_type,
ind_field->prefix_len,
dfield_get_len(row_field), row_field->data);
field->len = dtype_get_at_most_n_mbchars
(cur_type, ind_field->prefix_len,
dfield_get_len(row_field), row_field->data);
} else {
field->len = row_field->len;
}
@ -2466,7 +2476,7 @@ row_ins_step(
}
node->trx_id = trx->id;
same_trx:
same_trx:
node->state = INS_NODE_ALLOC_ROW_ID;
if (node->ins_type == INS_SEARCHED) {
@ -2482,7 +2492,7 @@ row_ins_step(
}
if ((node->ins_type == INS_SEARCHED)
&& (sel_node->state != SEL_NODE_FETCH)) {
&& (sel_node->state != SEL_NODE_FETCH)) {
ut_ad(sel_node->state == SEL_NODE_NO_MORE_ROWS);

File diff suppressed because it is too large Load diff

View file

@ -72,7 +72,7 @@ row_purge_reposition_pcur(
}
found = row_search_on_row_ref(&(node->pcur), mode, node->table,
node->ref, mtr);
node->ref, mtr);
node->found_clust = found;
if (found) {
@ -123,9 +123,10 @@ row_purge_remove_clust_if_poss_low(
rec = btr_pcur_get_rec(pcur);
if (0 != ut_dulint_cmp(node->roll_ptr,
row_get_rec_roll_ptr(rec, index, rec_get_offsets(
rec, index, offsets_, ULINT_UNDEFINED, &heap)))) {
if (0 != ut_dulint_cmp(node->roll_ptr, row_get_rec_roll_ptr
(rec, index, rec_get_offsets
(rec, index, offsets_,
ULINT_UNDEFINED, &heap)))) {
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@ -171,7 +172,7 @@ row_purge_remove_clust_if_poss(
ibool success;
ulint n_tries = 0;
/* fputs("Purge: Removing clustered record\n", stderr); */
/* fputs("Purge: Removing clustered record\n", stderr); */
success = row_purge_remove_clust_if_poss_low(node, BTR_MODIFY_LEAF);
if (success) {
@ -247,9 +248,9 @@ row_purge_remove_sec_if_poss_low(
success = row_purge_reposition_pcur(BTR_SEARCH_LEAF, node, mtr_vers);
if (success) {
old_has = row_vers_old_has_index_entry(TRUE,
btr_pcur_get_rec(&(node->pcur)),
mtr_vers, index, entry);
old_has = row_vers_old_has_index_entry
(TRUE, btr_pcur_get_rec(&(node->pcur)),
mtr_vers, index, entry);
}
btr_pcur_commit_specify_mtr(&(node->pcur), mtr_vers);
@ -264,7 +265,7 @@ row_purge_remove_sec_if_poss_low(
} else {
ut_ad(mode == BTR_MODIFY_TREE);
btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
FALSE, &mtr);
FALSE, &mtr);
if (err == DB_SUCCESS) {
success = TRUE;
} else if (err == DB_OUT_OF_FILE_SPACE) {
@ -294,17 +295,17 @@ row_purge_remove_sec_if_poss(
ibool success;
ulint n_tries = 0;
/* fputs("Purge: Removing secondary record\n", stderr); */
/* fputs("Purge: Removing secondary record\n", stderr); */
success = row_purge_remove_sec_if_poss_low(node, index, entry,
BTR_MODIFY_LEAF);
BTR_MODIFY_LEAF);
if (success) {
return;
}
retry:
success = row_purge_remove_sec_if_poss_low(node, index, entry,
BTR_MODIFY_TREE);
BTR_MODIFY_TREE);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
and restart with more file space */
@ -389,7 +390,7 @@ row_purge_upd_exist_or_extern(
index = node->index;
if (row_upd_changes_ord_field_binary(NULL, node->index,
node->update)) {
node->update)) {
/* Build the older version of the index entry */
entry = row_build_index_entry(node->row, index, heap);
@ -415,13 +416,13 @@ skip_secondaries:
address of the new_val data */
internal_offset = ((byte*)ufield->new_val.data)
- node->undo_rec;
- node->undo_rec;
ut_a(internal_offset < UNIV_PAGE_SIZE);
trx_undo_decode_roll_ptr(node->roll_ptr,
&is_insert, &rseg_id,
&page_no, &offset);
&is_insert, &rseg_id,
&page_no, &offset);
mtr_start(&mtr);
/* We have to acquire an X-latch to the clustered
@ -450,13 +451,14 @@ skip_secondaries:
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(buf_frame_align(data_field),
SYNC_TRX_UNDO_PAGE);
SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
data_field_len = ufield->new_val.len;
btr_free_externally_stored_field(index, data_field,
data_field_len, FALSE, &mtr);
data_field_len,
FALSE, &mtr);
mtr_commit(&mtr);
}
}
@ -493,7 +495,7 @@ row_purge_parse_undo_rec(
trx = thr_get_trx(thr);
ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &cmpl_info,
updated_extern, &undo_no, &table_id);
updated_extern, &undo_no, &table_id);
node->rec_type = type;
if (type == TRX_UNDO_UPD_DEL_REC && !(*updated_extern)) {
@ -502,11 +504,11 @@ row_purge_parse_undo_rec(
}
ptr = trx_undo_update_rec_get_sys_cols(ptr, &trx_id, &roll_ptr,
&info_bits);
&info_bits);
node->table = NULL;
if (type == TRX_UNDO_UPD_EXIST_REC
&& cmpl_info & UPD_NODE_NO_ORD_CHANGE && !(*updated_extern)) {
&& cmpl_info & UPD_NODE_NO_ORD_CHANGE && !(*updated_extern)) {
/* Purge requires no changes to indexes: we may return */
@ -553,17 +555,17 @@ row_purge_parse_undo_rec(
}
ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref),
node->heap);
node->heap);
ptr = trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
roll_ptr, info_bits, trx,
node->heap, &(node->update));
roll_ptr, info_bits, trx,
node->heap, &(node->update));
/* Read to the partial row the fields that occur in indexes */
if (!cmpl_info & UPD_NODE_NO_ORD_CHANGE) {
ptr = trx_undo_rec_get_partial_row(ptr, clust_index,
&(node->row), node->heap);
&(node->row), node->heap);
}
return(TRUE);
@ -592,8 +594,8 @@ row_purge(
trx = thr_get_trx(thr);
node->undo_rec = trx_purge_fetch_next_rec(&roll_ptr,
&(node->reservation),
node->heap);
&(node->reservation),
node->heap);
if (!node->undo_rec) {
/* Purge completed for this query thread */
@ -608,7 +610,7 @@ row_purge(
purge_needed = FALSE;
} else {
purge_needed = row_purge_parse_undo_rec(node, &updated_extern,
thr);
thr);
/* If purge_needed == TRUE, we must also remember to unfreeze
data dictionary! */
}
@ -616,14 +618,14 @@ row_purge(
if (purge_needed) {
node->found_clust = FALSE;
node->index = dict_table_get_next_index(
dict_table_get_first_index(node->table));
node->index = dict_table_get_next_index
(dict_table_get_first_index(node->table));
if (node->rec_type == TRX_UNDO_DEL_MARK_REC) {
row_purge_del_mark(node);
} else if (updated_extern
|| node->rec_type == TRX_UNDO_UPD_EXIST_REC) {
|| node->rec_type == TRX_UNDO_UPD_EXIST_REC) {
row_purge_upd_exist_or_extern(node);
}

View file

@ -128,8 +128,8 @@ row_build_index_entry(
if (index->type & DICT_UNIVERSAL) {
dtuple_set_n_fields_cmp(entry, entry_len);
} else {
dtuple_set_n_fields_cmp(entry,
dict_index_get_n_unique_in_tree(index));
dtuple_set_n_fields_cmp
(entry, dict_index_get_n_unique_in_tree(index));
}
for (i = 0; i < entry_len; i++) {
@ -144,15 +144,14 @@ row_build_index_entry(
/* If a column prefix index, take only the prefix */
if (ind_field->prefix_len > 0
&& dfield_get_len(dfield2) != UNIV_SQL_NULL) {
&& dfield_get_len(dfield2) != UNIV_SQL_NULL) {
cur_type = dict_col_get_type(
dict_field_get_col(ind_field));
cur_type = dict_col_get_type
(dict_field_get_col(ind_field));
storage_len = dtype_get_at_most_n_mbchars(
cur_type,
ind_field->prefix_len,
dfield_get_len(dfield2), dfield2->data);
storage_len = dtype_get_at_most_n_mbchars
(cur_type, ind_field->prefix_len,
dfield_get_len(dfield2), dfield2->data);
dfield_set_len(dfield, storage_len);
}
@ -211,7 +210,7 @@ row_build(
if (!offsets) {
offsets = rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &tmp_heap);
ULINT_UNDEFINED, &tmp_heap);
} else {
ut_ad(rec_offs_validate(rec, index, offsets));
}
@ -229,8 +228,8 @@ row_build(
row = dtuple_create(heap, row_len);
dtuple_set_info_bits(row, rec_get_info_bits(rec,
dict_table_is_comp(table)));
dtuple_set_info_bits(row, rec_get_info_bits
(rec, dict_table_is_comp(table)));
n_fields = rec_offs_n_fields(offsets);
@ -243,14 +242,14 @@ row_build(
col = dict_field_get_col(ind_field);
dfield = dtuple_get_nth_field(row,
dict_col_get_no(col));
dict_col_get_no(col));
field = rec_get_nth_field(rec, offsets, i, &len);
if (type == ROW_COPY_ALSO_EXTERNALS
&& rec_offs_nth_extern(offsets, i)) {
&& rec_offs_nth_extern(offsets, i)) {
field = btr_rec_copy_externally_stored_field(
rec, offsets, i, &len, heap);
field = btr_rec_copy_externally_stored_field
(rec, offsets, i, &len, heap);
}
dfield_set_data(dfield, field, len);
@ -305,7 +304,7 @@ row_rec_to_index_entry(
ut_ad(rec && heap && index);
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &tmp_heap);
ULINT_UNDEFINED, &tmp_heap);
if (type == ROW_COPY_DATA) {
/* Take a copy of rec to heap */
@ -326,7 +325,7 @@ row_rec_to_index_entry(
dict_index_copy_types(entry, index, rec_len);
dtuple_set_info_bits(entry,
rec_get_info_bits(rec, rec_offs_comp(offsets)));
rec_get_info_bits(rec, rec_offs_comp(offsets)));
for (i = 0; i < rec_len; i++) {
@ -387,7 +386,7 @@ row_build_row_ref(
ut_ad(index && rec && heap);
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &tmp_heap);
ULINT_UNDEFINED, &tmp_heap);
if (type == ROW_COPY_DATA) {
/* Take a copy of rec to heap */
@ -432,9 +431,10 @@ row_build_row_ref(
if (len != UNIV_SQL_NULL) {
dfield_set_len(dfield,
dtype_get_at_most_n_mbchars(
dfield_get_type(dfield),
clust_col_prefix_len, len, (char*) field));
dtype_get_at_most_n_mbchars
(dfield_get_type(dfield),
clust_col_prefix_len, len,
(char*) field));
}
}
}
@ -482,7 +482,7 @@ row_build_row_ref_in_tuple(
if (UNIV_UNLIKELY(!index->table)) {
fputs("InnoDB: table ", stderr);
notfound:
notfound:
ut_print_name(stderr, trx, TRUE, index->table_name);
fputs(" for index ", stderr);
ut_print_name(stderr, trx, FALSE, index->name);
@ -528,9 +528,10 @@ row_build_row_ref_in_tuple(
if (len != UNIV_SQL_NULL) {
dfield_set_len(dfield,
dtype_get_at_most_n_mbchars(
dfield_get_type(dfield),
clust_col_prefix_len, len, (char*) field));
dtype_get_at_most_n_mbchars
(dfield_get_type(dfield),
clust_col_prefix_len, len,
(char*) field));
}
}
}
@ -585,15 +586,14 @@ row_build_row_ref_from_row(
dfield_copy(dfield, dfield2);
if (field->prefix_len > 0
&& dfield->len != UNIV_SQL_NULL) {
&& dfield->len != UNIV_SQL_NULL) {
cur_type = dict_col_get_type(
dict_field_get_col(field));
cur_type = dict_col_get_type
(dict_field_get_col(field));
dfield->len = dtype_get_at_most_n_mbchars(
cur_type,
field->prefix_len,
dfield->len, dfield->data);
dfield->len = dtype_get_at_most_n_mbchars
(cur_type, field->prefix_len,
dfield->len, dfield->data);
}
}

File diff suppressed because it is too large Load diff

View file

@ -48,7 +48,7 @@ row_undo_ins_remove_clust_rec(
mtr_start(&mtr);
success = btr_pcur_restore_position(BTR_MODIFY_LEAF, &(node->pcur),
&mtr);
&mtr);
ut_a(success);
if (ut_dulint_cmp(node->table->id, DICT_INDEXES_ID) == 0) {
@ -63,7 +63,7 @@ row_undo_ins_remove_clust_rec(
mtr_start(&mtr);
success = btr_pcur_restore_position(BTR_MODIFY_LEAF,
&(node->pcur), &mtr);
&(node->pcur), &mtr);
ut_a(success);
}
@ -83,7 +83,7 @@ retry:
mtr_start(&mtr);
success = btr_pcur_restore_position(BTR_MODIFY_TREE,
&(node->pcur), &mtr);
&(node->pcur), &mtr);
ut_a(success);
btr_cur_pessimistic_delete(&err, FALSE, btr_cur, TRUE, &mtr);
@ -93,7 +93,7 @@ retry:
and restart with more file space */
if (err == DB_OUT_OF_FILE_SPACE
&& n_tries < BTR_CUR_RETRY_DELETE_N_TIMES) {
&& n_tries < BTR_CUR_RETRY_DELETE_N_TIMES) {
btr_pcur_commit_specify_mtr(&(node->pcur), &mtr);
@ -230,7 +230,7 @@ row_undo_ins_parse_undo_rec(
ut_ad(node);
ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &dummy,
&dummy_extern, &undo_no, &table_id);
&dummy_extern, &undo_no, &table_id);
ut_ad(type == TRX_UNDO_INSERT_REC);
node->rec_type = type;
@ -251,7 +251,7 @@ row_undo_ins_parse_undo_rec(
clust_index = dict_table_get_first_index(node->table);
ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref),
node->heap);
node->heap);
}
/***************************************************************
@ -286,12 +286,12 @@ row_undo_ins(
return(DB_SUCCESS);
}
node->index = dict_table_get_next_index(
dict_table_get_first_index(node->table));
node->index = dict_table_get_next_index
(dict_table_get_first_index(node->table));
while (node->index != NULL) {
entry = row_build_index_entry(node->row, node->index,
node->heap);
node->heap);
err = row_undo_ins_remove_sec(node->index, entry);
if (err != DB_SUCCESS) {

View file

@ -101,18 +101,19 @@ row_undo_mod_clust_low(
if (mode == BTR_MODIFY_LEAF) {
err = btr_cur_optimistic_update(BTR_NO_LOCKING_FLAG
| BTR_NO_UNDO_LOG_FLAG
| BTR_KEEP_SYS_FLAG,
btr_cur, node->update,
node->cmpl_info, thr, mtr);
| BTR_NO_UNDO_LOG_FLAG
| BTR_KEEP_SYS_FLAG,
btr_cur, node->update,
node->cmpl_info, thr, mtr);
} else {
ut_ad(mode == BTR_MODIFY_TREE);
err = btr_cur_pessimistic_update(BTR_NO_LOCKING_FLAG
| BTR_NO_UNDO_LOG_FLAG
| BTR_KEEP_SYS_FLAG,
btr_cur, &dummy_big_rec, node->update,
node->cmpl_info, thr, mtr);
err = btr_cur_pessimistic_update
(BTR_NO_LOCKING_FLAG
| BTR_NO_UNDO_LOG_FLAG
| BTR_KEEP_SYS_FLAG,
btr_cur, &dummy_big_rec, node->update,
node->cmpl_info, thr, mtr);
}
return(err);
@ -149,7 +150,7 @@ row_undo_mod_remove_clust_low(
/* Find out if we can remove the whole clustered index record */
if (node->rec_type == TRX_UNDO_UPD_DEL_REC
&& !row_vers_must_preserve_del_marked(node->new_trx_id, mtr)) {
&& !row_vers_must_preserve_del_marked(node->new_trx_id, mtr)) {
/* Ok, we can remove */
} else {
@ -234,7 +235,7 @@ row_undo_mod_clust(
mtr_start(&mtr);
err = row_undo_mod_remove_clust_low(node, thr, &mtr,
BTR_MODIFY_LEAF);
BTR_MODIFY_LEAF);
if (err != DB_SUCCESS) {
btr_pcur_commit_specify_mtr(pcur, &mtr);
@ -244,7 +245,7 @@ row_undo_mod_clust(
mtr_start(&mtr);
err = row_undo_mod_remove_clust_low(node, thr, &mtr,
BTR_MODIFY_TREE);
BTR_MODIFY_TREE);
}
btr_pcur_commit_specify_mtr(pcur, &mtr);
@ -318,15 +319,15 @@ row_undo_mod_del_mark_or_remove_sec_low(
mtr_start(&mtr_vers);
success = btr_pcur_restore_position(BTR_SEARCH_LEAF, &(node->pcur),
&mtr_vers);
&mtr_vers);
ut_a(success);
old_has = row_vers_old_has_index_entry(FALSE,
btr_pcur_get_rec(&(node->pcur)),
&mtr_vers, index, entry);
btr_pcur_get_rec(&(node->pcur)),
&mtr_vers, index, entry);
if (old_has) {
err = btr_cur_del_mark_set_sec_rec(BTR_NO_LOCKING_FLAG,
btr_cur, TRUE, thr, &mtr);
btr_cur, TRUE, thr, &mtr);
ut_ad(err == DB_SUCCESS);
} else {
/* Remove the index record */
@ -342,7 +343,7 @@ row_undo_mod_del_mark_or_remove_sec_low(
ut_ad(mode == BTR_MODIFY_TREE);
btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
TRUE, &mtr);
TRUE, &mtr);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
@ -378,14 +379,14 @@ row_undo_mod_del_mark_or_remove_sec(
ulint err;
err = row_undo_mod_del_mark_or_remove_sec_low(node, thr, index,
entry, BTR_MODIFY_LEAF);
entry, BTR_MODIFY_LEAF);
if (err == DB_SUCCESS) {
return(err);
}
err = row_undo_mod_del_mark_or_remove_sec_low(node, thr, index,
entry, BTR_MODIFY_TREE);
entry, BTR_MODIFY_TREE);
return(err);
}
@ -422,28 +423,29 @@ row_undo_mod_del_unmark_sec_and_undo_update(
if (!found) {
fputs("InnoDB: error in sec index entry del undo in\n"
"InnoDB: ", stderr);
"InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index);
fputs("\n"
"InnoDB: tuple ", stderr);
"InnoDB: tuple ", stderr);
dtuple_print(stderr, entry);
fputs("\n"
"InnoDB: record ", stderr);
"InnoDB: record ", stderr);
rec_print(stderr, btr_pcur_get_rec(&pcur), index);
putc('\n', stderr);
trx_print(stderr, trx, 0);
fputs("\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
} else {
btr_cur_t* btr_cur = btr_pcur_get_btr_cur(&pcur);
err = btr_cur_del_mark_set_sec_rec(BTR_NO_LOCKING_FLAG,
btr_cur, FALSE, thr, &mtr);
btr_cur, FALSE, thr, &mtr);
ut_a(err == DB_SUCCESS);
heap = mem_heap_create(100);
update = row_upd_build_sec_rec_difference_binary(index, entry,
btr_cur_get_rec(btr_cur), trx, heap);
update = row_upd_build_sec_rec_difference_binary
(index, entry, btr_cur_get_rec(btr_cur), trx, heap);
if (upd_get_n_fields(update) == 0) {
/* Do nothing */
@ -452,18 +454,18 @@ row_undo_mod_del_unmark_sec_and_undo_update(
/* Try an optimistic updating of the record, keeping
changes within the page */
err = btr_cur_optimistic_update(BTR_KEEP_SYS_FLAG
| BTR_NO_LOCKING_FLAG,
btr_cur, update, 0, thr, &mtr);
err = btr_cur_optimistic_update
(BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG,
btr_cur, update, 0, thr, &mtr);
if (err == DB_OVERFLOW || err == DB_UNDERFLOW) {
err = DB_FAIL;
}
} else {
ut_a(mode == BTR_MODIFY_TREE);
err = btr_cur_pessimistic_update(BTR_KEEP_SYS_FLAG
| BTR_NO_LOCKING_FLAG,
btr_cur, &dummy_big_rec,
update, 0, thr, &mtr);
err = btr_cur_pessimistic_update
(BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG,
btr_cur, &dummy_big_rec,
update, 0, thr, &mtr);
}
mem_heap_free(heap);
@ -498,7 +500,7 @@ row_undo_mod_upd_del_sec(
entry = row_build_index_entry(node->row, index, heap);
err = row_undo_mod_del_mark_or_remove_sec(node, thr, index,
entry);
entry);
if (err != DB_SUCCESS) {
mem_heap_free(heap);
@ -536,13 +538,11 @@ row_undo_mod_del_mark_sec(
entry = row_build_index_entry(node->row, index, heap);
err = row_undo_mod_del_unmark_sec_and_undo_update(
BTR_MODIFY_LEAF,
thr, index, entry);
err = row_undo_mod_del_unmark_sec_and_undo_update
(BTR_MODIFY_LEAF, thr, index, entry);
if (err == DB_FAIL) {
err = row_undo_mod_del_unmark_sec_and_undo_update(
BTR_MODIFY_TREE,
thr, index, entry);
err = row_undo_mod_del_unmark_sec_and_undo_update
(BTR_MODIFY_TREE, thr, index, entry);
}
if (err != DB_SUCCESS) {
@ -587,7 +587,7 @@ row_undo_mod_upd_exist_sec(
index = node->index;
if (row_upd_changes_ord_field_binary(node->row, node->index,
node->update)) {
node->update)) {
/* Build the newest version of the index entry */
entry = row_build_index_entry(node->row, index, heap);
@ -603,7 +603,8 @@ row_undo_mod_upd_exist_sec(
through which we do the search is delete-marked. */
err = row_undo_mod_del_mark_or_remove_sec(node, thr,
index, entry);
index,
entry);
if (err != DB_SUCCESS) {
mem_heap_free(heap);
@ -618,15 +619,12 @@ row_undo_mod_upd_exist_sec(
'abc' -> 'aBc'. */
row_upd_index_replace_new_col_vals(entry, index,
node->update, NULL);
err = row_undo_mod_del_unmark_sec_and_undo_update(
BTR_MODIFY_LEAF,
thr, index, entry);
node->update, NULL);
err = row_undo_mod_del_unmark_sec_and_undo_update
(BTR_MODIFY_LEAF, thr, index, entry);
if (err == DB_FAIL) {
err =
row_undo_mod_del_unmark_sec_and_undo_update(
BTR_MODIFY_TREE,
thr, index, entry);
err = row_undo_mod_del_unmark_sec_and_undo_update
(BTR_MODIFY_TREE, thr, index, entry);
}
if (err != DB_SUCCESS) {
@ -668,7 +666,7 @@ row_undo_mod_parse_undo_rec(
ut_ad(node && thr);
trx = thr_get_trx(thr);
ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &cmpl_info,
&dummy_extern, &undo_no, &table_id);
&dummy_extern, &undo_no, &table_id);
node->rec_type = type;
node->table = dict_table_get_on_id(table_id, trx);
@ -691,14 +689,14 @@ row_undo_mod_parse_undo_rec(
clust_index = dict_table_get_first_index(node->table);
ptr = trx_undo_update_rec_get_sys_cols(ptr, &trx_id, &roll_ptr,
&info_bits);
&info_bits);
ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref),
node->heap);
node->heap);
trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
roll_ptr, info_bits, trx,
node->heap, &(node->update));
roll_ptr, info_bits, trx,
node->heap, &(node->update));
node->new_roll_ptr = roll_ptr;
node->new_trx_id = trx_id;
node->cmpl_info = cmpl_info;
@ -738,8 +736,8 @@ row_undo_mod(
return(DB_SUCCESS);
}
node->index = dict_table_get_next_index(
dict_table_get_first_index(node->table));
node->index = dict_table_get_next_index
(dict_table_get_first_index(node->table));
if (node->rec_type == TRX_UNDO_UPD_EXIST_REC) {

View file

@ -161,15 +161,16 @@ row_undo_search_clust_to_pcur(
clust_index = dict_table_get_first_index(node->table);
found = row_search_on_row_ref(&(node->pcur), BTR_MODIFY_LEAF,
node->table, node->ref, &mtr);
node->table, node->ref, &mtr);
rec = btr_pcur_get_rec(&(node->pcur));
offsets = rec_get_offsets(rec, clust_index, offsets,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
if (!found || 0 != ut_dulint_cmp(node->roll_ptr,
row_get_rec_roll_ptr(rec, clust_index, offsets))) {
row_get_rec_roll_ptr(rec, clust_index,
offsets))) {
/* We must remove the reservation on the undo log record
BEFORE releasing the latch on the clustered index page: this
@ -177,12 +178,12 @@ row_undo_search_clust_to_pcur(
modification corresponding to node->roll_ptr. */
/* fputs("--------------------undoing a previous version\n",
stderr); */
stderr); */
ret = FALSE;
} else {
node->row = row_build(ROW_COPY_DATA, clust_index, rec,
offsets, node->heap);
offsets, node->heap);
btr_pcur_store_position(&(node->pcur), &mtr);
ret = TRUE;
@ -221,9 +222,9 @@ row_undo(
if (node->state == UNDO_NODE_FETCH_NEXT) {
node->undo_rec = trx_roll_pop_top_rec_of_trx(trx,
trx->roll_limit,
&roll_ptr,
node->heap);
trx->roll_limit,
&roll_ptr,
node->heap);
if (!node->undo_rec) {
/* Rollback completed for this query thread */
@ -250,7 +251,7 @@ row_undo(
roll_ptr = node->new_roll_ptr;
node->undo_rec = trx_undo_get_undo_rec_low(roll_ptr,
node->heap);
node->heap);
node->roll_ptr = roll_ptr;
node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec);
@ -335,8 +336,9 @@ row_undo_step(
if (err == DB_OUT_OF_FILE_SPACE) {
fprintf(stderr,
"InnoDB: Error 13 means out of tablespace.\n"
"InnoDB: Consider increasing your tablespace.\n");
"InnoDB: Error 13 means out of tablespace.\n"
"InnoDB: Consider increasing"
" your tablespace.\n");
exit(1);
}

View file

@ -196,10 +196,9 @@ row_upd_check_references_constraints(
NOT break the constraint. */
if (foreign->referenced_index == index
&& (node->is_delete
|| row_upd_changes_first_fields_binary(
entry, index, node->update,
foreign->n_fields))) {
&& (node->is_delete
|| row_upd_changes_first_fields_binary
(entry, index, node->update, foreign->n_fields))) {
if (foreign->foreign_table == NULL) {
dict_table_get(foreign->foreign_table_name);
@ -209,7 +208,7 @@ row_upd_check_references_constraints(
mutex_enter(&(dict_sys->mutex));
(foreign->foreign_table
->n_foreign_key_checks_running)++;
->n_foreign_key_checks_running)++;
mutex_exit(&(dict_sys->mutex));
}
@ -219,25 +218,25 @@ row_upd_check_references_constraints(
But the counter on the table protects 'foreign' from
being dropped while the check is running. */
err = row_ins_check_foreign_constraint(FALSE, foreign,
table, entry, thr);
err = row_ins_check_foreign_constraint
(FALSE, foreign, table, entry, thr);
if (foreign->foreign_table) {
mutex_enter(&(dict_sys->mutex));
ut_a(foreign->foreign_table
->n_foreign_key_checks_running > 0);
->n_foreign_key_checks_running > 0);
(foreign->foreign_table
->n_foreign_key_checks_running)--;
->n_foreign_key_checks_running)--;
mutex_exit(&(dict_sys->mutex));
}
if (err != DB_SUCCESS) {
if (got_s_lock) {
row_mysql_unfreeze_data_dictionary(
trx);
row_mysql_unfreeze_data_dictionary
(trx);
}
mem_heap_free(heap);
@ -389,16 +388,16 @@ row_upd_changes_field_size_or_external(
this fix also to 4.0. The merge to 5.0 will be made
manually immediately after we commit this to 4.1. */
new_len = dtype_get_sql_null_size(
dict_index_get_nth_type(index,
upd_field->field_no));
new_len = dtype_get_sql_null_size
(dict_index_get_nth_type(index,
upd_field->field_no));
}
old_len = rec_offs_nth_size(offsets, upd_field->field_no);
if (rec_offs_comp(offsets)
&& rec_offs_nth_sql_null(offsets,
upd_field->field_no)) {
&& rec_offs_nth_sql_null(offsets,
upd_field->field_no)) {
/* Note that in the compact table format, for a
variable length field, an SQL NULL will use zero
bytes in the offset array at the start of the physical
@ -456,8 +455,8 @@ row_upd_rec_in_place(
new_val = &(upd_field->new_val);
rec_set_nth_field(rec, offsets, upd_field->field_no,
dfield_get_data(new_val),
dfield_get_len(new_val));
dfield_get_data(new_val),
dfield_get_len(new_val));
}
}
@ -480,7 +479,8 @@ row_upd_write_sys_vals_to_log(
ut_ad(mtr);
log_ptr += mach_write_compressed(log_ptr,
dict_index_get_sys_col_pos(index, DATA_TRX_ID));
dict_index_get_sys_col_pos
(index, DATA_TRX_ID));
trx_write_roll_ptr(log_ptr, roll_ptr);
log_ptr += DATA_ROLL_PTR_LEN;
@ -635,7 +635,7 @@ row_upd_index_parse(
new_val = &(upd_field->new_val);
ptr = mach_parse_compressed(ptr, end_ptr,
&(upd_field->field_no));
&(upd_field->field_no));
if (ptr == NULL) {
return(NULL);
@ -733,7 +733,7 @@ row_upd_build_sec_rec_difference_binary(
n_diff = 0;
offsets = rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
for (i = 0; i < dtuple_get_n_fields(entry); i++) {
@ -815,7 +815,7 @@ row_upd_build_difference_binary(
trx_id_pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
offsets = rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
for (i = 0; i < dtuple_get_n_fields(entry); i++) {
@ -834,8 +834,8 @@ row_upd_build_difference_binary(
extern_bit = upd_ext_vec_contains(ext_vec, n_ext_vec, i);
if (UNIV_UNLIKELY(extern_bit ==
(ibool)!rec_offs_nth_extern(offsets, i))
|| !dfield_data_is_binary_equal(dfield, len, data)) {
(ibool)!rec_offs_nth_extern(offsets, i))
|| !dfield_data_is_binary_equal(dfield, len, data)) {
upd_field = upd_get_nth_field(update, n_diff);
@ -911,26 +911,24 @@ row_upd_index_replace_new_col_vals_index_pos(
new_val = &(upd_field->new_val);
dfield_set_data(dfield, new_val->data,
new_val->len);
new_val->len);
if (heap && new_val->len != UNIV_SQL_NULL) {
dfield->data = mem_heap_alloc(heap,
new_val->len);
dfield->data = mem_heap_alloc
(heap, new_val->len);
ut_memcpy(dfield->data, new_val->data,
new_val->len);
new_val->len);
}
if (field->prefix_len > 0
&& new_val->len != UNIV_SQL_NULL) {
&& new_val->len != UNIV_SQL_NULL) {
cur_type = dict_col_get_type(
dict_field_get_col(field));
cur_type = dict_col_get_type
(dict_field_get_col(field));
dfield->len =
dtype_get_at_most_n_mbchars(
cur_type,
field->prefix_len,
new_val->len,
new_val->data);
dfield->len
= dtype_get_at_most_n_mbchars
(cur_type, field->prefix_len,
new_val->len, new_val->data);
}
}
}
@ -981,26 +979,24 @@ row_upd_index_replace_new_col_vals(
new_val = &(upd_field->new_val);
dfield_set_data(dfield, new_val->data,
new_val->len);
new_val->len);
if (heap && new_val->len != UNIV_SQL_NULL) {
dfield->data = mem_heap_alloc(heap,
new_val->len);
dfield->data = mem_heap_alloc
(heap, new_val->len);
ut_memcpy(dfield->data, new_val->data,
new_val->len);
new_val->len);
}
if (field->prefix_len > 0
&& new_val->len != UNIV_SQL_NULL) {
&& new_val->len != UNIV_SQL_NULL) {
cur_type = dict_col_get_type(
dict_field_get_col(field));
cur_type = dict_col_get_type
(dict_field_get_col(field));
dfield->len =
dtype_get_at_most_n_mbchars(
cur_type,
field->prefix_len,
new_val->len,
new_val->data);
dfield->len
= dtype_get_at_most_n_mbchars
(cur_type, field->prefix_len,
new_val->len, new_val->data);
}
}
}
@ -1060,12 +1056,12 @@ row_upd_changes_ord_field_binary(
the datas */
if (col_pos == upd_field->field_no
&& (row == NULL
|| ind_field->prefix_len > 0
|| !dfield_datas_are_binary_equal(
dtuple_get_nth_field(row,
col_no),
&(upd_field->new_val)))) {
&& (row == NULL
|| ind_field->prefix_len > 0
|| !dfield_datas_are_binary_equal
(dtuple_get_nth_field(row, col_no),
&(upd_field->new_val)))) {
return(TRUE);
}
}
@ -1096,9 +1092,9 @@ row_upd_changes_some_index_ord_field_binary(
upd_field = upd_get_nth_field(update, i);
if (dict_field_get_col(dict_index_get_nth_field(index,
upd_field->field_no))
->ord_part) {
if (dict_field_get_col(dict_index_get_nth_field
(index, upd_field->field_no))
->ord_part) {
return(TRUE);
}
@ -1146,9 +1142,9 @@ row_upd_changes_first_fields_binary(
upd_field = upd_get_nth_field(update, j);
if (col_pos == upd_field->field_no
&& !dfield_datas_are_binary_equal(
dtuple_get_nth_field(entry, i),
&(upd_field->new_val))) {
&& !dfield_datas_are_binary_equal
(dtuple_get_nth_field(entry, i),
&(upd_field->new_val))) {
return(TRUE);
}
@ -1174,8 +1170,8 @@ row_upd_copy_columns(
while (column) {
data = rec_get_nth_field(rec, offsets,
column->field_nos[SYM_CLUST_FIELD_NO],
&len);
column->field_nos[SYM_CLUST_FIELD_NO],
&len);
eval_node_copy_and_alloc_val(column, data, len);
column = UT_LIST_GET_NEXT(col_var_list, column);
@ -1237,11 +1233,11 @@ row_upd_store_row(
rec = btr_pcur_get_rec(node->pcur);
offsets = rec_get_offsets(rec, clust_index, offsets_,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
node->row = row_build(ROW_COPY_DATA, clust_index, rec, offsets,
node->heap);
node->heap);
node->ext_vec = mem_heap_alloc(node->heap, sizeof(ulint)
* rec_offs_n_fields(offsets));
* rec_offs_n_fields(offsets));
if (node->is_delete) {
update = NULL;
} else {
@ -1249,7 +1245,7 @@ row_upd_store_row(
}
node->n_ext_vec = btr_push_update_extern_fields(node->ext_vec,
offsets, update);
offsets, update);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@ -1291,44 +1287,44 @@ row_upd_sec_index_entry(
mtr_start(&mtr);
found = row_search_index_entry(index, entry, BTR_MODIFY_LEAF, &pcur,
&mtr);
&mtr);
btr_cur = btr_pcur_get_btr_cur(&pcur);
rec = btr_cur_get_rec(btr_cur);
if (UNIV_UNLIKELY(!found)) {
fputs("InnoDB: error in sec index entry update in\n"
"InnoDB: ", stderr);
"InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index);
fputs("\n"
"InnoDB: tuple ", stderr);
"InnoDB: tuple ", stderr);
dtuple_print(stderr, entry);
fputs("\n"
"InnoDB: record ", stderr);
"InnoDB: record ", stderr);
rec_print(stderr, rec, index);
putc('\n', stderr);
trx_print(stderr, trx, 0);
fputs("\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
} else {
/* Delete mark the old index record; it can already be
delete marked if we return after a lock wait in
row_ins_index_entry below */
if (!rec_get_deleted_flag(rec,
dict_table_is_comp(index->table))) {
dict_table_is_comp(index->table))) {
err = btr_cur_del_mark_set_sec_rec(0, btr_cur, TRUE,
thr, &mtr);
thr, &mtr);
if (err == DB_SUCCESS && check_ref) {
/* NOTE that the following call loses
the position of pcur ! */
err = row_upd_check_references_constraints(
node,
&pcur, index->table,
index, thr, &mtr);
err = row_upd_check_references_constraints
(node, &pcur, index->table,
index, thr, &mtr);
if (err != DB_SUCCESS) {
goto close_cur;
@ -1374,12 +1370,12 @@ row_upd_sec_step(
ulint err;
ut_ad((node->state == UPD_NODE_UPDATE_ALL_SEC)
|| (node->state == UPD_NODE_UPDATE_SOME_SEC));
|| (node->state == UPD_NODE_UPDATE_SOME_SEC));
ut_ad(!(node->index->type & DICT_CLUSTERED));
if (node->state == UPD_NODE_UPDATE_ALL_SEC
|| row_upd_changes_ord_field_binary(node->row, node->index,
node->update)) {
|| row_upd_changes_ord_field_binary(node->row, node->index,
node->update)) {
err = row_upd_sec_index_entry(node, thr);
return(err);
@ -1427,7 +1423,7 @@ row_upd_clust_rec_by_insert(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG,
btr_cur, TRUE, thr, mtr);
btr_cur, TRUE, thr, mtr);
if (err != DB_SUCCESS) {
mtr_commit(mtr);
return(err);
@ -1438,16 +1434,17 @@ row_upd_clust_rec_by_insert(
free those externally stored fields even if the delete marked
record is removed from the index tree, or updated. */
btr_cur_mark_extern_inherited_fields(btr_cur_get_rec(btr_cur),
rec_get_offsets(btr_cur_get_rec(btr_cur),
dict_table_get_first_index(table), offsets_,
ULINT_UNDEFINED, &heap), node->update, mtr);
btr_cur_mark_extern_inherited_fields
(btr_cur_get_rec(btr_cur),
rec_get_offsets(btr_cur_get_rec(btr_cur),
dict_table_get_first_index(table),
offsets_, ULINT_UNDEFINED, &heap),
node->update, mtr);
if (check_ref) {
/* NOTE that the following call loses
the position of pcur ! */
err = row_upd_check_references_constraints(node,
pcur, table,
index, thr, mtr);
err = row_upd_check_references_constraints
(node, pcur, table, index, thr, mtr);
if (err != DB_SUCCESS) {
mtr_commit(mtr);
if (UNIV_LIKELY_NULL(heap)) {
@ -1477,16 +1474,16 @@ row_upd_clust_rec_by_insert(
if-branch above). We must unmark them. */
btr_cur_unmark_dtuple_extern_fields(entry, node->ext_vec,
node->n_ext_vec);
node->n_ext_vec);
/* We must mark non-updated extern fields in entry as inherited,
so that a possible rollback will not free them */
btr_cur_mark_dtuple_inherited_extern(entry, node->ext_vec,
node->n_ext_vec,
node->update);
node->n_ext_vec,
node->update);
err = row_ins_index_entry(index, entry, node->ext_vec,
node->n_ext_vec, thr);
node->n_ext_vec, thr);
mem_heap_free(heap);
return(err);
@ -1518,7 +1515,7 @@ row_upd_clust_rec(
btr_cur = btr_pcur_get_btr_cur(pcur);
ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
dict_table_is_comp(index->table)));
dict_table_is_comp(index->table)));
/* Try optimistic updating of the record, keeping changes within
the page; we do not check locks because we assume the x-lock on the
@ -1526,8 +1523,8 @@ row_upd_clust_rec(
if (node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE) {
err = btr_cur_update_in_place(BTR_NO_LOCKING_FLAG,
btr_cur, node->update,
node->cmpl_info, thr, mtr);
btr_cur, node->update,
node->cmpl_info, thr, mtr);
} else {
err = btr_cur_optimistic_update(BTR_NO_LOCKING_FLAG,
btr_cur, node->update,
@ -1559,11 +1556,11 @@ row_upd_clust_rec(
ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
dict_table_is_comp(index->table)));
dict_table_is_comp(index->table)));
err = btr_cur_pessimistic_update(BTR_NO_LOCKING_FLAG, btr_cur,
&big_rec, node->update,
node->cmpl_info, thr, mtr);
&big_rec, node->update,
node->cmpl_info, thr, mtr);
mtr_commit(mtr);
if (err == DB_SUCCESS && big_rec) {
@ -1576,10 +1573,11 @@ row_upd_clust_rec(
ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
rec = btr_cur_get_rec(btr_cur);
err = btr_store_big_rec_extern_fields(index, rec,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),
big_rec, mtr);
err = btr_store_big_rec_extern_fields
(index, rec,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),
big_rec, mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@ -1628,13 +1626,13 @@ row_upd_del_mark_clust_rec(
locks, because we assume that we have an x-lock on the record */
err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG,
btr_cur, TRUE, thr, mtr);
btr_cur, TRUE, thr, mtr);
if (err == DB_SUCCESS && check_ref) {
/* NOTE that the following call loses the position of pcur ! */
err = row_upd_check_references_constraints(node,
pcur, index->table,
index, thr, mtr);
pcur, index->table,
index, thr, mtr);
if (err != DB_SUCCESS) {
mtr_commit(mtr);
@ -1708,7 +1706,7 @@ row_upd_clust_step(
with the index */
if (node->is_delete
&& ut_dulint_cmp(node->table->id, DICT_INDEXES_ID) == 0) {
&& ut_dulint_cmp(node->table->id, DICT_INDEXES_ID) == 0) {
dict_drop_index_tree(btr_pcur_get_rec(pcur), mtr);
@ -1717,7 +1715,7 @@ row_upd_clust_step(
mtr_start(mtr);
success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur,
mtr);
mtr);
if (!success) {
err = DB_ERROR;
@ -1729,11 +1727,11 @@ row_upd_clust_step(
rec = btr_pcur_get_rec(pcur);
offsets = rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap);
ULINT_UNDEFINED, &heap);
if (!node->has_clust_rec_x_lock) {
err = lock_clust_rec_modify_check_and_lock(0,
rec, index, offsets, thr);
err = lock_clust_rec_modify_check_and_lock
(0, rec, index, offsets, thr);
if (err != DB_SUCCESS) {
mtr_commit(mtr);
goto exit_func;
@ -1744,12 +1742,12 @@ row_upd_clust_step(
if (node->is_delete) {
err = row_upd_del_mark_clust_rec(node, index, thr, check_ref,
mtr);
mtr);
if (err == DB_SUCCESS) {
node->state = UPD_NODE_UPDATE_ALL_SEC;
node->index = dict_table_get_next_index(index);
}
exit_func:
exit_func:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@ -1763,7 +1761,7 @@ row_upd_clust_step(
/* Copy the necessary columns from clust_rec and calculate the
new values to set */
row_upd_copy_columns(rec, offsets,
UT_LIST_GET_FIRST(node->columns));
UT_LIST_GET_FIRST(node->columns));
row_upd_eval_new_vals(node->update);
}
@ -1793,7 +1791,7 @@ row_upd_clust_step(
externally! */
err = row_upd_clust_rec_by_insert(node, index, thr, check_ref,
mtr);
mtr);
if (err != DB_SUCCESS) {
return(err);
@ -1838,9 +1836,9 @@ row_upd(
/* We do not get the cmpl_info value from the MySQL
interpreter: we must calculate it on the fly: */
if (node->is_delete ||
row_upd_changes_some_index_ord_field_binary(
node->table, node->update)) {
if (node->is_delete
|| row_upd_changes_some_index_ord_field_binary
(node->table, node->update)) {
node->cmpl_info = 0;
} else {
node->cmpl_info = UPD_NODE_NO_ORD_CHANGE;
@ -1848,7 +1846,7 @@ row_upd(
}
if (node->state == UPD_NODE_UPDATE_CLUSTERED
|| node->state == UPD_NODE_INSERT_CLUSTERED) {
|| node->state == UPD_NODE_INSERT_CLUSTERED) {
err = row_upd_clust_step(node, thr);
@ -2038,24 +2036,26 @@ row_upd_in_place_in_select(
/* Copy the necessary columns from clust_rec and calculate the new
values to set */
row_upd_copy_columns(btr_pcur_get_rec(pcur), rec_get_offsets(
btr_pcur_get_rec(pcur), btr_cur->index, offsets_,
ULINT_UNDEFINED, &heap),
UT_LIST_GET_FIRST(node->columns));
row_upd_copy_columns(btr_pcur_get_rec(pcur),
rec_get_offsets(btr_pcur_get_rec(pcur),
btr_cur->index, offsets_,
ULINT_UNDEFINED, &heap),
UT_LIST_GET_FIRST(node->columns));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
row_upd_eval_new_vals(node->update);
ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
dict_table_is_comp(btr_cur->index->table)));
ut_ad(!rec_get_deleted_flag
(btr_pcur_get_rec(pcur),
dict_table_is_comp(btr_cur->index->table)));
ut_ad(node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE);
ut_ad(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE);
ut_ad(node->select_will_do_update);
err = btr_cur_update_in_place(BTR_NO_LOCKING_FLAG, btr_cur,
node->update, node->cmpl_info,
thr, mtr);
node->update, node->cmpl_info,
thr, mtr);
ut_ad(err == DB_SUCCESS);
}

Some files were not shown because too many files have changed in this diff Show more