Applied innodb-5.1 snapshots ss799 and ss854

Bugs fixed:
- Bug #20877: InnoDB data dictionary memory footprint is too big
- Bug #13544: Second delete of same row in transaction illustrates non-optimal locking
- Bug #20791: valgrind errors in InnoDB
This commit is contained in:
tsmith/tim@siva.hindu.god 2006-09-21 01:39:09 -06:00
parent ec720a5800
commit f269d9b6c3
86 changed files with 3294 additions and 3251 deletions

File diff suppressed because it is too large Load diff

View file

@ -272,7 +272,6 @@ btr_cur_search_to_nth_level(
RW_S_LATCH, or 0 */
mtr_t* mtr) /* in: mtr */
{
dict_tree_t* tree;
page_cur_t* page_cursor;
page_t* page;
page_t* guess;
@ -303,7 +302,7 @@ btr_cur_search_to_nth_level(
ending to upper levels */
ut_ad(level == 0 || mode == PAGE_CUR_LE);
ut_ad(dict_tree_check_search_tuple(index->tree, tuple));
ut_ad(dict_index_check_search_tuple(index, tuple));
ut_ad(!(index->type & DICT_IBUF) || ibuf_inside());
ut_ad(dtuple_check_typed(tuple));
@ -374,23 +373,21 @@ btr_cur_search_to_nth_level(
savepoint = mtr_set_savepoint(mtr);
tree = index->tree;
if (latch_mode == BTR_MODIFY_TREE) {
mtr_x_lock(dict_tree_get_lock(tree), mtr);
mtr_x_lock(dict_index_get_lock(index), mtr);
} else if (latch_mode == BTR_CONT_MODIFY_TREE) {
/* Do nothing */
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
} else {
mtr_s_lock(dict_tree_get_lock(tree), mtr);
mtr_s_lock(dict_index_get_lock(index), mtr);
}
page_cursor = btr_cur_get_page_cur(cursor);
space = dict_tree_get_space(tree);
page_no = dict_tree_get_page(tree);
space = dict_index_get_space(index);
page_no = dict_index_get_page(index);
up_match = 0;
up_bytes = 0;
@ -478,7 +475,7 @@ retry_page_get:
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
}
#endif
ut_ad(0 == ut_dulint_cmp(tree->id,
ut_ad(0 == ut_dulint_cmp(index->id,
btr_page_get_index_id(page)));
if (height == ULINT_UNDEFINED) {
@ -507,9 +504,9 @@ retry_page_get:
/* Release the tree s-latch */
mtr_release_s_latch_at_savepoint
(mtr, savepoint,
dict_tree_get_lock(tree));
mtr_release_s_latch_at_savepoint(
mtr, savepoint,
dict_index_get_lock(index));
}
page_mode = mode;
@ -525,8 +522,8 @@ retry_page_get:
/* If this is the desired level, leave the loop */
ut_ad(height == btr_page_get_level
(page_cur_get_page(page_cursor), mtr));
ut_ad(height == btr_page_get_level(
page_cur_get_page(page_cursor), mtr));
if (level == height) {
@ -598,7 +595,6 @@ btr_cur_open_at_index_side(
mtr_t* mtr) /* in: mtr */
{
page_cur_t* page_cursor;
dict_tree_t* tree;
page_t* page;
ulint page_no;
ulint space;
@ -615,24 +611,22 @@ btr_cur_open_at_index_side(
estimate = latch_mode & BTR_ESTIMATE;
latch_mode = latch_mode & ~BTR_ESTIMATE;
tree = index->tree;
/* Store the position of the tree latch we push to mtr so that we
know how to release it when we have latched the leaf node */
savepoint = mtr_set_savepoint(mtr);
if (latch_mode == BTR_MODIFY_TREE) {
mtr_x_lock(dict_tree_get_lock(tree), mtr);
mtr_x_lock(dict_index_get_lock(index), mtr);
} else {
mtr_s_lock(dict_tree_get_lock(tree), mtr);
mtr_s_lock(dict_index_get_lock(index), mtr);
}
page_cursor = btr_cur_get_page_cur(cursor);
cursor->index = index;
space = dict_tree_get_space(tree);
page_no = dict_tree_get_page(tree);
space = dict_index_get_space(index);
page_no = dict_index_get_page(index);
height = ULINT_UNDEFINED;
@ -641,7 +635,7 @@ btr_cur_open_at_index_side(
BUF_GET,
__FILE__, __LINE__,
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
ut_ad(0 == ut_dulint_cmp(index->id,
btr_page_get_index_id(page)));
buf_block_align(page)->check_index_page_at_flush = TRUE;
@ -668,9 +662,9 @@ btr_cur_open_at_index_side(
/* Release the tree s-latch */
mtr_release_s_latch_at_savepoint
(mtr, savepoint,
dict_tree_get_lock(tree));
mtr_release_s_latch_at_savepoint(
mtr, savepoint,
dict_index_get_lock(index));
}
}
@ -727,7 +721,6 @@ btr_cur_open_at_rnd_pos(
mtr_t* mtr) /* in: mtr */
{
page_cur_t* page_cursor;
dict_tree_t* tree;
page_t* page;
ulint page_no;
ulint space;
@ -738,19 +731,17 @@ btr_cur_open_at_rnd_pos(
ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
tree = index->tree;
if (latch_mode == BTR_MODIFY_TREE) {
mtr_x_lock(dict_tree_get_lock(tree), mtr);
mtr_x_lock(dict_index_get_lock(index), mtr);
} else {
mtr_s_lock(dict_tree_get_lock(tree), mtr);
mtr_s_lock(dict_index_get_lock(index), mtr);
}
page_cursor = btr_cur_get_page_cur(cursor);
cursor->index = index;
space = dict_tree_get_space(tree);
page_no = dict_tree_get_page(tree);
space = dict_index_get_space(index);
page_no = dict_index_get_page(index);
height = ULINT_UNDEFINED;
@ -759,7 +750,7 @@ btr_cur_open_at_rnd_pos(
BUF_GET,
__FILE__, __LINE__,
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
ut_ad(0 == ut_dulint_cmp(index->id,
btr_page_get_index_id(page)));
if (height == ULINT_UNDEFINED) {
@ -1017,7 +1008,7 @@ calculate_sizes_again:
type = index->type;
if ((type & DICT_CLUSTERED)
&& (dict_tree_get_space_reserve(index->tree) + rec_size > max_size)
&& (dict_index_get_space_reserve() + rec_size > max_size)
&& (page_get_n_recs(page) >= 2)
&& (0 == level)
&& (btr_page_get_split_rec_to_right(cursor, &dummy_rec)
@ -1156,7 +1147,7 @@ btr_cur_pessimistic_insert(
page = btr_cur_get_page(cursor);
ut_ad(mtr_memo_contains(mtr,
dict_tree_get_lock(btr_cur_get_tree(cursor)),
dict_index_get_lock(btr_cur_get_index(cursor)),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
@ -1218,8 +1209,7 @@ btr_cur_pessimistic_insert(
}
}
if (dict_tree_get_page(index->tree)
== buf_frame_get_page_no(page)) {
if (dict_index_get_page(index) == buf_frame_get_page_no(page)) {
/* The page is the root page */
*rec = btr_root_raise_and_insert(cursor, entry, mtr);
@ -1292,10 +1282,10 @@ btr_cur_upd_lock_and_undo(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
err = lock_clust_rec_modify_check_and_lock
(flags, rec, index,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap), thr);
err = lock_clust_rec_modify_check_and_lock(
flags, rec, index,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap), thr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@ -1328,7 +1318,7 @@ btr_cur_update_in_place_log(
mtr_t* mtr) /* in: mtr */
{
byte* log_ptr;
page_t* page = ut_align_down(rec, UNIV_PAGE_SIZE);
page_t* page = page_align(rec);
ut_ad(flags < 256);
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
@ -1355,7 +1345,7 @@ btr_cur_update_in_place_log(
log_ptr = row_upd_write_sys_vals_to_log(index, trx, roll_ptr, log_ptr,
mtr);
mach_write_to_2(log_ptr, ut_align_offset(rec, UNIV_PAGE_SIZE));
mach_write_to_2(log_ptr, page_offset(rec));
log_ptr += 2;
row_upd_index_write_log(update, log_ptr, mtr);
@ -1514,11 +1504,8 @@ btr_cur_update_in_place(
row_upd_rec_sys_fields(rec, index, offsets, trx, roll_ptr);
}
/* FIXME: in a mixed tree, all records may not have enough ordering
fields for btr search: */
was_delete_marked = rec_get_deleted_flag
(rec, page_is_comp(buf_block_get_frame(block)));
was_delete_marked = rec_get_deleted_flag(
rec, page_is_comp(buf_block_get_frame(block)));
row_upd_rec_in_place(rec, offsets, update);
@ -1529,8 +1516,8 @@ btr_cur_update_in_place(
btr_cur_update_in_place_log(flags, rec, index, update, trx, roll_ptr,
mtr);
if (was_delete_marked
&& !rec_get_deleted_flag(rec, page_is_comp
(buf_block_get_frame(block)))) {
&& !rec_get_deleted_flag(rec, page_is_comp(
buf_block_get_frame(block)))) {
/* The new updated record owns its possible externally
stored fields */
@ -1801,7 +1788,6 @@ btr_cur_pessimistic_update(
big_rec_t* dummy_big_rec;
dict_index_t* index;
page_t* page;
dict_tree_t* tree;
rec_t* rec;
page_cur_t* page_cursor;
dtuple_t* new_entry;
@ -1825,9 +1811,8 @@ btr_cur_pessimistic_update(
page = btr_cur_get_page(cursor);
rec = btr_cur_get_rec(cursor);
index = cursor->index;
tree = index->tree;
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
@ -1912,8 +1897,8 @@ btr_cur_pessimistic_update(
n_ext_vect = btr_push_update_extern_fields(ext_vect, offsets, update);
if (UNIV_UNLIKELY(rec_get_converted_size(index, new_entry)
>= ut_min(page_get_free_space_of_empty
(page_is_comp(page)) / 2,
>= ut_min(page_get_free_space_of_empty(
page_is_comp(page)) / 2,
REC_MAX_DATA_SIZE))) {
big_rec_vec = dtuple_convert_big_rec(index, new_entry,
@ -2064,7 +2049,7 @@ btr_cur_del_mark_set_clust_rec_log(
log_ptr = row_upd_write_sys_vals_to_log(index, trx, roll_ptr, log_ptr,
mtr);
mach_write_to_2(log_ptr, ut_align_offset(rec, UNIV_PAGE_SIZE));
mach_write_to_2(log_ptr, page_offset(rec));
log_ptr += 2;
mlog_close(mtr, log_ptr);
@ -2129,10 +2114,10 @@ btr_cur_parse_del_mark_set_clust_rec(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
row_upd_rec_sys_fields_in_recovery
(rec, rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),
pos, trx_id, roll_ptr);
row_upd_rec_sys_fields_in_recovery(
rec, rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),
pos, trx_id, roll_ptr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@ -2261,12 +2246,12 @@ btr_cur_del_mark_set_sec_rec_log(
return;
}
log_ptr = mlog_write_initial_log_record_fast
(rec, MLOG_REC_SEC_DELETE_MARK, log_ptr, mtr);
log_ptr = mlog_write_initial_log_record_fast(
rec, MLOG_REC_SEC_DELETE_MARK, log_ptr, mtr);
mach_write_to_1(log_ptr, val);
log_ptr++;
mach_write_to_2(log_ptr, ut_align_offset(rec, UNIV_PAGE_SIZE));
mach_write_to_2(log_ptr, page_offset(rec));
log_ptr += 2;
mlog_close(mtr, log_ptr);
@ -2404,7 +2389,7 @@ btr_cur_compress(
mtr_t* mtr) /* in: mtr */
{
ut_ad(mtr_memo_contains(mtr,
dict_tree_get_lock(btr_cur_get_tree(cursor)),
dict_index_get_lock(btr_cur_get_index(cursor)),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_rec(cursor)),
MTR_MEMO_PAGE_X_FIX));
@ -2430,7 +2415,7 @@ btr_cur_compress_if_useful(
mtr_t* mtr) /* in: mtr */
{
ut_ad(mtr_memo_contains(mtr,
dict_tree_get_lock(btr_cur_get_tree(cursor)),
dict_index_get_lock(btr_cur_get_index(cursor)),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_rec(cursor)),
MTR_MEMO_PAGE_X_FIX));
@ -2483,8 +2468,8 @@ btr_cur_optimistic_delete(
ULINT_UNDEFINED, &heap);
no_compress_needed = !rec_offs_any_extern(offsets)
&& btr_cur_can_delete_without_compress
(cursor, rec_offs_size(offsets), mtr);
&& btr_cur_can_delete_without_compress(
cursor, rec_offs_size(offsets), mtr);
if (no_compress_needed) {
@ -2492,8 +2477,8 @@ btr_cur_optimistic_delete(
btr_search_update_hash_on_delete(cursor);
max_ins_size = page_get_max_insert_size_after_reorganize
(page, 1);
max_ins_size = page_get_max_insert_size_after_reorganize(
page, 1);
page_cur_delete_rec(btr_cur_get_page_cur(cursor),
cursor->index, offsets, mtr);
@ -2537,7 +2522,7 @@ btr_cur_pessimistic_delete(
mtr_t* mtr) /* in: mtr */
{
page_t* page;
dict_tree_t* tree;
dict_index_t* index;
rec_t* rec;
dtuple_t* node_ptr;
ulint n_extents = 0;
@ -2549,9 +2534,9 @@ btr_cur_pessimistic_delete(
ulint* offsets;
page = btr_cur_get_page(cursor);
tree = btr_cur_get_tree(cursor);
index = btr_cur_get_index(cursor);
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
@ -2563,7 +2548,7 @@ btr_cur_pessimistic_delete(
n_extents = cursor->tree_height / 32 + 1;
success = fsp_reserve_free_extents(&n_reserved,
cursor->index->space,
index->space,
n_extents,
FSP_CLEANING, mtr);
if (!success) {
@ -2576,8 +2561,7 @@ btr_cur_pessimistic_delete(
heap = mem_heap_create(1024);
rec = btr_cur_get_rec(cursor);
offsets = rec_get_offsets(rec, cursor->index,
NULL, ULINT_UNDEFINED, &heap);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
/* Free externally stored fields if the record is neither
a node pointer nor in two-byte format.
@ -2585,13 +2569,13 @@ btr_cur_pessimistic_delete(
if (page_is_comp(page)
? !rec_get_node_ptr_flag(rec)
: !rec_get_1byte_offs_flag(rec)) {
btr_rec_free_externally_stored_fields(cursor->index,
btr_rec_free_externally_stored_fields(index,
rec, offsets,
in_rollback, mtr);
}
if (UNIV_UNLIKELY(page_get_n_recs(page) < 2)
&& UNIV_UNLIKELY(dict_tree_get_page(btr_cur_get_tree(cursor))
&& UNIV_UNLIKELY(dict_index_get_page(btr_cur_get_index(cursor))
!= buf_frame_get_page_no(page))) {
/* If there is only one record, drop the whole page in
@ -2609,8 +2593,8 @@ btr_cur_pessimistic_delete(
level = btr_page_get_level(page, mtr);
if (level > 0
&& UNIV_UNLIKELY(rec == page_rec_get_next
(page_get_infimum_rec(page)))) {
&& UNIV_UNLIKELY(rec == page_rec_get_next(
page_get_infimum_rec(page)))) {
rec_t* next_rec = page_rec_get_next(rec);
@ -2628,23 +2612,22 @@ btr_cur_pessimistic_delete(
so that it is equal to the new leftmost node pointer
on the page */
btr_node_ptr_delete(tree, page, mtr);
btr_node_ptr_delete(index, page, mtr);
node_ptr = dict_tree_build_node_ptr
(tree, next_rec, buf_frame_get_page_no(page),
heap, level);
node_ptr = dict_index_build_node_ptr(
index, next_rec, buf_frame_get_page_no(page),
heap, level);
btr_insert_on_non_leaf_level(tree,
btr_insert_on_non_leaf_level(index,
level + 1, node_ptr, mtr);
}
}
btr_search_update_hash_on_delete(cursor);
page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index,
offsets, mtr);
page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, offsets, mtr);
ut_ad(btr_check_node_ptr(tree, page, mtr));
ut_ad(btr_check_node_ptr(index, page, mtr));
*err = DB_SUCCESS;
@ -2656,8 +2639,7 @@ return_after_reservations:
}
if (n_extents > 0) {
fil_space_release_free_extents(cursor->index->space,
n_reserved);
fil_space_release_free_extents(index->space, n_reserved);
}
return(ret);
@ -2939,8 +2921,8 @@ btr_estimate_number_of_different_key_vals(
}
total_external_size
+= btr_rec_get_externally_stored_len
(rec, offsets_rec);
+= btr_rec_get_externally_stored_len(
rec, offsets_rec);
rec = next_rec;
/* Initialize offsets_rec for the next round
@ -2974,8 +2956,8 @@ btr_estimate_number_of_different_key_vals(
offsets_rec = rec_get_offsets(rec, index, offsets_rec,
ULINT_UNDEFINED, &heap);
total_external_size += btr_rec_get_externally_stored_len
(rec, offsets_rec);
total_external_size += btr_rec_get_externally_stored_len(
rec, offsets_rec);
mtr_commit(&mtr);
}
@ -3137,8 +3119,8 @@ btr_cur_mark_extern_inherited_fields(
}
if (!is_updated) {
btr_cur_set_ownership_of_extern_field
(rec, offsets, i, FALSE, mtr);
btr_cur_set_ownership_of_extern_field(
rec, offsets, i, FALSE, mtr);
}
}
}
@ -3291,8 +3273,8 @@ btr_push_update_extern_fields(
if (upd_get_nth_field(update, i)->extern_storage) {
ext_vect[n_pushed] = upd_get_nth_field
(update, i)->field_no;
ext_vect[n_pushed] = upd_get_nth_field(
update, i)->field_no;
n_pushed++;
}
@ -3389,7 +3371,7 @@ btr_store_big_rec_extern_fields(
mtr_t mtr;
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(mtr_memo_contains(local_mtr, dict_tree_get_lock(index->tree),
ut_ad(mtr_memo_contains(local_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(local_mtr, buf_block_align(rec),
MTR_MEMO_PAGE_X_FIX));
@ -3422,7 +3404,7 @@ btr_store_big_rec_extern_fields(
hint_page_no = prev_page_no + 1;
}
page = btr_page_alloc(index->tree, hint_page_no,
page = btr_page_alloc(index, hint_page_no,
FSP_NO_DIR, 0, &mtr);
if (page == NULL) {
@ -3509,10 +3491,10 @@ btr_store_big_rec_extern_fields(
/* Set the bit denoting that this field
in rec is stored externally */
rec_set_nth_field_extern_bit
(rec, index,
big_rec_vec->fields[i].field_no,
TRUE, &mtr);
rec_set_nth_field_extern_bit(
rec, index,
big_rec_vec->fields[i].field_no,
TRUE, &mtr);
}
prev_page_no = page_no;
@ -3563,7 +3545,7 @@ btr_free_externally_stored_field(
mtr_t mtr;
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
ut_ad(mtr_memo_contains(local_mtr, dict_tree_get_lock(index->tree),
ut_ad(mtr_memo_contains(local_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(local_mtr, buf_block_align(data),
MTR_MEMO_PAGE_X_FIX));
@ -3635,7 +3617,7 @@ btr_free_externally_stored_field(
because we did not store it on the page (we save the space
overhead from an index page header. */
btr_page_free_low(index->tree, page, 0, &mtr);
btr_page_free_low(index, page, 0, &mtr);
mlog_write_ulint(data + local_len + BTR_EXTERN_PAGE_NO,
next_page_no,

View file

@ -76,20 +76,20 @@ btr_pcur_store_position(
{
page_cur_t* page_cursor;
rec_t* rec;
dict_tree_t* tree;
dict_index_t* index;
page_t* page;
ulint offs;
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor));
index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
page_cursor = btr_pcur_get_page_cur(cursor);
rec = page_cur_get_rec(page_cursor);
page = ut_align_down(rec, UNIV_PAGE_SIZE);
offs = ut_align_offset(rec, UNIV_PAGE_SIZE);
page = page_align(rec);
offs = page_offset(rec);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_S_FIX)
@ -133,13 +133,13 @@ btr_pcur_store_position(
}
cursor->old_stored = BTR_PCUR_OLD_STORED;
cursor->old_rec = dict_tree_copy_rec_order_prefix
(tree, rec, &cursor->old_n_fields,
&cursor->old_rec_buf, &cursor->buf_size);
cursor->old_rec = dict_index_copy_rec_order_prefix(
index, rec, &cursor->old_n_fields,
&cursor->old_rec_buf, &cursor->buf_size);
cursor->block_when_stored = buf_block_align(page);
cursor->modify_clock = buf_block_get_modify_clock
(cursor->block_when_stored);
cursor->modify_clock = buf_block_get_modify_clock(
cursor->block_when_stored);
}
/******************************************************************
@ -197,13 +197,15 @@ btr_pcur_restore_position(
btr_pcur_t* cursor, /* in: detached persistent cursor */
mtr_t* mtr) /* in: mtr */
{
dict_tree_t* tree;
dict_index_t* index;
page_t* page;
dtuple_t* tuple;
ulint mode;
ulint old_mode;
mem_heap_t* heap;
index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED)
|| UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
&& cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
@ -215,17 +217,16 @@ btr_pcur_restore_position(
ut_error;
}
if (UNIV_UNLIKELY
(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
if (UNIV_UNLIKELY(
cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
/* In these cases we do not try an optimistic restoration,
but always do a search */
btr_cur_open_at_index_side
(cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
btr_pcur_get_btr_cur(cursor)->index, latch_mode,
btr_pcur_get_btr_cur(cursor), mtr);
btr_cur_open_at_index_side(
cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
index, latch_mode, btr_pcur_get_btr_cur(cursor), mtr);
cursor->block_when_stored
= buf_block_align(btr_pcur_get_page(cursor));
@ -242,10 +243,10 @@ btr_pcur_restore_position(
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
/* Try optimistic restoration */
if (UNIV_LIKELY
(buf_page_optimistic_get(latch_mode,
cursor->block_when_stored, page,
cursor->modify_clock, mtr))) {
if (UNIV_LIKELY(buf_page_optimistic_get(
latch_mode,
cursor->block_when_stored, page,
cursor->modify_clock, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
@ -255,20 +256,18 @@ btr_pcur_restore_position(
rec_t* rec;
ulint* offsets1;
ulint* offsets2;
dict_index_t* index;
#endif /* UNIV_DEBUG */
cursor->latch_mode = latch_mode;
#ifdef UNIV_DEBUG
rec = btr_pcur_get_rec(cursor);
index = btr_pcur_get_btr_cur(cursor)->index;
heap = mem_heap_create(256);
offsets1 = rec_get_offsets
(cursor->old_rec, index, NULL,
cursor->old_n_fields, &heap);
offsets2 = rec_get_offsets
(rec, index, NULL,
cursor->old_n_fields, &heap);
offsets1 = rec_get_offsets(
cursor->old_rec, index, NULL,
cursor->old_n_fields, &heap);
offsets2 = rec_get_offsets(
rec, index, NULL,
cursor->old_n_fields, &heap);
ut_ad(!cmp_rec_rec(cursor->old_rec,
rec, offsets1, offsets2,
@ -286,9 +285,8 @@ btr_pcur_restore_position(
heap = mem_heap_create(256);
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor));
tuple = dict_tree_build_data_tuple(tree, cursor->old_rec,
cursor->old_n_fields, heap);
tuple = dict_index_build_data_tuple(index, cursor->old_rec,
cursor->old_n_fields, heap);
/* Save the old search mode of the cursor */
old_mode = cursor->search_mode;
@ -302,8 +300,8 @@ btr_pcur_restore_position(
mode = PAGE_CUR_L;
}
btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple,
mode, latch_mode, cursor, 0, mtr);
btr_pcur_open_with_no_init(index, tuple, mode, latch_mode,
cursor, 0, mtr);
/* Restore the old search mode */
cursor->search_mode = old_mode;
@ -311,19 +309,18 @@ btr_pcur_restore_position(
if (cursor->rel_pos == BTR_PCUR_ON
&& btr_pcur_is_on_user_rec(cursor, mtr)
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
rec_get_offsets
(btr_pcur_get_rec(cursor),
btr_pcur_get_btr_cur(cursor)->index,
NULL, ULINT_UNDEFINED, &heap))) {
rec_get_offsets(
btr_pcur_get_rec(cursor), index,
NULL, ULINT_UNDEFINED, &heap))) {
/* We have to store the NEW value for the modify clock, since
the cursor can now be on a different page! But we can retain
the value of old_rec */
cursor->block_when_stored = buf_block_align
(btr_pcur_get_page(cursor));
cursor->modify_clock = buf_block_get_modify_clock
(cursor->block_when_stored);
cursor->block_when_stored = buf_block_align(
btr_pcur_get_page(cursor));
cursor->modify_clock = buf_block_get_modify_clock(
cursor->block_when_stored);
cursor->old_stored = BTR_PCUR_OLD_STORED;
mem_heap_free(heap);

View file

@ -74,7 +74,7 @@ btr_search_build_page_hash_index(
ulint n_fields,/* in: hash this many full fields */
ulint n_bytes,/* in: hash this many bytes from the next
field */
ulint side); /* in: hash for searches from this side */
ibool left_side);/* in: hash for searches from left side? */
/*********************************************************************
This function should be called before reserving any btr search mutex, if
@ -157,10 +157,10 @@ btr_search_info_create(
info = mem_heap_alloc(heap, sizeof(btr_search_t));
#ifdef UNIV_DEBUG
info->magic_n = BTR_SEARCH_MAGIC_N;
#endif /* UNIV_DEBUG */
info->last_search = NULL;
info->n_direction = 0;
info->root_guess = NULL;
info->hash_analysis = 0;
@ -179,7 +179,7 @@ btr_search_info_create(
info->n_fields = 1;
info->n_bytes = 0;
info->side = BTR_SEARCH_LEFT_SIDE;
info->left_side = TRUE;
return(info);
}
@ -224,7 +224,7 @@ btr_search_info_update_hash(
hash prefix */
if (info->n_fields >= n_unique && cursor->up_match >= n_unique) {
increment_potential:
info->n_hash_potential++;
return;
@ -233,8 +233,7 @@ btr_search_info_update_hash(
cmp = ut_pair_cmp(info->n_fields, info->n_bytes,
cursor->low_match, cursor->low_bytes);
if ((info->side == BTR_SEARCH_LEFT_SIDE && cmp <= 0)
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp > 0)) {
if (info->left_side ? cmp <= 0 : cmp > 0) {
goto set_new_recomm;
}
@ -242,16 +241,11 @@ btr_search_info_update_hash(
cmp = ut_pair_cmp(info->n_fields, info->n_bytes,
cursor->up_match, cursor->up_bytes);
if ((info->side == BTR_SEARCH_LEFT_SIDE && cmp > 0)
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp <= 0)) {
if (info->left_side ? cmp <= 0 : cmp > 0) {
goto set_new_recomm;
goto increment_potential;
}
info->n_hash_potential++;
return;
set_new_recomm:
/* We have to set a new recommendation; skip the hash analysis
for a while to avoid unnecessary CPU time usage when there is no
@ -269,7 +263,7 @@ set_new_recomm:
info->n_fields = 1;
info->n_bytes = 0;
info->side = BTR_SEARCH_LEFT_SIDE;
info->left_side = TRUE;
} else if (cmp > 0) {
info->n_hash_potential = 1;
@ -288,7 +282,7 @@ set_new_recomm:
info->n_bytes = cursor->low_bytes + 1;
}
info->side = BTR_SEARCH_LEFT_SIDE;
info->left_side = TRUE;
} else {
info->n_hash_potential = 1;
@ -306,7 +300,7 @@ set_new_recomm:
info->n_bytes = cursor->up_bytes + 1;
}
info->side = BTR_SEARCH_RIGHT_SIDE;
info->left_side = FALSE;
}
}
@ -322,7 +316,8 @@ btr_search_update_block_hash_info(
the block is recommended */
btr_search_t* info, /* in: search info */
buf_block_t* block, /* in: buffer block */
btr_cur_t* cursor) /* in: cursor */
btr_cur_t* cursor __attribute__((unused)))
/* in: cursor */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
@ -335,18 +330,18 @@ btr_search_update_block_hash_info(
info->last_hash_succ = FALSE;
ut_a(block->magic_n == BUF_BLOCK_MAGIC_N);
ut_a(info->magic_n == BTR_SEARCH_MAGIC_N);
ut_ad(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)) {
&& (block->left_side == info->left_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_left_side == info->left_side)) {
/* The search would presumably have succeeded using
the hash index */
@ -359,12 +354,14 @@ btr_search_update_block_hash_info(
block->n_hash_helps = 1;
block->n_fields = info->n_fields;
block->n_bytes = info->n_bytes;
block->side = info->side;
block->left_side = info->left_side;
}
#ifdef UNIV_DEBUG
if (cursor->index->table->does_not_fit_in_memory) {
block->n_hash_helps = 0;
}
#endif /* UNIV_DEBUG */
if ((block->n_hash_helps > page_get_n_recs(block->frame)
/ BTR_SEARCH_PAGE_BUILD_LIMIT)
@ -375,7 +372,7 @@ btr_search_update_block_hash_info(
> 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->left_side != block->curr_left_side)) {
/* Build a new hash index on the page */
@ -404,7 +401,7 @@ btr_search_update_hash_ref(
{
ulint fold;
rec_t* rec;
dulint tree_id;
dulint index_id;
ut_ad(cursor->flag == BTR_CUR_HASH_FAIL);
#ifdef UNIV_SYNC_DEBUG
@ -419,7 +416,7 @@ btr_search_update_hash_ref(
&& (info->n_hash_potential > 0)
&& (block->curr_n_fields == info->n_fields)
&& (block->curr_n_bytes == info->n_bytes)
&& (block->curr_side == info->side)) {
&& (block->curr_left_side == info->left_side)) {
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
@ -431,12 +428,12 @@ btr_search_update_hash_ref(
return;
}
tree_id = ((cursor->index)->tree)->id;
index_id = cursor->index->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);
block->curr_n_bytes, index_id);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@ -509,7 +506,7 @@ btr_search_info_update_slow(
params = mem_alloc(3 * sizeof(ulint));
params[0] = block->n_fields;
params[1] = block->n_bytes;
params[2] = block->side;
params[2] = block->left_side;
/* Make sure the compiler cannot deduce the values and do
optimizations */
@ -618,8 +615,8 @@ 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;
}
@ -643,8 +640,9 @@ 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;
@ -702,7 +700,7 @@ btr_search_guess_on_hash(
page_t* page;
ulint fold;
ulint tuple_n_fields;
dulint tree_id;
dulint index_id;
ibool can_only_compare_to_cursor_rec = TRUE;
#ifdef notdefined
btr_cur_t cursor2;
@ -736,12 +734,12 @@ btr_search_guess_on_hash(
return(FALSE);
}
tree_id = (index->tree)->id;
index_id = index->id;
#ifdef UNIV_SEARCH_PERF_STAT
info->n_hash_succ++;
#endif
fold = dtuple_fold(tuple, cursor->n_fields, cursor->n_bytes, tree_id);
fold = dtuple_fold(tuple, cursor->n_fields, cursor->n_bytes, index_id);
cursor->fold = fold;
cursor->flag = BTR_CUR_HASH;
@ -763,10 +761,11 @@ btr_search_guess_on_hash(
if (UNIV_LIKELY(!has_search_latch)) {
if (UNIV_UNLIKELY
(!buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG,
__FILE__, __LINE__, mtr))) {
if (UNIV_UNLIKELY(
!buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG,
__FILE__, __LINE__,
mtr))) {
goto failure_unlock;
}
@ -801,7 +800,8 @@ btr_search_guess_on_hash(
is positioned on. We cannot look at the next of the previous
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)
if (UNIV_EXPECT(
ut_dulint_cmp(index_id, btr_page_get_index_id(page)), 0)
|| !btr_search_check_guess(cursor,
can_only_compare_to_cursor_rec,
tuple, mode, mtr)) {
@ -904,7 +904,7 @@ btr_search_drop_page_hash_index(
rec_t* rec;
ulint fold;
ulint prev_fold;
dulint tree_id;
dulint index_id;
ulint n_cached;
ulint n_recs;
ulint* folds;
@ -961,9 +961,9 @@ retry:
rec = page_get_infimum_rec(page);
rec = page_rec_get_next(rec);
tree_id = btr_page_get_index_id(page);
index_id = btr_page_get_index_id(page);
ut_a(0 == ut_dulint_cmp(tree_id, index->id));
ut_a(0 == ut_dulint_cmp(index_id, index->id));
prev_fold = 0;
@ -971,12 +971,10 @@ retry:
offsets = NULL;
while (!page_rec_is_supremum(rec)) {
/* 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);
ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
fold = rec_fold(rec, offsets, n_fields, n_bytes, index_id);
if (fold == prev_fold && prev_fold != 0) {
@ -1101,7 +1099,7 @@ btr_search_build_page_hash_index(
ulint n_fields,/* in: hash this many full fields */
ulint n_bytes,/* in: hash this many bytes from the next
field */
ulint side) /* in: hash for searches from this side */
ibool left_side)/* in: hash for searches from left side? */
{
hash_table_t* table;
buf_block_t* block;
@ -1109,7 +1107,7 @@ btr_search_build_page_hash_index(
rec_t* next_rec;
ulint fold;
ulint next_fold;
dulint tree_id;
dulint index_id;
ulint n_cached;
ulint n_recs;
ulint* folds;
@ -1135,7 +1133,7 @@ btr_search_build_page_hash_index(
if (block->is_hashed && ((block->curr_n_fields != n_fields)
|| (block->curr_n_bytes != n_bytes)
|| (block->curr_side != side))) {
|| (block->curr_left_side != left_side))) {
rw_lock_s_unlock(&btr_search_latch);
@ -1172,7 +1170,7 @@ btr_search_build_page_hash_index(
n_cached = 0;
tree_id = btr_page_get_index_id(page);
index_id = btr_page_get_index_id(page);
rec = page_get_infimum_rec(page);
rec = page_rec_get_next(rec);
@ -1188,11 +1186,9 @@ btr_search_build_page_hash_index(
}
}
/* FIXME: in a mixed tree, all records may not have enough ordering
fields: */
fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
fold = rec_fold(rec, offsets, n_fields, n_bytes, index_id);
if (side == BTR_SEARCH_LEFT_SIDE) {
if (left_side) {
folds[n_cached] = fold;
recs[n_cached] = rec;
@ -1204,7 +1200,7 @@ btr_search_build_page_hash_index(
if (page_rec_is_supremum(next_rec)) {
if (side == BTR_SEARCH_RIGHT_SIDE) {
if (!left_side) {
folds[n_cached] = fold;
recs[n_cached] = rec;
@ -1217,12 +1213,12 @@ btr_search_build_page_hash_index(
offsets = rec_get_offsets(next_rec, index, offsets,
n_fields + (n_bytes > 0), &heap);
next_fold = rec_fold(next_rec, offsets, n_fields,
n_bytes, tree_id);
n_bytes, index_id);
if (fold != next_fold) {
/* Insert an entry into the hash index */
if (side == BTR_SEARCH_LEFT_SIDE) {
if (left_side) {
folds[n_cached] = next_fold;
recs[n_cached] = next_rec;
@ -1244,7 +1240,7 @@ btr_search_build_page_hash_index(
if (block->is_hashed && ((block->curr_n_fields != n_fields)
|| (block->curr_n_bytes != n_bytes)
|| (block->curr_side != side))) {
|| (block->curr_left_side != left_side))) {
goto exit_func;
}
@ -1253,7 +1249,7 @@ btr_search_build_page_hash_index(
block->curr_n_fields = n_fields;
block->curr_n_bytes = n_bytes;
block->curr_side = side;
block->curr_left_side = left_side;
block->index = index;
for (i = 0; i < n_cached; i++) {
@ -1292,7 +1288,7 @@ btr_search_move_or_delete_hash_entries(
buf_block_t* new_block;
ulint n_fields;
ulint n_bytes;
ulint side;
ibool left_side;
block = buf_block_align(page);
new_block = buf_block_align(new_page);
@ -1320,22 +1316,23 @@ btr_search_move_or_delete_hash_entries(
n_fields = block->curr_n_fields;
n_bytes = block->curr_n_bytes;
side = block->curr_side;
left_side = block->curr_left_side;
new_block->n_fields = block->curr_n_fields;
new_block->n_bytes = block->curr_n_bytes;
new_block->side = block->curr_side;
new_block->left_side = left_side;
rw_lock_s_unlock(&btr_search_latch);
ut_a(n_fields + n_bytes > 0);
btr_search_build_page_hash_index(index, new_page, n_fields,
n_bytes, side);
n_bytes, left_side);
#if 1 /* TODO: safe to remove? */
ut_a(n_fields == block->curr_n_fields);
ut_a(n_bytes == block->curr_n_bytes);
ut_a(side == block->curr_side);
ut_a(left_side == block->curr_left_side);
#endif
return;
}
@ -1356,7 +1353,7 @@ btr_search_update_hash_on_delete(
buf_block_t* block;
rec_t* rec;
ulint fold;
dulint tree_id;
dulint index_id;
ibool found;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
mem_heap_t* heap = NULL;
@ -1380,10 +1377,10 @@ btr_search_update_hash_on_delete(
table = btr_search_sys->hash_index;
tree_id = cursor->index->tree->id;
index_id = cursor->index->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);
block->curr_n_fields, block->curr_n_bytes, index_id);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@ -1429,7 +1426,7 @@ btr_search_update_hash_node_on_insert(
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)) {
&& !block->curr_left_side) {
table = btr_search_sys->hash_index;
@ -1460,13 +1457,13 @@ btr_search_update_hash_on_insert(
rec_t* rec;
rec_t* ins_rec;
rec_t* next_rec;
dulint tree_id;
dulint index_id;
ulint fold;
ulint ins_fold;
ulint next_fold = 0; /* remove warning (??? bug ???) */
ulint n_fields;
ulint n_bytes;
ulint side;
ibool left_side;
ibool locked = FALSE;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
@ -1492,32 +1489,32 @@ btr_search_update_hash_on_insert(
ut_a(block->index == cursor->index);
tree_id = ((cursor->index)->tree)->id;
index_id = cursor->index->id;
n_fields = block->curr_n_fields;
n_bytes = block->curr_n_bytes;
side = block->curr_side;
left_side = block->curr_left_side;
ins_rec = page_rec_get_next(rec);
next_rec = page_rec_get_next(ins_rec);
offsets = rec_get_offsets(ins_rec, cursor->index, offsets,
ULINT_UNDEFINED, &heap);
ins_fold = rec_fold(ins_rec, offsets, n_fields, n_bytes, tree_id);
ins_fold = rec_fold(ins_rec, offsets, n_fields, n_bytes, index_id);
if (!page_rec_is_supremum(next_rec)) {
offsets = rec_get_offsets(next_rec, cursor->index, offsets,
n_fields + (n_bytes > 0), &heap);
next_fold = rec_fold(next_rec, offsets, n_fields,
n_bytes, tree_id);
n_bytes, index_id);
}
if (!page_rec_is_infimum(rec)) {
offsets = rec_get_offsets(rec, cursor->index, offsets,
n_fields + (n_bytes > 0), &heap);
fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
fold = rec_fold(rec, offsets, n_fields, n_bytes, index_id);
} else {
if (side == BTR_SEARCH_LEFT_SIDE) {
if (left_side) {
rw_lock_x_lock(&btr_search_latch);
@ -1538,7 +1535,7 @@ btr_search_update_hash_on_insert(
locked = TRUE;
}
if (side == BTR_SEARCH_RIGHT_SIDE) {
if (!left_side) {
ha_insert_for_fold(table, fold, rec);
} else {
ha_insert_for_fold(table, ins_fold, ins_rec);
@ -1548,7 +1545,7 @@ btr_search_update_hash_on_insert(
check_next_rec:
if (page_rec_is_supremum(next_rec)) {
if (side == BTR_SEARCH_RIGHT_SIDE) {
if (!left_side) {
if (!locked) {
rw_lock_x_lock(&btr_search_latch);
@ -1571,7 +1568,7 @@ check_next_rec:
locked = TRUE;
}
if (side == BTR_SEARCH_RIGHT_SIDE) {
if (!left_side) {
ha_insert_for_fold(table, ins_fold, ins_rec);
/*
@ -1659,17 +1656,17 @@ btr_search_validate(void)
" 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)));
btr_page_get_index_id(
page)));
fputs("InnoDB: Record ", stderr);
rec_print_new(stderr, (rec_t*)node->data,
@ -1681,7 +1678,7 @@ btr_search_validate(void)
(void*) page, (ulong) block->is_hashed,
(ulong) block->curr_n_fields,
(ulong) block->curr_n_bytes,
(ulong) block->curr_side);
(ulong) block->curr_left_side);
if (n_page_dumps < 20) {
buf_page_print(page);

View file

@ -350,9 +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:
@ -459,8 +459,8 @@ buf_page_print(
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);
@ -598,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 */
@ -625,8 +625,8 @@ buf_pool_init(
}
/*----------------------------------------*/
} else {
buf_pool->frame_mem = os_mem_alloc_large
(UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE);
buf_pool->frame_mem = os_mem_alloc_large(
UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE);
}
if (buf_pool->frame_mem == NULL) {
@ -821,10 +821,10 @@ buf_awe_map_page_to_frame(
} else {
/* We can map block to the frame of bck */
os_awe_map_physical_mem_to_window
(bck->frame,
UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
block->awe_info);
os_awe_map_physical_mem_to_window(
bck->frame,
UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
block->awe_info);
block->frame = bck->frame;
@ -840,10 +840,10 @@ buf_awe_map_page_to_frame(
bck);
if (add_to_mapped_list) {
UT_LIST_ADD_FIRST
(awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped,
block);
UT_LIST_ADD_FIRST(
awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped,
block);
}
buf_pool->n_pages_awe_remapped++;
@ -1583,7 +1583,7 @@ buf_page_init_for_backup_restore(
block->is_hashed = FALSE;
block->n_fields = 1;
block->n_bytes = 0;
block->side = BTR_SEARCH_LEFT_SIDE;
block->left_side = TRUE;
block->file_page_was_freed = FALSE;
}
@ -1650,7 +1650,7 @@ buf_page_init(
block->is_hashed = FALSE;
block->n_fields = 1;
block->n_bytes = 0;
block->side = BTR_SEARCH_LEFT_SIDE;
block->left_side = TRUE;
block->file_page_was_freed = FALSE;
}
@ -1710,8 +1710,8 @@ buf_page_init_for_read(
mutex_enter(&(buf_pool->mutex));
if (fil_tablespace_deleted_or_being_deleted_in_mem
(space, tablespace_version)) {
if (fil_tablespace_deleted_or_being_deleted_in_mem(
space, tablespace_version)) {
*err = DB_TABLESPACE_DELETED;
}
@ -1891,10 +1891,10 @@ 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)) {
@ -1980,9 +1980,9 @@ buf_page_io_complete(
}
if (!recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page
(block->frame, block->space,
block->offset, TRUE);
ibuf_merge_or_delete_for_page(
block->frame, block->space, block->offset,
TRUE);
}
}
@ -2110,8 +2110,9 @@ buf_validate(void)
if (block->flush_type == BUF_FLUSH_LRU) {
n_lru_flush++;
ut_a(rw_lock_is_locked
(&block->lock, RW_LOCK_SHARED));
ut_a(rw_lock_is_locked(
&block->lock,
RW_LOCK_SHARED));
} else if (block->flush_type
== BUF_FLUSH_LIST) {
n_list_flush++;

View file

@ -890,8 +890,8 @@ buf_flush_batch(
old_page_count = page_count;
/* Try to flush also all the neighbors */
page_count += buf_flush_try_neighbors
(space, offset, flush_type);
page_count += buf_flush_try_neighbors(
space, offset, flush_type);
/* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset,

View file

@ -542,16 +542,16 @@ buf_LRU_old_adjust_len(void)
if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) {
buf_pool->LRU_old = UT_LIST_GET_PREV
(LRU, buf_pool->LRU_old);
buf_pool->LRU_old = 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

View file

@ -257,10 +257,10 @@ 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,
@ -549,10 +549,10 @@ 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,

View file

@ -540,8 +540,8 @@ 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,
>= ut_min(page_get_free_space_of_empty(
dict_table_is_comp(index->table)) / 2,
REC_MAX_DATA_SIZE)) {
longest = 0;
@ -610,8 +610,8 @@ dtuple_convert_big_rec(
vector->fields[n_fields].len = dfield->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 */

View file

@ -40,9 +40,6 @@ charset-collation code for them. */
ulint data_mysql_default_charset_coll = 99999999;
dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0, 0, 0};
dtype_t* dtype_binary = &dtype_binary_val;
/*************************************************************************
Determine how many bytes the first n characters of the given string occupy.
If the string is shorter than n characters, returns the number of bytes
@ -53,7 +50,11 @@ dtype_get_at_most_n_mbchars(
/*========================*/
/* out: length of the prefix,
in bytes */
const dtype_t* dtype, /* in: data type */
ulint prtype, /* in: precise type */
ulint mbminlen, /* in: minimum length of a
multi-byte character */
ulint mbmaxlen, /* in: maximum length of a
multi-byte character */
ulint prefix_len, /* in: length of the requested
prefix, in characters, multiplied by
dtype_get_mbmaxlen(dtype) */
@ -63,12 +64,12 @@ dtype_get_at_most_n_mbchars(
{
#ifndef UNIV_HOTBACKUP
ut_a(data_len != UNIV_SQL_NULL);
ut_ad(!dtype->mbmaxlen || !(prefix_len % dtype->mbmaxlen));
ut_ad(!mbmaxlen || !(prefix_len % mbmaxlen));
if (dtype->mbminlen != dtype->mbmaxlen) {
ut_a(!(prefix_len % dtype->mbmaxlen));
return(innobase_get_at_most_n_mbchars
(dtype_get_charset_coll(dtype->prtype),
if (mbminlen != mbmaxlen) {
ut_a(!(prefix_len % mbmaxlen));
return(innobase_get_at_most_n_mbchars(
dtype_get_charset_coll(prtype),
prefix_len, data_len, str));
}
@ -270,8 +271,6 @@ dtype_print(
} else if (prtype == DATA_TRX_ID) {
fputs("DATA_TRX_ID", stderr);
len = DATA_TRX_ID_LEN;
} else if (prtype == DATA_MIX_ID) {
fputs("DATA_MIX_ID", stderr);
} else if (prtype == DATA_ENGLISH) {
fputs("DATA_ENGLISH", stderr);
} else {
@ -291,38 +290,5 @@ dtype_print(
}
}
fprintf(stderr, " len %lu prec %lu", (ulong) len, (ulong) type->prec);
}
/***************************************************************************
Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */
ulint
dtype_get_max_size(
/*===============*/
/* out: maximum size (ULINT_MAX for
unbounded types) */
const dtype_t* type) /* in: type */
{
switch (type->mtype) {
case DATA_SYS:
case DATA_CHAR:
case DATA_FIXBINARY:
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
case DATA_MYSQL:
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
return(type->len);
case DATA_BLOB:
return(ULINT_MAX);
default:
ut_error;
}
return(ULINT_MAX);
fprintf(stderr, " len %lu", (ulong) len);
}

View file

@ -58,8 +58,7 @@ dict_hdr_get_new_id(
dulint id;
mtr_t mtr;
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID)
|| (type == DICT_HDR_MIX_ID));
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID));
mtr_start(&mtr);
@ -141,6 +140,7 @@ dict_hdr_create(
mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
/* Obsolete, but we must initialize it to 0 anyway. */
mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
@ -214,7 +214,6 @@ dict_boot(void)
dict_index_t* index;
dict_hdr_t* dict_hdr;
mtr_t mtr;
ibool success;
mtr_start(&mtr);
@ -236,25 +235,25 @@ dict_boot(void)
..._MARGIN, it will immediately be updated to the disk-based
header. */
dict_sys->row_id = ut_dulint_add
(ut_dulint_align_up(mtr_read_dulint
(dict_hdr + DICT_HDR_ROW_ID, &mtr),
DICT_HDR_ROW_ID_WRITE_MARGIN),
DICT_HDR_ROW_ID_WRITE_MARGIN);
dict_sys->row_id = ut_dulint_add(
ut_dulint_align_up(mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
&mtr),
DICT_HDR_ROW_ID_WRITE_MARGIN),
DICT_HDR_ROW_ID_WRITE_MARGIN);
/* Insert into the dictionary cache the descriptions of the basic
system tables */
/*-------------------------*/
table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "N_COLS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "MIX_LEN", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "CLUSTER_NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "N_COLS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "MIX_LEN", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "CLUSTER_NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4);
table->id = DICT_TABLES_ID;
@ -269,31 +268,30 @@ dict_boot(void)
index->id = DICT_TABLES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_TABLES,
MLOG_4BYTES, &mtr));
ut_a(success);
dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr + DICT_HDR_TABLES,
MLOG_4BYTES, &mtr));
/*-------------------------*/
index = dict_mem_index_create("SYS_TABLES", "ID_IND",
DICT_HDR_SPACE, DICT_UNIQUE, 1);
dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_TABLE_IDS_ID;
success = dict_index_add_to_cache(table, index,
mtr_read_ulint
(dict_hdr + DICT_HDR_TABLE_IDS,
MLOG_4BYTES, &mtr));
ut_a(success);
dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr + DICT_HDR_TABLE_IDS,
MLOG_4BYTES, &mtr));
/*-------------------------*/
table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY,0,0,0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4);
table->id = DICT_COLUMNS_ID;
@ -308,20 +306,20 @@ dict_boot(void)
dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_COLUMNS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr));
ut_a(success);
dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr + DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr));
/*-------------------------*/
table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "N_FIELDS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "PAGE_NO", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "N_FIELDS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PAGE_NO", DATA_INT, 0, 4);
/* The '+ 2' below comes from the 2 system fields */
#if DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2
@ -346,16 +344,16 @@ dict_boot(void)
dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_INDEXES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr));
ut_a(success);
dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr + DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr));
/*-------------------------*/
table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0);
dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "COL_NAME", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "COL_NAME", DATA_BINARY, 0, 0);
table->id = DICT_FIELDS_ID;
dict_table_add_to_cache(table);
@ -369,10 +367,9 @@ dict_boot(void)
dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_FIELDS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint
(dict_hdr + DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr));
ut_a(success);
dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr + DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr));
mtr_commit(&mtr);
/*-------------------------*/

View file

@ -78,14 +78,14 @@ dict_create_sys_tables_tuple(
mach_write_to_4(ptr, DICT_TABLE_ORDINARY);
dfield_set_data(dfield, ptr, 4);
/* 6: MIX_ID ---------------------------*/
/* 6: MIX_ID (obsolete) ---------------------------*/
dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 8);
memset(ptr, 0, 8);
dfield_set_data(dfield, ptr, 8);
/* 7: MIX_LEN --------------------------*/
/* 7: MIX_LEN (obsolete) --------------------------*/
dfield = dtuple_get_nth_field(entry, 5);
@ -124,11 +124,12 @@ dict_create_sys_columns_tuple(
mem_heap_t* heap) /* in: memory heap from which the memory for
the built tuple is allocated */
{
dict_table_t* sys_columns;
dtuple_t* entry;
dict_col_t* column;
dfield_t* dfield;
byte* ptr;
dict_table_t* sys_columns;
dtuple_t* entry;
const dict_col_t* column;
dfield_t* dfield;
byte* ptr;
const char* col_name;
ut_ad(table && heap);
@ -155,33 +156,34 @@ dict_create_sys_columns_tuple(
/* 4: NAME ---------------------------*/
dfield = dtuple_get_nth_field(entry, 2);
dfield_set_data(dfield, column->name, ut_strlen(column->name));
col_name = dict_table_get_col_name(table, i);
dfield_set_data(dfield, col_name, ut_strlen(col_name));
/* 5: MTYPE --------------------------*/
dfield = dtuple_get_nth_field(entry, 3);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).mtype);
mach_write_to_4(ptr, column->mtype);
dfield_set_data(dfield, ptr, 4);
/* 6: PRTYPE -------------------------*/
dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).prtype);
mach_write_to_4(ptr, column->prtype);
dfield_set_data(dfield, ptr, 4);
/* 7: LEN ----------------------------*/
dfield = dtuple_get_nth_field(entry, 5);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).len);
mach_write_to_4(ptr, column->len);
dfield_set_data(dfield, ptr, 4);
/* 8: PREC ---------------------------*/
dfield = dtuple_get_nth_field(entry, 6);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).prec);
mach_write_to_4(ptr, 0/* unused */);
dfield_set_data(dfield, ptr, 4);
/*---------------------------------*/
@ -222,8 +224,7 @@ dict_build_table_def_step(
row_len = 0;
for (i = 0; i < table->n_def; i++) {
row_len += dtype_get_min_size(dict_col_get_type
(&table->cols[i]));
row_len += dict_col_get_min_size(&table->cols[i]);
}
if (row_len > BTR_PAGE_MAX_REC_SIZE) {
return(DB_TOO_BIG_RECORD);
@ -238,7 +239,7 @@ dict_build_table_def_step(
- page 3 will contain the root of the clustered index of the
table we create here. */
table->space = 0; /* reset to zero for the call below */
ulint space = 0; /* reset to zero for the call below */
if (table->dir_path_of_temp_table) {
/* We place tables created with CREATE TEMPORARY
@ -251,9 +252,11 @@ 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(
&space, path_or_name, is_path,
FIL_IBD_FILE_INITIAL_SIZE);
table->space = space;
if (error != DB_SUCCESS) {
return(error);
@ -768,8 +771,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
@ -798,7 +801,7 @@ dict_truncate_index_tree(
root_page_no = btr_create(type, space, index_id, comp, mtr);
if (index) {
index->tree->page = root_page_no;
index->page = root_page_no;
} else {
ut_print_timestamp(stderr);
fprintf(stderr,
@ -1004,7 +1007,6 @@ dict_create_index_step(
que_thr_t* thr) /* in: query thread */
{
ind_node_t* node;
ibool success;
ulint err = DB_ERROR;
trx_t* trx;
@ -1088,10 +1090,8 @@ dict_create_index_step(
if (node->state == INDEX_ADD_TO_CACHE) {
success = dict_index_add_to_cache(node->table, node->index,
node->page_no);
ut_a(success);
dict_index_add_to_cache(node->table, node->index,
node->page_no);
err = DB_SUCCESS;
}
@ -1328,13 +1328,14 @@ dict_create_add_foreign_field_to_dictionary(
pars_info_add_str_literal(info, "ref_col_name",
foreign->referenced_col_names[field_nr]);
return(dict_foreign_eval_sql
(info, "PROCEDURE P () IS\n"
"BEGIN\n"
"INSERT INTO SYS_FOREIGN_COLS VALUES"
"(:id, :pos, :for_col_name, :ref_col_name);\n"
"END;\n",
table, foreign, trx));
return(dict_foreign_eval_sql(
info,
"PROCEDURE P () IS\n"
"BEGIN\n"
"INSERT INTO SYS_FOREIGN_COLS VALUES"
"(:id, :pos, :for_col_name, :ref_col_name);\n"
"END;\n",
table, foreign, trx));
}
/************************************************************************
@ -1393,8 +1394,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) {
@ -1450,8 +1451,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

@ -26,6 +26,25 @@ Created 4/24/1996 Heikki Tuuri
#include "srv0start.h"
#include "srv0srv.h"
/********************************************************************
Returns TRUE if index's i'th column's name is 'name' .*/
static
ibool
name_of_col_is(
/*===========*/
/* out: */
dict_table_t* table, /* in: table */
dict_index_t* index, /* in: index */
ulint i, /* in: */
const char* name) /* in: name to compare to */
{
ulint tmp = dict_col_get_no(dict_field_get_col(
dict_index_get_nth_field(
index, i)));
return(strcmp(name, dict_table_get_col_name(table, tmp)) == 0);
}
/************************************************************************
Finds the first table name in the given database. */
@ -331,7 +350,6 @@ dict_load_columns(
ulint mtype;
ulint prtype;
ulint col_len;
ulint prec;
ulint i;
mtr_t mtr;
@ -356,7 +374,7 @@ dict_load_columns(
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < table->n_cols - DATA_N_SYS_COLS; i++) {
for (i = 0; i + DATA_N_SYS_COLS < (ulint) table->n_cols; i++) {
rec = btr_pcur_get_rec(&pcur);
@ -372,8 +390,7 @@ dict_load_columns(
ut_ad(len == 4);
ut_a(i == mach_read_from_4(field));
ut_a(!strcmp("NAME", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
ut_a(name_of_col_is(sys_columns, sys_index, 4, "NAME"));
field = rec_get_nth_field_old(rec, 4, &len);
name = mem_heap_strdupl(heap, (char*) field, len);
@ -392,30 +409,25 @@ dict_load_columns(
/* Use the binary collation for
string columns of binary type. */
prtype = dtype_form_prtype
(prtype,
DATA_MYSQL_BINARY_CHARSET_COLL);
prtype = dtype_form_prtype(
prtype,
DATA_MYSQL_BINARY_CHARSET_COLL);
} else {
/* Use the default charset for
other than binary columns. */
prtype = dtype_form_prtype
(prtype,
data_mysql_default_charset_coll);
prtype = dtype_form_prtype(
prtype,
data_mysql_default_charset_coll);
}
}
field = rec_get_nth_field_old(rec, 7, &len);
col_len = mach_read_from_4(field);
ut_a(!strcmp("PREC", dict_field_get_col
(dict_index_get_nth_field(sys_index, 8))->name));
ut_a(name_of_col_is(sys_columns, sys_index, 8, "PREC"));
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);
dict_mem_table_add_col(table, name, mtype, prtype, col_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
@ -526,13 +538,13 @@ dict_load_fields(
prefix_len = 0;
}
ut_a(!strcmp("COL_NAME", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
ut_a(name_of_col_is(sys_fields, sys_index, 4, "COL_NAME"));
field = rec_get_nth_field_old(rec, 4, &len);
dict_mem_index_add_field(index, mem_heap_strdupl
(heap, (char*) field, len),
dict_mem_index_add_field(index,
mem_heap_strdupl(heap,
(char*) field, len),
prefix_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
@ -631,8 +643,7 @@ dict_load_indexes(
ut_ad(len == 8);
id = mach_read_from_8(field);
ut_a(!strcmp("NAME", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
ut_a(name_of_col_is(sys_indexes, sys_index, 4, "NAME"));
field = rec_get_nth_field_old(rec, 4, &name_len);
name_buf = mem_heap_strdupl(heap, (char*) field, name_len);
@ -646,8 +657,7 @@ dict_load_indexes(
field = rec_get_nth_field_old(rec, 7, &len);
space = mach_read_from_4(field);
ut_a(!strcmp("PAGE_NO", dict_field_get_col
(dict_index_get_nth_field(sys_index, 8))->name));
ut_a(name_of_col_is(sys_indexes, sys_index, 8, "PAGE_NO"));
field = rec_get_nth_field_old(rec, 8, &len);
page_no = mach_read_from_4(field);
@ -785,8 +795,7 @@ err_exit:
goto err_exit;
}
ut_a(!strcmp("SPACE", dict_field_get_col
(dict_index_get_nth_field(sys_index, 9))->name));
ut_a(name_of_col_is(sys_tables, sys_index, 9, "SPACE"));
field = rec_get_nth_field_old(rec, 9, &len);
space = mach_read_from_4(field);
@ -819,8 +828,7 @@ err_exit:
}
}
ut_a(!strcmp("N_COLS", dict_field_get_col
(dict_index_get_nth_field(sys_index, 4))->name));
ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS"));
field = rec_get_nth_field_old(rec, 4, &len);
n_cols = mach_read_from_4(field);
@ -837,8 +845,7 @@ err_exit:
table->ibd_file_missing = ibd_file_missing;
ut_a(!strcmp("ID", dict_field_get_col
(dict_index_get_nth_field(sys_index, 3))->name));
ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID"));
field = rec_get_nth_field_old(rec, 3, &len);
table->id = mach_read_from_8(field);
@ -925,8 +932,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);
@ -1032,11 +1039,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");
@ -1067,12 +1074,12 @@ dict_load_foreign_cols(
ut_a(i == mach_read_from_4(field));
field = rec_get_nth_field_old(rec, 4, &len);
foreign->foreign_col_names[i] = mem_heap_strdupl
(foreign->heap, (char*) field, len);
foreign->foreign_col_names[i] = mem_heap_strdupl(
foreign->heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 5, &len);
foreign->referenced_col_names[i] = mem_heap_strdupl
(foreign->heap, (char*) field, len);
foreign->referenced_col_names[i] = mem_heap_strdupl(
foreign->heap, (char*) field, len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
@ -1165,8 +1172,8 @@ dict_load_foreign(
foreign = dict_mem_foreign_create();
foreign->n_fields = mach_read_from_4
(rec_get_nth_field_old(rec, 5, &len));
foreign->n_fields = mach_read_from_4(
rec_get_nth_field_old(rec, 5, &len));
ut_a(len == 4);
@ -1178,12 +1185,12 @@ dict_load_foreign(
foreign->id = mem_heap_strdup(foreign->heap, id);
field = rec_get_nth_field_old(rec, 3, &len);
foreign->foreign_table_name = mem_heap_strdupl
(foreign->heap, (char*) field, len);
foreign->foreign_table_name = mem_heap_strdupl(
foreign->heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 4, &len);
foreign->referenced_table_name = mem_heap_strdupl
(foreign->heap, (char*) field, len);
foreign->referenced_table_name = mem_heap_strdupl(
foreign->heap, (char*) field, len);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@ -1257,8 +1264,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);
@ -1289,7 +1296,8 @@ loop:
following call does the comparison in the latin1_swedish_ci
charset-collation, in a case-insensitive way. */
if (0 != cmp_data_data(dfield_get_type(dfield),
if (0 != cmp_data_data(dfield_get_type(dfield)->mtype,
dfield_get_type(dfield)->prtype,
dfield_get_data(dfield), dfield_get_len(dfield),
field, len)) {

View file

@ -66,6 +66,7 @@ dict_mem_table_create(
table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS)
* sizeof(dict_col_t));
table->col_names = NULL;
UT_LIST_INIT(table->indexes);
table->auto_inc_lock = mem_heap_alloc(heap, lock_get_size());
@ -76,20 +77,22 @@ dict_mem_table_create(
UT_LIST_INIT(table->foreign_list);
UT_LIST_INIT(table->referenced_list);
#ifdef UNIV_DEBUG
table->does_not_fit_in_memory = FALSE;
#endif /* UNIV_DEBUG */
table->stat_initialized = FALSE;
table->stat_modified_counter = 0;
table->max_row_size = 0;
table->big_rows = 0;
mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
table->autoinc_inited = FALSE;
#ifdef UNIV_DEBUG
table->magic_n = DICT_TABLE_MAGIC_N;
#endif /* UNIV_DEBUG */
return(table);
}
@ -105,9 +108,74 @@ dict_mem_table_free(
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
mutex_free(&(table->autoinc_mutex));
if (table->col_names && (table->n_def < table->n_cols)) {
ut_free((void*)table->col_names);
}
mem_heap_free(table->heap);
}
/********************************************************************
Add 'name' to end of the col_names array (see dict_table_t::col_names). Call
ut_free on col_names (if not NULL), allocate new array (if heap, from it,
otherwise with ut_malloc), and copy col_names + name to it. */
static
const char*
dict_add_col_name(
/*==============*/
/* out: new column names array */
const char* col_names, /* in: existing column names, or
NULL */
ulint cols, /* in: number of existing columns */
const char* name, /* in: new column name */
mem_heap_t* heap) /* in: heap, or NULL */
{
ulint i;
ulint old_len;
ulint new_len;
ulint total_len;
const char* s;
char* res;
ut_a(((cols == 0) && !col_names) || ((cols > 0) && col_names));
ut_a(*name);
/* Find out length of existing array. */
if (col_names) {
s = col_names;
for (i = 0; i < cols; i++) {
s += strlen(s) + 1;
}
old_len = s - col_names;
} else {
old_len = 0;
}
new_len = strlen(name) + 1;
total_len = old_len + new_len;
if (heap) {
res = mem_heap_alloc(heap, total_len);
} else {
res = ut_malloc(total_len);
}
if (old_len > 0) {
memcpy(res, col_names, old_len);
}
memcpy(res + old_len, name, new_len);
if (col_names) {
ut_free((char*)col_names);
}
return(res);
}
/**************************************************************************
Adds a column definition to a table. */
@ -118,29 +186,36 @@ dict_mem_table_add_col(
const char* name, /* in: column name */
ulint mtype, /* in: main datatype */
ulint prtype, /* in: precise type */
ulint len, /* in: length */
ulint prec) /* in: precision */
ulint len) /* in: precision */
{
dict_col_t* col;
dtype_t* type;
ulint mbminlen;
ulint mbmaxlen;
mem_heap_t* heap;
ut_ad(table && name);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
table->n_def++;
col = dict_table_get_nth_col(table, table->n_def - 1);
heap = table->n_def < table->n_cols ? NULL : table->heap;
table->col_names = dict_add_col_name(table->col_names,
table->n_def - 1,
name, heap);
col = (dict_col_t*) dict_table_get_nth_col(table, table->n_def - 1);
col->ind = table->n_def - 1;
col->name = mem_heap_strdup(table->heap, name);
col->table = table;
col->ord_part = 0;
col->clust_pos = ULINT_UNDEFINED;
col->mtype = mtype;
col->prtype = prtype;
col->len = len;
type = dict_col_get_type(col);
dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen);
dtype_set(type, mtype, prtype, len, prec);
col->mbminlen = mbminlen;
col->mbmaxlen = mbmaxlen;
}
/**************************************************************************
@ -171,6 +246,7 @@ dict_mem_index_create(
index->type = type;
index->space = space;
index->page = 0;
index->name = mem_heap_strdup(heap, index_name);
index->table_name = table_name;
index->table = NULL;
@ -183,8 +259,10 @@ dict_mem_index_create(
index->stat_n_diff_key_vals = NULL;
index->cached = FALSE;
memset(&index->lock, 0, sizeof index->lock);
#ifdef UNIV_DEBUG
index->magic_n = DICT_INDEX_MAGIC_N;
#endif /* UNIV_DEBUG */
return(index);
}

View file

@ -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;
}

View file

@ -51,8 +51,8 @@ if_step(
for (;;) {
eval_exp(elsif_node->cond);
if (eval_node_get_ibool_val
(elsif_node->cond)) {
if (eval_node_get_ibool_val(
elsif_node->cond)) {
/* The condition evaluated to TRUE:
start execution from the first

View file

@ -529,9 +529,8 @@ fil_node_open_file(
os_file_read() in Windows to read from a file opened for
async I/O! */
node->handle = os_file_create_simple_no_error_handling
(node->name,
OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
node->handle = os_file_create_simple_no_error_handling(
node->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
@ -1564,9 +1563,9 @@ fil_write_flushed_lsn_to_data_files(
while (node) {
mutex_exit(&(fil_system->mutex));
err = fil_write_lsn_and_arch_no_to_file
(space->id, sum_of_sizes,
lsn, arch_log_no);
err = fil_write_lsn_and_arch_no_to_file(
space->id, sum_of_sizes, lsn,
arch_log_no);
if (err != DB_SUCCESS) {
return(err);
@ -1936,9 +1935,9 @@ fil_op_log_parse_or_replay(
ut_a(space_id != 0);
if (fil_create_new_single_table_tablespace
(&space_id, name, FALSE,
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
if (fil_create_new_single_table_tablespace(
&space_id, name, FALSE,
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
ut_error;
}
}
@ -2580,8 +2579,8 @@ fil_reset_too_high_lsns(
filepath = fil_make_ibd_name(name, FALSE);
file = os_file_create_simple_no_error_handling
(filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success);
file = os_file_create_simple_no_error_handling(
filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
@ -2654,8 +2653,8 @@ fil_reset_too_high_lsns(
if (ut_dulint_cmp(mach_read_from_8(page + FIL_PAGE_LSN),
current_lsn) > 0) {
/* We have to reset the lsn */
space_id = mach_read_from_4
(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
space_id = mach_read_from_4(
page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
buf_flush_init_for_writing(page, current_lsn, space_id,
@ -2735,8 +2734,8 @@ fil_open_single_table_tablespace(
filepath = fil_make_ibd_name(name, FALSE);
file = os_file_create_simple_no_error_handling
(filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
file = os_file_create_simple_no_error_handling(
filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
@ -2887,8 +2886,8 @@ fil_load_single_table_tablespace(
dict_casedn_str(filepath);
# endif /* !UNIV_HOTBACKUP */
#endif
file = os_file_create_simple_no_error_handling
(filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
file = os_file_create_simple_no_error_handling(
filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
@ -3242,8 +3241,8 @@ fil_load_single_table_tablespaces(void)
".ibd")) {
/* The name ends in .ibd; try opening
the file */
fil_load_single_table_tablespace
(dbinfo.name, fileinfo.name);
fil_load_single_table_tablespace(
dbinfo.name, fileinfo.name);
}
next_file_item:
ret = fil_file_readdir_next_file(&err,
@ -3736,8 +3735,8 @@ fil_extend_tablespaces_to_stored_len(void)
size_in_header = fsp_get_size_low(buf);
success = fil_extend_space_to_desired_size
(&actual_size, space->id, size_in_header);
success = fil_extend_space_to_desired_size(
&actual_size, space->id, size_in_header);
if (!success) {
fprintf(stderr,
"InnoDB: Error: could not extend the"
@ -4082,9 +4081,9 @@ fil_io(
for (;;) {
if (node == NULL) {
fil_report_invalid_page_access
(block_offset, space_id,
space->name, byte_offset, len, type);
fil_report_invalid_page_access(
block_offset, space_id, space->name,
byte_offset, len, type);
ut_error;
}
@ -4113,9 +4112,9 @@ fil_io(
if (space->purpose == FIL_TABLESPACE && space->id != 0
&& node->size <= block_offset) {
fil_report_invalid_page_access
(block_offset, space_id,
space->name, byte_offset, len, type);
fil_report_invalid_page_access(
block_offset, space_id, space->name, byte_offset,
len, type);
ut_error;
}
@ -4384,10 +4383,10 @@ skip_flush:
space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE
(unflushed_spaces,
system->unflushed_spaces,
space);
UT_LIST_REMOVE(
unflushed_spaces,
system->unflushed_spaces,
space);
}
}

View file

@ -768,8 +768,9 @@ xdes_lst_get_next(
space = buf_frame_get_space_id(descr);
return(xdes_lst_get_descriptor
(space, flst_get_next_addr(descr + XDES_FLST_NODE, mtr), mtr));
return(xdes_lst_get_descriptor(
space,
flst_get_next_addr(descr + XDES_FLST_NODE, mtr), mtr));
}
/************************************************************************
@ -1116,8 +1117,8 @@ fsp_try_extend_data_file(
fprintf(stderr,
"InnoDB: Error: Last data file size is %lu,"
" max size allowed %lu\n",
(ulong) srv_data_file_sizes
[srv_n_data_files - 1],
(ulong) srv_data_file_sizes[
srv_n_data_files - 1],
(ulong) srv_last_file_size_max);
}
@ -1137,13 +1138,13 @@ fsp_try_extend_data_file(
if (size < FSP_EXTENT_SIZE) {
/* Let us first extend the file to 64 pages */
success = fsp_try_extend_data_file_with_pages
(space, FSP_EXTENT_SIZE - 1,
header, mtr);
success = fsp_try_extend_data_file_with_pages(
space, FSP_EXTENT_SIZE - 1,
header, mtr);
if (!success) {
new_size = mtr_read_ulint
(header + FSP_SIZE,
MLOG_4BYTES, mtr);
new_size = mtr_read_ulint(
header + FSP_SIZE,
MLOG_4BYTES, mtr);
*actual_increase = new_size - old_size;
@ -1246,9 +1247,9 @@ fsp_fill_free_list(
/* Update the free limit info in the log system and make
a checkpoint */
if (space == 0) {
log_fsp_current_free_limit_set_and_checkpoint
((i + FSP_EXTENT_SIZE)
/ ((1024 * 1024) / UNIV_PAGE_SIZE));
log_fsp_current_free_limit_set_and_checkpoint(
(i + FSP_EXTENT_SIZE)
/ ((1024 * 1024) / UNIV_PAGE_SIZE));
}
if (0 == i % XDES_DESCRIBED_PER_PAGE) {
@ -1967,8 +1968,8 @@ fseg_find_last_used_frag_page_slot(
ut_ad(inode && mtr);
for (i = 0; i < FSEG_FRAG_ARR_N_SLOTS; i++) {
page_no = fseg_get_nth_frag_page_no
(inode, FSEG_FRAG_ARR_N_SLOTS - i - 1, mtr);
page_no = fseg_get_nth_frag_page_no(
inode, FSEG_FRAG_ARR_N_SLOTS - i - 1, mtr);
if (page_no != FIL_NULL) {
@ -2526,8 +2527,8 @@ fseg_alloc_free_page_low(
return(FIL_NULL);
}
success = fsp_try_extend_data_file_with_pages
(space, ret_page, space_header, mtr);
success = fsp_try_extend_data_file_with_pages(
space, ret_page, space_header, mtr);
if (!success) {
/* No disk space left */
return(FIL_NULL);
@ -3161,8 +3162,8 @@ fseg_free_extent(
/* Drop search system page hash index if the page is
found in the pool and is hashed */
btr_search_drop_page_hash_when_freed
(space, first_page_in_extent + i);
btr_search_drop_page_hash_when_freed(
space, first_page_in_extent + i);
}
}
@ -3176,8 +3177,8 @@ fseg_free_extent(
flst_remove(seg_inode + FSEG_NOT_FULL,
descr + XDES_FLST_NODE, mtr);
not_full_n_used = mtr_read_ulint
(seg_inode + FSEG_NOT_FULL_N_USED, MLOG_4BYTES, mtr);
not_full_n_used = mtr_read_ulint(
seg_inode + FSEG_NOT_FULL_N_USED, MLOG_4BYTES, mtr);
descr_n_used = xdes_get_n_used(descr, mtr);
ut_a(not_full_n_used >= descr_n_used);
@ -3758,15 +3759,15 @@ fsp_validate(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr
(space, node_addr, RW_X_LATCH, &mtr)
seg_inode_page = fut_get_ptr(
space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode
(seg_inode_page, n, &mtr);
ut_a(ut_dulint_cmp
(mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0);
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, &mtr);
ut_a(ut_dulint_cmp(
mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0);
fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_FREE,
@ -3778,8 +3779,8 @@ fsp_validate(
n_used2 += fseg_get_n_frag_pages(seg_inode, &mtr);
next_node_addr = flst_get_next_addr
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
next_node_addr = flst_get_next_addr(
seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
}
@ -3804,29 +3805,29 @@ fsp_validate(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr
(space, node_addr, RW_X_LATCH, &mtr)
seg_inode_page = fut_get_ptr(
space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode
(seg_inode_page, n, &mtr);
if (ut_dulint_cmp
(mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0) {
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, &mtr);
if (ut_dulint_cmp(
mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0) {
fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len
(seg_inode + FSEG_FREE, &mtr);
descr_count += flst_get_len
(seg_inode + FSEG_FULL, &mtr);
descr_count += flst_get_len
(seg_inode + FSEG_NOT_FULL, &mtr);
n_used2 += fseg_get_n_frag_pages
(seg_inode, &mtr);
descr_count += flst_get_len(
seg_inode + FSEG_FREE, &mtr);
descr_count += flst_get_len(
seg_inode + FSEG_FULL, &mtr);
descr_count += flst_get_len(
seg_inode + FSEG_NOT_FULL, &mtr);
n_used2 += fseg_get_n_frag_pages(
seg_inode, &mtr);
}
next_node_addr = flst_get_next_addr
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
next_node_addr = flst_get_next_addr(
seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
}
@ -3931,21 +3932,21 @@ fsp_print(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr
(space, node_addr, RW_X_LATCH, &mtr)
seg_inode_page = fut_get_ptr(
space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode
(seg_inode_page, n, &mtr);
ut_a(ut_dulint_cmp
(mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0);
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, &mtr);
ut_a(ut_dulint_cmp(
mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0);
fseg_print_low(seg_inode, &mtr);
n_segs++;
next_node_addr = flst_get_next_addr
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
next_node_addr = flst_get_next_addr(
seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
}
@ -3968,22 +3969,22 @@ fsp_print(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr
(space, node_addr, RW_X_LATCH, &mtr)
seg_inode_page = fut_get_ptr(
space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode
(seg_inode_page, n, &mtr);
if (ut_dulint_cmp
(mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0) {
seg_inode = fsp_seg_inode_page_get_nth_inode(
seg_inode_page, n, &mtr);
if (ut_dulint_cmp(
mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0) {
fseg_print_low(seg_inode, &mtr);
n_segs++;
}
next_node_addr = flst_get_next_addr
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
next_node_addr = flst_get_next_addr(
seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
}

View file

@ -3025,8 +3025,9 @@ ha_innobase::store_key_val_for_row(
/******************************************************************
Builds a 'template' to the prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
static
void
ha_innobase::build_template(
build_template(
/*===========*/
row_prebuilt_t* prebuilt, /* in: prebuilt struct */
THD* thd, /* in: current user thread, used
@ -3167,8 +3168,8 @@ include_field:
templ->col_no = i;
if (index == clust_index) {
templ->rec_field_no = (index->table->cols + i)
->clust_pos;
templ->rec_field_no = dict_col_get_clust_pos_noninline(
&index->table->cols[i], index);
} else {
templ->rec_field_no = dict_index_get_nth_col_pos(
index, i);
@ -3197,7 +3198,7 @@ include_field:
mysql_prefix_len = templ->mysql_col_offset
+ templ->mysql_col_len;
}
templ->type = index->table->cols[i].type.mtype;
templ->type = index->table->cols[i].mtype;
templ->mysql_type = (ulint)field->type();
if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR) {
@ -3206,10 +3207,10 @@ include_field:
}
templ->charset = dtype_get_charset_coll_noninline(
index->table->cols[i].type.prtype);
templ->mbminlen = index->table->cols[i].type.mbminlen;
templ->mbmaxlen = index->table->cols[i].type.mbmaxlen;
templ->is_unsigned = index->table->cols[i].type.prtype
index->table->cols[i].prtype);
templ->mbminlen = index->table->cols[i].mbminlen;
templ->mbmaxlen = index->table->cols[i].mbmaxlen;
templ->is_unsigned = index->table->cols[i].prtype
& DATA_UNSIGNED;
if (templ->type == DATA_BLOB) {
prebuilt->templ_contains_blob = TRUE;
@ -3227,8 +3228,9 @@ skip_field:
for (i = 0; i < n_requested_fields; i++) {
templ = prebuilt->mysql_template + i;
templ->rec_field_no =
(index->table->cols + templ->col_no)->clust_pos;
templ->rec_field_no = dict_col_get_clust_pos_noninline(
&index->table->cols[templ->col_no],
clust_index);
}
}
}
@ -3494,9 +3496,11 @@ calc_row_difference(
ulint col_type;
ulint n_changed = 0;
dfield_t dfield;
dict_index_t* clust_index;
uint i;
n_fields = table->s->fields;
clust_index = dict_table_get_first_index_noninline(prebuilt->table);
/* We use upd_buff to convert changed fields */
buf = (byte*) upd_buff;
@ -3527,7 +3531,7 @@ calc_row_difference(
field_mysql_type = field->type();
col_type = prebuilt->table->cols[i].type.mtype;
col_type = prebuilt->table->cols[i].mtype;
switch (col_type) {
@ -3582,7 +3586,8 @@ calc_row_difference(
/* Let us use a dummy dfield to make the conversion
from the MySQL column format to the InnoDB format */
dfield.type = (prebuilt->table->cols + i)->type;
dict_col_copy_type_noninline(prebuilt->table->cols + i,
&dfield.type);
if (n_len != UNIV_SQL_NULL) {
buf = row_mysql_store_col_in_innobase_format(
@ -3601,7 +3606,8 @@ calc_row_difference(
}
ufield->exp = NULL;
ufield->field_no = prebuilt->table->cols[i].clust_pos;
ufield->field_no = dict_col_get_clust_pos_noninline(
&prebuilt->table->cols[i], clust_index);
n_changed++;
}
}
@ -4581,8 +4587,7 @@ create_table_def(
| nulls_allowed | unsigned_type
| binary_type | long_true_varchar,
charset_no),
col_len,
0);
col_len);
}
error = row_create_table_for_mysql(table, trx);
@ -6175,25 +6180,11 @@ ha_innobase::start_stmt(
1) ::store_lock(),
2) ::external_lock(),
3) ::init_table_handle_for_HANDLER(), and
4) :.transactional_table_lock(). */
4) ::transactional_table_lock(). */
prebuilt->select_lock_type =
prebuilt->stored_select_lock_type;
}
if (prebuilt->stored_select_lock_type != LOCK_S
&& prebuilt->stored_select_lock_type != LOCK_X) {
sql_print_error(
"stored_select_lock_type is %lu inside "
"::start_stmt()!",
prebuilt->stored_select_lock_type);
/* Set the value to LOCK_X: this is just fault
tolerance, we do not know what the correct value
should be! */
prebuilt->select_lock_type = LOCK_X;
}
}
trx->detailed_error[0] = '\0';

View file

@ -201,8 +201,6 @@ class ha_innobase: public handler
int cmp_ref(const byte *ref1, const byte *ref2);
bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes);
void build_template(struct row_prebuilt_struct *prebuilt, THD *thd,
TABLE *table, uint templ_type);
};
extern SHOW_VAR innodb_status_variables[];

View file

@ -305,7 +305,7 @@ ibuf_tree_root_get(
ut_a(space == 0);
ut_ad(ibuf_inside());
mtr_x_lock(dict_tree_get_lock((data->index)->tree), mtr);
mtr_x_lock(dict_index_get_lock(data->index), mtr);
page = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
mtr);
@ -524,16 +524,16 @@ ibuf_data_init_for_space(
/* use old-style record format for the insert buffer */
table = dict_mem_table_create(buf, space, 2, 0);
dict_mem_table_add_col(table, "PAGE_NO", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "TYPES", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "PAGE_NO", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "TYPES", DATA_BINARY, 0, 0);
table->id = ut_dulint_add(DICT_IBUF_ID_MIN, space);
dict_table_add_to_cache(table);
index = dict_mem_index_create
(buf, "CLUST_IND", space,
DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, 2);
index = dict_mem_index_create(
buf, "CLUST_IND", space,
DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, 2);
dict_mem_index_add_field(index, "PAGE_NO", 0);
dict_mem_index_add_field(index, "TYPES", 0);
@ -768,9 +768,9 @@ ibuf_set_free_bits_low(
return;
}
bitmap_page = ibuf_bitmap_get_map_page
(buf_frame_get_space_id(page),
buf_frame_get_page_no(page), mtr);
bitmap_page = ibuf_bitmap_get_map_page(
buf_frame_get_space_id(page),
buf_frame_get_page_no(page), mtr);
#ifdef UNIV_IBUF_DEBUG
# if 0
fprintf(stderr,
@ -818,17 +818,17 @@ ibuf_set_free_bits(
mtr_start(&mtr);
bitmap_page = ibuf_bitmap_get_map_page
(buf_frame_get_space_id(page),
buf_frame_get_page_no(page), &mtr);
bitmap_page = ibuf_bitmap_get_map_page(
buf_frame_get_space_id(page), buf_frame_get_page_no(page),
&mtr);
if (max_val != ULINT_UNDEFINED) {
#ifdef UNIV_IBUF_DEBUG
ulint old_val;
old_val = ibuf_bitmap_page_get_bits
(bitmap_page, buf_frame_get_page_no(page),
IBUF_BITMAP_FREE, &mtr);
old_val = ibuf_bitmap_page_get_bits(
bitmap_page, buf_frame_get_page_no(page),
IBUF_BITMAP_FREE, &mtr);
# if 0
if (old_val != max_val) {
fprintf(stderr,
@ -1145,9 +1145,8 @@ ibuf_dummy_index_add_col(
dict_mem_table_add_col(index->table, "DUMMY",
dtype_get_mtype(type),
dtype_get_prtype(type),
dtype_get_len(type),
dtype_get_prec(type));
dict_index_add_col(index,
dtype_get_len(type));
dict_index_add_col(index, index->table, (dict_col_t*)
dict_table_get_nth_col(index->table, i), len);
}
/************************************************************************
@ -1165,6 +1164,11 @@ ibuf_dummy_index_free(
dict_mem_table_free(table);
}
void
dict_index_print_low(
/*=================*/
dict_index_t* index); /* in: index */
/*************************************************************************
Builds the entry to insert into a non-clustered index when we have the
corresponding record in an ibuf index. */
@ -1213,9 +1217,9 @@ ibuf_build_entry_from_ibuf_rec(
dfield_set_data(field, data, len);
dtype_read_for_order_and_null_size
(dfield_get_type(field),
types + i * DATA_ORDER_NULL_TYPE_BUF_SIZE);
dtype_read_for_order_and_null_size(
dfield_get_type(field),
types + i * DATA_ORDER_NULL_TYPE_BUF_SIZE);
}
*pindex = ibuf_dummy_index_create(n_fields, FALSE);
@ -1235,8 +1239,8 @@ ibuf_build_entry_from_ibuf_rec(
types = rec_get_nth_field_old(ibuf_rec, 3, &len);
ut_a(len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE <= 1);
index = ibuf_dummy_index_create
(n_fields, len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
index = ibuf_dummy_index_create(
n_fields, len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
if (len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE) {
/* compact record format */
@ -1254,9 +1258,9 @@ ibuf_build_entry_from_ibuf_rec(
dfield_set_data(field, data, len);
dtype_new_read_for_order_and_null_size
(dfield_get_type(field),
types + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
dtype_new_read_for_order_and_null_size(
dfield_get_type(field),
types + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
ibuf_dummy_index_add_col(index, dfield_get_type(field), len);
}
@ -1315,8 +1319,8 @@ ibuf_rec_get_volume(
ulint volume;
dict_index_t* dummy_index;
mem_heap_t* heap = mem_heap_create(500);
dtuple_t* entry = ibuf_build_entry_from_ibuf_rec
(ibuf_rec, heap, &dummy_index);
dtuple_t* entry = ibuf_build_entry_from_ibuf_rec(
ibuf_rec, heap, &dummy_index);
volume = rec_get_converted_size(dummy_index, entry);
ibuf_dummy_index_free(dummy_index);
mem_heap_free(heap);
@ -1332,15 +1336,15 @@ ibuf_rec_get_volume(
if (new_format) {
data = rec_get_nth_field_old(ibuf_rec, i + 4, &len);
dtype_new_read_for_order_and_null_size
(&dtype, types + i
* DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
dtype_new_read_for_order_and_null_size(
&dtype, types + i
* DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
} else {
data = rec_get_nth_field_old(ibuf_rec, i + 2, &len);
dtype_read_for_order_and_null_size
(&dtype, types + i
* DATA_ORDER_NULL_TYPE_BUF_SIZE);
dtype_read_for_order_and_null_size(
&dtype, types + i
* DATA_ORDER_NULL_TYPE_BUF_SIZE);
}
if (len == UNIV_SQL_NULL) {
@ -1365,8 +1369,8 @@ ibuf_entry_build(
index tree; NOTE that the original entry
must be kept because we copy pointers to its
fields */
dict_index_t* index, /* in: non-clustered index */
dtuple_t* entry, /* in: entry for a non-clustered index */
ibool comp, /* in: flag: TRUE=compact record format */
ulint space, /* in: space id */
ulint page_no,/* in: index page number where entry should
be inserted */
@ -1430,13 +1434,12 @@ ibuf_entry_build(
dfield_set_data(field, buf, 4);
ut_ad(comp == 0 || comp == 1);
/* Store the type info in buf2, and add the fields from entry to
tuple */
buf2 = mem_heap_alloc(heap, n_fields
* DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
+ comp);
if (comp) {
+ dict_table_is_comp(index->table));
if (dict_table_is_comp(index->table)) {
*buf2++ = 0; /* write the compact format indicator */
}
for (i = 0; i < n_fields; i++) {
@ -1447,22 +1450,23 @@ ibuf_entry_build(
entry_field = dtuple_get_nth_field(entry, i);
dfield_copy(field, entry_field);
dtype_new_store_for_order_and_null_size
(buf2 + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
dfield_get_type(entry_field));
dtype_new_store_for_order_and_null_size(
buf2 + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
dfield_get_type(entry_field),
dict_index_get_nth_field(index, i)->prefix_len);
}
/* Store the type info in buf2 to field 3 of tuple */
field = dtuple_get_nth_field(tuple, 3);
if (comp) {
if (dict_table_is_comp(index->table)) {
buf2--;
}
dfield_set_data(field, buf2, n_fields
* DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
+ comp);
+ dict_table_is_comp(index->table));
/* Set all the types in the new tuple binary */
dtuple_set_types_binary(tuple, n_fields + 4);
@ -2605,8 +2609,7 @@ ibuf_insert_low(
the first fields and the type information for other fields, and which
will be inserted to the insert buffer. */
ibuf_entry = ibuf_entry_build(entry, dict_table_is_comp(index->table),
space, page_no, heap);
ibuf_entry = ibuf_entry_build(index, entry, space, page_no, heap);
/* Open a cursor to the insert buffer tree to calculate if we can add
the new entry to it without exceeding the free space limit for the
@ -2879,8 +2882,9 @@ dump:
PAGE_CUR_LE, &page_cur);
/* This time the record must fit */
if (UNIV_UNLIKELY(!page_cur_tuple_insert
(&page_cur, entry, index, mtr))) {
if (UNIV_UNLIKELY(!page_cur_tuple_insert(
&page_cur, entry, index,
mtr))) {
ut_print_timestamp(stderr);
@ -2888,10 +2892,10 @@ dump:
"InnoDB: Error: Insert buffer insert"
" fails; page free %lu,"
" dtuple size %lu\n",
(ulong) page_get_max_insert_size
(page, 1),
(ulong) rec_get_converted_size
(index, entry));
(ulong) page_get_max_insert_size(
page, 1),
(ulong) rec_get_converted_size(
index, entry));
fputs("InnoDB: Cannot insert index record ",
stderr);
dtuple_print(stderr, entry);
@ -2901,14 +2905,14 @@ dump:
" Please run CHECK TABLE on\n"
"InnoDB: that table.\n", stderr);
bitmap_page = ibuf_bitmap_get_map_page
(buf_frame_get_space_id(page),
buf_frame_get_page_no(page),
mtr);
old_bits = ibuf_bitmap_page_get_bits
(bitmap_page,
buf_frame_get_page_no(page),
IBUF_BITMAP_FREE, mtr);
bitmap_page = ibuf_bitmap_get_map_page(
buf_frame_get_space_id(page),
buf_frame_get_page_no(page),
mtr);
old_bits = ibuf_bitmap_page_get_bits(
bitmap_page,
buf_frame_get_page_no(page),
IBUF_BITMAP_FREE, mtr);
fprintf(stderr, "Bitmap bits %lu\n",
(ulong) old_bits);
@ -2996,7 +3000,7 @@ ibuf_delete_rec(
btr_pcur_commit_specify_mtr(pcur, mtr);
fputs("InnoDB: Validating insert buffer tree:\n", stderr);
if (!btr_validate_tree(ibuf_data->index->tree, NULL)) {
if (!btr_validate_index(ibuf_data->index, NULL)) {
ut_error;
}
@ -3235,12 +3239,12 @@ loop:
keep the latch to the ibuf_rec page until the
insertion is finished! */
dict_index_t* dummy_index;
dulint max_trx_id = page_get_max_trx_id
(buf_frame_align(ibuf_rec));
dulint max_trx_id = page_get_max_trx_id(
buf_frame_align(ibuf_rec));
page_update_max_trx_id(page, max_trx_id);
entry = ibuf_build_entry_from_ibuf_rec
(ibuf_rec, heap, &dummy_index);
entry = ibuf_build_entry_from_ibuf_rec(
ibuf_rec, heap, &dummy_index);
#ifdef UNIV_IBUF_DEBUG
volume += rec_get_converted_size(dummy_index, entry)
+ page_dir_calc_reserved_space(1);
@ -3283,15 +3287,15 @@ reset_bit:
ibuf_bitmap_page_set_bits(bitmap_page, page_no,
IBUF_BITMAP_BUFFERED, FALSE, &mtr);
if (page) {
ulint old_bits = ibuf_bitmap_page_get_bits
(bitmap_page, page_no, IBUF_BITMAP_FREE, &mtr);
ulint old_bits = ibuf_bitmap_page_get_bits(
bitmap_page, page_no, IBUF_BITMAP_FREE, &mtr);
ulint new_bits = ibuf_index_page_calc_free(page);
#if 0 /* defined UNIV_IBUF_DEBUG */
fprintf(stderr, "Old bits %lu new bits %lu"
" max size %lu\n",
old_bits, new_bits,
page_get_max_insert_size_after_reorganize
(page, 1));
page_get_max_insert_size_after_reorganize(
page, 1));
#endif
if (old_bits != new_bits) {
ibuf_bitmap_page_set_bits(bitmap_page, page_no,

View file

@ -52,7 +52,7 @@ page_t*
btr_root_get(
/*=========*/
/* out: root page, x-latched */
dict_tree_t* tree, /* in: index tree */
dict_index_t* index, /* in: index tree */
mtr_t* mtr); /* in: mtr */
/******************************************************************
Gets a buffer page and declares its latching order level. */
@ -255,7 +255,7 @@ that mtr holds an x-latch on the tree. */
void
btr_insert_on_non_leaf_level(
/*=========================*/
dict_tree_t* tree, /* in: tree */
dict_index_t* index, /* in: index */
ulint level, /* in: level, must be > 0 */
dtuple_t* tuple, /* in: the record to be inserted */
mtr_t* mtr); /* in: mtr */
@ -274,7 +274,7 @@ Deletes on the upper level the node pointer to a page. */
void
btr_node_ptr_delete(
/*================*/
dict_tree_t* tree, /* in: index tree */
dict_index_t* index, /* in: index tree */
page_t* page, /* in: page whose node pointer is deleted */
mtr_t* mtr); /* in: mtr */
#ifdef UNIV_DEBUG
@ -285,7 +285,7 @@ ibool
btr_check_node_ptr(
/*===============*/
/* out: TRUE */
dict_tree_t* tree, /* in: index tree */
dict_index_t* index, /* in: index tree */
page_t* page, /* in: index page */
mtr_t* mtr); /* in: mtr */
#endif /* UNIV_DEBUG */
@ -361,7 +361,7 @@ btr_page_alloc(
/*===========*/
/* out: new allocated page, x-latched;
NULL if out of space */
dict_tree_t* tree, /* in: index tree */
dict_index_t* index, /* in: index tree */
ulint hint_page_no, /* in: hint of a good page */
byte file_direction, /* in: direction where a possible
page split is made */
@ -375,7 +375,7 @@ storage pages because the page must contain info on its level. */
void
btr_page_free(
/*==========*/
dict_tree_t* tree, /* in: index tree */
dict_index_t* index, /* in: index tree */
page_t* page, /* in: page to be freed, x-latched */
mtr_t* mtr); /* in: mtr */
/******************************************************************
@ -386,7 +386,7 @@ argument. */
void
btr_page_free_low(
/*==============*/
dict_tree_t* tree, /* in: index tree */
dict_index_t* index, /* in: index tree */
page_t* page, /* in: page to be freed, x-latched */
ulint level, /* in: page level */
mtr_t* mtr); /* in: mtr */
@ -397,14 +397,14 @@ Prints size info of a B-tree. */
void
btr_print_size(
/*===========*/
dict_tree_t* tree); /* in: index tree */
dict_index_t* index); /* in: index tree */
/******************************************************************
Prints directories and other info of all nodes in the tree. */
Prints directories and other info of all nodes in the index. */
void
btr_print_tree(
/*===========*/
dict_tree_t* tree, /* in: tree */
btr_print_index(
/*============*/
dict_index_t* index, /* in: index */
ulint width); /* in: print this many entries from start
and end */
#endif /* UNIV_BTR_PRINT */
@ -425,10 +425,10 @@ btr_index_rec_validate(
Checks the consistency of an index tree. */
ibool
btr_validate_tree(
/*==============*/
btr_validate_index(
/*===============*/
/* out: TRUE if ok */
dict_tree_t* tree, /* in: tree */
dict_index_t* index, /* in: index */
trx_t* trx); /* in: transaction or NULL */
#define BTR_N_LEAF_PAGES 1

View file

@ -204,7 +204,7 @@ btr_node_ptr_get_child_page_no(
fprintf(stderr,
"InnoDB: a nonsensical page number 0"
" in a node ptr record at offset %lu\n",
(ulong) ut_align_offset(rec, UNIV_PAGE_SIZE));
(ulong) page_offset(rec));
buf_page_print(buf_frame_align(rec));
}

View file

@ -59,13 +59,13 @@ btr_cur_get_page(
/* out: pointer to page */
btr_cur_t* cursor);/* in: tree cursor */
/*************************************************************
Returns the tree of a cursor. */
Returns the index of a cursor. */
UNIV_INLINE
dict_tree_t*
btr_cur_get_tree(
/*=============*/
/* out: tree */
btr_cur_t* cursor);/* in: tree cursor */
dict_index_t*
btr_cur_get_index(
/*==============*/
/* out: index */
btr_cur_t* cursor);/* in: B-tree cursor */
/*************************************************************
Positions a tree cursor at a given record. */
UNIV_INLINE

View file

@ -56,15 +56,15 @@ btr_cur_get_page(
}
/*************************************************************
Returns the tree of a cursor. */
Returns the index of a cursor. */
UNIV_INLINE
dict_tree_t*
btr_cur_get_tree(
/*=============*/
/* out: tree */
btr_cur_t* cursor) /* in: tree cursor */
dict_index_t*
btr_cur_get_index(
/*==============*/
/* out: index */
btr_cur_t* cursor) /* in: B-tree cursor */
{
return((cursor->index)->tree);
return(cursor->index);
}
/*************************************************************
@ -109,15 +109,8 @@ btr_cur_compress_recommendation(
one page: we recommend compression if this is not the
root page. */
if (dict_tree_get_page((cursor->index)->tree)
== buf_frame_get_page_no(page)) {
/* It is the root page */
return(FALSE);
}
return(TRUE);
return(dict_index_get_page(cursor->index)
!= buf_frame_get_page_no(page));
}
return(FALSE);
@ -153,15 +146,8 @@ btr_cur_can_delete_without_compress(
one page, OR the page will become empty: we recommend
compression if this is not the root page. */
if (dict_tree_get_page((cursor->index)->tree)
== buf_frame_get_page_no(page)) {
/* It is the root page */
return(TRUE);
}
return(FALSE);
return(dict_index_get_page(cursor->index)
== buf_frame_get_page_no(page));
}
return(TRUE);

View file

@ -445,7 +445,7 @@ selects, updates, and deletes. */
struct btr_pcur_struct{
btr_cur_t btr_cur; /* a B-tree cursor */
ulint latch_mode; /* see FIXME note below!
ulint latch_mode; /* see TODO note below!
BTR_SEARCH_LEAF, BTR_MODIFY_LEAF,
BTR_MODIFY_TREE, or BTR_NO_LATCHES,
depending on the latching state of
@ -473,7 +473,7 @@ struct btr_pcur_struct{
dulint modify_clock; /* the modify clock value of the
buffer block when the cursor position
was stored */
ulint pos_state; /* see FIXME note below!
ulint pos_state; /* see TODO note below!
BTR_PCUR_IS_POSITIONED,
BTR_PCUR_WAS_POSITIONED,
BTR_PCUR_NOT_POSITIONED */
@ -495,14 +495,18 @@ struct btr_pcur_struct{
is not NULL */
};
#define BTR_PCUR_IS_POSITIONED 1997660512 /* FIXME: currently, the state
#define BTR_PCUR_IS_POSITIONED 1997660512 /* TODO: currently, the state
can be BTR_PCUR_IS_POSITIONED,
though it really should be
BTR_PCUR_WAS_POSITIONED,
because we have no obligation
to commit the cursor with
mtr; similarly latch_mode may
be out of date */
be out of date. This can
lead to problems if btr_pcur
is not used the right way;
all current code should be
ok. */
#define BTR_PCUR_WAS_POSITIONED 1187549791
#define BTR_PCUR_NOT_POSITIONED 1328997689

View file

@ -134,48 +134,34 @@ btr_search_validate(void);
/*======================*/
/* out: TRUE if ok */
/* Search info directions */
#define BTR_SEA_NO_DIRECTION 1
#define BTR_SEA_LEFT 2
#define BTR_SEA_RIGHT 3
#define BTR_SEA_SAME_REC 4
/* The search info struct in an index */
struct btr_search_struct{
ulint magic_n; /* magic number */
/* The following 4 fields are currently not used: */
rec_t* last_search; /* pointer to the lower limit record of the
previous search; NULL if not known */
ulint n_direction; /* number of consecutive searches in the
same direction */
ulint direction; /* BTR_SEA_NO_DIRECTION, BTR_SEA_LEFT,
BTR_SEA_RIGHT, BTR_SEA_SAME_REC,
or BTR_SEA_SAME_PAGE */
dulint modify_clock; /* value of modify clock at the time
last_search was stored */
/*----------------------*/
/* The following 4 fields are not protected by any latch: */
/* The following fields are not protected by any latch.
Unfortunately, this means that they must be aligned to
the machine word, i.e., they cannot be turned into bit-fields. */
page_t* root_guess; /* the root page frame when it was last time
fetched, or NULL */
ulint hash_analysis; /* when this exceeds a certain value, the
hash analysis starts; this is reset if no
ulint hash_analysis; /* when this exceeds BTR_SEARCH_HASH_ANALYSIS,
the hash analysis starts; this is reset if no
success noticed */
ibool last_hash_succ; /* TRUE if the last search would have
succeeded, or did succeed, using the hash
index; NOTE that the value here is not exact:
it is not calculated for every search, and the
calculation itself is not always accurate! */
ulint n_hash_potential;/* number of consecutive searches which would
have succeeded, or did succeed, using the hash
index */
ulint n_hash_potential;
/* number of consecutive searches
which would have succeeded, or did succeed,
using the hash index;
the range is 0 .. BTR_SEARCH_BUILD_LIMIT + 5 */
/*----------------------*/
ulint n_fields; /* recommended prefix length for hash search:
number of full fields */
ulint n_bytes; /* recommended prefix: number of bytes in
an incomplete field */
ulint side; /* BTR_SEARCH_LEFT_SIDE or
BTR_SEARCH_RIGHT_SIDE, depending on whether
an incomplete field;
cf. BTR_PAGE_MAX_REC_SIZE */
ibool left_side; /* TRUE or FALSE, depending on whether
the leftmost record of several records with
the same prefix should be indexed in the
hash index */
@ -188,10 +174,12 @@ struct btr_search_struct{
far */
ulint n_searches; /* number of searches */
#endif /* UNIV_SEARCH_PERF_STAT */
#ifdef UNIV_DEBUG
ulint magic_n; /* magic number */
# define BTR_SEARCH_MAGIC_N 1112765
#endif /* UNIV_DEBUG */
};
#define BTR_SEARCH_MAGIC_N 1112765
/* The hash index system */
typedef struct btr_search_sys_struct btr_search_sys_t;
@ -229,9 +217,6 @@ is no hope in building a hash index. */
#define BTR_SEARCH_HASH_ANALYSIS 17
#define BTR_SEARCH_LEFT_SIDE 1
#define BTR_SEARCH_RIGHT_SIDE 2
/* Limit of consecutive searches for trying a search shortcut on the search
pattern */

View file

@ -825,8 +825,7 @@ struct buf_block_struct{
search: number of full fields */
ulint n_bytes; /* recommended prefix: number of bytes
in an incomplete field */
ulint side; /* BTR_SEARCH_LEFT_SIDE or
BTR_SEARCH_RIGHT_SIDE, depending on
ibool left_side; /* TRUE or FALSE, depending on
whether the leftmost record of several
records with the same prefix should be
indexed in the hash index */
@ -851,9 +850,7 @@ struct buf_block_struct{
ulint curr_n_fields; /* prefix length for hash indexing:
number of full fields */
ulint curr_n_bytes; /* number of bytes in hash indexing */
ulint curr_side; /* BTR_SEARCH_LEFT_SIDE or
BTR_SEARCH_RIGHT_SIDE in hash
indexing */
ibool curr_left_side; /* TRUE or FALSE in hash indexing */
dict_index_t* index; /* Index for which the adaptive
hash index has been created. */
/* 6. Debug fields */

View file

@ -334,7 +334,7 @@ dtuple_set_types_binary(
for (i = 0; i < n; i++) {
dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i));
dtype_set(dfield_type, DATA_BINARY, 0, 0, 0);
dtype_set(dfield_type, DATA_BINARY, 0, 0);
}
}

View file

@ -18,10 +18,6 @@ extern ulint data_mysql_default_charset_coll;
/* SQL data type struct */
typedef struct dtype_struct dtype_t;
/* This variable is initialized as the standard binary variable length
data type */
extern dtype_t* dtype_binary;
/*-------------------------------------------*/
/* The 'MAIN TYPE' of a column */
#define DATA_VARCHAR 1 /* character varying of the
@ -124,11 +120,7 @@ be less than 256 */
#define DATA_ROLL_PTR 2 /* rollback data pointer: 7 bytes */
#define DATA_ROLL_PTR_LEN 7
#define DATA_MIX_ID 3 /* mixed index label: a dulint, stored in
a row in a compressed form */
#define DATA_MIX_ID_LEN 9 /* maximum stored length for mix id (in a
compressed dulint form) */
#define DATA_N_SYS_COLS 4 /* number of system columns defined above */
#define DATA_N_SYS_COLS 3 /* number of system columns defined above */
/* Flags ORed to the precise data type */
#define DATA_NOT_NULL 256 /* this is ORed to the precise type when
@ -176,7 +168,11 @@ dtype_get_at_most_n_mbchars(
/*========================*/
/* out: length of the prefix,
in bytes */
const dtype_t* dtype, /* in: data type */
ulint prtype, /* in: precise type */
ulint mbminlen, /* in: minimum length of a
multi-byte character */
ulint mbmaxlen, /* in: maximum length of a
multi-byte character */
ulint prefix_len, /* in: length of the requested
prefix, in characters, multiplied by
dtype_get_mbmaxlen(dtype) */
@ -224,8 +220,7 @@ dtype_set(
dtype_t* type, /* in: type struct to init */
ulint mtype, /* in: main data type */
ulint prtype, /* in: precise type */
ulint len, /* in: length of type */
ulint prec); /* in: precision of type */
ulint len); /* in: precision of type */
/*************************************************************************
Copies a data type structure. */
UNIV_INLINE
@ -233,7 +228,7 @@ void
dtype_copy(
/*=======*/
dtype_t* type1, /* in: type struct to copy to */
dtype_t* type2); /* in: type struct to copy from */
const dtype_t* type2); /* in: type struct to copy from */
/*************************************************************************
Gets the SQL main data type. */
UNIV_INLINE
@ -249,6 +244,18 @@ dtype_get_prtype(
/*=============*/
dtype_t* type);
/*************************************************************************
Compute the mbminlen and mbmaxlen members of a data type structure. */
UNIV_INLINE
void
dtype_get_mblen(
/*============*/
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type (and collation) */
ulint* mbminlen, /* out: minimum length of a
multi-byte character */
ulint* mbmaxlen); /* out: maximum length of a
multi-byte character */
/*************************************************************************
Gets the MySQL charset-collation code for MySQL string types. */
ulint
@ -280,13 +287,6 @@ dtype_get_len(
/*==========*/
dtype_t* type);
/*************************************************************************
Gets the type precision. */
UNIV_INLINE
ulint
dtype_get_prec(
/*===========*/
dtype_t* type);
/*************************************************************************
Gets the minimum length of a character, in bytes. */
UNIV_INLINE
ulint
@ -312,50 +312,52 @@ dtype_get_pad_char(
/*===============*/
/* out: padding character code, or
ULINT_UNDEFINED if no padding specified */
const dtype_t* type); /* in: type */
ulint mtype, /* in: main type */
ulint prtype); /* in: precise type */
/***************************************************************************
Returns the size of a fixed size data type, 0 if not a fixed size type. */
UNIV_INLINE
ulint
dtype_get_fixed_size(
/*=================*/
dtype_get_fixed_size_low(
/*=====================*/
/* out: fixed size, or 0 */
dtype_t* type); /* in: type */
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type */
ulint len, /* in: length */
ulint mbminlen, /* in: minimum length of a multibyte char */
ulint mbmaxlen); /* in: maximum length of a multibyte char */
/***************************************************************************
Returns the minimum size of a data type. */
UNIV_INLINE
ulint
dtype_get_min_size(
/*===============*/
dtype_get_min_size_low(
/*===================*/
/* out: minimum size */
const dtype_t* type); /* in: type */
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type */
ulint len, /* in: length */
ulint mbminlen, /* in: minimum length of a multibyte char */
ulint mbmaxlen); /* in: maximum length of a multibyte char */
/***************************************************************************
Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */
UNIV_INLINE
ulint
dtype_get_max_size(
/*===============*/
/* out: maximum size (ULINT_MAX for
unbounded types) */
const dtype_t* type); /* in: type */
dtype_get_max_size_low(
/*===================*/
/* out: maximum size */
ulint mtype, /* in: main type */
ulint len); /* in: length */
/***************************************************************************
Returns a stored SQL NULL size for a type. For fixed length types it is
the fixed length of the type, otherwise 0. */
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a type.
For fixed length types it is the fixed length of the type, otherwise 0. */
UNIV_INLINE
ulint
dtype_get_sql_null_size(
/*====================*/
/* out: SQL null storage size */
dtype_t* type); /* in: type */
/***************************************************************************
Returns TRUE if a type is of a fixed size. */
UNIV_INLINE
ibool
dtype_is_fixed_size(
/*================*/
/* out: TRUE if fixed size */
dtype_t* type); /* in: type */
/* out: SQL null storage size
in ROW_FORMAT=REDUNDANT */
const dtype_t* type); /* in: type */
/**************************************************************************
Reads to a type the stored information which determines its alphabetical
ordering and the storage size of an SQL NULL value. */
@ -376,7 +378,9 @@ dtype_new_store_for_order_and_null_size(
byte* buf, /* in: buffer for
DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
bytes where we store the info */
dtype_t* type); /* in: type struct */
dtype_t* type, /* in: type struct */
ulint prefix_len);/* in: prefix length to
replace type->len, or 0 */
/**************************************************************************
Reads to a type the stored information which determines its alphabetical
ordering and the storage size of an SQL NULL value. This is the 4.1.x storage
@ -413,25 +417,30 @@ dtype_new_read_for_order_and_null_size()
sym_tab_add_null_lit() */
struct dtype_struct{
ulint mtype; /* main data type */
ulint prtype; /* precise type; MySQL data type, charset code,
flags to indicate nullability, signedness,
whether this is a binary string, whether this
is a true VARCHAR where MySQL uses 2 bytes to
store the length */
unsigned mtype:8; /* main data type */
unsigned prtype:24; /* precise type; MySQL data
type, charset code, flags to
indicate nullability,
signedness, whether this is a
binary string, whether this is
a true VARCHAR where MySQL
uses 2 bytes to store the length */
/* the remaining fields do not affect alphabetical ordering: */
ulint len; /* length; for MySQL data this is
field->pack_length(), except that for a
>= 5.0.3 type true VARCHAR this is the
maximum byte length of the string data
(in addition to the string, MySQL uses 1 or
2 bytes to store the string length) */
ulint prec; /* precision */
unsigned len:16; /* length; for MySQL data this
is field->pack_length(),
except that for a >= 5.0.3
type true VARCHAR this is the
maximum byte length of the
string data (in addition to
the string, MySQL uses 1 or 2
bytes to store the string length) */
ulint mbminlen; /* minimum length of a character, in bytes */
ulint mbmaxlen; /* maximum length of a character, in bytes */
unsigned mbminlen:2; /* minimum length of a
character, in bytes */
unsigned mbmaxlen:3; /* maximum length of a
character, in bytes */
};
#ifndef UNIV_NONINL

View file

@ -48,33 +48,50 @@ dtype_get_mysql_type(
}
/*************************************************************************
Sets the mbminlen and mbmaxlen members of a data type structure. */
Compute the mbminlen and mbmaxlen members of a data type structure. */
UNIV_INLINE
void
dtype_get_mblen(
/*============*/
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type (and collation) */
ulint* mbminlen, /* out: minimum length of a
multi-byte character */
ulint* mbmaxlen) /* out: maximum length of a
multi-byte character */
{
if (dtype_is_string_type(mtype)) {
#ifndef UNIV_HOTBACKUP
innobase_get_cset_width(dtype_get_charset_coll(prtype),
mbminlen, mbmaxlen);
ut_ad(*mbminlen <= *mbmaxlen);
ut_ad(*mbminlen <= 2); /* cf. the bit-field in dtype_t */
ut_ad(*mbmaxlen < 1 << 3); /* cf. the bit-field in dtype_t */
#else /* !UNIV_HOTBACKUP */
ut_a(mtype <= DATA_BINARY);
*mbminlen = *mbmaxlen = 1;
#endif /* !UNIV_HOTBACKUP */
} else {
*mbminlen = *mbmaxlen = 0;
}
}
/*************************************************************************
Compute the mbminlen and mbmaxlen members of a data type structure. */
UNIV_INLINE
void
dtype_set_mblen(
/*============*/
dtype_t* type) /* in/out: type struct */
dtype_t* type) /* in/out: type */
{
ut_ad(type);
if (dtype_is_string_type(type->mtype)) {
#ifndef UNIV_HOTBACKUP
innobase_get_cset_width(dtype_get_charset_coll(type->prtype),
&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);
#endif
ut_a(type->mtype <= DATA_BINARY);
#ifdef notdefined
ut_a(type->prtype == (DATA_BINARY | DATA_NOT_NULL));
#endif
type->mbminlen = type->mbmaxlen = 1;
#endif /* !UNIV_HOTBACKUP */
} else {
type->mbminlen = type->mbmaxlen = 0;
}
ulint mbminlen;
ulint mbmaxlen;
dtype_get_mblen(type->mtype, type->prtype, &mbminlen, &mbmaxlen);
type->mbminlen = mbminlen;
type->mbmaxlen = mbmaxlen;
ut_ad(dtype_validate(type));
}
/*************************************************************************
@ -86,8 +103,7 @@ dtype_set(
dtype_t* type, /* in: type struct to init */
ulint mtype, /* in: main data type */
ulint prtype, /* in: precise type */
ulint len, /* in: length of type */
ulint prec) /* in: precision of type */
ulint len) /* in: precision of type */
{
ut_ad(type);
ut_ad(mtype <= DATA_MTYPE_MAX);
@ -95,10 +111,8 @@ dtype_set(
type->mtype = mtype;
type->prtype = prtype;
type->len = len;
type->prec = prec;
dtype_set_mblen(type);
ut_ad(dtype_validate(type));
}
/*************************************************************************
@ -108,7 +122,7 @@ void
dtype_copy(
/*=======*/
dtype_t* type1, /* in: type struct to copy to */
dtype_t* type2) /* in: type struct to copy from */
const dtype_t* type2) /* in: type struct to copy from */
{
*type1 = *type2;
@ -154,19 +168,6 @@ dtype_get_len(
return(type->len);
}
/*************************************************************************
Gets the type precision. */
UNIV_INLINE
ulint
dtype_get_prec(
/*===========*/
dtype_t* type)
{
ut_ad(type);
return(type->prec);
}
/*************************************************************************
Gets the minimum length of a character, in bytes. */
UNIV_INLINE
@ -195,19 +196,20 @@ dtype_get_mbmaxlen(
}
/*************************************************************************
Gets the padding character code for the type. */
Gets the padding character code for a type. */
UNIV_INLINE
ulint
dtype_get_pad_char(
/*===============*/
/* out: padding character code, or
ULINT_UNDEFINED if no padding specified */
const dtype_t* type) /* in: type */
ulint mtype, /* in: main type */
ulint prtype) /* in: precise type */
{
switch (type->mtype) {
switch (mtype) {
case DATA_FIXBINARY:
case DATA_BINARY:
if (UNIV_UNLIKELY(dtype_get_charset_coll(type->prtype)
if (UNIV_UNLIKELY(dtype_get_charset_coll(prtype)
== DATA_MYSQL_BINARY_CHARSET_COLL)) {
/* Starting from 5.0.18, do not pad
VARBINARY or BINARY columns. */
@ -223,7 +225,7 @@ dtype_get_pad_char(
return(0x20);
case DATA_BLOB:
if ((type->prtype & DATA_BINARY_TYPE) == 0) {
if (!(prtype & DATA_BINARY_TYPE)) {
return(0x20);
}
/* Fall through */
@ -244,11 +246,14 @@ dtype_new_store_for_order_and_null_size(
byte* buf, /* in: buffer for
DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
bytes where we store the info */
dtype_t* type) /* in: type struct */
dtype_t* type, /* in: type struct */
ulint prefix_len)/* in: prefix length to
replace type->len, or 0 */
{
#if 6 != DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
#error "6 != DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE"
#endif
ulint len;
buf[0] = (byte)(type->mtype & 0xFFUL);
@ -263,7 +268,9 @@ dtype_new_store_for_order_and_null_size(
buf[1] = (byte)(type->prtype & 0xFFUL);
mach_write_to_2(buf + 2, type->len & 0xFFFFUL);
len = prefix_len ? prefix_len : type->len;
mach_write_to_2(buf + 2, len & 0xFFFFUL);
ut_ad(dtype_get_charset_coll(type->prtype) < 256);
mach_write_to_2(buf + 4, dtype_get_charset_coll(type->prtype));
@ -284,7 +291,9 @@ dtype_read_for_order_and_null_size(
dtype_t* type, /* in: type struct */
byte* buf) /* in: buffer for stored type order info */
{
ut_ad(4 == DATA_ORDER_NULL_TYPE_BUF_SIZE);
#if 4 != DATA_ORDER_NULL_TYPE_BUF_SIZE
# error "4 != DATA_ORDER_NULL_TYPE_BUF_SIZE"
#endif
type->mtype = buf[0] & 63;
type->prtype = buf[1];
@ -356,34 +365,31 @@ dtype_new_read_for_order_and_null_size(
Returns the size of a fixed size data type, 0 if not a fixed size type. */
UNIV_INLINE
ulint
dtype_get_fixed_size(
/*=================*/
dtype_get_fixed_size_low(
/*=====================*/
/* out: fixed size, or 0 */
dtype_t* type) /* in: type */
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type */
ulint len, /* in: length */
ulint mbminlen, /* in: minimum length of a multibyte char */
ulint mbmaxlen) /* in: maximum length of a multibyte char */
{
ulint mtype;
mtype = dtype_get_mtype(type);
switch (mtype) {
case DATA_SYS:
#ifdef UNIV_DEBUG
switch (type->prtype & DATA_MYSQL_TYPE_MASK) {
switch (prtype & DATA_MYSQL_TYPE_MASK) {
case DATA_ROW_ID:
ut_ad(len == DATA_ROW_ID_LEN);
break;
case DATA_TRX_ID:
ut_ad(len == DATA_TRX_ID_LEN);
break;
case DATA_ROLL_PTR:
ut_ad(len == DATA_ROLL_PTR_LEN);
break;
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:
@ -391,32 +397,32 @@ dtype_get_fixed_size(
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
return(dtype_get_len(type));
return(len);
case DATA_MYSQL:
if (type->prtype & DATA_BINARY_TYPE) {
return(dtype_get_len(type));
if (prtype & DATA_BINARY_TYPE) {
return(len);
} else {
#ifdef UNIV_HOTBACKUP
if (type->mbminlen == type->mbmaxlen) {
return(dtype_get_len(type));
if (mbminlen == mbmaxlen) {
return(len);
}
#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
mbminlen and mbmaxlen are
initialized if and only if 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;
ulint i_mbminlen, i_mbmaxlen;
innobase_get_cset_width
(dtype_get_charset_coll(type->prtype),
&mbminlen, &mbmaxlen);
innobase_get_cset_width(
dtype_get_charset_coll(prtype),
&i_mbminlen, &i_mbmaxlen);
if (UNIV_UNLIKELY(type->mbminlen != mbminlen)
|| UNIV_UNLIKELY(type->mbmaxlen != mbmaxlen)) {
if (UNIV_UNLIKELY(mbminlen != i_mbminlen)
|| UNIV_UNLIKELY(mbmaxlen != i_mbmaxlen)) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: "
@ -424,13 +430,13 @@ dtype_get_fixed_size(
"mbmaxlen=%lu, "
"type->mbminlen=%lu, "
"type->mbmaxlen=%lu\n",
(ulong) i_mbminlen,
(ulong) i_mbmaxlen,
(ulong) mbminlen,
(ulong) mbmaxlen,
(ulong) type->mbminlen,
(ulong) type->mbmaxlen);
(ulong) mbmaxlen);
}
if (mbminlen == mbmaxlen) {
return(dtype_get_len(type));
return(len);
}
#endif /* !UNIV_HOTBACKUP */
}
@ -452,30 +458,31 @@ dtype_get_fixed_size(
Returns the minimum size of a data type. */
UNIV_INLINE
ulint
dtype_get_min_size(
/*===============*/
dtype_get_min_size_low(
/*===================*/
/* out: minimum size */
const dtype_t* type) /* in: type */
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type */
ulint len, /* in: length */
ulint mbminlen, /* in: minimum length of a multibyte char */
ulint mbmaxlen) /* in: maximum length of a multibyte char */
{
switch (type->mtype) {
switch (mtype) {
case DATA_SYS:
#ifdef UNIV_DEBUG
switch (type->prtype & DATA_MYSQL_TYPE_MASK) {
switch (prtype & DATA_MYSQL_TYPE_MASK) {
case DATA_ROW_ID:
ut_ad(len == DATA_ROW_ID_LEN);
break;
case DATA_TRX_ID:
ut_ad(len == DATA_TRX_ID_LEN);
break;
case DATA_ROLL_PTR:
ut_ad(len == DATA_ROLL_PTR_LEN);
break;
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:
@ -483,58 +490,73 @@ dtype_get_min_size(
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
return(type->len);
return(len);
case DATA_MYSQL:
if ((type->prtype & DATA_BINARY_TYPE)
|| type->mbminlen == type->mbmaxlen) {
return(type->len);
if ((prtype & DATA_BINARY_TYPE) || mbminlen == mbmaxlen) {
return(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);
ut_a(mbminlen > 0);
ut_a(mbmaxlen > mbminlen);
ut_a(len % mbmaxlen == 0);
return(len * mbminlen / mbmaxlen);
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
case DATA_BLOB:
return(0);
default: ut_error;
default:
ut_error;
}
return(0);
}
/***************************************************************************
Returns a stored SQL NULL size for a type. For fixed length types it is
the fixed length of the type, otherwise 0. */
Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */
UNIV_INLINE
ulint
dtype_get_max_size_low(
/*===================*/
/* out: maximum size */
ulint mtype, /* in: main type */
ulint len) /* in: length */
{
switch (mtype) {
case DATA_SYS:
case DATA_CHAR:
case DATA_FIXBINARY:
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
case DATA_MYSQL:
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
return(len);
case DATA_BLOB:
break;
default:
ut_error;
}
return(ULINT_MAX);
}
/***************************************************************************
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a type.
For fixed length types it is the fixed length of the type, otherwise 0. */
UNIV_INLINE
ulint
dtype_get_sql_null_size(
/*====================*/
/* out: SQL null storage size */
dtype_t* type) /* in: type */
/* out: SQL null storage size
in ROW_FORMAT=REDUNDANT */
const dtype_t* type) /* in: type */
{
return(dtype_get_fixed_size(type));
}
/***************************************************************************
Returns TRUE if a type is of a fixed size. */
UNIV_INLINE
ibool
dtype_is_fixed_size(
/*================*/
/* out: TRUE if fixed size */
dtype_t* type) /* in: type */
{
ulint size;
size = dtype_get_fixed_size(type);
if (size) {
return(TRUE);
}
return(FALSE);
return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len,
type->mbminlen, type->mbmaxlen) > 0);
}

View file

@ -103,7 +103,7 @@ dict_create(void);
#define DICT_HDR_ROW_ID 0 /* The latest assigned row id */
#define DICT_HDR_TABLE_ID 8 /* The latest assigned table id */
#define DICT_HDR_INDEX_ID 16 /* The latest assigned index id */
#define DICT_HDR_MIX_ID 24 /* The latest assigned mix id */
#define DICT_HDR_MIX_ID 24 /* Obsolete, always 0. */
#define DICT_HDR_TABLES 32 /* Root of the table index tree */
#define DICT_HDR_TABLE_IDS 36 /* Root of the table index tree */
#define DICT_HDR_COLUMNS 40 /* Root of the column index tree */

View file

@ -79,24 +79,77 @@ dict_load_space_id_list(void);
/*************************************************************************
Gets the column data type. */
UNIV_INLINE
dtype_t*
dict_col_get_type(
/*==============*/
dict_col_t* col);
void
dict_col_copy_type(
/*===============*/
const dict_col_t* col, /* in: column */
dtype_t* type); /* out: data type */
/*************************************************************************
Gets the column data type. */
void
dict_col_copy_type_noninline(
/*=========================*/
const dict_col_t* col, /* in: column */
dtype_t* type); /* out: data type */
/***************************************************************************
Returns the minimum size of the column. */
UNIV_INLINE
ulint
dict_col_get_min_size(
/*==================*/
/* out: minimum size */
const dict_col_t* col); /* in: column */
/***************************************************************************
Returns the maximum size of the column. */
UNIV_INLINE
ulint
dict_col_get_max_size(
/*==================*/
/* out: maximum size */
const dict_col_t* col); /* in: column */
/***************************************************************************
Returns the size of a fixed size column, 0 if not a fixed size column. */
UNIV_INLINE
ulint
dict_col_get_fixed_size(
/*====================*/
/* out: fixed size, or 0 */
const dict_col_t* col); /* in: column */
/***************************************************************************
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column.
For fixed length types it is the fixed length of the type, otherwise 0. */
UNIV_INLINE
ulint
dict_col_get_sql_null_size(
/*=======================*/
/* out: SQL null storage size
in ROW_FORMAT=REDUNDANT */
const dict_col_t* col); /* in: column */
/*************************************************************************
Gets the column number. */
UNIV_INLINE
ulint
dict_col_get_no(
/*============*/
dict_col_t* col);
const dict_col_t* col);
/*************************************************************************
Gets the column position in the clustered index. */
UNIV_INLINE
ulint
dict_col_get_clust_pos(
/*===================*/
dict_col_t* col);
const dict_col_t* col, /* in: table column */
const dict_index_t* clust_index); /* in: clustered index */
/*************************************************************************
Gets the column position in the clustered index. */
ulint
dict_col_get_clust_pos_noninline(
/*=============================*/
const dict_col_t* col, /* in: table column */
const dict_index_t* clust_index); /* in: clustered index */
/********************************************************************
If the given column name is reserved for InnoDB system columns, return
TRUE. */
@ -354,6 +407,19 @@ dict_table_get_index_noninline(
dict_table_t* table, /* in: table */
const char* name); /* in: index name */
/**************************************************************************
Returns a column's name. */
const char*
dict_table_get_col_name(
/*====================*/
/* out: column name. NOTE: not
guaranteed to stay valid if table is
modified in any way (columns added,
etc.). */
const dict_table_t* table, /* in: table */
ulint col_nr);/* in: column number */
/**************************************************************************
Prints a table definition. */
void
@ -468,30 +534,30 @@ dict_table_get_n_cols(
/************************************************************************
Gets the nth column of a table. */
UNIV_INLINE
dict_col_t*
const dict_col_t*
dict_table_get_nth_col(
/*===================*/
/* out: pointer to column object */
dict_table_t* table, /* in: table */
ulint pos); /* in: position of column */
/* out: pointer to column object */
const dict_table_t* table, /* in: table */
ulint pos); /* in: position of column */
/************************************************************************
Gets the nth column of a table. */
dict_col_t*
const dict_col_t*
dict_table_get_nth_col_noninline(
/*=============================*/
/* out: pointer to column object */
dict_table_t* table, /* in: table */
ulint pos); /* in: position of column */
/* out: pointer to column object */
const dict_table_t* table, /* in: table */
ulint pos); /* in: position of column */
/************************************************************************
Gets the given system column of a table. */
UNIV_INLINE
dict_col_t*
const dict_col_t*
dict_table_get_sys_col(
/*===================*/
/* out: pointer to column object */
dict_table_t* table, /* in: table */
ulint sys); /* in: DATA_ROW_ID, ... */
/* out: pointer to column object */
const dict_table_t* table, /* in: table */
ulint sys); /* in: DATA_ROW_ID, ... */
/************************************************************************
Gets the given system column number of a table. */
UNIV_INLINE
@ -549,12 +615,11 @@ dict_index_find_on_id_low(
/* out: index or NULL if not found from cache */
dulint id); /* in: index id */
/**************************************************************************
Adds an index to dictionary cache. */
Adds an index to the dictionary cache. */
ibool
void
dict_index_add_to_cache(
/*====================*/
/* out: TRUE if success */
dict_table_t* table, /* in: table on which the index is */
dict_index_t* index, /* in, own: index; NOTE! The index memory
object is freed in this function! */
@ -614,23 +679,23 @@ dict_index_get_nth_field(
dict_index_t* index, /* in: index */
ulint pos); /* in: position of field */
/************************************************************************
Gets pointer to the nth field data type in an index. */
Gets pointer to the nth column in an index. */
UNIV_INLINE
dtype_t*
dict_index_get_nth_type(
/*====================*/
/* out: data type */
dict_index_t* index, /* in: index */
ulint pos); /* in: position of the field */
const dict_col_t*
dict_index_get_nth_col(
/*===================*/
/* out: column */
const dict_index_t* index, /* in: index */
ulint pos); /* in: position of the field */
/************************************************************************
Gets the column number of the nth field in an index. */
UNIV_INLINE
ulint
dict_index_get_nth_col_no(
/*======================*/
/* out: column number */
dict_index_t* index, /* in: index */
ulint pos); /* in: position of the field */
/* out: column number */
const dict_index_t* index, /* in: index */
ulint pos); /* in: position of the field */
/************************************************************************
Looks for column n in an index. */
@ -694,6 +759,7 @@ void
dict_index_add_col(
/*===============*/
dict_index_t* index, /* in: index */
dict_table_t* table, /* in: table */
dict_col_t* col, /* in: column */
ulint prefix_len); /* in: column prefix length */
/***********************************************************************
@ -706,38 +772,12 @@ dict_index_copy_types(
dict_index_t* index, /* in: index */
ulint n_fields); /* in: number of field types to copy */
/*************************************************************************
Gets the index tree where the index is stored. */
UNIV_INLINE
dict_tree_t*
dict_index_get_tree(
/*================*/
/* out: index tree */
dict_index_t* index); /* in: index */
/*************************************************************************
Gets the field column. */
UNIV_INLINE
dict_col_t*
const dict_col_t*
dict_field_get_col(
/*===============*/
dict_field_t* field);
/**************************************************************************
Creates an index tree struct. */
dict_tree_t*
dict_tree_create(
/*=============*/
/* out, own: created tree */
dict_index_t* index, /* in: the index for which to create: in the
case of a mixed tree, this should be the
index of the cluster object */
ulint page_no);/* in: root page number of the index */
/**************************************************************************
Frees an index tree struct. */
void
dict_tree_free(
/*===========*/
dict_tree_t* tree); /* in, own: index tree */
const dict_field_t* field);
/**************************************************************************
In an index tree, finds the index corresponding to a record in the tree. */
@ -755,20 +795,20 @@ Checks that a tuple has n_fields_cmp value in a sensible range, so that
no comparison can occur with the page number field in a node pointer. */
ibool
dict_tree_check_search_tuple(
/*=========================*/
dict_index_check_search_tuple(
/*==========================*/
/* out: TRUE if ok */
dict_tree_t* tree, /* in: index tree */
dict_index_t* index, /* in: index */
dtuple_t* tuple); /* in: tuple used in a search */
#endif /* UNIV_DEBUG */
/**************************************************************************
Builds a node pointer out of a physical record and a page number. */
dtuple_t*
dict_tree_build_node_ptr(
/*=====================*/
dict_index_build_node_ptr(
/*======================*/
/* out, own: node pointer */
dict_tree_t* tree, /* in: index tree */
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record for which to build node
pointer */
ulint page_no,/* in: page number to put in node pointer */
@ -780,10 +820,10 @@ Copies an initial segment of a physical record, long enough to specify an
index entry uniquely. */
rec_t*
dict_tree_copy_rec_order_prefix(
/*============================*/
dict_index_copy_rec_order_prefix(
/*=============================*/
/* out: pointer to the prefix record */
dict_tree_t* tree, /* in: index tree */
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record for which to copy prefix */
ulint* n_fields,/* out: number of fields copied */
byte** buf, /* in/out: memory buffer for the copied prefix,
@ -793,10 +833,10 @@ dict_tree_copy_rec_order_prefix(
Builds a typed data tuple out of a physical record. */
dtuple_t*
dict_tree_build_data_tuple(
/*=======================*/
dict_index_build_data_tuple(
/*========================*/
/* out, own: data tuple */
dict_tree_t* tree, /* in: index tree */
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record for which to build data tuple */
ulint n_fields,/* in: number of data fields */
mem_heap_t* heap); /* in: memory heap where tuple created */
@ -804,61 +844,60 @@ dict_tree_build_data_tuple(
Gets the space id of the root of the index tree. */
UNIV_INLINE
ulint
dict_tree_get_space(
/*================*/
dict_index_get_space(
/*=================*/
/* out: space id */
dict_tree_t* tree); /* in: tree */
dict_index_t* index); /* in: index */
/*************************************************************************
Sets the space id of the root of the index tree. */
UNIV_INLINE
void
dict_tree_set_space(
/*================*/
dict_tree_t* tree, /* in: tree */
dict_index_set_space(
/*=================*/
dict_index_t* index, /* in: index */
ulint space); /* in: space id */
/*************************************************************************
Gets the page number of the root of the index tree. */
UNIV_INLINE
ulint
dict_tree_get_page(
/*===============*/
dict_index_get_page(
/*================*/
/* out: page number */
dict_tree_t* tree); /* in: tree */
dict_index_t* tree); /* in: index */
/*************************************************************************
Sets the page number of the root of index tree. */
UNIV_INLINE
void
dict_tree_set_page(
/*===============*/
dict_tree_t* tree, /* in: tree */
dict_index_set_page(
/*================*/
dict_index_t* index, /* in: index */
ulint page); /* in: page number */
/*************************************************************************
Gets the type of the index tree. */
UNIV_INLINE
ulint
dict_tree_get_type(
/*===============*/
dict_index_get_type(
/*================*/
/* out: type */
dict_tree_t* tree); /* in: tree */
dict_index_t* index); /* in: index */
/*************************************************************************
Gets the read-write lock of the index tree. */
UNIV_INLINE
rw_lock_t*
dict_tree_get_lock(
/*===============*/
dict_index_get_lock(
/*================*/
/* out: read-write lock */
dict_tree_t* tree); /* in: tree */
dict_index_t* index); /* in: index */
/************************************************************************
Returns free space reserved for future updates of records. This is
relevant only in the case of many consecutive inserts, as updates
which make the records bigger might fragment the index. */
UNIV_INLINE
ulint
dict_tree_get_space_reserve(
/*========================*/
dict_index_get_space_reserve(void);
/*==============================*/
/* out: number of free bytes on page,
reserved for updates */
dict_tree_t* tree); /* in: a tree */
/*************************************************************************
Calculates the minimum record length in an index. */
@ -945,7 +984,6 @@ struct dict_sys_struct{
on name */
hash_table_t* table_id_hash; /* hash table of the tables, based
on id */
hash_table_t* col_hash; /* hash table of the columns */
UT_LIST_BASE_NODE_T(dict_table_t)
table_LRU; /* LRU list of tables */
ulint size; /* varying space in bytes occupied

View file

@ -9,18 +9,74 @@ Created 1/8/1996 Heikki Tuuri
#include "dict0load.h"
#include "trx0undo.h"
#include "trx0sys.h"
#include "rem0types.h"
#include "data0type.h"
/*************************************************************************
Gets the column data type. */
UNIV_INLINE
dtype_t*
dict_col_get_type(
/*==============*/
dict_col_t* col)
void
dict_col_copy_type(
/*===============*/
const dict_col_t* col, /* in: column */
dtype_t* type) /* out: data type */
{
ut_ad(col);
ut_ad(col && type);
return(&col->type);
type->mtype = col->mtype;
type->prtype = col->prtype;
type->len = col->len;
type->mbminlen = col->mbminlen;
type->mbmaxlen = col->mbmaxlen;
}
/***************************************************************************
Returns the minimum size of the column. */
UNIV_INLINE
ulint
dict_col_get_min_size(
/*==================*/
/* out: minimum size */
const dict_col_t* col) /* in: column */
{
return(dtype_get_min_size_low(col->mtype, col->prtype, col->len,
col->mbminlen, col->mbmaxlen));
}
/***************************************************************************
Returns the maximum size of the column. */
UNIV_INLINE
ulint
dict_col_get_max_size(
/*==================*/
/* out: maximum size */
const dict_col_t* col) /* in: column */
{
return(dtype_get_max_size_low(col->mtype, col->len));
}
/***************************************************************************
Returns the size of a fixed size column, 0 if not a fixed size column. */
UNIV_INLINE
ulint
dict_col_get_fixed_size(
/*====================*/
/* out: fixed size, or 0 */
const dict_col_t* col) /* in: column */
{
return(dtype_get_fixed_size_low(col->mtype, col->prtype, col->len,
col->mbminlen, col->mbmaxlen));
}
/***************************************************************************
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column.
For fixed length types it is the fixed length of the type, otherwise 0. */
UNIV_INLINE
ulint
dict_col_get_sql_null_size(
/*=======================*/
/* out: SQL null storage size
in ROW_FORMAT=REDUNDANT */
const dict_col_t* col) /* in: column */
{
return(dict_col_get_fixed_size(col));
}
/*************************************************************************
@ -29,7 +85,7 @@ UNIV_INLINE
ulint
dict_col_get_no(
/*============*/
dict_col_t* col)
const dict_col_t* col)
{
ut_ad(col);
@ -42,11 +98,23 @@ UNIV_INLINE
ulint
dict_col_get_clust_pos(
/*===================*/
dict_col_t* col)
const dict_col_t* col, /* in: table column */
const dict_index_t* clust_index) /* in: clustered index */
{
ut_ad(col);
ulint i;
return(col->clust_pos);
ut_ad(col);
ut_ad(clust_index && clust_index->type & DICT_CLUSTERED);
for (i = 0; i < clust_index->n_def; i++) {
const dict_field_t* field = &clust_index->fields[i];
if (!field->prefix_len && field->col == col) {
return(i);
}
}
return(ULINT_UNDEFINED);
}
/************************************************************************
@ -132,12 +200,12 @@ dict_table_get_n_cols(
/************************************************************************
Gets the nth column of a table. */
UNIV_INLINE
dict_col_t*
const dict_col_t*
dict_table_get_nth_col(
/*===================*/
/* out: pointer to column object */
dict_table_t* table, /* in: table */
ulint pos) /* in: position of column */
/* out: pointer to column object */
const dict_table_t* table, /* in: table */
ulint pos) /* in: position of column */
{
ut_ad(table);
ut_ad(pos < table->n_def);
@ -149,14 +217,14 @@ dict_table_get_nth_col(
/************************************************************************
Gets the given system column of a table. */
UNIV_INLINE
dict_col_t*
const dict_col_t*
dict_table_get_sys_col(
/*===================*/
/* out: pointer to column object */
dict_table_t* table, /* in: table */
ulint sys) /* in: DATA_ROW_ID, ... */
/* out: pointer to column object */
const dict_table_t* table, /* in: table */
ulint sys) /* in: DATA_ROW_ID, ... */
{
dict_col_t* col;
const dict_col_t* col;
ut_ad(table);
ut_ad(sys < DATA_N_SYS_COLS);
@ -164,8 +232,8 @@ dict_table_get_sys_col(
col = dict_table_get_nth_col(table, table->n_cols
- DATA_N_SYS_COLS + sys);
ut_ad(col->type.mtype == DATA_SYS);
ut_ad(col->type.prtype == (sys | DATA_NOT_NULL));
ut_ad(col->mtype == DATA_SYS);
ut_ad(col->prtype == (sys | DATA_NOT_NULL));
return(col);
}
@ -311,45 +379,28 @@ dict_index_get_sys_col_pos(
dict_index_t* index, /* in: index */
ulint type) /* in: DATA_ROW_ID, ... */
{
dict_col_t* col;
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
ut_ad(!(index->type & DICT_UNIVERSAL));
col = dict_table_get_sys_col(index->table, type);
if (index->type & DICT_CLUSTERED) {
return(col->clust_pos);
return(dict_col_get_clust_pos(
dict_table_get_sys_col(index->table, type),
index));
}
return(dict_index_get_nth_col_pos
(index, dict_table_get_sys_col_no(index->table, type)));
}
/*************************************************************************
Gets the index tree where the index is stored. */
UNIV_INLINE
dict_tree_t*
dict_index_get_tree(
/*================*/
/* out: index tree */
dict_index_t* index) /* in: index */
{
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(index->tree);
return(dict_index_get_nth_col_pos(
index, dict_table_get_sys_col_no(index->table, type)));
}
/*************************************************************************
Gets the field column. */
UNIV_INLINE
dict_col_t*
const dict_col_t*
dict_field_get_col(
/*===============*/
dict_field_t* field)
const dict_field_t* field)
{
ut_ad(field);
@ -357,17 +408,17 @@ dict_field_get_col(
}
/************************************************************************
Gets pointer to the nth field data type in an index. */
Gets pointer to the nth column in an index. */
UNIV_INLINE
dtype_t*
dict_index_get_nth_type(
/*====================*/
/* out: data type */
dict_index_t* index, /* in: index */
ulint pos) /* in: position of the field */
const dict_col_t*
dict_index_get_nth_col(
/*===================*/
/* out: column */
const 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_field_get_col(dict_index_get_nth_field((dict_index_t*)
index, pos)));
}
/************************************************************************
@ -376,102 +427,101 @@ UNIV_INLINE
ulint
dict_index_get_nth_col_no(
/*======================*/
/* out: column number */
dict_index_t* index, /* in: index */
ulint pos) /* in: position of the field */
/* out: column number */
const 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_index_get_nth_col(index, pos)));
}
/*************************************************************************
Gets the space id of the root of the index tree. */
UNIV_INLINE
ulint
dict_tree_get_space(
/*================*/
dict_index_get_space(
/*=================*/
/* out: space id */
dict_tree_t* tree) /* in: tree */
dict_index_t* index) /* in: index */
{
ut_ad(tree);
ut_ad(tree->magic_n == DICT_TREE_MAGIC_N);
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(tree->space);
return(index->space);
}
/*************************************************************************
Sets the space id of the root of the index tree. */
UNIV_INLINE
void
dict_tree_set_space(
/*================*/
dict_tree_t* tree, /* in: tree */
dict_index_set_space(
/*=================*/
dict_index_t* index, /* in: index */
ulint space) /* in: space id */
{
ut_ad(tree);
ut_ad(tree->magic_n == DICT_TREE_MAGIC_N);
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
tree->space = space;
index->space = space;
}
/*************************************************************************
Gets the page number of the root of the index tree. */
UNIV_INLINE
ulint
dict_tree_get_page(
/*===============*/
dict_index_get_page(
/*================*/
/* out: page number */
dict_tree_t* tree) /* in: tree */
dict_index_t* index) /* in: index */
{
ut_ad(tree);
ut_ad(tree->magic_n == DICT_TREE_MAGIC_N);
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(tree->page);
return(index->page);
}
/*************************************************************************
Sets the page number of the root of index tree. */
UNIV_INLINE
void
dict_tree_set_page(
/*===============*/
dict_tree_t* tree, /* in: tree */
dict_index_set_page(
/*================*/
dict_index_t* index, /* in: index */
ulint page) /* in: page number */
{
ut_ad(tree);
ut_ad(tree->magic_n == DICT_TREE_MAGIC_N);
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
tree->page = page;
index->page = page;
}
/*************************************************************************
Gets the type of the index tree. */
UNIV_INLINE
ulint
dict_tree_get_type(
/*===============*/
dict_index_get_type(
/*================*/
/* out: type */
dict_tree_t* tree) /* in: tree */
dict_index_t* index) /* in: index */
{
ut_ad(tree);
ut_ad(tree->magic_n == DICT_TREE_MAGIC_N);
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(tree->type);
return(index->type);
}
/*************************************************************************
Gets the read-write lock of the index tree. */
UNIV_INLINE
rw_lock_t*
dict_tree_get_lock(
/*===============*/
dict_index_get_lock(
/*================*/
/* out: read-write lock */
dict_tree_t* tree) /* in: tree */
dict_index_t* index) /* in: index */
{
ut_ad(tree);
ut_ad(tree->magic_n == DICT_TREE_MAGIC_N);
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(&(tree->lock));
return(&(index->lock));
}
/************************************************************************
@ -480,16 +530,11 @@ relevant only in the case of many consecutive inserts, as updates
which make the records bigger might fragment the index. */
UNIV_INLINE
ulint
dict_tree_get_space_reserve(
/*========================*/
dict_index_get_space_reserve(void)
/*==============================*/
/* out: number of free bytes on page,
reserved for updates */
dict_tree_t* tree) /* in: a tree */
{
ut_ad(tree);
UT_NOT_USED(tree);
return(UNIV_PAGE_SIZE / 16);
}

View file

@ -75,8 +75,7 @@ dict_mem_table_add_col(
const char* name, /* in: column name */
ulint mtype, /* in: main datatype */
ulint prtype, /* in: precise type */
ulint len, /* in: length */
ulint prec); /* in: precision */
ulint len); /* in: precision */
/**************************************************************************
Creates an index memory object. */
@ -122,16 +121,41 @@ dict_mem_foreign_create(void);
/* Data structure for a column in a table */
struct dict_col_struct{
hash_node_t hash; /* hash chain node */
ulint ind; /* table column position (they are numbered
starting from 0) */
ulint clust_pos;/* position of the column in the
clustered index */
ulint ord_part;/* count of how many times this column
appears in ordering fields of an index */
const char* name; /* name */
dtype_t type; /* data type */
dict_table_t* table; /* back pointer to table of this column */
/*----------------------*/
/* The following are copied from dtype_t,
so that all bit-fields can be packed tightly. */
unsigned mtype:8; /* main data type */
unsigned prtype:24; /* precise type; MySQL data
type, charset code, flags to
indicate nullability,
signedness, whether this is a
binary string, whether this is
a true VARCHAR where MySQL
uses 2 bytes to store the length */
/* the remaining fields do not affect alphabetical ordering: */
unsigned len:16; /* length; for MySQL data this
is field->pack_length(),
except that for a >= 5.0.3
type true VARCHAR this is the
maximum byte length of the
string data (in addition to
the string, MySQL uses 1 or 2
bytes to store the string length) */
unsigned mbminlen:2; /* minimum length of a
character, in bytes */
unsigned mbmaxlen:3; /* maximum length of a
character, in bytes */
/*----------------------*/
/* End of definitions copied from dtype_t */
unsigned ind:10; /* table column position
(starting from 0) */
unsigned ord_part:1; /* nonzero if this column
appears in the ordering fields
of an index */
};
/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the max index column
@ -145,35 +169,18 @@ UTF-8 charset. In that charset, a character may take at most 3 bytes. */
struct dict_field_struct{
dict_col_t* col; /* pointer to the table column */
const char* name; /* name of the column */
ulint prefix_len; /* 0 or the length of the column
unsigned prefix_len:10; /* 0 or the length of the column
prefix in bytes in a MySQL index of
type, e.g., INDEX (textcol(25));
must be smaller than
DICT_MAX_INDEX_COL_LEN; NOTE that
in the UTF-8 charset, MySQL sets this
to 3 * the prefix len in UTF-8 chars */
ulint fixed_len; /* 0 or the fixed length of the
unsigned fixed_len:10; /* 0 or the fixed length of the
column if smaller than
DICT_MAX_INDEX_COL_LEN */
};
/* Data structure for an index tree */
struct dict_tree_struct{
ulint type; /* tree type */
dulint id; /* id of the index stored in the tree */
ulint space; /* space of index tree */
ulint page; /* index tree root page number */
byte pad[64];/* Padding to prevent other memory hotspots on
the same memory cache line */
rw_lock_t lock; /* read-write lock protecting the upper levels
of the index tree */
dict_index_t* tree_index; /* the index stored in the
index tree */
ulint magic_n;/* magic number */
};
#define DICT_TREE_MAGIC_N 7545676
/* Data structure for an index */
struct dict_index_struct{
dulint id; /* id of the index */
@ -182,30 +189,28 @@ struct dict_index_struct{
const char* name; /* index name */
const char* table_name; /* table name */
dict_table_t* table; /* back pointer to table */
ulint space; /* space where the index tree is placed */
ulint trx_id_offset;/* position of the the trx id column
unsigned space:32;
/* space where the index tree is placed */
unsigned page:32;/* index tree root page number */
unsigned trx_id_offset:10;/* position of the the trx id column
in a clustered index record, if the fields
before it are known to be of a fixed size,
0 otherwise */
ulint n_user_defined_cols;
unsigned n_user_defined_cols:10;
/* number of columns the user defined to
be in the index: in the internal
representation we add more columns */
ulint n_uniq; /* number of fields from the beginning
unsigned n_uniq:10;/* number of fields from the beginning
which are enough to determine an index
entry uniquely */
ulint n_def; /* number of fields defined so far */
ulint n_fields;/* number of fields in the index */
unsigned n_def:10;/* number of fields defined so far */
unsigned n_fields:10;/* number of fields in the index */
unsigned n_nullable:10;/* number of nullable fields */
unsigned cached:1;/* TRUE if the index object is in the
dictionary cache */
dict_field_t* fields; /* array of field descriptions */
ulint n_nullable;/* number of nullable fields */
UT_LIST_NODE_T(dict_index_t)
indexes;/* list of indexes of the table */
dict_tree_t* tree; /* index tree struct */
UT_LIST_NODE_T(dict_index_t)
tree_indexes; /* list of indexes of the same index
tree */
ibool cached; /* TRUE if the index object is in the
dictionary cache */
btr_search_t* search_info; /* info used in optimistic searches */
/*----------------------*/
ib_longlong* stat_n_diff_key_vals;
@ -218,7 +223,12 @@ struct dict_index_struct{
ulint stat_n_leaf_pages;
/* approximate number of leaf pages in the
index tree */
rw_lock_t lock; /* read-write lock protecting the upper levels
of the index tree */
#ifdef UNIV_DEBUG
ulint magic_n;/* magic number */
# define DICT_INDEX_MAGIC_N 76789786
#endif
};
/* Data structure for a foreign key constraint; an example:
@ -229,7 +239,13 @@ struct dict_foreign_struct{
this memory heap */
char* id; /* id of the constraint as a
null-terminated string */
ulint type; /* 0 or DICT_FOREIGN_ON_DELETE_CASCADE
unsigned n_fields:10; /* number of indexes' first fields
for which the the foreign key
constraint is defined: we allow the
indexes to contain more fields than
mentioned in the constraint, as long
as the first fields are as mentioned */
unsigned type:6; /* 0 or DICT_FOREIGN_ON_DELETE_CASCADE
or DICT_FOREIGN_ON_DELETE_SET_NULL */
char* foreign_table_name;/* foreign table name */
dict_table_t* foreign_table; /* table where the foreign key is */
@ -240,12 +256,6 @@ struct dict_foreign_struct{
is */
const char** referenced_col_names;/* names of the referenced
columns in the referenced table */
ulint n_fields; /* number of indexes' first fields
for which the the foreign key
constraint is defined: we allow the
indexes to contain more fields than
mentioned in the constraint, as long
as the first fields are as mentioned */
dict_index_t* foreign_index; /* foreign index; we require that
both tables contain explicitly defined
indexes for the constraint: InnoDB
@ -270,12 +280,9 @@ a foreign key constraint is enforced, therefore RESTRICT just means no flag */
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32
#define DICT_INDEX_MAGIC_N 76789786
/* Data structure for a database table */
struct dict_table_struct{
dulint id; /* id of the table */
ulint flags; /* DICT_TF_COMPACT, ... */
mem_heap_t* heap; /* memory heap */
const char* name; /* table name */
const char* dir_path_of_temp_table;/* NULL or the directory path
@ -284,20 +291,33 @@ struct dict_table_struct{
innodb_file_per_table is defined in my.cnf;
in Unix this is usually /tmp/..., in Windows
\temp\... */
ulint space; /* space where the clustered index of the
unsigned space:32;
/* space where the clustered index of the
table is placed */
ibool ibd_file_missing;/* TRUE if this is in a single-table
unsigned ibd_file_missing:1;
/* TRUE if this is in a single-table
tablespace and the .ibd file is missing; then
we must return in ha_innodb.cc an error if the
user tries to query such an orphaned table */
ibool tablespace_discarded;/* this flag is set TRUE when the
user calls DISCARD TABLESPACE on this table,
and reset to FALSE in IMPORT TABLESPACE */
unsigned tablespace_discarded:1;
/* this flag is set TRUE when the user
calls DISCARD TABLESPACE on this
table, and reset to FALSE in IMPORT
TABLESPACE */
unsigned cached:1;/* TRUE if the table object has been added
to the dictionary cache */
unsigned flags:8;/* DICT_TF_COMPACT, ... */
unsigned n_def:10;/* number of columns defined so far */
unsigned n_cols:10;/* number of columns */
dict_col_t* cols; /* array of column descriptions */
const char* col_names;
/* n_def column names packed in an
"name1\0name2\0...nameN\0" array. until
n_def reaches n_cols, this is allocated with
ut_malloc, and the final size array is
allocated through the table's heap. */
hash_node_t name_hash; /* hash chain node */
hash_node_t id_hash; /* hash chain node */
ulint n_def; /* number of columns defined so far */
ulint n_cols; /* number of columns */
dict_col_t* cols; /* array of column descriptions */
UT_LIST_BASE_NODE_T(dict_index_t)
indexes; /* list of indexes of the table */
UT_LIST_BASE_NODE_T(dict_foreign_t)
@ -321,8 +341,6 @@ struct dict_table_struct{
on the table: we cannot drop the table while
there are foreign key checks running on
it! */
ibool cached; /* TRUE if the table object has been added
to the dictionary cache */
lock_t* auto_inc_lock;/* a buffer for an auto-inc lock
for this table: we allocate the memory here
so that individual transactions can get it
@ -339,12 +357,7 @@ struct dict_table_struct{
had an IX lock on */
UT_LIST_BASE_NODE_T(lock_t)
locks; /* list of locks on the table */
ulint max_row_size;
/* maximum size of a single row in the
table, not guaranteed to be especially
accurate. it's ULINT_MAX if there are
unbounded variable-width fields. initialized
in dict_table_add_to_cache. */
#ifdef UNIV_DEBUG
/*----------------------*/
ibool does_not_fit_in_memory;
/* this field is used to specify in simulations
@ -355,7 +368,15 @@ struct dict_table_struct{
dictionary on disk, and the database will
forget about value TRUE if it has to reload
the table definition from disk */
#endif /* UNIV_DEBUG */
/*----------------------*/
unsigned big_rows:1;
/* flag: TRUE if the maximum length of
a single row exceeds BIG_ROW_SIZE;
initialized in dict_table_add_to_cache() */
unsigned stat_initialized:1; /* TRUE if statistics have
been calculated the first time
after database startup or table creation */
ib_longlong stat_n_rows;
/* approximate number of rows in the table;
we periodically calculate new estimates */
@ -364,9 +385,6 @@ struct dict_table_struct{
database pages */
ulint stat_sum_of_other_index_sizes;
/* other indexes in database pages */
ibool stat_initialized; /* TRUE if statistics have
been calculated the first time
after database startup or table creation */
ulint stat_modified_counter;
/* when a row is inserted, updated, or deleted,
we add 1 to this number; we calculate new
@ -389,9 +407,11 @@ struct dict_table_struct{
SELECT MAX(auto inc column) */
ib_longlong autoinc;/* autoinc counter value to give to the
next inserted row */
#ifdef UNIV_DEBUG
ulint magic_n;/* magic number */
# define DICT_TABLE_MAGIC_N 76333786
#endif /* UNIV_DEBUG */
};
#define DICT_TABLE_MAGIC_N 76333786
#ifndef UNIV_NONINL
#include "dict0mem.ic"

View file

@ -13,7 +13,6 @@ typedef struct dict_sys_struct dict_sys_t;
typedef struct dict_col_struct dict_col_t;
typedef struct dict_field_struct dict_field_t;
typedef struct dict_index_struct dict_index_t;
typedef struct dict_tree_struct dict_tree_t;
typedef struct dict_table_struct dict_table_t;
typedef struct dict_foreign_struct dict_foreign_t;

View file

@ -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)));
}
/****************************************************************************

View file

@ -132,6 +132,24 @@ directory. */
#define PAGE_DIR_SLOT_MAX_N_OWNED 8
#define PAGE_DIR_SLOT_MIN_N_OWNED 4
/****************************************************************
Gets the start of a page. */
UNIV_INLINE
page_t*
page_align(
/*=======*/
/* out: start of the page */
void* ptr) /* in: pointer to page frame */
__attribute__((const));
/****************************************************************
Gets the offset within a page. */
UNIV_INLINE
ulint
page_offset(
/*========*/
/* out: offset from the start of the page */
const void* ptr) /* in: pointer to page frame */
__attribute__((const));
/*****************************************************************
Returns the max trx id field value. */
UNIV_INLINE

View file

@ -15,6 +15,28 @@ Created 2/2/1994 Heikki Tuuri
#define UNIV_INLINE
#endif
/****************************************************************
Gets the start of a page. */
UNIV_INLINE
page_t*
page_align(
/*=======*/
/* out: start of the page */
void* ptr) /* in: pointer to page frame */
{
return((page_t*) ut_align_down(ptr, UNIV_PAGE_SIZE));
}
/****************************************************************
Gets the offset within a page. */
UNIV_INLINE
ulint
page_offset(
/*========*/
/* out: offset from the start of the page */
const void* ptr) /* in: pointer to page frame */
{
return(ut_align_offset(ptr, UNIV_PAGE_SIZE));
}
/*****************************************************************
Returns the max trx id field value. */
UNIV_INLINE
@ -175,7 +197,7 @@ page_rec_is_comp(
/* out: nonzero if in compact format */
const rec_t* rec) /* in: record */
{
return(page_is_comp(ut_align_down((rec_t*) rec, UNIV_PAGE_SIZE)));
return(page_is_comp(page_align((rec_t*) rec)));
}
/****************************************************************
@ -291,7 +313,7 @@ page_rec_is_user_rec(
/* out: TRUE if a user record */
const rec_t* rec) /* in: record */
{
return(page_rec_is_user_rec_low(ut_align_offset(rec, UNIV_PAGE_SIZE)));
return(page_rec_is_user_rec_low(page_offset(rec)));
}
/****************************************************************
@ -303,7 +325,7 @@ page_rec_is_supremum(
/* out: TRUE if the supremum record */
const rec_t* rec) /* in: record */
{
return(page_rec_is_supremum_low(ut_align_offset(rec, UNIV_PAGE_SIZE)));
return(page_rec_is_supremum_low(page_offset(rec)));
}
/****************************************************************
@ -315,7 +337,7 @@ page_rec_is_infimum(
/* out: TRUE if the infimum record */
const rec_t* rec) /* in: record */
{
return(page_rec_is_infimum_low(ut_align_offset(rec, UNIV_PAGE_SIZE)));
return(page_rec_is_infimum_low(page_offset(rec)));
}
/*****************************************************************
@ -351,7 +373,7 @@ page_cmp_dtuple_rec_with_match(
ut_ad(rec_offs_validate(rec, NULL, offsets));
ut_ad(!rec_offs_comp(offsets) == !page_rec_is_comp(rec));
rec_offset = ut_align_offset(rec, UNIV_PAGE_SIZE);
rec_offset = page_offset(rec);
if (UNIV_UNLIKELY(rec_offset == PAGE_NEW_INFIMUM)
|| UNIV_UNLIKELY(rec_offset == PAGE_OLD_INFIMUM)) {
@ -492,7 +514,7 @@ page_dir_slot_set_rec(
{
ut_ad(page_rec_check(rec));
mach_write_to_2(slot, ut_align_offset(rec, UNIV_PAGE_SIZE));
mach_write_to_2(slot, page_offset(rec));
}
/*******************************************************************
@ -550,7 +572,7 @@ page_rec_get_next(
ut_ad(page_rec_check(rec));
page = ut_align_down(rec, UNIV_PAGE_SIZE);
page = page_align(rec);
offs = rec_get_next_offs(rec, page_is_comp(page));
@ -592,11 +614,11 @@ page_rec_set_next(
ut_ad(page_rec_check(rec));
ut_ad(!page_rec_is_supremum(rec));
page = ut_align_down(rec, UNIV_PAGE_SIZE);
page = page_align(rec);
if (next) {
ut_ad(!page_rec_is_infimum(next));
ut_ad(page == ut_align_down(next, UNIV_PAGE_SIZE));
ut_ad(page == page_align(next));
offs = (ulint) (next - page);
} else {
offs = 0;
@ -623,7 +645,7 @@ page_rec_get_prev(
ut_ad(page_rec_check(rec));
page = ut_align_down(rec, UNIV_PAGE_SIZE);
page = page_align(rec);
ut_ad(!page_rec_is_infimum(rec));
@ -735,15 +757,15 @@ 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_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_dir_calc_reserved_space(
n_recs + page_dir_get_n_heap(page) - 2);
free_space = page_get_free_space_of_empty(FALSE);
}

View file

@ -69,9 +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

@ -16,16 +16,17 @@ Created 7/1/1994 Heikki Tuuri
#include "rem0rec.h"
/*****************************************************************
Returns TRUE if two types are equal for comparison purposes. */
Returns TRUE if two columns are equal for comparison purposes. */
ibool
cmp_types_are_equal(
/*================*/
/* out: TRUE if the types are considered
equal in comparisons */
dtype_t* type1, /* in: type 1 */
dtype_t* type2, /* in: type 2 */
ibool check_charsets); /* in: whether to check charsets */
cmp_cols_are_equal(
/*===============*/
/* out: TRUE if the columns are
considered equal in comparisons */
const dict_col_t* col1, /* in: column 1 */
const dict_col_t* col2, /* in: column 2 */
ibool check_charsets);
/* in: whether to check charsets */
/*****************************************************************
This function is used to compare two data fields for which we know the
data type. */
@ -35,7 +36,8 @@ cmp_data_data(
/*==========*/
/* out: 1, 0, -1, if data1 is greater, equal,
less than data2, respectively */
dtype_t* cur_type,/* in: data type of the fields */
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type */
byte* data1, /* in: data field (== a pointer to a memory
buffer) */
ulint len1, /* in: data field length or UNIV_SQL_NULL */
@ -51,7 +53,8 @@ cmp_data_data_slow(
/*===============*/
/* out: 1, 0, -1, if data1 is greater, equal,
less than data2, respectively */
dtype_t* cur_type,/* in: data type of the fields */
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type */
byte* data1, /* in: data field (== a pointer to a memory
buffer) */
ulint len1, /* in: data field length or UNIV_SQL_NULL */

View file

@ -15,7 +15,8 @@ cmp_data_data(
/*==========*/
/* out: 1, 0, -1, if data1 is greater, equal,
less than data2, respectively */
dtype_t* cur_type,/* in: data type of the fields */
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type */
byte* data1, /* in: data field (== a pointer to a memory
buffer) */
ulint len1, /* in: data field length or UNIV_SQL_NULL */
@ -23,7 +24,7 @@ cmp_data_data(
buffer) */
ulint len2) /* in: data field length or UNIV_SQL_NULL */
{
return(cmp_data_data_slow(cur_type, data1, len1, data2, len2));
return(cmp_data_data_slow(mtype, prtype, data1, len1, data2, len2));
}
/*****************************************************************
@ -38,12 +39,17 @@ cmp_dfield_dfield(
dfield_t* dfield1,/* in: data field; must have type field set */
dfield_t* dfield2)/* in: data field */
{
const dtype_t* type;
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)));
type = dfield_get_type(dfield1);
return(cmp_data_data(type->mtype, type->prtype,
dfield_get_data(dfield1),
dfield_get_len(dfield1),
dfield_get_data(dfield2),
dfield_get_len(dfield2)));
}
/*****************************************************************

View file

@ -14,11 +14,6 @@ Created 5/30/1994 Heikki Tuuri
#include "rem0types.h"
#include "mtr0types.h"
/* Maximum values for various fields (for non-blob tuples) */
#define REC_MAX_N_FIELDS (1024 - 1)
#define REC_MAX_HEAP_NO (2 * 8192 - 1)
#define REC_MAX_N_OWNED (16 - 1)
/* Info bit denoting the predefined minimum record: this bit is set
if and only if the record is the first user record on a non-leaf
B-tree page that is the leftmost page on its level

View file

@ -336,8 +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;
@ -597,15 +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)));
}
}
@ -846,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:
@ -1453,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

@ -12,5 +12,9 @@ Created 5/30/1994 Heikki Tuuri
/* We define the physical record simply as an array of bytes */
typedef byte rec_t;
/* Maximum values for various fields (for non-blob tuples) */
#define REC_MAX_N_FIELDS (1024 - 1)
#define REC_MAX_HEAP_NO (2 * 8192 - 1)
#define REC_MAX_N_OWNED (16 - 1)
#endif

View file

@ -93,8 +93,8 @@ upd_field_set_field_no(
(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_col_copy_type(dict_index_get_nth_col(index, field_no),
dfield_get_type(&(upd_field->new_val)));
}
/*************************************************************************

View file

@ -426,13 +426,6 @@ struct rw_lock_struct {
waiters (readers or writers) in the global
wait array, waiting for this rw_lock.
Otherwise, == 0. */
ibool writer_is_wait_ex;
/* This is TRUE if the writer field is
RW_LOCK_WAIT_EX; this field is located far
from the memory update hotspot fields which
are at the start of this struct, thus we can
peek this field without causing much memory
bus traffic */
UT_LIST_NODE_T(rw_lock_t) list;
/* All allocated rw locks are put into a
list */
@ -440,15 +433,21 @@ struct rw_lock_struct {
UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list;
/* In the debug version: pointer to the debug
info list of the lock */
#endif /* UNIV_SYNC_DEBUG */
ulint level; /* Level in the global latching order. */
#endif /* UNIV_SYNC_DEBUG */
const char* cfile_name;/* File name where lock created */
ulint cline; /* Line where created */
const char* last_s_file_name;/* File name where last s-locked */
const char* last_x_file_name;/* File name where last x-locked */
ulint last_s_line; /* Line number where last time s-locked */
ulint last_x_line; /* Line number where last time x-locked */
ibool writer_is_wait_ex;
/* This is TRUE if the writer field is
RW_LOCK_WAIT_EX; this field is located far
from the memory update hotspot fields which
are at the start of this struct, thus we can
peek this field without causing much memory
bus traffic */
unsigned cline:14; /* Line where created */
unsigned last_s_line:14; /* Line number where last time s-locked */
unsigned last_x_line:14; /* Line number where last time x-locked */
ulint magic_n;
};

View file

@ -91,6 +91,7 @@ memory is read outside the allocated blocks. */
#define UNIV_SYNC_PERF_STAT
#define UNIV_SEARCH_PERF_STAT
#define UNIV_SRV_PRINT_LATCH_WAITS
#define UNIV_BTR_PRINT
#endif
#define UNIV_BTR_DEBUG

View file

@ -1041,8 +1041,8 @@ lock_has_to_wait(
return(lock_rec_has_to_wait(lock1->trx,
lock1->type_mode, lock2,
lock_rec_get_nth_bit
(lock1, 1)));
lock_rec_get_nth_bit(
lock1, 1)));
}
return(TRUE);
@ -1303,13 +1303,13 @@ lock_rec_get_next(
if (page_rec_is_comp(rec)) {
do {
lock = lock_rec_get_next_on_page(lock);
} while (lock && !lock_rec_get_nth_bit
(lock, rec_get_heap_no(rec, TRUE)));
} while (lock && !lock_rec_get_nth_bit(
lock, rec_get_heap_no(rec, TRUE)));
} else {
do {
lock = lock_rec_get_next_on_page(lock);
} while (lock && !lock_rec_get_nth_bit
(lock, rec_get_heap_no(rec, FALSE)));
} while (lock && !lock_rec_get_nth_bit(
lock, rec_get_heap_no(rec, FALSE)));
}
return(lock);
@ -1880,8 +1880,8 @@ lock_rec_enqueue_waiting(
if (lock_deadlock_occurs(lock, trx)) {
lock_reset_lock_and_trx_wait(lock);
lock_rec_reset_nth_bit(lock, rec_get_heap_no
(rec, page_rec_is_comp(rec)));
lock_rec_reset_nth_bit(lock, rec_get_heap_no(
rec, page_rec_is_comp(rec)));
return(DB_DEADLOCK);
}
@ -2661,8 +2661,9 @@ lock_move_reorganize_page(
for (;;) {
ut_ad(comp || !memcmp(page_cur_get_rec(&cur1),
page_cur_get_rec(&cur2),
rec_get_data_size_old
(page_cur_get_rec(&cur2))));
rec_get_data_size_old(
page_cur_get_rec(
&cur2))));
old_heap_no = rec_get_heap_no(page_cur_get_rec(&cur2),
comp);
@ -2759,8 +2760,9 @@ lock_move_rec_list_end(
while (page_cur_get_rec(&cur1) != sup) {
ut_ad(comp || !memcmp(page_cur_get_rec(&cur1),
page_cur_get_rec(&cur2),
rec_get_data_size_old
(page_cur_get_rec(&cur2))));
rec_get_data_size_old(
page_cur_get_rec(
&cur2))));
heap_no = rec_get_heap_no(page_cur_get_rec(&cur1),
comp);
@ -2839,8 +2841,9 @@ lock_move_rec_list_start(
while (page_cur_get_rec(&cur1) != rec) {
ut_ad(comp || !memcmp(page_cur_get_rec(&cur1),
page_cur_get_rec(&cur2),
rec_get_data_size_old
(page_cur_get_rec(&cur2))));
rec_get_data_size_old(
page_cur_get_rec(
&cur2))));
heap_no = rec_get_heap_no(page_cur_get_rec(&cur1),
comp);
@ -2898,8 +2901,8 @@ lock_update_split_right(
of the infimum on right page */
lock_rec_inherit_to_gap(page_get_supremum_rec(left_page),
page_rec_get_next
(page_get_infimum_rec(right_page)));
page_rec_get_next(
page_get_infimum_rec(right_page)));
lock_mutex_exit_kernel();
}
@ -3000,8 +3003,8 @@ lock_update_split_left(
successor of the infimum on the right page */
lock_rec_inherit_to_gap(page_get_supremum_rec(left_page),
page_rec_get_next
(page_get_infimum_rec(right_page)));
page_rec_get_next(
page_get_infimum_rec(right_page)));
lock_mutex_exit_kernel();
}
@ -3439,9 +3442,9 @@ lock_deadlock_recursive(
incompatible mode, and is itself waiting for
a lock */
ret = lock_deadlock_recursive
(start, lock_trx,
lock_trx->wait_lock, cost, depth + 1);
ret = lock_deadlock_recursive(
start, lock_trx,
lock_trx->wait_lock, cost, depth + 1);
if (ret != 0) {
return(ret);
@ -4219,9 +4222,9 @@ lock_rec_print(
if (page) {
rec_t* rec
= page_find_rec_with_heap_no(page, i);
offsets = rec_get_offsets
(rec, lock->index, offsets,
ULINT_UNDEFINED, &heap);
offsets = rec_get_offsets(
rec, lock->index, offsets,
ULINT_UNDEFINED, &heap);
rec_print_new(file, rec, offsets);
}
@ -4378,14 +4381,14 @@ loop:
fprintf(file,
"Trx read view will not see trx with"
" id >= %lu %lu, sees < %lu %lu\n",
(ulong) ut_dulint_get_high
(trx->read_view->low_limit_id),
(ulong) ut_dulint_get_low
(trx->read_view->low_limit_id),
(ulong) ut_dulint_get_high
(trx->read_view->up_limit_id),
(ulong) ut_dulint_get_low
(trx->read_view->up_limit_id));
(ulong) ut_dulint_get_high(
trx->read_view->low_limit_id),
(ulong) ut_dulint_get_low(
trx->read_view->low_limit_id),
(ulong) ut_dulint_get_high(
trx->read_view->up_limit_id),
(ulong) ut_dulint_get_low(
trx->read_view->up_limit_id));
}
fprintf(file,
@ -4443,8 +4446,8 @@ loop:
mtr_start(&mtr);
page = buf_page_get_with_no_latch
(space, page_no, &mtr);
page = buf_page_get_with_no_latch(
space, page_no, &mtr);
mtr_commit(&mtr);
@ -4510,8 +4513,9 @@ lock_table_queue_validate(
ut_a(!is_waiting);
ut_a(!lock_table_other_has_incompatible
(lock->trx, 0, table, lock_get_mode(lock)));
ut_a(!lock_table_other_has_incompatible(
lock->trx, 0, table,
lock_get_mode(lock)));
} else {
is_waiting = TRUE;
@ -4580,8 +4584,8 @@ lock_rec_queue_validate(
impl_trx = lock_clust_rec_some_has_impl(rec, index, offsets);
if (impl_trx && lock_rec_other_has_expl_req
(LOCK_S, 0, LOCK_WAIT, rec, impl_trx)) {
if (impl_trx && lock_rec_other_has_expl_req(
LOCK_S, 0, LOCK_WAIT, rec, impl_trx)) {
ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
rec, impl_trx));
@ -4594,11 +4598,11 @@ lock_rec_queue_validate(
next function call: we have to release lock table mutex
to obey the latching order */
impl_trx = lock_sec_rec_some_has_impl_off_kernel
(rec, index, offsets);
impl_trx = lock_sec_rec_some_has_impl_off_kernel(
rec, index, offsets);
if (impl_trx && lock_rec_other_has_expl_req
(LOCK_S, 0, LOCK_WAIT, rec, impl_trx)) {
if (impl_trx && lock_rec_other_has_expl_req(
LOCK_S, 0, LOCK_WAIT, rec, impl_trx)) {
ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
rec, impl_trx));
@ -4626,8 +4630,8 @@ lock_rec_queue_validate(
} else {
mode = LOCK_S;
}
ut_a(!lock_rec_other_has_expl_req
(mode, 0, 0, rec, lock->trx));
ut_a(!lock_rec_other_has_expl_req(
mode, 0, 0, rec, lock->trx));
} else if (lock_get_wait(lock) && !lock_rec_get_gap(lock)) {
@ -4764,8 +4768,8 @@ lock_validate(void)
while (lock) {
if (lock_get_type(lock) & LOCK_TABLE) {
lock_table_queue_validate
(lock->un_member.tab_lock.table);
lock_table_queue_validate(
lock->un_member.tab_lock.table);
}
lock = UT_LIST_GET_NEXT(trx_locks, lock);
@ -4787,9 +4791,9 @@ lock_validate(void)
space = lock->un_member.rec_lock.space;
page_no = lock->un_member.rec_lock.page_no;
if (ut_dulint_cmp
(ut_dulint_create(space, page_no),
limit) >= 0) {
if (ut_dulint_cmp(
ut_dulint_create(space, page_no),
limit) >= 0) {
break;
}
@ -4889,8 +4893,9 @@ lock_rec_insert_check_and_lock(
had to wait for their insert. Both had waiting gap type lock requests
on the successor, which produced an unnecessary deadlock. */
if (lock_rec_other_has_conflicting
(LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION, next_rec, trx)) {
if (lock_rec_other_has_conflicting(
LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION, next_rec,
trx)) {
/* Note that we may get DB_SUCCESS also here! */
err = lock_rec_enqueue_waiting(LOCK_X | LOCK_GAP
@ -4952,8 +4957,8 @@ lock_rec_convert_impl_to_expl(
if (index->type & DICT_CLUSTERED) {
impl_trx = lock_clust_rec_some_has_impl(rec, index, offsets);
} else {
impl_trx = lock_sec_rec_some_has_impl_off_kernel
(rec, index, offsets);
impl_trx = lock_sec_rec_some_has_impl_off_kernel(
rec, index, offsets);
}
if (impl_trx) {
@ -4963,9 +4968,9 @@ lock_rec_convert_impl_to_expl(
if (!lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, rec,
impl_trx)) {
lock_rec_add_to_queue
(LOCK_REC | LOCK_X | LOCK_REC_NOT_GAP,
rec, index, impl_trx);
lock_rec_add_to_queue(
LOCK_REC | LOCK_X | LOCK_REC_NOT_GAP,
rec, index, impl_trx);
}
}
}

View file

@ -355,8 +355,8 @@ log_close(void)
full by the current mtr: the next mtr log record group
will start within this block at the offset data_len */
log_block_set_first_rec_group
(log_block, log_block_get_data_len(log_block));
log_block_set_first_rec_group(
log_block, log_block_get_data_len(log_block));
}
if (log->buf_free > log->max_buf_free) {
@ -900,17 +900,17 @@ log_group_init(
#endif /* UNIV_LOG_ARCHIVE */
for (i = 0; i < n_files; i++) {
*(group->file_header_bufs + i) = ut_align
(mem_alloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE),
OS_FILE_LOG_BLOCK_SIZE);
*(group->file_header_bufs + i) = ut_align(
mem_alloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE),
OS_FILE_LOG_BLOCK_SIZE);
memset(*(group->file_header_bufs + i), '\0',
LOG_FILE_HDR_SIZE);
#ifdef UNIV_LOG_ARCHIVE
*(group->archive_file_header_bufs + i) = ut_align
(mem_alloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE),
OS_FILE_LOG_BLOCK_SIZE);
*(group->archive_file_header_bufs + i) = ut_align(
mem_alloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE),
OS_FILE_LOG_BLOCK_SIZE);
memset(*(group->archive_file_header_bufs + i), '\0',
LOG_FILE_HDR_SIZE);
#endif /* UNIV_LOG_ARCHIVE */
@ -923,9 +923,8 @@ log_group_init(
group->archived_offset = 0;
#endif /* UNIV_LOG_ARCHIVE */
group->checkpoint_buf = ut_align
(mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE),
OS_FILE_LOG_BLOCK_SIZE);
group->checkpoint_buf = ut_align(
mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE), OS_FILE_LOG_BLOCK_SIZE);
memset(group->checkpoint_buf, '\0', OS_FILE_LOG_BLOCK_SIZE);
@ -1029,9 +1028,9 @@ log_sys_check_flush_completion(void)
/* Move the log buffer content to the start of the
buffer */
move_start = ut_calc_align_down
(log_sys->write_end_offset,
OS_FILE_LOG_BLOCK_SIZE);
move_start = ut_calc_align_down(
log_sys->write_end_offset,
OS_FILE_LOG_BLOCK_SIZE);
move_end = ut_calc_align(log_sys->buf_free,
OS_FILE_LOG_BLOCK_SIZE);
@ -1255,16 +1254,16 @@ loop:
(ulong) ut_dulint_get_high(start_lsn),
(ulong) ut_dulint_get_low(start_lsn),
(ulong) log_block_get_hdr_no(buf),
(ulong) log_block_get_hdr_no
(buf + write_len - OS_FILE_LOG_BLOCK_SIZE));
(ulong) log_block_get_hdr_no(
buf + write_len - OS_FILE_LOG_BLOCK_SIZE));
ut_a(log_block_get_hdr_no(buf)
== log_block_convert_lsn_to_no(start_lsn));
for (i = 0; i < write_len / OS_FILE_LOG_BLOCK_SIZE; i++) {
ut_a(log_block_get_hdr_no(buf) + i
== log_block_get_hdr_no
(buf + i * OS_FILE_LOG_BLOCK_SIZE));
== log_block_get_hdr_no(
buf + i * OS_FILE_LOG_BLOCK_SIZE));
}
}
#endif /* UNIV_DEBUG */
@ -1412,10 +1411,10 @@ loop:
if (log_debug_writes) {
fprintf(stderr,
"Writing log from %lu %lu up to lsn %lu %lu\n",
(ulong) ut_dulint_get_high
(log_sys->written_to_all_lsn),
(ulong) ut_dulint_get_low
(log_sys->written_to_all_lsn),
(ulong) ut_dulint_get_high(
log_sys->written_to_all_lsn),
(ulong) ut_dulint_get_low(
log_sys->written_to_all_lsn),
(ulong) ut_dulint_get_high(log_sys->lsn),
(ulong) ut_dulint_get_low(log_sys->lsn));
}
@ -1446,9 +1445,9 @@ loop:
log_sys->one_flushed = FALSE;
log_block_set_flush_bit(log_sys->buf + area_start, TRUE);
log_block_set_checkpoint_no
(log_sys->buf + area_end - OS_FILE_LOG_BLOCK_SIZE,
log_sys->next_checkpoint_no);
log_block_set_checkpoint_no(
log_sys->buf + area_end - OS_FILE_LOG_BLOCK_SIZE,
log_sys->next_checkpoint_no);
/* Copy the last, incompletely written, log block a log block length
up, so that when the flush operation writes from the log buffer, the
@ -1466,12 +1465,12 @@ loop:
/* Do the write to the log files */
while (group) {
log_group_write_buf
(group, log_sys->buf + area_start,
area_end - area_start,
ut_dulint_align_down(log_sys->written_to_all_lsn,
OS_FILE_LOG_BLOCK_SIZE),
start_offset - area_start);
log_group_write_buf(
group, log_sys->buf + area_start,
area_end - area_start,
ut_dulint_align_down(log_sys->written_to_all_lsn,
OS_FILE_LOG_BLOCK_SIZE),
start_offset - area_start);
log_group_set_fields(group, log_sys->write_lsn);
@ -1730,8 +1729,8 @@ log_group_checkpoint(
log_sys->next_checkpoint_lsn);
mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET,
log_group_calc_lsn_offset
(log_sys->next_checkpoint_lsn, group));
log_group_calc_lsn_offset(
log_sys->next_checkpoint_lsn, group));
mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, log_sys->buf_size);
@ -2355,9 +2354,9 @@ loop:
OS_DATA_FILE, &ret);
if (!ret && (open_mode == OS_FILE_CREATE)) {
file_handle = os_file_create
(name, OS_FILE_OPEN, OS_FILE_AIO,
OS_DATA_FILE, &ret);
file_handle = os_file_create(
name, OS_FILE_OPEN, OS_FILE_AIO,
OS_DATA_FILE, &ret);
}
if (!ret) {
@ -2388,10 +2387,10 @@ loop:
group->archive_space_id, FALSE);
if (next_offset % group->file_size == 0) {
log_group_archive_file_header_write
(group, n_files,
group->archived_file_no + n_files,
start_lsn);
log_group_archive_file_header_write(
group, n_files,
group->archived_file_no + n_files,
start_lsn);
next_offset += LOG_FILE_HDR_SIZE;
}
@ -2513,10 +2512,10 @@ log_archive_write_complete_groups(void)
#endif /* UNIV_DEBUG */
/* Calculate the archive file space start lsn */
start_lsn = ut_dulint_subtract
(log_sys->next_archived_lsn,
end_offset - LOG_FILE_HDR_SIZE + trunc_files
* (group->file_size - LOG_FILE_HDR_SIZE));
start_lsn = ut_dulint_subtract(
log_sys->next_archived_lsn,
end_offset - LOG_FILE_HDR_SIZE + trunc_files
* (group->file_size - LOG_FILE_HDR_SIZE));
end_lsn = start_lsn;
for (i = 0; i < trunc_files; i++) {
@ -2656,8 +2655,8 @@ loop:
if (ut_dulint_cmp(limit_lsn, log_sys->lsn) >= 0) {
limit_lsn = ut_dulint_align_down
(log_sys->lsn, OS_FILE_LOG_BLOCK_SIZE);
limit_lsn = ut_dulint_align_down(
log_sys->lsn, OS_FILE_LOG_BLOCK_SIZE);
}
}
@ -2804,8 +2803,8 @@ log_archive_close_groups(
/* Write a notice to the headers of archived log
files that the file write has been completed */
log_group_archive_completed_header_write
(group, 0, log_sys->archived_lsn);
log_group_archive_completed_header_write(
group, 0, log_sys->archived_lsn);
fil_space_truncate_start(group->archive_space_id,
trunc_len);

View file

@ -239,12 +239,14 @@ recv_truncate_group(
archived_lsn = checkpoint_lsn;
}
finish_lsn1 = ut_dulint_add(ut_dulint_align_down
(archived_lsn, OS_FILE_LOG_BLOCK_SIZE),
finish_lsn1 = ut_dulint_add(ut_dulint_align_down(
archived_lsn,
OS_FILE_LOG_BLOCK_SIZE),
log_group_get_capacity(group));
finish_lsn2 = ut_dulint_add(ut_dulint_align_up
(recovered_lsn, OS_FILE_LOG_BLOCK_SIZE),
finish_lsn2 = ut_dulint_add(ut_dulint_align_up(
recovered_lsn,
OS_FILE_LOG_BLOCK_SIZE),
recv_sys->last_log_buf_size);
if (ut_dulint_cmp(limit_lsn, ut_dulint_max) != 0) {
@ -274,8 +276,8 @@ recv_truncate_group(
ut_memcpy(log_sys->buf, recv_sys->last_block,
OS_FILE_LOG_BLOCK_SIZE);
log_block_set_data_len(log_sys->buf, ut_dulint_minus
(recovered_lsn, start_lsn));
log_block_set_data_len(log_sys->buf, ut_dulint_minus(
recovered_lsn, start_lsn));
}
if (ut_dulint_cmp(start_lsn, finish_lsn) >= 0) {
@ -441,16 +443,16 @@ recv_check_cp_is_consistent(
fold = ut_fold_binary(buf, LOG_CHECKPOINT_CHECKSUM_1);
if ((fold & 0xFFFFFFFFUL) != mach_read_from_4
(buf + LOG_CHECKPOINT_CHECKSUM_1)) {
if ((fold & 0xFFFFFFFFUL) != mach_read_from_4(
buf + LOG_CHECKPOINT_CHECKSUM_1)) {
return(FALSE);
}
fold = ut_fold_binary(buf + LOG_CHECKPOINT_LSN,
LOG_CHECKPOINT_CHECKSUM_2 - LOG_CHECKPOINT_LSN);
if ((fold & 0xFFFFFFFFUL) != mach_read_from_4
(buf + LOG_CHECKPOINT_CHECKSUM_2)) {
if ((fold & 0xFFFFFFFFUL) != mach_read_from_4(
buf + LOG_CHECKPOINT_CHECKSUM_2)) {
return(FALSE);
}
@ -498,9 +500,9 @@ recv_find_max_checkpoint(
" %lu at %lu invalid, %lu\n",
(ulong) group->id,
(ulong) field,
(ulong) mach_read_from_4
(buf
+ LOG_CHECKPOINT_CHECKSUM_1));
(ulong) mach_read_from_4(
buf
+ LOG_CHECKPOINT_CHECKSUM_1));
}
#endif /* UNIV_DEBUG */
@ -509,20 +511,20 @@ recv_find_max_checkpoint(
group->state = LOG_GROUP_OK;
group->lsn = mach_read_from_8
(buf + LOG_CHECKPOINT_LSN);
group->lsn_offset = mach_read_from_4
(buf + LOG_CHECKPOINT_OFFSET);
checkpoint_no = mach_read_from_8
(buf + LOG_CHECKPOINT_NO);
group->lsn = mach_read_from_8(
buf + LOG_CHECKPOINT_LSN);
group->lsn_offset = mach_read_from_4(
buf + LOG_CHECKPOINT_OFFSET);
checkpoint_no = mach_read_from_8(
buf + LOG_CHECKPOINT_NO);
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
"InnoDB: Checkpoint number %lu"
" found in group %lu\n",
(ulong) ut_dulint_get_low
(checkpoint_no),
(ulong) ut_dulint_get_low(
checkpoint_no),
(ulong) group->id);
}
#endif /* UNIV_DEBUG */
@ -609,8 +611,8 @@ recv_read_cp_info_for_backup(
if (mach_read_from_4(cp_buf + LOG_CHECKPOINT_FSP_MAGIC_N)
== LOG_CHECKPOINT_FSP_MAGIC_N_VAL) {
*fsp_limit = mach_read_from_4
(cp_buf + LOG_CHECKPOINT_FSP_FREE_LIMIT);
*fsp_limit = mach_read_from_4(
cp_buf + LOG_CHECKPOINT_FSP_FREE_LIMIT);
if (*fsp_limit == 0) {
*fsp_limit = 1000000000;
@ -779,10 +781,10 @@ recv_parse_or_apply_log_rec_body(
ptr = mlog_parse_nbytes(type, ptr, end_ptr, page);
break;
case MLOG_REC_INSERT: case MLOG_COMP_REC_INSERT:
if (NULL != (ptr = mlog_parse_index
(ptr, end_ptr,
type == MLOG_COMP_REC_INSERT,
&index))) {
if (NULL != (ptr = mlog_parse_index(
ptr, end_ptr,
type == MLOG_COMP_REC_INSERT,
&index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
@ -791,15 +793,15 @@ recv_parse_or_apply_log_rec_body(
}
break;
case MLOG_REC_CLUST_DELETE_MARK: case MLOG_COMP_REC_CLUST_DELETE_MARK:
if (NULL != (ptr = mlog_parse_index
(ptr, end_ptr,
type == MLOG_COMP_REC_CLUST_DELETE_MARK,
&index))) {
if (NULL != (ptr = mlog_parse_index(
ptr, end_ptr,
type == MLOG_COMP_REC_CLUST_DELETE_MARK,
&index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
ptr = btr_cur_parse_del_mark_set_clust_rec
(ptr, end_ptr, index, page);
ptr = btr_cur_parse_del_mark_set_clust_rec(
ptr, end_ptr, index, page);
}
break;
case MLOG_COMP_REC_SEC_DELETE_MARK:
@ -815,10 +817,10 @@ recv_parse_or_apply_log_rec_body(
ptr = btr_cur_parse_del_mark_set_sec_rec(ptr, end_ptr, page);
break;
case MLOG_REC_UPDATE_IN_PLACE: case MLOG_COMP_REC_UPDATE_IN_PLACE:
if (NULL != (ptr = mlog_parse_index
(ptr, end_ptr,
type == MLOG_COMP_REC_UPDATE_IN_PLACE,
&index))) {
if (NULL != (ptr = mlog_parse_index(
ptr, end_ptr,
type == MLOG_COMP_REC_UPDATE_IN_PLACE,
&index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
@ -828,11 +830,11 @@ recv_parse_or_apply_log_rec_body(
break;
case MLOG_LIST_END_DELETE: case MLOG_COMP_LIST_END_DELETE:
case MLOG_LIST_START_DELETE: case MLOG_COMP_LIST_START_DELETE:
if (NULL != (ptr = mlog_parse_index
(ptr, end_ptr,
type == MLOG_COMP_LIST_END_DELETE
|| type == MLOG_COMP_LIST_START_DELETE,
&index))) {
if (NULL != (ptr = mlog_parse_index(
ptr, end_ptr,
type == MLOG_COMP_LIST_END_DELETE
|| type == MLOG_COMP_LIST_START_DELETE,
&index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
@ -841,22 +843,22 @@ recv_parse_or_apply_log_rec_body(
}
break;
case MLOG_LIST_END_COPY_CREATED: case MLOG_COMP_LIST_END_COPY_CREATED:
if (NULL != (ptr = mlog_parse_index
(ptr, end_ptr,
type == MLOG_COMP_LIST_END_COPY_CREATED,
&index))) {
if (NULL != (ptr = mlog_parse_index(
ptr, end_ptr,
type == MLOG_COMP_LIST_END_COPY_CREATED,
&index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
ptr = page_parse_copy_rec_list_to_created_page
(ptr, end_ptr, index, page, mtr);
ptr = page_parse_copy_rec_list_to_created_page(
ptr, end_ptr, index, page, mtr);
}
break;
case MLOG_PAGE_REORGANIZE: case MLOG_COMP_PAGE_REORGANIZE:
if (NULL != (ptr = mlog_parse_index
(ptr, end_ptr,
type == MLOG_COMP_PAGE_REORGANIZE,
&index))) {
if (NULL != (ptr = mlog_parse_index(
ptr, end_ptr,
type == MLOG_COMP_PAGE_REORGANIZE,
&index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
@ -887,15 +889,15 @@ recv_parse_or_apply_log_rec_body(
page, mtr);
break;
case MLOG_REC_MIN_MARK: case MLOG_COMP_REC_MIN_MARK:
ptr = btr_parse_set_min_rec_mark
(ptr, end_ptr, type == MLOG_COMP_REC_MIN_MARK,
page, mtr);
ptr = btr_parse_set_min_rec_mark(
ptr, end_ptr, type == MLOG_COMP_REC_MIN_MARK,
page, mtr);
break;
case MLOG_REC_DELETE: case MLOG_COMP_REC_DELETE:
if (NULL != (ptr = mlog_parse_index
(ptr, end_ptr,
type == MLOG_COMP_REC_DELETE,
&index))) {
if (NULL != (ptr = mlog_parse_index(
ptr, end_ptr,
type == MLOG_COMP_REC_DELETE,
&index))) {
ut_a(!page
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
@ -1430,8 +1432,8 @@ loop:
RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level
(page, SYNC_NO_ORDER_CHECK);
buf_page_dbg_add_level(
page, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
recv_recover_page(FALSE, FALSE, page,
space, page_no);
@ -1570,18 +1572,18 @@ recv_apply_log_recs_for_backup(void)
the block corresponding to buf_pool->frame_zero
(== page). */
buf_page_init_for_backup_restore
(recv_addr->space, recv_addr->page_no,
buf_block_align(page));
buf_page_init_for_backup_restore(
recv_addr->space, recv_addr->page_no,
buf_block_align(page));
/* Extend the tablespace's last file if the page_no
does not fall inside its bounds; we assume the last
file is auto-extending, and ibbackup copied the file
when it still was smaller */
success = fil_extend_space_to_desired_size
(&actual_size,
recv_addr->space, recv_addr->page_no + 1);
success = fil_extend_space_to_desired_size(
&actual_size,
recv_addr->space, recv_addr->page_no + 1);
if (!success) {
fprintf(stderr,
"InnoDB: Fatal error: cannot extend"
@ -1615,9 +1617,9 @@ recv_apply_log_recs_for_backup(void)
/* Write the page back to the tablespace file using the
fil0fil.c routines */
buf_flush_init_for_writing
(page, mach_read_from_8(page + FIL_PAGE_LSN),
recv_addr->space, recv_addr->page_no);
buf_flush_init_for_writing(
page, mach_read_from_8(page + FIL_PAGE_LSN),
recv_addr->space, recv_addr->page_no);
error = fil_io(OS_FILE_WRITE, TRUE, recv_addr->space,
recv_addr->page_no, 0, UNIV_PAGE_SIZE,
@ -1916,8 +1918,9 @@ loop:
fil_path_to_mysql_datadir is set in ibbackup to
point to the datadir we should use there */
if (NULL == fil_op_log_parse_or_replay
(body, end_ptr, type, TRUE, space)) {
if (NULL == fil_op_log_parse_or_replay(
body, end_ptr, type, TRUE,
space)) {
fprintf(stderr,
"InnoDB: Error: file op"
" log record of type %lu"
@ -1956,8 +1959,8 @@ loop:
if (recv_sys->found_corrupt_log) {
recv_report_corrupt_log
(ptr, type, space, page_no);
recv_report_corrupt_log(
ptr, type, space, page_no);
}
return(FALSE);
@ -1998,8 +2001,8 @@ loop:
}
}
new_recovered_lsn = recv_calc_lsn_on_data_add
(recv_sys->recovered_lsn, total_len);
new_recovered_lsn = recv_calc_lsn_on_data_add(
recv_sys->recovered_lsn, total_len);
if (ut_dulint_cmp(new_recovered_lsn, recv_sys->scanned_lsn)
> 0) {
@ -2202,22 +2205,21 @@ recv_scan_log_recs(
|| !log_block_checksum_is_ok_or_old_format(log_block)) {
if (no == log_block_convert_lsn_to_no(scanned_lsn)
&& !log_block_checksum_is_ok_or_old_format
(log_block)) {
&& !log_block_checksum_is_ok_or_old_format(
log_block)) {
fprintf(stderr,
"InnoDB: Log block no %lu at"
" lsn %lu %lu has\n"
"InnoDB: ok header, but checksum field"
" contains %lu, should be %lu\n",
(ulong) no,
(ulong) ut_dulint_get_high
(scanned_lsn),
(ulong) ut_dulint_get_low
(scanned_lsn),
(ulong) log_block_get_checksum
(log_block),
(ulong) log_block_calc_checksum
(log_block));
(ulong) ut_dulint_get_high(
scanned_lsn),
(ulong) ut_dulint_get_low(scanned_lsn),
(ulong) log_block_get_checksum(
log_block),
(ulong) log_block_calc_checksum(
log_block));
}
/* Garbage or an incompletely written log block */
@ -2273,8 +2275,8 @@ recv_scan_log_recs(
recv_sys->parse_start_lsn
= ut_dulint_add(scanned_lsn,
log_block_get_first_rec_group
(log_block));
log_block_get_first_rec_group(
log_block));
recv_sys->scanned_lsn = recv_sys->parse_start_lsn;
recv_sys->recovered_lsn = recv_sys->parse_start_lsn;
}
@ -2297,8 +2299,8 @@ recv_scan_log_recs(
recv_sys->found_corrupt_log = TRUE;
} else if (!recv_sys->found_corrupt_log) {
more_data = recv_sys_add_to_parsing_buf
(log_block, scanned_lsn);
more_data = recv_sys_add_to_parsing_buf(
log_block, scanned_lsn);
}
recv_sys->scanned_lsn = scanned_lsn;
@ -2385,11 +2387,10 @@ recv_group_scan_log_recs(
log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
group, start_lsn, end_lsn);
finished = recv_scan_log_recs
(TRUE, (buf_pool->n_frames - recv_n_pool_free_frames)
* UNIV_PAGE_SIZE, TRUE, log_sys->buf,
RECV_SCAN_SIZE, start_lsn,
contiguous_lsn, group_scanned_lsn);
finished = recv_scan_log_recs(
TRUE, (buf_pool->n_frames - recv_n_pool_free_frames)
* UNIV_PAGE_SIZE, TRUE, log_sys->buf, RECV_SCAN_SIZE,
start_lsn, contiguous_lsn, group_scanned_lsn);
start_lsn = end_lsn;
}
@ -2561,18 +2562,18 @@ recv_recovery_from_checkpoint_start(
"InnoDB: %lu %lu and %lu %lu.\n"
"InnoDB: #########################"
"#################################\n",
(ulong) ut_dulint_get_high
(checkpoint_lsn),
(ulong) ut_dulint_get_low
(checkpoint_lsn),
(ulong) ut_dulint_get_high
(min_flushed_lsn),
(ulong) ut_dulint_get_low
(min_flushed_lsn),
(ulong) ut_dulint_get_high
(max_flushed_lsn),
(ulong) ut_dulint_get_low
(max_flushed_lsn));
(ulong) ut_dulint_get_high(
checkpoint_lsn),
(ulong) ut_dulint_get_low(
checkpoint_lsn),
(ulong) ut_dulint_get_high(
min_flushed_lsn),
(ulong) ut_dulint_get_low(
min_flushed_lsn),
(ulong) ut_dulint_get_high(
max_flushed_lsn),
(ulong) ut_dulint_get_low(
max_flushed_lsn));
}
recv_needed_recovery = TRUE;
@ -2602,8 +2603,8 @@ recv_recovery_from_checkpoint_start(
" half-written data pages from"
" the doublewrite\n"
"InnoDB: buffer...\n");
trx_sys_doublewrite_init_or_restore_pages
(TRUE);
trx_sys_doublewrite_init_or_restore_pages(
TRUE);
}
ut_print_timestamp(stderr);
@ -2629,10 +2630,10 @@ recv_recovery_from_checkpoint_start(
group = recv_sys->archive_group;
capacity = log_group_get_capacity(group);
if ((ut_dulint_cmp(recv_sys->scanned_lsn, ut_dulint_add
(checkpoint_lsn, capacity)) > 0)
|| (ut_dulint_cmp(checkpoint_lsn, ut_dulint_add
(recv_sys->scanned_lsn, capacity))
if ((ut_dulint_cmp(recv_sys->scanned_lsn, ut_dulint_add(
checkpoint_lsn, capacity)) > 0)
|| (ut_dulint_cmp(checkpoint_lsn, ut_dulint_add(
recv_sys->scanned_lsn, capacity))
> 0)) {
mutex_exit(&(log_sys->mutex));
@ -2756,10 +2757,10 @@ recv_recovery_from_checkpoint_start(
" lsn %lu %lu up to lsn %lu %lu\n",
(ulong) ut_dulint_get_high(checkpoint_lsn),
(ulong) ut_dulint_get_low(checkpoint_lsn),
(ulong) ut_dulint_get_high
(recv_sys->recovered_lsn),
(ulong) ut_dulint_get_low
(recv_sys->recovered_lsn));
(ulong) ut_dulint_get_high(
recv_sys->recovered_lsn),
(ulong) ut_dulint_get_low(
recv_sys->recovered_lsn));
}
} else {
srv_start_lsn = recv_sys->recovered_lsn;
@ -3189,10 +3190,10 @@ ask_again:
group->archive_space_id, read_offset / UNIV_PAGE_SIZE,
read_offset % UNIV_PAGE_SIZE, len, buf, NULL);
ret = recv_scan_log_recs
(TRUE, (buf_pool->n_frames - recv_n_pool_free_frames)
* UNIV_PAGE_SIZE, TRUE, buf, len, start_lsn,
&dummy_lsn, &scanned_lsn);
ret = recv_scan_log_recs(
TRUE, (buf_pool->n_frames - recv_n_pool_free_frames)
* UNIV_PAGE_SIZE, TRUE, buf, len, start_lsn,
&dummy_lsn, &scanned_lsn);
if (ut_dulint_cmp(scanned_lsn, file_end_lsn) == 0) {

View file

@ -497,8 +497,8 @@ mem_heap_validate_or_print(
" %lx but trailer %lx\n",
(ulint)block,
(ulint)field, len, check_field,
mem_field_trailer_get_check
(user_field));
mem_field_trailer_get_check(
user_field));
return;
}

View file

@ -501,8 +501,8 @@ 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,"

View file

@ -445,21 +445,21 @@ mlog_open_and_write_index(
dict_index_get_n_unique_in_tree(index));
log_ptr += 2;
for (i = 0; i < n; i++) {
dict_field_t* field;
dtype_t* type;
ulint len;
dict_field_t* field;
const dict_col_t* col;
ulint len;
field = dict_index_get_nth_field(index, i);
type = dict_col_get_type(dict_field_get_col(field));
col = dict_field_get_col(field);
len = field->fixed_len;
ut_ad(len < 0x7fff);
if (len == 0
&& (dtype_get_len(type) > 255
|| dtype_get_mtype(type) == DATA_BLOB)) {
&& (col->len > 255 || col->mtype == DATA_BLOB)) {
/* variable-length field
with maximum length > 255 */
len = 0x7fff;
}
if (dtype_get_prtype(type) & DATA_NOT_NULL) {
if (col->prtype & DATA_NOT_NULL) {
len |= 0x8000;
}
if (log_ptr + 2 > log_end) {
@ -541,14 +541,16 @@ 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);
dict_index_add_col(ind, table, (dict_col_t*)
dict_table_get_nth_col(table, i),
0);
}
ptr += 2;
}

View file

@ -131,9 +131,9 @@ mtr_log_reserve_and_write(
}
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;

View file

@ -3483,9 +3483,9 @@ try_again:
#endif
} else {
if (!wake_later) {
os_aio_simulated_wake_handler_thread
(os_aio_get_segment_no_from_slot
(array, slot));
os_aio_simulated_wake_handler_thread(
os_aio_get_segment_no_from_slot(
array, slot));
}
}
} else if (type == OS_FILE_WRITE) {
@ -3501,9 +3501,9 @@ try_again:
#endif
} else {
if (!wake_later) {
os_aio_simulated_wake_handler_thread
(os_aio_get_segment_no_from_slot
(array, slot));
os_aio_simulated_wake_handler_thread(
os_aio_get_segment_no_from_slot(
array, slot));
}
}
} else {

View file

@ -142,8 +142,9 @@ 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"

View file

@ -259,11 +259,11 @@ page_cur_search_with_match(
&& (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;
}
}
@ -326,8 +326,9 @@ low_slot_match:
} 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;
}
@ -382,8 +383,9 @@ low_rec_match:
} 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;
}
@ -645,9 +647,9 @@ page_cur_insert_rec_write_log(
+ 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 */
@ -796,8 +798,8 @@ page_cur_parse_insert_rec(
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;
}
@ -975,8 +977,8 @@ page_cur_insert_rec_low(
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)
@ -984,8 +986,8 @@ page_cur_insert_rec_low(
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);
@ -1278,7 +1280,7 @@ page_cur_delete_rec_write_log(
}
/* Write the cursor rec offset as a 2-byte ulint */
mach_write_to_2(log_ptr, ut_align_offset(rec, UNIV_PAGE_SIZE));
mach_write_to_2(log_ptr, page_offset(rec));
mlog_close(mtr, log_ptr + 2);
}

View file

@ -381,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);
/* Set the corresponding physical record to its place in the page
record heap */
@ -407,7 +407,7 @@ 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);
supremum_rec = rec_convert_dtuple_to_rec(heap_top, index, tuple);
@ -650,7 +650,7 @@ page_delete_rec_list_write_log(
log_ptr = mlog_open_and_write_index(mtr, rec, index, type, 2);
if (log_ptr) {
/* Write the parameter as a 2-byte ulint */
mach_write_to_2(log_ptr, ut_align_offset(rec, UNIV_PAGE_SIZE));
mach_write_to_2(log_ptr, page_offset(rec));
mlog_close(mtr, log_ptr + 2);
}
}

View file

@ -333,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 */
@ -346,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;
@ -675,10 +675,11 @@ 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))) {
@ -903,8 +904,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);

View file

@ -254,43 +254,43 @@ pars_resolve_func_data_type(
== DATA_INT);
} else if (func == PARS_COUNT_TOKEN) {
ut_a(arg);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
} 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);
} 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);
} else {
dtype_set(que_node_get_data_type(node), DATA_BINARY,
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);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
} else if (func == PARS_BINARY_TO_NUMBER_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
} else if (func == PARS_LENGTH_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
} else if (func == PARS_INSTR_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
} else if (func == PARS_SYSDATE_TOKEN) {
ut_a(arg == NULL);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
} else if ((func == PARS_SUBSTR_TOKEN)
|| (func == PARS_CONCAT_TOKEN)) {
@ -298,7 +298,7 @@ pars_resolve_func_data_type(
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
DATA_ENGLISH, 0, 0);
DATA_ENGLISH, 0);
} else if ((func == '>') || (func == '<') || (func == '=')
|| (func == PARS_GE_TOKEN)
@ -310,18 +310,18 @@ pars_resolve_func_data_type(
|| (func == PARS_NOTFOUND_TOKEN)) {
/* We currently have no iboolean type: use integer type */
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
} else if (func == PARS_RND_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
} else if (func == PARS_RND_STR_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);
} else {
ut_error;
}
@ -450,7 +450,6 @@ pars_resolve_exp_columns(
sym_node_t* sym_node;
dict_table_t* table;
sym_node_t* t_node;
dict_col_t* col;
ulint n_cols;
ulint i;
@ -490,10 +489,13 @@ pars_resolve_exp_columns(
n_cols = dict_table_get_n_cols(table);
for (i = 0; i < n_cols; i++) {
col = dict_table_get_nth_col(table, i);
const dict_col_t* col
= dict_table_get_nth_col(table, i);
const char* col_name
= dict_table_get_col_name(table, i);
if ((sym_node->name_len == ut_strlen(col->name))
&& (0 == ut_memcmp(sym_node->name, col->name,
if ((sym_node->name_len == ut_strlen(col_name))
&& (0 == ut_memcmp(sym_node->name, col_name,
sym_node->name_len))) {
/* Found */
sym_node->resolved = TRUE;
@ -502,8 +504,10 @@ pars_resolve_exp_columns(
sym_node->col_no = i;
sym_node->prefetch_buf = NULL;
dfield_set_type(&(sym_node->common.val),
dict_col_get_type(col));
dict_col_copy_type(
col,
dfield_get_type(&sym_node
->common.val));
return;
}
@ -592,7 +596,6 @@ pars_select_all_columns(
sym_node_t* col_node;
sym_node_t* table_node;
dict_table_t* table;
dict_col_t* col;
ulint i;
select_node->select_list = NULL;
@ -603,15 +606,15 @@ pars_select_all_columns(
table = table_node->table;
for (i = 0; i < dict_table_get_n_user_cols(table); i++) {
col = dict_table_get_nth_col(table, i);
const char* col_name = dict_table_get_col_name(
table, i);
col_node = sym_tab_add_id(pars_sym_tab_global,
(byte*)col->name,
ut_strlen(col->name));
select_node->select_list
= que_node_list_add_last
(select_node->select_list, col_node);
(byte*)col_name,
ut_strlen(col_name));
select_node->select_list = que_node_list_add_last(
select_node->select_list, col_node);
}
table_node = que_node_get_next(table_node);
@ -888,10 +891,12 @@ pars_process_assign_list(
pars_resolve_exp_columns(table_sym, assign_node->val);
pars_resolve_exp_variables_and_types(NULL, assign_node->val);
#if 0
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))));
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))));
#endif
/* Add to the update node all the columns found in assignment
@ -915,13 +920,14 @@ 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),
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 (!dict_col_get_fixed_size(
dict_index_get_nth_col(clust_index,
upd_field->field_no))) {
changes_field_size = 0;
}
@ -1126,23 +1132,23 @@ pars_set_dfield_type(
if (type == &pars_int_token) {
ut_a(len == 0);
dtype_set(dfield_get_type(dfield), DATA_INT, flags, 4, 0);
dtype_set(dfield_get_type(dfield), DATA_INT, flags, 4);
} else if (type == &pars_char_token) {
ut_a(len == 0);
dtype_set(dfield_get_type(dfield), DATA_VARCHAR,
DATA_ENGLISH | flags, 0, 0);
DATA_ENGLISH | flags, 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);
} 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);
} else {
ut_error;
}
@ -1599,7 +1605,8 @@ pars_create_table(
sym_node_t* table_sym, /* in: table name node in the symbol
table */
sym_node_t* column_defs, /* in: list of column names */
void* not_fit_in_memory)/* in: a non-NULL pointer means that
void* not_fit_in_memory __attribute__((unused)))
/* in: a non-NULL pointer means that
this is a table which in simulations
should be simulated as not fitting
in memory; thread is put to sleep
@ -1623,18 +1630,18 @@ pars_create_table(
create tables in the old (not compact) record format. */
table = dict_mem_table_create(table_sym->name, 0, n_cols, 0);
#ifdef UNIV_DEBUG
if (not_fit_in_memory != NULL) {
table->does_not_fit_in_memory = TRUE;
}
#endif /* UNIV_DEBUG */
column = column_defs;
while (column) {
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);
column->resolved = TRUE;
column->token_type = SYM_COLUMN;
@ -1859,8 +1866,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;

View file

@ -102,7 +102,7 @@ sym_tab_add_int_lit(
node->indirection = NULL;
dtype_set(&(node->common.val.type), DATA_INT, 0, 4, 0);
dtype_set(&(node->common.val.type), DATA_INT, 0, 4);
data = mem_heap_alloc(sym_tab->heap, 4);
mach_write_to_4(data, val);
@ -144,7 +144,7 @@ sym_tab_add_str_lit(
node->indirection = NULL;
dtype_set(&(node->common.val.type), DATA_VARCHAR, DATA_ENGLISH, 0, 0);
dtype_set(&(node->common.val.type), DATA_VARCHAR, DATA_ENGLISH, 0);
if (len) {
data = mem_heap_alloc(sym_tab->heap, len);
@ -226,7 +226,7 @@ sym_tab_add_bound_lit(
ut_error;
}
dtype_set(&(node->common.val.type), blit->type, blit->prtype, len, 0);
dtype_set(&(node->common.val.type), blit->type, blit->prtype, len);
dfield_set_data(&(node->common.val), blit->address, blit->length);

View file

@ -200,8 +200,9 @@ read_view_oldest_copy_or_open_new(
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 +217,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;
}
@ -379,10 +380,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)));
}
}
@ -420,8 +421,8 @@ read_cursor_view_create_for_mysql(
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;

View file

@ -92,47 +92,48 @@ cmp_collate(
}
/*****************************************************************
Returns TRUE if two types are equal for comparison purposes. */
Returns TRUE if two columns are equal for comparison purposes. */
ibool
cmp_types_are_equal(
/*================*/
/* out: TRUE if the types are considered
equal in comparisons */
dtype_t* type1, /* in: type 1 */
dtype_t* type2, /* in: type 2 */
ibool check_charsets) /* in: whether to check charsets */
cmp_cols_are_equal(
/*===============*/
/* out: TRUE if the columns are
considered equal in comparisons */
const dict_col_t* col1, /* in: column 1 */
const dict_col_t* col2, /* in: column 2 */
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)) {
if (dtype_is_non_binary_string_type(col1->mtype, col1->prtype)
&& dtype_is_non_binary_string_type(col2->mtype, col2->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));
return(dtype_get_charset_coll(col1->prtype)
== dtype_get_charset_coll(col2->prtype));
} else {
return(TRUE);
}
}
if (dtype_is_binary_string_type(type1->mtype, type1->prtype)
&& dtype_is_binary_string_type(type2->mtype, type2->prtype)) {
if (dtype_is_binary_string_type(col1->mtype, col1->prtype)
&& dtype_is_binary_string_type(col2->mtype, col2->prtype)) {
/* Both are binary string types: they can be compared */
return(TRUE);
}
if (type1->mtype != type2->mtype) {
if (col1->mtype != col2->mtype) {
return(FALSE);
}
if (type1->mtype == DATA_INT
&& (type1->prtype & DATA_UNSIGNED)
!= (type2->prtype & DATA_UNSIGNED)) {
if (col1->mtype == DATA_INT
&& (col1->prtype & DATA_UNSIGNED)
!= (col2->prtype & DATA_UNSIGNED)) {
/* The storage format of an unsigned integer is different
from a signed integer: in a signed integer we OR
@ -141,12 +142,7 @@ cmp_types_are_equal(
return(FALSE);
}
if (type1->mtype == DATA_INT && type1->len != type2->len) {
return(FALSE);
}
return(TRUE);
return(col1->mtype != DATA_INT || col1->len == col2->len);
}
#ifndef UNIV_HOTBACKUP
@ -159,7 +155,8 @@ cmp_whole_field(
/*============*/
/* out: 1, 0, -1, if a is greater,
equal, less than b, respectively */
dtype_t* type, /* in: data type */
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type */
unsigned char* a, /* in: data field */
unsigned int a_length, /* in: data field length,
not UNIV_SQL_NULL */
@ -172,11 +169,8 @@ cmp_whole_field(
double d_1;
double d_2;
int swap_flag = 1;
ulint data_type;
data_type = type->mtype;
switch (data_type) {
switch (mtype) {
case DATA_DECIMAL:
/* Remove preceding spaces */
@ -253,11 +247,8 @@ cmp_whole_field(
}
return(0);
case DATA_VARMYSQL:
case DATA_MYSQL:
case DATA_BLOB:
if (data_type == DATA_BLOB
&& 0 != (type->prtype & DATA_BINARY_TYPE)) {
if (prtype & DATA_BINARY_TYPE) {
ut_print_timestamp(stderr);
fprintf(stderr,
@ -265,15 +256,17 @@ cmp_whole_field(
" 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));
/* fall through */
case DATA_VARMYSQL:
case DATA_MYSQL:
return(innobase_mysql_cmp(
(int)(prtype & DATA_MYSQL_TYPE_MASK),
(uint)dtype_get_charset_coll(prtype),
a, a_length, b, b_length));
default:
fprintf(stderr,
"InnoDB: unknown type number %lu\n",
(ulong) data_type);
(ulong) mtype);
ut_error;
}
@ -290,7 +283,8 @@ cmp_data_data_slow(
/*===============*/
/* out: 1, 0, -1, if data1 is greater, equal,
less than data2, respectively */
dtype_t* cur_type,/* in: data type of the fields */
ulint mtype, /* in: main type */
ulint prtype, /* in: precise type */
byte* data1, /* in: data field (== a pointer to a memory
buffer) */
ulint len1, /* in: data field length or UNIV_SQL_NULL */
@ -303,8 +297,6 @@ cmp_data_data_slow(
ulint data2_byte;
ulint cur_bytes;
ut_ad(dtype_validate(cur_type));
if (len1 == UNIV_SQL_NULL || len2 == UNIV_SQL_NULL) {
if (len1 == len2) {
@ -322,13 +314,13 @@ cmp_data_data_slow(
return(1);
}
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)
if (mtype >= DATA_FLOAT
|| (mtype == DATA_BLOB
&& 0 == (prtype & DATA_BINARY_TYPE)
&& dtype_get_charset_coll(prtype)
!= DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
return(cmp_whole_field(cur_type,
return(cmp_whole_field(mtype, prtype,
data1, (unsigned) len1,
data2, (unsigned) len2));
}
@ -344,7 +336,7 @@ cmp_data_data_slow(
return(0);
}
data1_byte = dtype_get_pad_char(cur_type);
data1_byte = dtype_get_pad_char(mtype, prtype);
if (data1_byte == ULINT_UNDEFINED) {
@ -355,7 +347,7 @@ cmp_data_data_slow(
}
if (len2 <= cur_bytes) {
data2_byte = dtype_get_pad_char(cur_type);
data2_byte = dtype_get_pad_char(mtype, prtype);
if (data2_byte == ULINT_UNDEFINED) {
@ -372,9 +364,9 @@ cmp_data_data_slow(
goto next_byte;
}
if (cur_type->mtype <= DATA_CHAR
|| (cur_type->mtype == DATA_BLOB
&& 0 == (cur_type->prtype & DATA_BINARY_TYPE))) {
if (mtype <= DATA_CHAR
|| (mtype == DATA_BLOB
&& 0 == (prtype & DATA_BINARY_TYPE))) {
data1_byte = cmp_collate(data1_byte);
data2_byte = cmp_collate(data2_byte);
@ -435,8 +427,6 @@ cmp_dtuple_rec_with_match(
value for current comparison */
{
#ifndef UNIV_HOTBACKUP
dtype_t* cur_type; /* pointer to type of the current
field in dtuple */
dfield_t* dtuple_field; /* current field in logical record */
ulint dtuple_f_len; /* the length of the current field
in the logical record */
@ -483,8 +473,17 @@ cmp_dtuple_rec_with_match(
while (cur_field < dtuple_get_n_fields_cmp(dtuple)) {
ulint mtype;
ulint prtype;
dtuple_field = dtuple_get_nth_field(dtuple, cur_field);
cur_type = dfield_get_type(dtuple_field);
{
const dtype_t* type
= dfield_get_type(dtuple_field);
mtype = type->mtype;
prtype = type->prtype;
}
dtuple_f_len = dfield_get_len(dtuple_field);
@ -524,13 +523,13 @@ 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)
if (mtype >= DATA_FLOAT
|| (mtype == DATA_BLOB
&& 0 == (prtype & DATA_BINARY_TYPE)
&& dtype_get_charset_coll(prtype)
!= DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
ret = cmp_whole_field(cur_type,
ret = cmp_whole_field(mtype, prtype,
dfield_get_data(dtuple_field),
(unsigned) dtuple_f_len,
rec_b_ptr, (unsigned) rec_f_len);
@ -558,7 +557,7 @@ cmp_dtuple_rec_with_match(
goto next_field;
}
rec_byte = dtype_get_pad_char(cur_type);
rec_byte = dtype_get_pad_char(mtype, prtype);
if (rec_byte == ULINT_UNDEFINED) {
ret = 1;
@ -570,7 +569,8 @@ cmp_dtuple_rec_with_match(
}
if (UNIV_UNLIKELY(dtuple_f_len <= cur_bytes)) {
dtuple_byte = dtype_get_pad_char(cur_type);
dtuple_byte = dtype_get_pad_char(mtype,
prtype);
if (dtuple_byte == ULINT_UNDEFINED) {
ret = -1;
@ -589,9 +589,9 @@ cmp_dtuple_rec_with_match(
goto next_byte;
}
if (cur_type->mtype <= DATA_CHAR
|| (cur_type->mtype == DATA_BLOB
&& !(cur_type->prtype & DATA_BINARY_TYPE))) {
if (mtype <= DATA_CHAR
|| (mtype == DATA_BLOB
&& !(prtype & DATA_BINARY_TYPE))) {
rec_byte = cmp_collate(rec_byte);
dtuple_byte = cmp_collate(dtuple_byte);
@ -696,8 +696,8 @@ cmp_dtuple_is_prefix_of_rec(
}
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);
}
@ -730,8 +730,6 @@ cmp_rec_rec_with_match(
the value for the current comparison */
{
#ifndef UNIV_HOTBACKUP
dtype_t* cur_type; /* pointer to type struct of the
current field in index */
ulint rec1_n_fields; /* the number of fields in rec */
ulint rec1_f_len; /* length of current field in rec */
byte* rec1_b_ptr; /* pointer to the current byte in rec field */
@ -764,12 +762,19 @@ cmp_rec_rec_with_match(
while ((cur_field < rec1_n_fields) && (cur_field < rec2_n_fields)) {
if (index->type & DICT_UNIVERSAL) {
cur_type = dtype_binary;
ulint mtype;
ulint prtype;
if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
/* This is for the insert buffer B-tree. */
mtype = DATA_BINARY;
prtype = 0;
} else {
cur_type = dict_col_get_type
(dict_field_get_col(dict_index_get_nth_field
(index, cur_field)));
const dict_col_t* col
= dict_index_get_nth_col(index, cur_field);
mtype = col->mtype;
prtype = col->prtype;
}
rec1_b_ptr = rec_get_nth_field(rec1, offsets1,
@ -834,13 +839,13 @@ 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)
if (mtype >= DATA_FLOAT
|| (mtype == DATA_BLOB
&& 0 == (prtype & DATA_BINARY_TYPE)
&& dtype_get_charset_coll(prtype)
!= DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
ret = cmp_whole_field(cur_type,
ret = cmp_whole_field(mtype, prtype,
rec1_b_ptr,
(unsigned) rec1_f_len,
rec2_b_ptr,
@ -867,7 +872,7 @@ cmp_rec_rec_with_match(
goto next_field;
}
rec2_byte = dtype_get_pad_char(cur_type);
rec2_byte = dtype_get_pad_char(mtype, prtype);
if (rec2_byte == ULINT_UNDEFINED) {
ret = 1;
@ -879,7 +884,7 @@ cmp_rec_rec_with_match(
}
if (rec1_f_len <= cur_bytes) {
rec1_byte = dtype_get_pad_char(cur_type);
rec1_byte = dtype_get_pad_char(mtype, prtype);
if (rec1_byte == ULINT_UNDEFINED) {
ret = -1;
@ -898,9 +903,9 @@ cmp_rec_rec_with_match(
goto next_byte;
}
if (cur_type->mtype <= DATA_CHAR
|| (cur_type->mtype == DATA_BLOB
&& !(cur_type->prtype & DATA_BINARY_TYPE))) {
if (mtype <= DATA_CHAR
|| (mtype == DATA_BLOB
&& !(prtype & DATA_BINARY_TYPE))) {
rec1_byte = cmp_collate(rec1_byte);
rec2_byte = cmp_collate(rec2_byte);
@ -972,8 +977,6 @@ cmp_debug_dtuple_rec_with_match(
returns, contains the value for current
comparison */
{
dtype_t* cur_type; /* pointer to type of the current
field in dtuple */
dfield_t* dtuple_field; /* current field in logical record */
ulint dtuple_f_len; /* the length of the current field
in the logical record */
@ -1014,9 +1017,17 @@ cmp_debug_dtuple_rec_with_match(
while (cur_field < dtuple_get_n_fields_cmp(dtuple)) {
dtuple_field = dtuple_get_nth_field(dtuple, cur_field);
ulint mtype;
ulint prtype;
cur_type = dfield_get_type(dtuple_field);
dtuple_field = dtuple_get_nth_field(dtuple, cur_field);
{
const dtype_t* type
= dfield_get_type(dtuple_field);
mtype = type->mtype;
prtype = type->prtype;
}
dtuple_f_data = dfield_get_data(dtuple_field);
dtuple_f_len = dfield_get_len(dtuple_field);
@ -1032,7 +1043,7 @@ cmp_debug_dtuple_rec_with_match(
goto order_resolved;
}
ret = cmp_data_data(cur_type, dtuple_f_data, dtuple_f_len,
ret = cmp_data_data(mtype, prtype, dtuple_f_data, dtuple_f_len,
rec_f_data, rec_f_len);
if (ret != 0) {
goto order_resolved;

View file

@ -202,8 +202,7 @@ rec_init_offsets(
}
field = dict_index_get_nth_field(index, i);
if (!(dtype_get_prtype(dict_col_get_type
(dict_field_get_col(field)))
if (!(dict_field_get_col(field)->prtype
& DATA_NOT_NULL)) {
/* nullable field => read the null flag */
@ -226,11 +225,11 @@ 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));
const dict_col_t* col
= dict_field_get_col(field);
len = *lens--;
if (UNIV_UNLIKELY(dtype_get_len(type) > 255)
|| UNIV_UNLIKELY(dtype_get_mtype(type)
if (UNIV_UNLIKELY(col->len > 255)
|| UNIV_UNLIKELY(col->mtype
== DATA_BLOB)) {
if (len & 0x80) {
/* 1exxxxxxx xxxxxxxx */
@ -442,8 +441,6 @@ rec_get_converted_size_new(
{
ulint size = REC_N_NEW_EXTRA_BYTES
+ (index->n_nullable + 7) / 8;
dict_field_t* field;
dtype_t* type;
ulint i;
ulint n_fields;
ut_ad(index && dtuple);
@ -471,25 +468,27 @@ rec_get_converted_size_new(
/* read the lengths of fields 0..n */
for (i = 0; i < n_fields; i++) {
ulint len = dtuple_get_nth_field(dtuple, i)->len;
dict_field_t* field;
ulint len;
const dict_col_t* col;
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));
len = dtuple_get_nth_field(dtuple, i)->len;
col = dict_field_get_col(field);
ut_ad(len != UNIV_SQL_NULL || !(col->prtype & DATA_NOT_NULL));
if (len == UNIV_SQL_NULL) {
/* No length is stored for NULL fields. */
continue;
}
ut_ad(len <= dtype_get_len(type)
|| dtype_get_mtype(type) == DATA_BLOB);
ut_ad(len <= col->len || col->mtype == 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)) {
|| (col->len < 256 && col->mtype != DATA_BLOB)) {
size++;
} else {
size += 2;
@ -588,8 +587,6 @@ rec_set_nth_field_extern_bit_new(
{
byte* nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
byte* lens = nulls - (index->n_nullable + 7) / 8;
dict_field_t* field;
dtype_t* type;
ulint i;
ulint n_fields;
ulint null_mask = 1;
@ -603,9 +600,13 @@ rec_set_nth_field_extern_bit_new(
/* read the lengths of fields 0..n */
for (i = 0; i < n_fields; i++) {
const dict_field_t* field;
const dict_col_t* col;
field = dict_index_get_nth_field(index, i);
type = dict_col_get_type(dict_field_get_col(field));
if (!(dtype_get_prtype(type) & DATA_NOT_NULL)) {
col = dict_field_get_col(field);
if (!(col->prtype & DATA_NOT_NULL)) {
if (UNIV_UNLIKELY(!(byte) null_mask)) {
nulls--;
null_mask = 1;
@ -629,8 +630,7 @@ rec_set_nth_field_extern_bit_new(
continue;
}
lens--;
if (dtype_get_len(type) > 255
|| dtype_get_mtype(type) == DATA_BLOB) {
if (col->len > 255 || col->mtype == DATA_BLOB) {
ulint len = lens[1];
if (len & 0x80) { /* 1exxxxxx: 2-byte length */
if (i == ith) {
@ -640,9 +640,10 @@ 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;
}
@ -767,8 +768,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;
@ -795,8 +796,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;
@ -1057,8 +1058,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++) {
@ -1137,8 +1138,6 @@ rec_copy_prefix_to_buf(
{
byte* nulls;
byte* lens;
dict_field_t* field;
dtype_t* type;
ulint i;
ulint prefix_len;
ulint null_mask;
@ -1148,10 +1147,10 @@ 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,
rec_get_field_start_offs(rec, n_fields),
buf, buf_size));
return(rec_copy_prefix_to_buf_old(
rec, n_fields,
rec_get_field_start_offs(rec, n_fields),
buf, buf_size));
}
status = rec_get_status(rec);
@ -1180,9 +1179,13 @@ rec_copy_prefix_to_buf(
/* read the lengths of fields 0..n */
for (i = 0; i < n_fields; i++) {
const dict_field_t* field;
const dict_col_t* col;
field = dict_index_get_nth_field(index, i);
type = dict_col_get_type(dict_field_get_col(field));
if (!(dtype_get_prtype(type) & DATA_NOT_NULL)) {
col = dict_field_get_col(field);
if (!(col->prtype & DATA_NOT_NULL)) {
/* nullable field => read the null flag */
if (UNIV_UNLIKELY(!(byte) null_mask)) {
nulls--;
@ -1201,8 +1204,7 @@ rec_copy_prefix_to_buf(
prefix_len += field->fixed_len;
} else {
ulint len = *lens--;
if (dtype_get_len(type) > 255
|| dtype_get_mtype(type) == DATA_BLOB) {
if (col->len > 255 || col->mtype == DATA_BLOB) {
if (len & 0x80) {
/* 1exxxxxx */
len &= 0x3f;

View file

@ -135,12 +135,12 @@ row_ins_alloc_sys_fields(
/*=====================*/
ins_node_t* node) /* in: insert node */
{
dtuple_t* row;
dict_table_t* table;
mem_heap_t* heap;
dict_col_t* col;
dfield_t* dfield;
byte* ptr;
dtuple_t* row;
dict_table_t* table;
mem_heap_t* heap;
const dict_col_t* col;
dfield_t* dfield;
byte* ptr;
row = node->row;
table = node->table;
@ -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 */
@ -445,7 +445,6 @@ row_ins_cascade_calc_update_vec(
upd_field_t* parent_ufield;
ulint n_fields_updated;
ulint parent_field_no;
dtype_t* type;
ulint i;
ulint j;
@ -470,16 +469,19 @@ 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;
if (parent_ufield->field_no == parent_field_no) {
ulint min_size;
ulint min_size;
const dict_col_t* col;
col = dict_index_get_nth_col(index, i);
/* A field in the parent index record is
updated. Let us make the update vector
@ -488,20 +490,17 @@ 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));
= dict_table_get_nth_col_pos(
table, dict_col_get_no(col));
ufield->exp = NULL;
ufield->new_val = parent_ufield->new_val;
type = dict_index_get_nth_type(index, i);
/* Do not allow a NOT NULL column to be
updated as NULL */
if (ufield->new_val.len == UNIV_SQL_NULL
&& (type->prtype & DATA_NOT_NULL)) {
&& (col->prtype & DATA_NOT_NULL)) {
return(ULINT_UNDEFINED);
}
@ -510,9 +509,12 @@ 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)
&& dtype_get_at_most_n_mbchars(
col->prtype,
col->mbminlen, col->mbmaxlen,
col->len,
ufield->new_val.len,
ufield->new_val.data)
< ufield->new_val.len) {
return(ULINT_UNDEFINED);
@ -523,7 +525,7 @@ row_ins_cascade_calc_update_vec(
need to pad with spaces the new value of the
child column */
min_size = dtype_get_min_size(type);
min_size = dict_col_get_min_size(col);
if (min_size
&& ufield->new_val.len != UNIV_SQL_NULL
@ -531,8 +533,8 @@ row_ins_cascade_calc_update_vec(
char* pad_start;
const char* pad_end;
ufield->new_val.data = mem_heap_alloc
(heap, min_size);
ufield->new_val.data = mem_heap_alloc(
heap, min_size);
pad_start = ((char*) ufield
->new_val.data)
+ ufield->new_val.len;
@ -544,14 +546,13 @@ row_ins_cascade_calc_update_vec(
parent_ufield->new_val.data,
parent_ufield->new_val.len);
switch (UNIV_EXPECT(dtype_get_mbminlen
(type), 1)) {
switch (UNIV_EXPECT(col->mbminlen,1)) {
default:
ut_error;
case 1:
if (UNIV_UNLIKELY
(dtype_get_charset_coll
(dtype_get_prtype(type))
(dtype_get_charset_coll(
col->prtype)
== DATA_MYSQL_BINARY_CHARSET_COLL)) {
/* Do not pad BINARY
columns. */
@ -603,8 +604,8 @@ 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);
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");
@ -834,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);
}
@ -881,11 +882,11 @@ row_ins_foreign_check_on_constraint(
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;
}
@ -893,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;
}
@ -961,9 +962,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) {
@ -995,8 +996,9 @@ 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;
@ -1017,14 +1019,14 @@ row_ins_foreign_check_on_constraint(
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;
}
@ -1133,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);
@ -1164,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);
@ -1232,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;
}
@ -1286,8 +1288,8 @@ run_again:
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);
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);
@ -1348,9 +1350,8 @@ run_again:
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;
@ -1364,9 +1365,9 @@ 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);
err = row_ins_set_shared_rec_lock(
LOCK_ORDINARY, rec, check_index,
offsets, thr);
if (err != DB_SUCCESS) {
break;
@ -1376,9 +1377,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) {
@ -1394,9 +1395,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
@ -1417,9 +1418,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;
@ -1428,8 +1429,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;
@ -1437,8 +1438,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;
}
@ -1453,8 +1454,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;
@ -1546,8 +1547,8 @@ 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));
@ -1617,8 +1618,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);
}
@ -1665,8 +1666,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);
}
@ -1702,12 +1703,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) {
@ -1831,22 +1832,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;
@ -1869,22 +1870,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;
@ -2021,8 +2022,8 @@ 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)
@ -2040,16 +2041,16 @@ row_ins_index_entry_low(
/* 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) {
@ -2084,19 +2085,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()) {
@ -2105,9 +2106,9 @@ 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) {
@ -2211,7 +2212,6 @@ row_ins_index_entry_set_vals(
dfield_t* row_field;
ulint n_fields;
ulint i;
dtype_t* cur_type;
ut_ad(entry && row);
@ -2227,12 +2227,13 @@ row_ins_index_entry_set_vals(
if (ind_field->prefix_len > 0
&& dfield_get_len(row_field) != UNIV_SQL_NULL) {
cur_type = dict_col_get_type
(dict_field_get_col(ind_field));
const dict_col_t* col
= 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(
col->prtype, col->mbminlen, col->mbmaxlen,
ind_field->prefix_len,
row_field->len, row_field->data);
} else {
field->len = row_field->len;
}

View file

@ -417,13 +417,13 @@ row_mysql_convert_row_to_innobase(
}
}
row_mysql_store_col_in_innobase_format
(dfield,
prebuilt->ins_upd_rec_buff + templ->mysql_col_offset,
TRUE, /* MySQL row format data */
mysql_rec + templ->mysql_col_offset,
templ->mysql_col_len,
dict_table_is_comp(prebuilt->table));
row_mysql_store_col_in_innobase_format(
dfield,
prebuilt->ins_upd_rec_buff + templ->mysql_col_offset,
TRUE, /* MySQL row format data */
mysql_rec + templ->mysql_col_offset,
templ->mysql_col_len,
dict_table_is_comp(prebuilt->table));
next_column:
;
}
@ -619,8 +619,8 @@ row_create_prebuilt(
prebuilt->sel_graph = NULL;
prebuilt->search_tuple = dtuple_create
(heap, 2 * dict_table_get_n_cols(table));
prebuilt->search_tuple = dtuple_create(
heap, 2 * dict_table_get_n_cols(table));
clust_index = dict_table_get_first_index(table);
@ -707,16 +707,16 @@ row_prebuilt_free(
for (i = 0; i < MYSQL_FETCH_CACHE_SIZE; i++) {
if (prebuilt->fetch_cache[i] != NULL) {
if ((ROW_PREBUILT_FETCH_MAGIC_N != mach_read_from_4
((prebuilt->fetch_cache[i]) - 4))
|| (ROW_PREBUILT_FETCH_MAGIC_N != mach_read_from_4
((prebuilt->fetch_cache[i])
+ prebuilt->mysql_row_len))) {
if ((ROW_PREBUILT_FETCH_MAGIC_N != mach_read_from_4(
(prebuilt->fetch_cache[i]) - 4))
|| (ROW_PREBUILT_FETCH_MAGIC_N != mach_read_from_4(
(prebuilt->fetch_cache[i])
+ prebuilt->mysql_row_len))) {
fputs("InnoDB: Error: trying to free"
" a corrupt fetch buffer.\n", stderr);
mem_analyze_corruption
(prebuilt->fetch_cache[i]);
mem_analyze_corruption(
prebuilt->fetch_cache[i]);
ut_error;
}
@ -811,8 +811,8 @@ row_get_prebuilt_insert_row(
prebuilt->ins_node = node;
if (prebuilt->ins_upd_rec_buff == NULL) {
prebuilt->ins_upd_rec_buff = mem_heap_alloc
(prebuilt->heap, prebuilt->mysql_row_len);
prebuilt->ins_upd_rec_buff = mem_heap_alloc(
prebuilt->heap, prebuilt->mysql_row_len);
}
row = dtuple_create(prebuilt->heap,
@ -830,10 +830,10 @@ row_get_prebuilt_insert_row(
ins_node_set_new_row(node, row);
prebuilt->ins_graph = que_node_get_parent
(pars_complete_graph_for_exec(node,
prebuilt->trx,
prebuilt->heap));
prebuilt->ins_graph = que_node_get_parent(
pars_complete_graph_for_exec(node,
prebuilt->trx,
prebuilt->heap));
prebuilt->ins_graph->state = QUE_FORK_ACTIVE;
}
@ -1188,10 +1188,10 @@ row_prebuild_sel_graph(
node = sel_node_create(prebuilt->heap);
prebuilt->sel_graph = que_node_get_parent
(pars_complete_graph_for_exec(node,
prebuilt->trx,
prebuilt->heap));
prebuilt->sel_graph = que_node_get_parent(
pars_complete_graph_for_exec(node,
prebuilt->trx,
prebuilt->heap));
prebuilt->sel_graph->state = QUE_FORK_ACTIVE;
}
@ -1260,10 +1260,10 @@ row_get_prebuilt_update_vector(
prebuilt->upd_node = node;
prebuilt->upd_graph = que_node_get_parent
(pars_complete_graph_for_exec(node,
prebuilt->trx,
prebuilt->heap));
prebuilt->upd_graph = que_node_get_parent(
pars_complete_graph_for_exec(node,
prebuilt->trx,
prebuilt->heap));
prebuilt->upd_graph->state = QUE_FORK_ACTIVE;
}
@ -1607,16 +1607,11 @@ row_table_got_default_clust_index(
/*==============================*/
dict_table_t* table)
{
dict_index_t* clust_index;
const dict_index_t* clust_index;
clust_index = dict_table_get_first_index(table);
if (dtype_get_mtype(dict_index_get_nth_type(clust_index, 0))
== DATA_SYS) {
return(TRUE);
}
return(FALSE);
return(dict_index_get_nth_col(clust_index, 0)->mtype == DATA_SYS);
}
/*************************************************************************
@ -1782,9 +1777,8 @@ row_create_table_for_mysql(
/* Check that no reserved column names are used. */
for (i = 0; i < dict_table_get_n_user_cols(table); i++) {
dict_col_t* col = dict_table_get_nth_col(table, i);
if (dict_col_name_is_reserved(col->name)) {
if (dict_col_name_is_reserved(
dict_table_get_col_name(table, i))) {
dict_mem_table_free(table);
trx_commit_for_mysql(trx);
@ -1975,16 +1969,16 @@ row_create_index_for_mysql(
for (i = 0; i < dict_index_get_n_fields(index); i++) {
for (j = 0; j < i; j++) {
if (0 == ut_strcmp
(dict_index_get_nth_field(index, j)->name,
dict_index_get_nth_field(index, i)->name)) {
if (0 == ut_strcmp(
dict_index_get_nth_field(index, j)->name,
dict_index_get_nth_field(index, i)->name)) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: column ", stderr);
ut_print_name(stderr, trx, FALSE,
dict_index_get_nth_field
(index, i)->name);
dict_index_get_nth_field(
index, i)->name);
fputs(" appears twice in ", stderr);
dict_index_name_print(stderr, trx, index);
fputs("\n"
@ -2205,8 +2199,8 @@ loop:
goto already_dropped;
}
if (DB_SUCCESS != row_drop_table_for_mysql_in_background
(drop->table_name)) {
if (DB_SUCCESS != row_drop_table_for_mysql_in_background(
drop->table_name)) {
/* If the DROP fails for some table, we return, and let the
main thread retry later */
@ -2835,9 +2829,9 @@ row_truncate_table_for_mysql(
rec = btr_pcur_get_rec(&pcur);
if (root_page_no != FIL_NULL) {
page_rec_write_index_page_no
(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
root_page_no, &mtr);
page_rec_write_index_page_no(
rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
root_page_no, &mtr);
/* We will need to commit and restart the
mini-transaction in order to avoid deadlocks.
The dict_truncate_index_tree() call has allocated
@ -3038,8 +3032,8 @@ check_next_foreign:
}
if (foreign && trx->check_foreigns
&& !(drop_db && dict_tables_have_same_db
(name, foreign->foreign_table_name))) {
&& !(drop_db && dict_tables_have_same_db(
name, foreign->foreign_table_name))) {
FILE* ef = dict_foreign_err_file;
/* We only allow dropping a referenced table if
@ -3232,8 +3226,8 @@ check_next_foreign:
space_id = table->space;
if (table->dir_path_of_temp_table != NULL) {
dir_path_of_temp_table = mem_strdup
(table->dir_path_of_temp_table);
dir_path_of_temp_table = mem_strdup(
table->dir_path_of_temp_table);
is_path = TRUE;
name_or_path = dir_path_of_temp_table;
} else {
@ -3447,8 +3441,8 @@ row_delete_constraint(
ulint err;
/* New format constraints have ids <databasename>/<constraintname>. */
err = row_delete_constraint_low
(mem_heap_strcat(heap, database_name, id), trx);
err = row_delete_constraint_low(
mem_heap_strcat(heap, database_name, id), trx);
if ((err == DB_SUCCESS) && !strchr(id, '/')) {
/* Old format < 4.0.18 constraints have constraint ids
@ -3570,9 +3564,9 @@ row_rename_table_for_mysql(
heap = mem_heap_create(100);
err = dict_foreign_parse_drop_constraints
(heap, trx, table,
&n_constraints_to_drop, &constraints_to_drop);
err = dict_foreign_parse_drop_constraints(
heap, trx, table, &n_constraints_to_drop,
&constraints_to_drop);
if (err != DB_SUCCESS) {
@ -3611,71 +3605,71 @@ row_rename_table_for_mysql(
pars_info_add_str_literal(info, "new_table_name", new_name);
pars_info_add_str_literal(info, "old_table_name", old_name);
err = que_eval_sql
(info,
"PROCEDURE RENAME_CONSTRAINT_IDS () IS\n"
"gen_constr_prefix CHAR;\n"
"new_db_name CHAR;\n"
"foreign_id CHAR;\n"
"new_foreign_id CHAR;\n"
"old_db_name_len INT;\n"
"old_t_name_len INT;\n"
"new_db_name_len INT;\n"
"id_len INT;\n"
"found INT;\n"
"BEGIN\n"
"found := 1;\n"
"old_db_name_len := INSTR(:old_table_name, '/')-1;\n"
"new_db_name_len := INSTR(:new_table_name, '/')-1;\n"
"new_db_name := SUBSTR(:new_table_name, 0,\n"
" new_db_name_len);\n"
"old_t_name_len := LENGTH(:old_table_name);\n"
"gen_constr_prefix := CONCAT(:old_table_name,\n"
" '_ibfk_');\n"
"WHILE found = 1 LOOP\n"
" SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n"
" WHERE FOR_NAME = :old_table_name\n"
" AND TO_BINARY(FOR_NAME)\n"
" = TO_BINARY(:old_table_name)\n"
" LOCK IN SHARE MODE;\n"
" IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n"
" ELSE\n"
" UPDATE SYS_FOREIGN\n"
" SET FOR_NAME = :new_table_name\n"
" WHERE ID = foreign_id;\n"
" id_len := LENGTH(foreign_id);\n"
" IF (INSTR(foreign_id, '/') > 0) THEN\n"
" IF (INSTR(foreign_id,\n"
" gen_constr_prefix) > 0)\n"
" THEN\n"
" new_foreign_id :=\n"
" CONCAT(:new_table_name,\n"
" SUBSTR(foreign_id, old_t_name_len,\n"
" id_len - old_t_name_len));\n"
" ELSE\n"
" new_foreign_id :=\n"
" CONCAT(new_db_name,\n"
" SUBSTR(foreign_id,\n"
" old_db_name_len,\n"
" id_len - old_db_name_len));\n"
" END IF;\n"
" UPDATE SYS_FOREIGN\n"
" SET ID = new_foreign_id\n"
" WHERE ID = foreign_id;\n"
" UPDATE SYS_FOREIGN_COLS\n"
" SET ID = new_foreign_id\n"
" WHERE ID = foreign_id;\n"
" END IF;\n"
" END IF;\n"
"END LOOP;\n"
"UPDATE SYS_FOREIGN SET REF_NAME = :new_table_name\n"
"WHERE REF_NAME = :old_table_name\n"
" AND TO_BINARY(REF_NAME)\n"
" = TO_BINARY(:old_table_name);\n"
"END;\n"
, FALSE, trx);
err = que_eval_sql(
info,
"PROCEDURE RENAME_CONSTRAINT_IDS () IS\n"
"gen_constr_prefix CHAR;\n"
"new_db_name CHAR;\n"
"foreign_id CHAR;\n"
"new_foreign_id CHAR;\n"
"old_db_name_len INT;\n"
"old_t_name_len INT;\n"
"new_db_name_len INT;\n"
"id_len INT;\n"
"found INT;\n"
"BEGIN\n"
"found := 1;\n"
"old_db_name_len := INSTR(:old_table_name, '/')-1;\n"
"new_db_name_len := INSTR(:new_table_name, '/')-1;\n"
"new_db_name := SUBSTR(:new_table_name, 0,\n"
" new_db_name_len);\n"
"old_t_name_len := LENGTH(:old_table_name);\n"
"gen_constr_prefix := CONCAT(:old_table_name,\n"
" '_ibfk_');\n"
"WHILE found = 1 LOOP\n"
" SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n"
" WHERE FOR_NAME = :old_table_name\n"
" AND TO_BINARY(FOR_NAME)\n"
" = TO_BINARY(:old_table_name)\n"
" LOCK IN SHARE MODE;\n"
" IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n"
" ELSE\n"
" UPDATE SYS_FOREIGN\n"
" SET FOR_NAME = :new_table_name\n"
" WHERE ID = foreign_id;\n"
" id_len := LENGTH(foreign_id);\n"
" IF (INSTR(foreign_id, '/') > 0) THEN\n"
" IF (INSTR(foreign_id,\n"
" gen_constr_prefix) > 0)\n"
" THEN\n"
" new_foreign_id :=\n"
" CONCAT(:new_table_name,\n"
" SUBSTR(foreign_id, old_t_name_len,\n"
" id_len - old_t_name_len));\n"
" ELSE\n"
" new_foreign_id :=\n"
" CONCAT(new_db_name,\n"
" SUBSTR(foreign_id,\n"
" old_db_name_len,\n"
" id_len - old_db_name_len));\n"
" END IF;\n"
" UPDATE SYS_FOREIGN\n"
" SET ID = new_foreign_id\n"
" WHERE ID = foreign_id;\n"
" UPDATE SYS_FOREIGN_COLS\n"
" SET ID = new_foreign_id\n"
" WHERE ID = foreign_id;\n"
" END IF;\n"
" END IF;\n"
"END LOOP;\n"
"UPDATE SYS_FOREIGN SET REF_NAME = :new_table_name\n"
"WHERE REF_NAME = :old_table_name\n"
" AND TO_BINARY(REF_NAME)\n"
" = TO_BINARY(:old_table_name);\n"
"END;\n"
, FALSE, trx);
} else if (n_constraints_to_drop > 0) {
/* Drop some constraints of tmp tables. */
@ -3763,8 +3757,8 @@ end:
/* We only want to switch off some of the type checking in
an ALTER, not in a RENAME. */
err = dict_load_foreigns
(new_name, old_is_tmp ? trx->check_foreigns : TRUE);
err = dict_load_foreigns(
new_name, old_is_tmp ? trx->check_foreigns : TRUE);
if (err != DB_SUCCESS) {
ut_print_timestamp(stderr);
@ -3904,8 +3898,8 @@ func_exit:
for (i = 0;
i < dict_index_get_n_ordering_defined_by_user(index);
i++) {
if (UNIV_SQL_NULL == dfield_get_len
(dtuple_get_nth_field(prev_entry, i))) {
if (UNIV_SQL_NULL == dfield_get_len(
dtuple_get_nth_field(prev_entry, i))) {
contains_null = TRUE;
}
@ -3928,8 +3922,8 @@ not_ok:
} else if ((index->type & DICT_UNIQUE)
&& !contains_null
&& matched_fields
>= dict_index_get_n_ordering_defined_by_user
(index)) {
>= dict_index_get_n_ordering_defined_by_user(
index)) {
fputs("InnoDB: duplicate key in ", stderr);
goto not_ok;
@ -4004,7 +3998,7 @@ row_check_table_for_mysql(
ut_print_name(stderr, trx, FALSE, index->name);
putc('\n', stderr); */
if (!btr_validate_tree(index->tree, prebuilt->trx)) {
if (!btr_validate_index(index, prebuilt->trx)) {
ret = DB_ERROR;
} else {
if (!row_scan_and_check_index(prebuilt,

View file

@ -123,10 +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);
}
@ -248,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);
@ -430,7 +430,7 @@ skip_secondaries:
index = dict_table_get_first_index(node->table);
mtr_x_lock(dict_tree_get_lock(index->tree), &mtr);
mtr_x_lock(dict_index_get_lock(index), &mtr);
/* NOTE: we must also acquire an X-latch to the
root page of the tree. We will need it when we
@ -441,7 +441,7 @@ skip_secondaries:
latching order if we would only later latch the
root page of such a tree! */
btr_root_get(index->tree, &mtr);
btr_root_get(index, &mtr);
/* We assume in purge of externally stored fields
that the space id of the undo log record is 0! */
@ -618,8 +618,8 @@ 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);

View file

@ -114,10 +114,8 @@ row_build_index_entry(
dict_field_t* ind_field;
dfield_t* dfield;
dfield_t* dfield2;
dict_col_t* col;
ulint i;
ulint storage_len;
dtype_t* cur_type;
ut_ad(row && index && heap);
ut_ad(dtuple_check_typed(row));
@ -128,13 +126,13 @@ 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++) {
ind_field = dict_index_get_nth_field(index, i);
col = ind_field->col;
const dict_col_t* col = ind_field->col;
dfield = dtuple_get_nth_field(entry, i);
@ -143,17 +141,20 @@ row_build_index_entry(
dfield_copy(dfield, dfield2);
/* If a column prefix index, take only the prefix */
if (ind_field->prefix_len > 0
&& dfield_get_len(dfield2) != UNIV_SQL_NULL) {
if (ind_field->prefix_len) {
if (dfield_get_len(dfield2) != UNIV_SQL_NULL) {
cur_type = dict_col_get_type
(dict_field_get_col(ind_field));
storage_len = dtype_get_at_most_n_mbchars(
col->prtype,
col->mbminlen, col->mbmaxlen,
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);
}
dfield_set_len(dfield, storage_len);
dfield_get_type(dfield)->len = ind_field->prefix_len;
}
}
@ -192,7 +193,6 @@ row_build(
dtuple_t* row;
dict_table_t* table;
dict_field_t* ind_field;
dict_col_t* col;
dfield_t* dfield;
ulint n_fields;
byte* field;
@ -227,8 +227,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);
@ -239,7 +239,9 @@ row_build(
if (ind_field->prefix_len == 0) {
col = dict_field_get_col(ind_field);
const dict_col_t* col
= dict_field_get_col(ind_field);
dfield = dtuple_get_nth_field(row,
dict_col_get_no(col));
field = rec_get_nth_field(rec, offsets, i, &len);
@ -416,17 +418,22 @@ row_build_row_ref(
column, or the full column, and we must adjust the length
accordingly. */
clust_col_prefix_len = dict_index_get_nth_field
(clust_index, i)->prefix_len;
clust_col_prefix_len = dict_index_get_nth_field(
clust_index, i)->prefix_len;
if (clust_col_prefix_len > 0) {
if (len != UNIV_SQL_NULL) {
const dtype_t* dtype
= dfield_get_type(dfield);
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(
dtype->prtype,
dtype->mbminlen,
dtype->mbmaxlen,
clust_col_prefix_len,
len, (char*) field));
}
}
}
@ -513,17 +520,22 @@ notfound:
column, or the full column, and we must adjust the length
accordingly. */
clust_col_prefix_len = dict_index_get_nth_field
(clust_index, i)->prefix_len;
clust_col_prefix_len = dict_index_get_nth_field(
clust_index, i)->prefix_len;
if (clust_col_prefix_len > 0) {
if (len != UNIV_SQL_NULL) {
const dtype_t* dtype
= dfield_get_type(dfield);
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(
dtype->prtype,
dtype->mbminlen,
dtype->mbmaxlen,
clust_col_prefix_len,
len, (char*) field));
}
}
}
@ -550,13 +562,8 @@ row_build_row_ref_from_row(
directly into data of this row */
{
dict_index_t* clust_index;
dict_field_t* field;
dfield_t* dfield;
dfield_t* dfield2;
dict_col_t* col;
ulint ref_len;
ulint i;
dtype_t* cur_type;
ut_ad(ref && table && row);
@ -567,6 +574,11 @@ row_build_row_ref_from_row(
ut_ad(ref_len == dtuple_get_n_fields(ref));
for (i = 0; i < ref_len; i++) {
const dict_col_t* col;
dict_field_t* field;
dfield_t* dfield;
dfield_t* dfield2;
dfield = dtuple_get_nth_field(ref, i);
field = dict_index_get_nth_field(clust_index, i);
@ -580,12 +592,9 @@ row_build_row_ref_from_row(
if (field->prefix_len > 0
&& dfield->len != UNIV_SQL_NULL) {
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(
col->prtype, col->mbminlen, col->mbmaxlen,
field->prefix_len, dfield->len, dfield->data);
}
}

View file

@ -45,9 +45,6 @@ to que_run_threads: this is to allow canceling runaway queries */
#define SEL_COST_LIMIT 100
/* The lower limit for what we consider a "big" row */
#define BIG_ROW_SIZE 1024
/* Flags for search shortcut */
#define SEL_FOUND 0
#define SEL_EXHAUSTED 1
@ -72,15 +69,12 @@ row_sel_sec_rec_is_for_clust_rec(
rec_t* clust_rec, /* in: clustered index record */
dict_index_t* clust_index) /* in: clustered index */
{
dict_field_t* ifield;
dict_col_t* col;
byte* sec_field;
ulint sec_len;
byte* clust_field;
ulint clust_len;
ulint n;
ulint i;
dtype_t* cur_type;
mem_heap_t* heap = NULL;
ulint clust_offsets_[REC_OFFS_NORMAL_SIZE];
ulint sec_offsets_[REC_OFFS_SMALL_SIZE];
@ -99,26 +93,26 @@ row_sel_sec_rec_is_for_clust_rec(
n = dict_index_get_n_ordering_defined_by_user(sec_index);
for (i = 0; i < n; i++) {
const dict_field_t* ifield;
const dict_col_t* col;
ifield = dict_index_get_nth_field(sec_index, i);
col = dict_field_get_col(ifield);
clust_field = rec_get_nth_field(clust_rec, clust_offs,
dict_col_get_clust_pos(col),
&clust_len);
clust_field = rec_get_nth_field(
clust_rec, clust_offs,
dict_col_get_clust_pos(col, clust_index), &clust_len);
sec_field = rec_get_nth_field(sec_rec, sec_offs, i, &sec_len);
if (ifield->prefix_len > 0
&& clust_len != UNIV_SQL_NULL) {
if (ifield->prefix_len > 0 && clust_len != UNIV_SQL_NULL) {
cur_type = dict_col_get_type
(dict_field_get_col(ifield));
clust_len = dtype_get_at_most_n_mbchars
(cur_type, ifield->prefix_len,
clust_len, (char*) clust_field);
clust_len = dtype_get_at_most_n_mbchars(
col->prtype, col->mbminlen, col->mbmaxlen,
ifield->prefix_len,
clust_len, (char*) clust_field);
}
if (0 != cmp_data_data(dict_col_get_type(col),
if (0 != cmp_data_data(col->mtype, col->prtype,
clust_field, clust_len,
sec_field, sec_len)) {
is_equal = FALSE;
@ -319,8 +313,8 @@ row_sel_fetch_columns(
heap = mem_heap_create(1);
data = btr_rec_copy_externally_stored_field
(rec, offsets, field_no, &len, heap);
data = btr_rec_copy_externally_stored_field(
rec, offsets, field_no, &len, heap);
ut_a(len != UNIV_SQL_NULL);
@ -557,9 +551,9 @@ row_sel_build_prev_vers(
plan->old_vers_heap = mem_heap_create(512);
}
err = row_vers_build_for_consistent_read
(rec, mtr, plan->index, offsets, read_view, offset_heap,
plan->old_vers_heap, old_vers);
err = row_vers_build_for_consistent_read(
rec, mtr, plan->index, offsets, read_view, offset_heap,
plan->old_vers_heap, old_vers);
return(err);
}
@ -592,9 +586,9 @@ row_sel_build_committed_vers_for_mysql(
prebuilt->old_vers_heap = mem_heap_create(200);
}
err = row_vers_build_for_semi_consistent_read
(rec, mtr, clust_index, offsets, offset_heap,
prebuilt->old_vers_heap, old_vers);
err = row_vers_build_for_semi_consistent_read(
rec, mtr, clust_index, offsets, offset_heap,
prebuilt->old_vers_heap, old_vers);
return(err);
}
@ -754,9 +748,9 @@ row_sel_get_clust_rec(
lock_type = LOCK_ORDINARY;
}
err = lock_clust_rec_read_check_and_lock
(0, clust_rec, index, offsets,
node->row_lock_mode, lock_type, thr);
err = lock_clust_rec_read_check_and_lock(
0, clust_rec, index, offsets,
node->row_lock_mode, lock_type, thr);
if (err != DB_SUCCESS) {
@ -800,8 +794,8 @@ row_sel_get_clust_rec(
exist in our snapshot. */
if ((old_vers
|| rec_get_deleted_flag(rec, dict_table_is_comp
(plan->table)))
|| rec_get_deleted_flag(rec, dict_table_is_comp(
plan->table)))
&& !row_sel_sec_rec_is_for_clust_rec(rec, plan->index,
clust_rec, index)) {
goto func_exit;
@ -850,11 +844,11 @@ sel_set_rec_lock(
}
if (index->type & DICT_CLUSTERED) {
err = lock_clust_rec_read_check_and_lock
(0, rec, index, offsets, mode, type, thr);
err = lock_clust_rec_read_check_and_lock(
0, rec, index, offsets, mode, type, thr);
} else {
err = lock_sec_rec_read_check_and_lock
(0, rec, index, offsets, mode, type, thr);
err = lock_sec_rec_read_check_and_lock(
0, rec, index, offsets, mode, type, thr);
}
return(err);
@ -1246,7 +1240,7 @@ table_loop:
if (consistent_read && plan->unique_search && !plan->pcur_is_open
&& !plan->must_get_clust
&& (plan->table->max_row_size < BIG_ROW_SIZE)) {
&& !plan->table->big_rows) {
if (!search_latch_locked) {
rw_lock_s_lock(&btr_search_latch);
@ -1506,13 +1500,13 @@ skip_lock:
}
if (old_vers == NULL) {
offsets = rec_get_offsets
(rec, index, offsets,
ULINT_UNDEFINED, &heap);
row_sel_fetch_columns
(index, rec, offsets,
UT_LIST_GET_FIRST
(plan->columns));
offsets = rec_get_offsets(
rec, index, offsets,
ULINT_UNDEFINED, &heap);
row_sel_fetch_columns(
index, rec, offsets,
UT_LIST_GET_FIRST(
plan->columns));
if (!row_sel_test_end_conds(plan)) {
@ -1651,7 +1645,7 @@ skip_lock:
if ((plan->n_rows_fetched <= SEL_PREFETCH_LIMIT)
|| plan->unique_search || plan->no_prefetch
|| (plan->table->max_row_size >= BIG_ROW_SIZE)) {
|| plan->table->big_rows) {
/* No prefetch in operation: go to the next table */
@ -1922,8 +1916,8 @@ row_sel_step(
if (node->consistent_read) {
/* Assign a read view for the query */
node->read_view = trx_assign_read_view
(thr_get_trx(thr));
node->read_view = trx_assign_read_view(
thr_get_trx(thr));
} else {
if (node->set_x_locks) {
i_lock_mode = LOCK_IX;
@ -2010,8 +2004,8 @@ fetch_step(
sel_assign_into_var_values(node->into_list,
sel_node);
} else {
void* ret = (*node->func->func)
(sel_node, node->func->arg);
void* ret = (*node->func->func)(
sel_node, node->func->arg);
if (!ret) {
sel_node->state
@ -2249,8 +2243,7 @@ row_sel_convert_mysql_key_to_innobase(
while (key_ptr < key_end) {
ut_a(dict_col_get_type(field->col)->mtype
== dfield_get_type(dfield)->mtype);
ut_a(field->col->mtype == dfield_get_type(dfield)->mtype);
data_offset = 0;
is_null = FALSE;
@ -2334,11 +2327,11 @@ row_sel_convert_mysql_key_to_innobase(
/* Storing may use at most data_len bytes of buf */
if (!is_null) {
row_mysql_store_col_in_innobase_format
(dfield, buf,
FALSE, /* MySQL key value format col */
key_ptr + data_offset, data_len,
dict_table_is_comp(index->table));
row_mysql_store_col_in_innobase_format(
dfield, buf,
FALSE, /* MySQL key value format col */
key_ptr + data_offset, data_len,
dict_table_is_comp(index->table));
buf += data_len;
}
@ -2405,9 +2398,9 @@ row_sel_store_row_id_to_prebuilt(
ut_ad(rec_offs_validate(index_rec, index, offsets));
data = rec_get_nth_field
(index_rec, offsets,
dict_index_get_sys_col_pos(index, DATA_ROW_ID), &len);
data = rec_get_nth_field(
index_rec, offsets,
dict_index_get_sys_col_pos(index, DATA_ROW_ID), &len);
if (len != DATA_ROW_ID_LEN) {
fprintf(stderr,
@ -2480,8 +2473,8 @@ row_sel_field_store_in_mysql_format(
length of the data to the first byte or the first
two bytes of dest. */
dest = row_mysql_store_true_var_len
(dest, len, templ->mysql_length_bytes);
dest = row_mysql_store_true_var_len(
dest, len, templ->mysql_length_bytes);
}
/* Copy the actual data */
@ -2614,8 +2607,8 @@ row_sel_store_mysql_rec(
if (UNIV_UNLIKELY(templ->type == DATA_BLOB)) {
if (prebuilt->blob_heap == NULL) {
prebuilt->blob_heap = mem_heap_create
(UNIV_PAGE_SIZE);
prebuilt->blob_heap = mem_heap_create(
UNIV_PAGE_SIZE);
}
heap = prebuilt->blob_heap;
@ -2630,9 +2623,9 @@ row_sel_store_mysql_rec(
already run out of memory in the next call, which
causes an assert */
data = btr_rec_copy_externally_stored_field
(rec, offsets, templ->rec_field_no,
&len, heap);
data = btr_rec_copy_externally_stored_field(
rec, offsets, templ->rec_field_no,
&len, heap);
ut_a(len != UNIV_SQL_NULL);
} else {
@ -2643,9 +2636,9 @@ row_sel_store_mysql_rec(
}
if (len != UNIV_SQL_NULL) {
row_sel_field_store_in_mysql_format
(mysql_rec + templ->mysql_col_offset,
templ, data, len);
row_sel_field_store_in_mysql_format(
mysql_rec + templ->mysql_col_offset,
templ, data, len);
/* Cleanup */
if (extern_field_heap) {
@ -2747,9 +2740,9 @@ row_sel_build_prev_vers_for_mysql(
prebuilt->old_vers_heap = mem_heap_create(200);
}
err = row_vers_build_for_consistent_read
(rec, mtr, clust_index, offsets, read_view, offset_heap,
prebuilt->old_vers_heap, old_vers);
err = row_vers_build_for_consistent_read(
rec, mtr, clust_index, offsets, read_view, offset_heap,
prebuilt->old_vers_heap, old_vers);
return(err);
}
@ -2853,9 +2846,9 @@ row_sel_get_clust_rec_for_mysql(
the clust rec with a unique condition, hence
we set a LOCK_REC_NOT_GAP type lock */
err = lock_clust_rec_read_check_and_lock
(0, clust_rec, clust_index, *offsets,
prebuilt->select_lock_type, LOCK_REC_NOT_GAP, thr);
err = lock_clust_rec_read_check_and_lock(
0, clust_rec, clust_index, *offsets,
prebuilt->select_lock_type, LOCK_REC_NOT_GAP, thr);
if (err != DB_SUCCESS) {
goto err_exit;
@ -2870,15 +2863,16 @@ row_sel_get_clust_rec_for_mysql(
then we never look for an earlier version */
if (trx->isolation_level > TRX_ISO_READ_UNCOMMITTED
&& !lock_clust_rec_cons_read_sees
(clust_rec, clust_index, *offsets, trx->read_view)) {
&& !lock_clust_rec_cons_read_sees(
clust_rec, clust_index, *offsets,
trx->read_view)) {
/* The following call returns 'offsets' associated with
'old_vers' */
err = row_sel_build_prev_vers_for_mysql
(trx->read_view, clust_index,
prebuilt, clust_rec, offsets, offset_heap,
&old_vers, mtr);
err = row_sel_build_prev_vers_for_mysql(
trx->read_view, clust_index, prebuilt,
clust_rec, offsets, offset_heap, &old_vers,
mtr);
if (err != DB_SUCCESS) {
@ -2901,16 +2895,18 @@ row_sel_get_clust_rec_for_mysql(
visit through secondary index records that would not really
exist in our snapshot. */
if (clust_rec && (old_vers || rec_get_deleted_flag
(rec, dict_table_is_comp(sec_index->table)))
&& !row_sel_sec_rec_is_for_clust_rec
(rec, sec_index, clust_rec, clust_index)) {
if (clust_rec && (old_vers || rec_get_deleted_flag(
rec,
dict_table_is_comp(
sec_index->table)))
&& !row_sel_sec_rec_is_for_clust_rec(
rec, sec_index, clust_rec, clust_index)) {
clust_rec = NULL;
} else {
#ifdef UNIV_SEARCH_DEBUG
ut_a(clust_rec == NULL
|| row_sel_sec_rec_is_for_clust_rec
(rec, sec_index, clust_rec, clust_index));
|| row_sel_sec_rec_is_for_clust_rec(
rec, sec_index, clust_rec, clust_index));
#endif
}
}
@ -3018,8 +3014,8 @@ row_sel_pop_cached_row_for_mysql(
if (UNIV_UNLIKELY(prebuilt->keep_other_fields_on_keyread)) {
/* Copy cache record field by field, don't touch fields that
are not covered by current key */
cached_rec = prebuilt->fetch_cache
[prebuilt->fetch_cache_first];
cached_rec = prebuilt->fetch_cache[
prebuilt->fetch_cache_first];
for (i = 0; i < prebuilt->n_template; i++) {
templ = prebuilt->mysql_template + i;
@ -3031,8 +3027,7 @@ row_sel_pop_cached_row_for_mysql(
if (templ->mysql_null_bit_mask) {
buf[templ->mysql_null_byte_offset]
^= (buf[templ->mysql_null_byte_offset]
^ cached_rec
[templ->mysql_null_byte_offset])
^ cached_rec[templ->mysql_null_byte_offset])
& (byte)templ->mysql_null_bit_mask;
}
}
@ -3088,9 +3083,10 @@ row_sel_push_cache_row_for_mysql(
ut_ad(prebuilt->fetch_cache_first == 0);
if (UNIV_UNLIKELY(!row_sel_store_mysql_rec
(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
prebuilt, rec, offsets))) {
if (UNIV_UNLIKELY(!row_sel_store_mysql_rec(
prebuilt->fetch_cache[
prebuilt->n_fetch_cached],
prebuilt, rec, offsets))) {
ut_error;
}
@ -3217,15 +3213,12 @@ row_search_for_mysql(
ibool mtr_has_extra_clust_latch = FALSE;
ibool moves_up = FALSE;
ibool set_also_gap_locks = TRUE;
/* if the query is a plain
locking SELECT, and the isolation
level is <= TRX_ISO_READ_COMMITTED,
then this is set to FALSE */
/* if the query is a plain locking SELECT, and the isolation level
is <= TRX_ISO_READ_COMMITTED, then this is set to FALSE */
ibool did_semi_consistent_read = FALSE;
/* if the returned record was locked
and we did a semi-consistent read
(fetch the newest committed version),
then this is set to TRUE */
/* if the returned record was locked and we did a semi-consistent
read (fetch the newest committed version), then this is set to
TRUE */
#ifdef UNIV_SEARCH_DEBUG
ulint cnt = 0;
#endif /* UNIV_SEARCH_DEBUG */
@ -3478,8 +3471,9 @@ row_search_for_mysql(
trx->has_search_latch = TRUE;
}
#endif
switch (row_sel_try_search_shortcut_for_mysql
(&rec, prebuilt, &offsets, &heap, &mtr)) {
switch (row_sel_try_search_shortcut_for_mysql(
&rec, prebuilt, &offsets, &heap,
&mtr)) {
case SEL_FOUND:
#ifdef UNIV_SEARCH_DEBUG
ut_a(0 == cmp_dtuple_rec(search_tuple,
@ -3559,8 +3553,8 @@ shortcut_fails_too_big_rec:
/* Scan the MySQL query string; check if SELECT is the first
word there */
if (dict_str_starts_with_keyword
(trx->mysql_thd, *trx->mysql_query_str, "SELECT")) {
if (dict_str_starts_with_keyword(
trx->mysql_thd, *trx->mysql_query_str, "SELECT")) {
/* It is a plain locking SELECT and the isolation
level is low: do not lock gaps */
@ -3587,9 +3581,9 @@ shortcut_fails_too_big_rec:
clust_index = dict_table_get_first_index(index->table);
if (UNIV_LIKELY(direction != 0)) {
ibool need_to_process = sel_restore_position_for_mysql
(&same_user_rec, BTR_SEARCH_LEAF,
pcur, moves_up, &mtr);
ibool need_to_process = sel_restore_position_for_mysql(
&same_user_rec, BTR_SEARCH_LEAF,
pcur, moves_up, &mtr);
if (UNIV_UNLIKELY(need_to_process)) {
if (UNIV_UNLIKELY(prebuilt->row_read_type
@ -3621,13 +3615,13 @@ shortcut_fails_too_big_rec:
pcur->trx_if_known = trx;
} else {
if (mode == PAGE_CUR_G) {
btr_pcur_open_at_index_side
(TRUE, index,
BTR_SEARCH_LEAF, pcur, FALSE, &mtr);
btr_pcur_open_at_index_side(
TRUE, index, BTR_SEARCH_LEAF, pcur, FALSE,
&mtr);
} else if (mode == PAGE_CUR_L) {
btr_pcur_open_at_index_side
(FALSE, index,
BTR_SEARCH_LEAF, pcur, FALSE, &mtr);
btr_pcur_open_at_index_side(
FALSE, index, BTR_SEARCH_LEAF, pcur, FALSE,
&mtr);
}
}
@ -3759,7 +3753,7 @@ wrong_offs:
"InnoDB: Index corruption: rec offs %lu"
" next offs %lu, page no %lu,\n"
"InnoDB: ",
(ulong) ut_align_offset(rec, UNIV_PAGE_SIZE),
(ulong) page_offset(rec),
(ulong) next_offs,
(ulong) buf_frame_get_page_no(rec));
dict_index_name_print(stderr, trx, index);
@ -3779,7 +3773,7 @@ wrong_offs:
"InnoDB: Index corruption: rec offs %lu"
" next offs %lu, page no %lu,\n"
"InnoDB: ",
(ulong) ut_align_offset(rec, UNIV_PAGE_SIZE),
(ulong) page_offset(rec),
(ulong) next_offs,
(ulong) buf_frame_get_page_no(rec));
dict_index_name_print(stderr, trx, index);
@ -3804,7 +3798,7 @@ wrong_offs:
"InnoDB: Index corruption: rec offs %lu"
" next offs %lu, page no %lu,\n"
"InnoDB: ",
(ulong) ut_align_offset(rec, UNIV_PAGE_SIZE),
(ulong) page_offset(rec),
(ulong) next_offs,
(ulong) buf_frame_get_page_no(rec));
dict_index_name_print(stderr, trx, index);
@ -3839,10 +3833,10 @@ wrong_offs:
option is not set or this session is not
using a READ COMMITTED isolation level. */
err = sel_set_rec_lock
(rec, index, offsets,
prebuilt->select_lock_type,
LOCK_GAP, thr);
err = sel_set_rec_lock(
rec, index, offsets,
prebuilt->select_lock_type, LOCK_GAP,
thr);
if (err != DB_SUCCESS) {
@ -3874,10 +3868,10 @@ wrong_offs:
option is not set or this session is not
using a READ COMMITTED isolation level. */
err = sel_set_rec_lock
(rec, index, offsets,
prebuilt->select_lock_type,
LOCK_GAP, thr);
err = sel_set_rec_lock(
rec, index, offsets,
prebuilt->select_lock_type, LOCK_GAP,
thr);
if (err != DB_SUCCESS) {
@ -3961,9 +3955,9 @@ no_gap_lock:
/* The following call returns 'offsets'
associated with 'old_vers' */
err = row_sel_build_committed_vers_for_mysql
(clust_index, prebuilt, rec,
&offsets, &heap, &old_vers, &mtr);
err = row_sel_build_committed_vers_for_mysql(
clust_index, prebuilt, rec,
&offsets, &heap, &old_vers, &mtr);
if (err != DB_SUCCESS) {
@ -3977,8 +3971,8 @@ no_gap_lock:
goto lock_wait_or_error;
}
if (UNIV_LIKELY(trx->wait_lock != NULL)) {
lock_cancel_waiting_and_release
(trx->wait_lock);
lock_cancel_waiting_and_release(
trx->wait_lock);
trx_reset_new_rec_lock_info(trx);
} else {
mutex_exit(&kernel_mutex);
@ -4025,16 +4019,16 @@ no_gap_lock:
by skipping this lookup */
if (UNIV_LIKELY(srv_force_recovery < 5)
&& !lock_clust_rec_cons_read_sees
(rec, index, offsets, trx->read_view)) {
&& !lock_clust_rec_cons_read_sees(
rec, index, offsets, trx->read_view)) {
rec_t* old_vers;
/* The following call returns 'offsets'
associated with 'old_vers' */
err = row_sel_build_prev_vers_for_mysql
(trx->read_view, clust_index,
prebuilt, rec, &offsets, &heap,
&old_vers, &mtr);
err = row_sel_build_prev_vers_for_mysql(
trx->read_view, clust_index,
prebuilt, rec, &offsets, &heap,
&old_vers, &mtr);
if (err != DB_SUCCESS) {
@ -4084,6 +4078,23 @@ no_gap_lock:
row_unlock_for_mysql(prebuilt, TRUE);
}
/* This is an optimization to skip setting the next key lock
on the record that follows this delete-marked record. This
optimization works because of the unique search criteria
which precludes the presence of a range lock between this
delete marked record and the record following it.
For now this is applicable only to clustered indexes while
doing a unique search. There is scope for further optimization
applicable to unique secondary indexes. Current behaviour is
to widen the scope of a lock on an already delete marked record
if the same record is deleted twice by the same transaction */
if (index == clust_index && unique_search) {
err = DB_RECORD_NOT_FOUND;
goto normal_return;
}
goto next_rec;
}
@ -4209,9 +4220,9 @@ requires_clust_rec:
if (prebuilt->clust_index_was_generated) {
if (result_rec != rec) {
offsets = rec_get_offsets
(rec, index, offsets,
ULINT_UNDEFINED, &heap);
offsets = rec_get_offsets(
rec, index, offsets, ULINT_UNDEFINED,
&heap);
}
row_sel_store_row_id_to_prebuilt(prebuilt, rec,
index, offsets);
@ -4466,8 +4477,8 @@ row_search_check_if_query_cache_permitted(
if (trx->isolation_level >= TRX_ISO_REPEATABLE_READ
&& !trx->read_view) {
trx->read_view = read_view_open_now
(trx->id, trx->global_read_view_heap);
trx->read_view = read_view_open_now(
trx->id, trx->global_read_view_heap);
trx->global_read_view = trx->read_view;
}
}

View file

@ -286,8 +286,8 @@ 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,

View file

@ -108,12 +108,12 @@ row_undo_mod_clust_low(
} 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);
@ -444,8 +444,8 @@ row_undo_mod_del_unmark_sec_and_undo_update(
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 */
@ -454,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);
@ -538,11 +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) {
@ -620,11 +620,11 @@ row_undo_mod_upd_exist_sec(
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);
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) {
@ -736,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

@ -197,8 +197,9 @@ row_upd_check_references_constraints(
if (foreign->referenced_index == index
&& (node->is_delete
|| row_upd_changes_first_fields_binary
(entry, index, node->update, foreign->n_fields))) {
|| 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);
@ -218,8 +219,8 @@ 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));
@ -235,8 +236,8 @@ row_upd_check_references_constraints(
if (err != DB_SUCCESS) {
if (got_s_lock) {
row_mysql_unfreeze_data_dictionary
(trx);
row_mysql_unfreeze_data_dictionary(
trx);
}
mem_heap_free(heap);
@ -388,9 +389,9 @@ 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 = dict_col_get_sql_null_size(
dict_index_get_nth_col(index,
upd_field->field_no));
}
old_len = rec_offs_nth_size(offsets, upd_field->field_no);
@ -479,8 +480,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;
@ -884,7 +885,6 @@ row_upd_index_replace_new_col_vals_index_pos(
ulint j;
ulint i;
ulint n_fields;
dtype_t* cur_type;
ut_ad(index);
@ -913,8 +913,8 @@ row_upd_index_replace_new_col_vals_index_pos(
dfield_set_data(dfield, new_val->data,
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);
}
@ -922,13 +922,17 @@ row_upd_index_replace_new_col_vals_index_pos(
if (field->prefix_len > 0
&& new_val->len != UNIV_SQL_NULL) {
cur_type = dict_col_get_type
(dict_field_get_col(field));
const dict_col_t* col
= dict_field_get_col(field);
dfield->len
= dtype_get_at_most_n_mbchars
(cur_type, field->prefix_len,
new_val->len, new_val->data);
= dtype_get_at_most_n_mbchars(
col->prtype,
col->mbminlen,
col->mbmaxlen,
field->prefix_len,
new_val->len,
new_val->data);
}
}
}
@ -952,27 +956,31 @@ row_upd_index_replace_new_col_vals(
copy the new values, set this as NULL if you
do not want allocation */
{
dict_field_t* field;
upd_field_t* upd_field;
dfield_t* dfield;
dfield_t* new_val;
ulint j;
ulint i;
dtype_t* cur_type;
dict_index_t* clust_index;
ut_ad(index);
clust_index = dict_table_get_first_index(index->table);
dtuple_set_info_bits(entry, update->info_bits);
for (j = 0; j < dict_index_get_n_fields(index); j++) {
field = dict_index_get_nth_field(index, j);
ulint clust_pos;
dict_field_t* field = dict_index_get_nth_field(index, j);
clust_pos = dict_col_get_clust_pos(field->col, clust_index);
for (i = 0; i < upd_get_n_fields(update); i++) {
upd_field = upd_get_nth_field(update, i);
if (upd_field->field_no == field->col->clust_pos) {
if (upd_field->field_no == clust_pos) {
dfield = dtuple_get_nth_field(entry, j);
@ -981,8 +989,8 @@ row_upd_index_replace_new_col_vals(
dfield_set_data(dfield, new_val->data,
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);
}
@ -990,13 +998,17 @@ row_upd_index_replace_new_col_vals(
if (field->prefix_len > 0
&& new_val->len != UNIV_SQL_NULL) {
cur_type = dict_col_get_type
(dict_field_get_col(field));
const dict_col_t* col
= dict_field_get_col(field);
dfield->len
= dtype_get_at_most_n_mbchars
(cur_type, field->prefix_len,
new_val->len, new_val->data);
= dtype_get_at_most_n_mbchars(
col->prtype,
col->mbminlen,
col->mbmaxlen,
field->prefix_len,
new_val->len,
new_val->data);
}
}
}
@ -1025,30 +1037,34 @@ row_upd_changes_ord_field_binary(
field numbers in this MUST be clustered index
positions! */
{
upd_field_t* upd_field;
dict_field_t* ind_field;
dict_col_t* col;
ulint n_unique;
ulint n_upd_fields;
ulint col_pos;
ulint col_no;
ulint i, j;
dict_index_t* clust_index;
ut_ad(update && index);
n_unique = dict_index_get_n_unique(index);
n_upd_fields = upd_get_n_fields(update);
clust_index = dict_table_get_first_index(index->table);
for (i = 0; i < n_unique; i++) {
const dict_field_t* ind_field;
const dict_col_t* col;
ulint col_pos;
ulint col_no;
ind_field = dict_index_get_nth_field(index, i);
col = dict_field_get_col(ind_field);
col_pos = dict_col_get_clust_pos(col);
col_pos = dict_col_get_clust_pos(col, clust_index);
col_no = dict_col_get_no(col);
for (j = 0; j < n_upd_fields; j++) {
upd_field = upd_get_nth_field(update, j);
upd_field_t* upd_field
= upd_get_nth_field(update, j);
/* Note that if the index field is a column prefix
then it may be that row does not contain an externally
@ -1058,9 +1074,9 @@ row_upd_changes_ord_field_binary(
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)))) {
|| !dfield_datas_are_binary_equal(
dtuple_get_nth_field(row, col_no),
&(upd_field->new_val)))) {
return(TRUE);
}
@ -1092,8 +1108,8 @@ 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))
if (dict_field_get_col(dict_index_get_nth_field(
index, upd_field->field_no))
->ord_part) {
return(TRUE);
@ -1117,34 +1133,37 @@ row_upd_changes_first_fields_binary(
upd_t* update, /* in: update vector for the row */
ulint n) /* in: how many first fields to check */
{
upd_field_t* upd_field;
dict_field_t* ind_field;
dict_col_t* col;
ulint n_upd_fields;
ulint col_pos;
ulint i, j;
dict_index_t* clust_index;
ut_a(update && index);
ut_a(n <= dict_index_get_n_fields(index));
ut_ad(update && index);
ut_ad(n <= dict_index_get_n_fields(index));
n_upd_fields = upd_get_n_fields(update);
clust_index = dict_table_get_first_index(index->table);
for (i = 0; i < n; i++) {
const dict_field_t* ind_field;
const dict_col_t* col;
ulint col_pos;
ind_field = dict_index_get_nth_field(index, i);
col = dict_field_get_col(ind_field);
col_pos = dict_col_get_clust_pos(col);
col_pos = dict_col_get_clust_pos(col, clust_index);
ut_a(ind_field->prefix_len == 0);
for (j = 0; j < n_upd_fields; j++) {
upd_field = upd_get_nth_field(update, j);
upd_field_t* 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);
}
@ -1322,9 +1341,9 @@ row_upd_sec_index_entry(
/* 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;
@ -1356,8 +1375,8 @@ close_cur:
}
/***************************************************************
Updates secondary index record if it is changed in the row update. This
should be quite rare in database applications. */
Updates the secondary index record if it is changed in the row update or
deletes it if this is a delete. */
UNIV_INLINE
ulint
row_upd_sec_step(
@ -1434,17 +1453,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)) {
@ -1573,10 +1592,10 @@ 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),
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);
@ -1730,8 +1749,8 @@ row_upd_clust_step(
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;
@ -1831,14 +1850,14 @@ row_upd(
ut_ad(node && thr);
if (node->in_mysql_interface) {
if (UNIV_LIKELY(node->in_mysql_interface)) {
/* 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)) {
|| 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;
@ -2046,9 +2065,9 @@ row_upd_in_place_in_select(
}
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);

View file

@ -158,9 +158,9 @@ row_vers_impl_x_locked_off_kernel(
mem_heap_free(heap2); /* free version and clust_offsets */
if (prev_version) {
clust_offsets = rec_get_offsets
(prev_version, clust_index, NULL,
ULINT_UNDEFINED, &heap);
clust_offsets = rec_get_offsets(
prev_version, clust_index, NULL,
ULINT_UNDEFINED, &heap);
row = row_build(ROW_COPY_POINTERS, clust_index,
prev_version, clust_offsets, heap);
entry = row_build_index_entry(row, index, heap);

View file

@ -899,21 +899,21 @@ srv_init(void)
table = dict_mem_table_create("SYS_DUMMY1",
DICT_HDR_SPACE, 1, 0);
dict_mem_table_add_col(table, "DUMMY", DATA_CHAR,
DATA_ENGLISH | DATA_NOT_NULL, 8, 0);
DATA_ENGLISH | DATA_NOT_NULL, 8);
srv_sys->dummy_ind1 = dict_mem_index_create
("SYS_DUMMY1", "SYS_DUMMY1", DICT_HDR_SPACE, 0, 1);
dict_index_add_col(srv_sys->dummy_ind1,
srv_sys->dummy_ind1 = dict_mem_index_create(
"SYS_DUMMY1", "SYS_DUMMY1", DICT_HDR_SPACE, 0, 1);
dict_index_add_col(srv_sys->dummy_ind1, table, (dict_col_t*)
dict_table_get_nth_col(table, 0), 0);
srv_sys->dummy_ind1->table = table;
/* create dummy table and index for new-style infimum and supremum */
table = dict_mem_table_create("SYS_DUMMY2",
DICT_HDR_SPACE, 1, DICT_TF_COMPACT);
dict_mem_table_add_col(table, "DUMMY", DATA_CHAR,
DATA_ENGLISH | DATA_NOT_NULL, 8, 0);
srv_sys->dummy_ind2 = dict_mem_index_create
("SYS_DUMMY2", "SYS_DUMMY2", DICT_HDR_SPACE, 0, 1);
dict_index_add_col(srv_sys->dummy_ind2,
DATA_ENGLISH | DATA_NOT_NULL, 8);
srv_sys->dummy_ind2 = dict_mem_index_create(
"SYS_DUMMY2", "SYS_DUMMY2", DICT_HDR_SPACE, 0, 1);
dict_index_add_col(srv_sys->dummy_ind2, table, (dict_col_t*)
dict_table_get_nth_col(table, 0), 0);
srv_sys->dummy_ind2->table = table;
@ -1902,8 +1902,8 @@ loop:
if (srv_innodb_status) {
mutex_enter(&srv_monitor_file_mutex);
rewind(srv_monitor_file);
srv_printf_innodb_monitor
(srv_monitor_file, NULL, NULL);
srv_printf_innodb_monitor(srv_monitor_file, NULL,
NULL);
os_file_set_eof(srv_monitor_file);
mutex_exit(&srv_monitor_file_mutex);
}
@ -1984,9 +1984,9 @@ loop:
granted: in that case do nothing */
if (thr_get_trx(slot->thr)->wait_lock) {
lock_cancel_waiting_and_release
(thr_get_trx(slot->thr)
->wait_lock);
lock_cancel_waiting_and_release(
thr_get_trx(slot->thr)
->wait_lock);
}
}
}
@ -2493,8 +2493,8 @@ flush_loop:
srv_main_thread_op_info = "flushing buffer pool pages";
if (srv_fast_shutdown < 2) {
n_pages_flushed = buf_flush_batch
(BUF_FLUSH_LIST, 100, ut_dulint_max);
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100,
ut_dulint_max);
} else {
/* In the fastest shutdown we do not flush the buffer pool
to data files: we set n_pages_flushed to 0 artificially. */

View file

@ -301,8 +301,8 @@ srv_parse_data_file_paths_and_sizes(
str += (sizeof ":max:") - 1;
str = srv_parse_megabytes
(str, max_auto_extend_size);
str = srv_parse_megabytes(
str, max_auto_extend_size);
}
if (*str != '\0') {
@ -557,8 +557,8 @@ open_or_create_log_file(
*log_file_created = FALSE;
srv_normalize_path_for_win(srv_log_group_home_dirs[k]);
srv_log_group_home_dirs[k] = srv_add_path_separator_if_needed
(srv_log_group_home_dirs[k]);
srv_log_group_home_dirs[k] = srv_add_path_separator_if_needed(
srv_log_group_home_dirs[k]);
ut_a(strlen(srv_log_group_home_dirs[k])
< (sizeof name) - 10 - sizeof "ib_logfile");
@ -796,17 +796,17 @@ open_or_create_data_files(
}
if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
files[i] = os_file_create
(name, OS_FILE_OPEN_RAW,
OS_FILE_NORMAL, OS_DATA_FILE, &ret);
files[i] = os_file_create(
name, OS_FILE_OPEN_RAW,
OS_FILE_NORMAL, OS_DATA_FILE, &ret);
} else if (i == 0) {
files[i] = os_file_create
(name, OS_FILE_OPEN_RETRY,
OS_FILE_NORMAL, OS_DATA_FILE, &ret);
files[i] = os_file_create(
name, OS_FILE_OPEN_RETRY,
OS_FILE_NORMAL, OS_DATA_FILE, &ret);
} else {
files[i] = os_file_create
(name, OS_FILE_OPEN,
OS_FILE_NORMAL, OS_DATA_FILE, &ret);
files[i] = os_file_create(
name, OS_FILE_OPEN, OS_FILE_NORMAL,
OS_DATA_FILE, &ret);
}
if (!ret) {
@ -876,12 +876,12 @@ open_or_create_data_files(
return(DB_ERROR);
}
skip_size_check:
fil_read_flushed_lsn_and_arch_log_no
(files[i], one_opened,
fil_read_flushed_lsn_and_arch_log_no(
files[i], one_opened,
#ifdef UNIV_LOG_ARCHIVE
min_arch_log_no, max_arch_log_no,
min_arch_log_no, max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
min_flushed_lsn, max_flushed_lsn);
min_flushed_lsn, max_flushed_lsn);
one_opened = TRUE;
} else {
/* We created the data file and now write it full of
@ -915,10 +915,10 @@ skip_size_check:
"InnoDB: Database physically writes the"
" file full: wait...\n");
ret = os_file_set_size
(name, files[i],
srv_calc_low32(srv_data_file_sizes[i]),
srv_calc_high32(srv_data_file_sizes[i]));
ret = os_file_set_size(
name, files[i],
srv_calc_low32(srv_data_file_sizes[i]),
srv_calc_high32(srv_data_file_sizes[i]));
if (!ret) {
fprintf(stderr,
@ -1198,9 +1198,9 @@ innobase_start_or_create_for_mysql(void)
mutex_create(&srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK);
if (srv_innodb_status) {
srv_monitor_file_name = mem_alloc
(strlen(fil_path_to_mysql_datadir)
+ 20 + sizeof "/innodb_status.");
srv_monitor_file_name = mem_alloc(
strlen(fil_path_to_mysql_datadir)
+ 20 + sizeof "/innodb_status.");
sprintf(srv_monitor_file_name, "%s/innodb_status.%lu",
fil_path_to_mysql_datadir, os_proc_get_number());
srv_monitor_file = fopen(srv_monitor_file_name, "w+");
@ -1471,10 +1471,9 @@ innobase_start_or_create_for_mysql(void)
fprintf(stderr,
"InnoDB: Starting archive"
" recovery from a backup...\n");
err = recv_recovery_from_archive_start
(min_flushed_lsn,
srv_archive_recovery_limit_lsn,
min_arch_log_no);
err = recv_recovery_from_archive_start(
min_flushed_lsn, srv_archive_recovery_limit_lsn,
min_arch_log_no);
if (err != DB_SUCCESS) {
return(DB_ERROR);
@ -1535,8 +1534,8 @@ innobase_start_or_create_for_mysql(void)
data dictionary tables. Does that harm the scanning of
the data dictionary below? */
dict_check_tablespaces_and_store_max_id
(recv_needed_recovery);
dict_check_tablespaces_and_store_max_id(
recv_needed_recovery);
}
srv_startup_is_before_trx_rollback_phase = FALSE;

View file

@ -737,9 +737,9 @@ sync_array_detect_deadlock(
(cannot be cell thread) (wait) x-lock, and
he is blocked by start thread */
ret = sync_array_deadlock_step
(arr, start, thread,
debug->pass, depth);
ret = sync_array_deadlock_step(
arr, start, thread, debug->pass,
depth);
if (ret) {
print:
fprintf(stderr, "rw-lock %p ",
@ -772,9 +772,9 @@ print:
holding (wait) x-lock, and he is blocked by
start thread */
ret = sync_array_deadlock_step
(arr, start, thread,
debug->pass, depth);
ret = sync_array_deadlock_step(
arr, start, thread, debug->pass,
depth);
if (ret) {
goto print;
}

View file

@ -89,7 +89,8 @@ void
rw_lock_create_func(
/*================*/
rw_lock_t* lock, /* in: pointer to memory */
ulint level, /* in: level */
ulint level __attribute__((unused)),
/* in: level */
const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */
const char* cmutex_name) /* in: mutex name */
@ -116,9 +117,9 @@ rw_lock_create_func(
#ifdef UNIV_SYNC_DEBUG
UT_LIST_INIT(lock->debug_list);
#endif /* UNIV_SYNC_DEBUG */
lock->level = level;
#endif /* UNIV_SYNC_DEBUG */
lock->magic_n = RW_LOCK_MAGIC_N;

View file

@ -838,17 +838,17 @@ sync_thread_levels_g(
ulint line;
os_thread_id_t thread_id;
mutex_get_debug_info
(mutex, &file_name,
&line, &thread_id);
mutex_get_debug_info(
mutex, &file_name,
&line, &thread_id);
fprintf(stderr,
"InnoDB: Locked mutex:"
" addr %p thread %ld"
" file %s line %ld\n",
(void*) mutex,
os_thread_pf
(thread_id),
os_thread_pf(
thread_id),
file_name,
(ulong) line);
#else /* UNIV_SYNC_DEBUG */
@ -1155,8 +1155,8 @@ sync_thread_add_level(
case SYNC_IBUF_HEADER:
ut_a(sync_thread_levels_g(array, SYNC_FSP - 1)
&& !sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)
&& !sync_thread_levels_contain
(array, SYNC_IBUF_PESS_INSERT_MUTEX));
&& !sync_thread_levels_contain(
array, SYNC_IBUF_PESS_INSERT_MUTEX));
break;
case SYNC_DICT_AUTOINC_MUTEX:
ut_a(sync_thread_levels_g(array, SYNC_DICT_AUTOINC_MUTEX));

View file

@ -284,8 +284,8 @@ trx_purge_add_update_undo_to_history(
hist_size = mtr_read_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
MLOG_4BYTES, mtr);
ut_ad(undo->size == flst_get_len
(seg_header + TRX_UNDO_PAGE_LIST, mtr));
ut_ad(undo->size == flst_get_len(
seg_header + TRX_UNDO_PAGE_LIST, mtr));
mlog_write_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
hist_size + undo->size, MLOG_4BYTES, mtr);
@ -454,8 +454,8 @@ trx_purge_truncate_rseg_history(
rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr);
hdr_addr = trx_purge_get_log_from_hist
(flst_get_last(rseg_hdr + TRX_RSEG_HISTORY, &mtr));
hdr_addr = trx_purge_get_log_from_hist(
flst_get_last(rseg_hdr + TRX_RSEG_HISTORY, &mtr));
loop:
if (hdr_addr.page == FIL_NULL) {
@ -493,8 +493,8 @@ loop:
return;
}
prev_hdr_addr = trx_purge_get_log_from_hist
(flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE, &mtr));
prev_hdr_addr = trx_purge_get_log_from_hist(
flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE, &mtr));
n_removed_logs++;
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
@ -633,8 +633,8 @@ trx_purge_rseg_get_next_history_log(
purge_sys->n_pages_handled++;
prev_log_addr = trx_purge_get_log_from_hist
(flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE, &mtr));
prev_log_addr = trx_purge_get_log_from_hist(
flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE, &mtr));
if (prev_log_addr.page == FIL_NULL) {
/* No logs left in the history list */
@ -855,9 +855,9 @@ trx_purge_get_next_rec(
purge_sys->hdr_page_no,
purge_sys->hdr_offset);
if (next_rec == NULL) {
rec2 = trx_undo_get_next_rec
(rec2, purge_sys->hdr_page_no,
purge_sys->hdr_offset, &mtr);
rec2 = trx_undo_get_next_rec(
rec2, purge_sys->hdr_page_no,
purge_sys->hdr_offset, &mtr);
break;
}

View file

@ -50,8 +50,8 @@ trx_undof_page_add_undo_rec_log(
}
log_end = &log_ptr[11 + 13 + MLOG_BUF_MARGIN];
log_ptr = mlog_write_initial_log_record_fast
(undo_page, MLOG_UNDO_INSERT, log_ptr, mtr);
log_ptr = mlog_write_initial_log_record_fast(
undo_page, MLOG_UNDO_INSERT, log_ptr, mtr);
len = new_free - old_free - 4;
mach_write_to_2(log_ptr, len);
@ -413,7 +413,6 @@ trx_undo_page_report_modify(
{
dict_table_t* table;
upd_field_t* upd_field;
dict_col_t* col;
ulint first_free;
byte* ptr;
ulint len;
@ -486,13 +485,13 @@ trx_undo_page_report_modify(
/* Store the values of the system columns */
field = rec_get_nth_field(rec, offsets,
dict_index_get_sys_col_pos
(index, DATA_TRX_ID), &len);
dict_index_get_sys_col_pos(
index, DATA_TRX_ID), &len);
ut_ad(len == DATA_TRX_ID_LEN);
trx_id = trx_read_trx_id(field);
field = rec_get_nth_field(rec, offsets,
dict_index_get_sys_col_pos
(index, DATA_ROLL_PTR), &len);
dict_index_get_sys_col_pos(
index, DATA_ROLL_PTR), &len);
ut_ad(len == DATA_ROLL_PTR_LEN);
roll_ptr = trx_read_roll_ptr(field);
@ -567,9 +566,9 @@ trx_undo_page_report_modify(
/* If a field has external storage, we add
to flen the flag */
len = mach_write_compressed
(ptr,
UNIV_EXTERN_STORAGE_FIELD + flen);
len = mach_write_compressed(
ptr,
UNIV_EXTERN_STORAGE_FIELD + flen);
/* Notify purge that it eventually has to
free the old externally stored field */
@ -627,7 +626,8 @@ trx_undo_page_report_modify(
for (col_no = 0; col_no < dict_table_get_n_cols(table);
col_no++) {
col = dict_table_get_nth_col(table, col_no);
const dict_col_t* col
= dict_table_get_nth_col(table, col_no);
if (col->ord_part > 0) {
@ -826,9 +826,9 @@ trx_undo_update_rec_get_update(
buf = mem_heap_alloc(heap, DATA_ROLL_PTR_LEN);
trx_write_roll_ptr(buf, roll_ptr);
upd_field_set_field_no
(upd_field, dict_index_get_sys_col_pos(index, DATA_ROLL_PTR),
index, trx);
upd_field_set_field_no(
upd_field, dict_index_get_sys_col_pos(index, DATA_ROLL_PTR),
index, trx);
dfield_set_data(&(upd_field->new_val), buf, DATA_ROLL_PTR_LEN);
/* Store then the updated ordinary columns to the update vector */
@ -1094,14 +1094,14 @@ trx_undo_report_row_operation(
#endif /* UNIV_SYNC_DEBUG */
if (op_type == TRX_UNDO_INSERT_OP) {
offset = trx_undo_page_report_insert
(undo_page, trx, index, clust_entry, &mtr);
offset = trx_undo_page_report_insert(
undo_page, trx, index, clust_entry, &mtr);
} else {
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
offset = trx_undo_page_report_modify
(undo_page, trx, index, rec, offsets,
update, cmpl_info, &mtr);
offset = trx_undo_page_report_modify(
undo_page, trx, index, rec, offsets, update,
cmpl_info, &mtr);
}
if (offset == 0) {

View file

@ -171,18 +171,18 @@ trx_rseg_mem_create(
if (len > 0) {
trx_sys->rseg_history_len += len;
node_addr = trx_purge_get_log_from_hist
(flst_get_last(rseg_header + TRX_RSEG_HISTORY, mtr));
node_addr = trx_purge_get_log_from_hist(
flst_get_last(rseg_header + TRX_RSEG_HISTORY, mtr));
rseg->last_page_no = node_addr.page;
rseg->last_offset = node_addr.boffset;
undo_log_hdr = trx_undo_page_get(rseg->space, node_addr.page,
mtr) + node_addr.boffset;
rseg->last_trx_no = mtr_read_dulint
(undo_log_hdr + TRX_UNDO_TRX_NO, mtr);
rseg->last_del_marks = mtr_read_ulint
(undo_log_hdr + TRX_UNDO_DEL_MARKS, MLOG_2BYTES, mtr);
rseg->last_trx_no = mtr_read_dulint(
undo_log_hdr + TRX_UNDO_TRX_NO, mtr);
rseg->last_del_marks = mtr_read_ulint(
undo_log_hdr + TRX_UNDO_DEL_MARKS, MLOG_2BYTES, mtr);
} else {
rseg->last_page_no = FIL_NULL;
}

View file

@ -105,17 +105,17 @@ trx_doublewrite_init(
trx_doublewrite->first_free = 0;
trx_doublewrite->block1 = mach_read_from_4
(doublewrite + TRX_SYS_DOUBLEWRITE_BLOCK1);
trx_doublewrite->block2 = mach_read_from_4
(doublewrite + TRX_SYS_DOUBLEWRITE_BLOCK2);
trx_doublewrite->write_buf_unaligned = ut_malloc
((1 + 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE);
trx_doublewrite->block1 = mach_read_from_4(
doublewrite + TRX_SYS_DOUBLEWRITE_BLOCK1);
trx_doublewrite->block2 = mach_read_from_4(
doublewrite + TRX_SYS_DOUBLEWRITE_BLOCK2);
trx_doublewrite->write_buf_unaligned = ut_malloc(
(1 + 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE);
trx_doublewrite->write_buf = ut_align
(trx_doublewrite->write_buf_unaligned, UNIV_PAGE_SIZE);
trx_doublewrite->buf_block_arr = mem_alloc
(2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * sizeof(void*));
trx_doublewrite->write_buf = ut_align(
trx_doublewrite->write_buf_unaligned, UNIV_PAGE_SIZE);
trx_doublewrite->buf_block_arr = mem_alloc(
2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * sizeof(void*));
}
/********************************************************************
@ -438,8 +438,8 @@ trx_sys_doublewrite_init_or_restore_pages(
/* printf("Resetting space id in page %lu\n",
source_page_no); */
} else {
space_id = mach_read_from_4
(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
space_id = mach_read_from_4(
page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
}
if (!restore_corrupt_pages) {
@ -671,12 +671,12 @@ trx_sys_print_mysql_binlog_offset_from_page(
fprintf(stderr,
"ibbackup: Last MySQL binlog file position %lu %lu,"
" file name %s\n",
(ulong) mach_read_from_4
(sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH),
(ulong) mach_read_from_4
(sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW),
(ulong) mach_read_from_4(
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH),
(ulong) mach_read_from_4(
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW),
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_NAME);
}
@ -708,12 +708,12 @@ trx_sys_print_mysql_binlog_offset(void)
return;
}
trx_sys_mysql_bin_log_pos_high = mach_read_from_4
(sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH);
trx_sys_mysql_bin_log_pos_low = mach_read_from_4
(sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW);
trx_sys_mysql_bin_log_pos_high = mach_read_from_4(
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH);
trx_sys_mysql_bin_log_pos_low = mach_read_from_4(
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW);
trx_sys_mysql_bin_log_pos
= (((ib_longlong)trx_sys_mysql_bin_log_pos_high) << 32)
@ -777,12 +777,12 @@ trx_sys_print_mysql_master_log_pos(void)
TRX_SYS_MYSQL_LOG_NAME_LEN);
trx_sys_mysql_master_log_pos
= (((ib_longlong) mach_read_from_4
(sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH)) << 32)
+ ((ib_longlong) mach_read_from_4
(sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW));
= (((ib_longlong) mach_read_from_4(
sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH)) << 32)
+ ((ib_longlong) mach_read_from_4(
sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW));
mtr_commit(&mtr);
}
@ -847,12 +847,6 @@ trx_sysf_create(
mtr);
ut_a(buf_frame_get_page_no(page) == TRX_SYS_PAGE_NO);
/* Reset the doublewrite buffer magic number to zero so that we
know that the doublewrite buffer has not yet been created (this
suppresses a Valgrind warning) */
mach_write_to_4(page + TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_MAGIC,
0);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TRX_SYS_HEADER);
#endif /* UNIV_SYNC_DEBUG */
@ -860,6 +854,13 @@ trx_sysf_create(
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_TYPE_TRX_SYS,
MLOG_2BYTES, mtr);
/* Reset the doublewrite buffer magic number to zero so that we
know that the doublewrite buffer has not yet been created (this
suppresses a Valgrind warning) */
mlog_write_ulint(page + TRX_SYS_DOUBLEWRITE
+ TRX_SYS_DOUBLEWRITE_MAGIC, 0, MLOG_4BYTES, mtr);
sys_header = trx_sysf_get(mtr);
/* Start counting transaction ids from number 1 up */
@ -919,12 +920,12 @@ trx_sys_init_at_db_start(void)
to the disk-based header! Thus trx id values will not overlap when
the database is repeatedly started! */
trx_sys->max_trx_id = ut_dulint_add
(ut_dulint_align_up(mtr_read_dulint
(sys_header
+ TRX_SYS_TRX_ID_STORE, &mtr),
TRX_SYS_TRX_ID_WRITE_MARGIN),
2 * TRX_SYS_TRX_ID_WRITE_MARGIN);
trx_sys->max_trx_id = ut_dulint_add(
ut_dulint_align_up(mtr_read_dulint(
sys_header
+ TRX_SYS_TRX_ID_STORE, &mtr),
TRX_SYS_TRX_ID_WRITE_MARGIN),
2 * TRX_SYS_TRX_ID_WRITE_MARGIN);
UT_LIST_INIT(trx_sys->mysql_trx_list);
trx_lists_init_at_db_start();
@ -935,8 +936,8 @@ trx_sys_init_at_db_start(void)
for (;;) {
if ( trx->conc_state != TRX_PREPARED) {
rows_to_undo += ut_conv_dulint_to_longlong
(trx->undo_no);
rows_to_undo += ut_conv_dulint_to_longlong(
trx->undo_no);
}
trx = UT_LIST_GET_NEXT(trx_list, trx);

View file

@ -556,10 +556,10 @@ trx_lists_init_at_db_start(void)
"InnoDB: Transaction"
" %lu %lu was in the"
" XA prepared state.\n",
ut_dulint_get_high
(trx->id),
ut_dulint_get_low
(trx->id));
ut_dulint_get_high(
trx->id),
ut_dulint_get_low(
trx->id));
if (srv_force_recovery == 0) {
@ -790,8 +790,8 @@ trx_commit_off_kernel(
because only a single OS thread is allowed to do the
transaction commit for this transaction. */
update_hdr_page = trx_undo_set_state_at_finish
(trx, undo, &mtr);
update_hdr_page = trx_undo_set_state_at_finish(
trx, undo, &mtr);
/* We have to do the cleanup for the update log while
holding the rseg mutex because update log headers
@ -809,19 +809,19 @@ trx_commit_off_kernel(
if (trx->mysql_log_file_name
&& trx->mysql_log_file_name[0] != '\0') {
trx_sys_update_mysql_binlog_offset
(trx->mysql_log_file_name,
trx->mysql_log_offset,
TRX_SYS_MYSQL_LOG_INFO, &mtr);
trx_sys_update_mysql_binlog_offset(
trx->mysql_log_file_name,
trx->mysql_log_offset,
TRX_SYS_MYSQL_LOG_INFO, &mtr);
trx->mysql_log_file_name = NULL;
}
if (trx->mysql_master_log_file_name[0] != '\0') {
/* This database server is a MySQL replication slave */
trx_sys_update_mysql_binlog_offset
(trx->mysql_master_log_file_name,
trx->mysql_master_log_pos,
TRX_SYS_MYSQL_MASTER_LOG_INFO, &mtr);
trx_sys_update_mysql_binlog_offset(
trx->mysql_master_log_file_name,
trx->mysql_master_log_pos,
TRX_SYS_MYSQL_MASTER_LOG_INFO, &mtr);
}
/* The following call commits the mini-transaction, making the
@ -1010,8 +1010,8 @@ trx_assign_read_view(
mutex_enter(&kernel_mutex);
if (!trx->read_view) {
trx->read_view = read_view_open_now
(trx->id, trx->global_read_view_heap);
trx->read_view = read_view_open_now(
trx->id, trx->global_read_view_heap);
trx->global_read_view = trx->read_view;
}
@ -1835,8 +1835,8 @@ trx_prepare_off_kernel(
}
if (trx->update_undo) {
update_hdr_page = trx_undo_set_state_at_prepare
(trx, trx->update_undo, &mtr);
update_hdr_page = trx_undo_set_state_at_prepare(
trx, trx->update_undo, &mtr);
}
mutex_exit(&(rseg->mutex));
@ -1983,8 +1983,8 @@ trx_recover_for_mysql(
fprintf(stderr,
" InnoDB: Transaction contains changes"
" to %lu rows\n",
(ulong) ut_conv_dulint_to_longlong
(trx->undo_no));
(ulong) ut_conv_dulint_to_longlong(
trx->undo_no));
count++;

View file

@ -153,8 +153,8 @@ trx_undo_get_prev_rec_from_prev_page(
return(NULL);
}
prev_page = trx_undo_page_get_s_latched
(buf_frame_get_space_id(undo_page), prev_page_no, mtr);
prev_page = trx_undo_page_get_s_latched(
buf_frame_get_space_id(undo_page), prev_page_no, mtr);
return(trx_undo_page_get_last_rec(prev_page, page_no, offset));
}
@ -1041,8 +1041,8 @@ trx_undo_truncate_end(
goto function_exit;
}
trx_undo_free_page_in_rollback
(trx, undo, last_page_no, &mtr);
trx_undo_free_page_in_rollback(
trx, undo, last_page_no, &mtr);
break;
}
@ -1261,8 +1261,8 @@ trx_undo_mem_create_at_db_start(
page_no, offset);
mutex_exit(&(rseg->mutex));
undo->dict_operation = mtr_read_ulint
(undo_header + TRX_UNDO_DICT_TRANS, MLOG_1BYTE, mtr);
undo->dict_operation = mtr_read_ulint(
undo_header + TRX_UNDO_DICT_TRANS, MLOG_1BYTE, mtr);
undo->table_id = mtr_read_dulint(undo_header + TRX_UNDO_TABLE_ID, mtr);
undo->state = state;
@ -1601,8 +1601,8 @@ trx_undo_reuse_cached(
offset = trx_undo_insert_header_reuse(undo_page, trx_id, mtr);
if (trx->support_xa) {
trx_undo_header_add_space_for_xid
(undo_page, undo_page + offset, mtr);
trx_undo_header_add_space_for_xid(
undo_page, undo_page + offset, mtr);
}
} else {
ut_a(mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
@ -1612,8 +1612,8 @@ trx_undo_reuse_cached(
offset = trx_undo_header_create(undo_page, trx_id, mtr);
if (trx->support_xa) {
trx_undo_header_add_space_for_xid
(undo_page, undo_page + offset, mtr);
trx_undo_header_add_space_for_xid(
undo_page, undo_page + offset, mtr);
}
}