Below is the list of changes that have just been committed into a local
5.1 repository of alexi. When alexi does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2251 06/07/26 09:15:14 aivanov@stripped +3 -0
Merge mysql.com:/home/alexi/innodb/mysql-5.0-work
into mysql.com:/home/alexi/innodb/mysql-5.1-work
Null merge.
storage/innobase/include/sync0rw.ic
1.13 06/07/26 08:28:48 aivanov@stripped +1 -1
Null merge.
storage/innobase/ibuf/ibuf0ibuf.c
1.44 06/07/26 08:28:46 aivanov@stripped +9 -6
Null merge.
storage/innobase/btr/btr0cur.c
1.53 06/07/26 08:28:26 aivanov@stripped +1 -2
Null merge.
storage/innobase/include/sync0rw.ic
1.9.2.2 06/07/26 08:27:25 aivanov@stripped +0 -0
Merge rename: innobase/include/sync0rw.ic -> storage/innobase/include/sync0rw.ic
storage/innobase/ibuf/ibuf0ibuf.c
1.36.4.3 06/07/26 08:27:25 aivanov@stripped +0 -0
Merge rename: innobase/ibuf/ibuf0ibuf.c -> storage/innobase/ibuf/ibuf0ibuf.c
storage/innobase/btr/btr0cur.c
1.44.5.2 06/07/26 08:27:25 aivanov@stripped +0 -0
Merge rename: innobase/btr/btr0cur.c -> storage/innobase/btr/btr0cur.c
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: aivanov
# Host: mysqld.localdomain
# Root: /home/alexi/innodb/mysql-5.1-work/RESYNC
--- 1.44.5.1/innobase/btr/btr0cur.c 2006-07-26 08:25:57 +04:00
+++ 1.53/storage/innobase/btr/btr0cur.c 2006-07-26 08:28:26 +04:00
@@ -116,7 +116,7 @@
const ulint* offsets);/* in: array returned by rec_get_offsets() */
/*==================== B-TREE SEARCH =========================*/
-
+
/************************************************************************
Latches the leaf page or pages requested. */
static
@@ -128,17 +128,17 @@
ulint space, /* in: space id */
ulint page_no, /* in: page number of the leaf */
ulint latch_mode, /* in: BTR_SEARCH_LEAF, ... */
- btr_cur_t* cursor, /* in: cursor */
+ btr_cur_t* cursor, /* in: cursor */
mtr_t* mtr) /* in: mtr */
{
ulint left_page_no;
ulint right_page_no;
page_t* get_page;
-
+
ut_ad(page && mtr);
if (latch_mode == BTR_SEARCH_LEAF) {
-
+
get_page = btr_page_get(space, page_no, RW_S_LATCH, mtr);
ut_a(page_is_comp(get_page) == page_is_comp(page));
buf_block_align(get_page)->check_index_page_at_flush = TRUE;
@@ -157,11 +157,15 @@
if (left_page_no != FIL_NULL) {
get_page = btr_page_get(space, left_page_no,
RW_X_LATCH, mtr);
+#ifdef UNIV_BTR_DEBUG
+ ut_a(btr_page_get_next(get_page, mtr)
+ == buf_frame_get_page_no(page));
+#endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(get_page) == page_is_comp(page));
buf_block_align(get_page)->check_index_page_at_flush =
TRUE;
}
-
+
get_page = btr_page_get(space, page_no, RW_X_LATCH, mtr);
ut_a(page_is_comp(get_page) == page_is_comp(page));
buf_block_align(get_page)->check_index_page_at_flush = TRUE;
@@ -171,6 +175,10 @@
if (right_page_no != FIL_NULL) {
get_page = btr_page_get(space, right_page_no,
RW_X_LATCH, mtr);
+#ifdef UNIV_BTR_DEBUG
+ ut_a(btr_page_get_prev(get_page, mtr)
+ == buf_frame_get_page_no(page));
+#endif /* UNIV_BTR_DEBUG */
buf_block_align(get_page)->check_index_page_at_flush =
TRUE;
}
@@ -183,6 +191,10 @@
if (left_page_no != FIL_NULL) {
cursor->left_page = btr_page_get(space, left_page_no,
RW_S_LATCH, mtr);
+#ifdef UNIV_BTR_DEBUG
+ ut_a(btr_page_get_next(cursor->left_page, mtr)
+ == buf_frame_get_page_no(page));
+#endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(cursor->left_page) ==
page_is_comp(page));
buf_block_align(
@@ -201,6 +213,10 @@
if (left_page_no != FIL_NULL) {
cursor->left_page = btr_page_get(space, left_page_no,
RW_X_LATCH, mtr);
+#ifdef UNIV_BTR_DEBUG
+ ut_a(btr_page_get_next(cursor->left_page, mtr)
+ == buf_frame_get_page_no(page));
+#endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(cursor->left_page) ==
page_is_comp(page));
buf_block_align(
@@ -261,7 +277,7 @@
ulint up_match;
ulint up_bytes;
ulint low_match;
- ulint low_bytes;
+ ulint low_bytes;
ulint height;
ulint savepoint;
ulint rw_latch;
@@ -289,7 +305,7 @@
#ifdef UNIV_DEBUG
cursor->up_match = ULINT_UNDEFINED;
cursor->low_match = ULINT_UNDEFINED;
-#endif
+#endif
insert_planned = latch_mode & BTR_INSERT;
estimate = latch_mode & BTR_ESTIMATE;
ignore_sec_unique = latch_mode & BTR_IGNORE_SEC_UNIQUE;
@@ -297,7 +313,7 @@
| BTR_IGNORE_SEC_UNIQUE);
ut_ad(!insert_planned || (mode == PAGE_CUR_LE));
-
+
cursor->flag = BTR_CUR_BINARY;
cursor->index = index;
@@ -312,7 +328,7 @@
#ifdef UNIV_SEARCH_PERF_STAT
info->n_searches++;
-#endif
+#endif
if (btr_search_latch.writer == RW_LOCK_NOT_LOCKED
&& latch_mode <= BTR_MODIFY_LEAF && info->last_hash_succ
&& !estimate
@@ -320,7 +336,7 @@
&& mode != PAGE_CUR_LE_OR_EXTENDS
#endif /* PAGE_CUR_LE_OR_EXTENDS */
&& srv_use_adaptive_hash_indexes
- && btr_search_guess_on_hash(index, info, tuple, mode,
+ && btr_search_guess_on_hash(index, info, tuple, mode,
latch_mode, cursor,
has_search_latch, mtr)) {
@@ -334,7 +350,7 @@
|| mode != PAGE_CUR_LE);
btr_cur_n_sea++;
- return;
+ return;
}
#endif
#endif
@@ -354,7 +370,7 @@
savepoint = mtr_set_savepoint(mtr);
tree = index->tree;
-
+
if (latch_mode == BTR_MODIFY_TREE) {
mtr_x_lock(dict_tree_get_lock(tree), mtr);
@@ -365,7 +381,7 @@
} else {
mtr_s_lock(dict_tree_get_lock(tree), mtr);
}
-
+
page_cursor = btr_cur_get_page_cur(cursor);
space = dict_tree_get_space(tree);
@@ -411,14 +427,14 @@
if (insert_planned && ibuf_should_try(index,
ignore_sec_unique)) {
-
+
/* Try insert to the insert buffer if the
page is not in the buffer pool */
buf_mode = BUF_GET_IF_IN_POOL;
}
}
-retry_page_get:
+retry_page_get:
page = buf_page_get_gen(space, page_no, rw_latch, guess,
buf_mode,
__FILE__, __LINE__,
@@ -439,7 +455,7 @@
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
- goto func_exit;
+ return;
}
/* Insert to the insert buffer did not succeed:
@@ -451,8 +467,8 @@
}
buf_block_align(page)->check_index_page_at_flush = TRUE;
-
-#ifdef UNIV_SYNC_DEBUG
+
+#ifdef UNIV_SYNC_DEBUG
if (rw_latch != RW_NO_LATCH) {
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
}
@@ -469,10 +485,10 @@
#ifdef BTR_CUR_ADAPT
if (page != guess) {
info->root_guess = page;
- }
+ }
#endif
}
-
+
if (height == 0) {
if (rw_latch == RW_NO_LATCH) {
@@ -482,7 +498,7 @@
}
if ((latch_mode != BTR_MODIFY_TREE)
- && (latch_mode != BTR_CONT_MODIFY_TREE)) {
+ && (latch_mode != BTR_CONT_MODIFY_TREE)) {
/* Release the tree s-latch */
@@ -499,7 +515,7 @@
&low_match, &low_bytes, page_cursor);
if (estimate) {
btr_cur_add_path_info(cursor, height, root_height);
- }
+ }
/* If this is the desired level, leave the loop */
@@ -513,7 +529,7 @@
page = btr_page_get(space,
page_no, RW_X_LATCH, mtr);
ut_a((ibool)!!page_is_comp(page)
- == index->table->comp);
+ == dict_table_is_comp(index->table));
}
break;
@@ -541,7 +557,7 @@
cursor->up_match = up_match;
cursor->up_bytes = up_bytes;
-#ifdef BTR_CUR_ADAPT
+#ifdef BTR_CUR_ADAPT
if (srv_use_adaptive_hash_indexes) {
btr_search_info_update(index, cursor);
@@ -555,9 +571,8 @@
|| mode != PAGE_CUR_LE);
}
-func_exit:
if (has_search_latch) {
-
+
rw_lock_s_lock(&btr_search_latch);
}
}
@@ -584,7 +599,7 @@
ulint root_height = 0; /* remove warning */
rec_t* node_ptr;
ulint estimate;
- ulint savepoint;
+ ulint savepoint;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
@@ -592,9 +607,9 @@
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 */
@@ -605,7 +620,7 @@
} else {
mtr_s_lock(dict_tree_get_lock(tree), mtr);
}
-
+
page_cursor = btr_cur_get_page_cur(cursor);
cursor->index = index;
@@ -640,9 +655,9 @@
we had to scan far to find a record visible to the
current transaction, that could starve others
waiting for the tree latch. */
-
+
if ((latch_mode != BTR_MODIFY_TREE)
- && (latch_mode != BTR_CONT_MODIFY_TREE)) {
+ && (latch_mode != BTR_CONT_MODIFY_TREE)) {
/* Release the tree s-latch */
@@ -651,7 +666,7 @@
dict_tree_get_lock(tree));
}
}
-
+
if (from_left) {
page_cur_set_before_first(page, page_cursor);
} else {
@@ -659,10 +674,10 @@
}
if (height == 0) {
- if (estimate) {
- btr_cur_add_path_info(cursor, height,
- root_height);
- }
+ if (estimate) {
+ btr_cur_add_path_info(cursor, height,
+ root_height);
+ }
break;
}
@@ -692,7 +707,7 @@
mem_heap_free(heap);
}
}
-
+
/**************************************************************************
Positions a cursor at a randomly chosen position within a B-tree. */
@@ -717,13 +732,13 @@
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
tree = index->tree;
-
+
if (latch_mode == BTR_MODIFY_TREE) {
mtr_x_lock(dict_tree_get_lock(tree), mtr);
} else {
mtr_s_lock(dict_tree_get_lock(tree), mtr);
}
-
+
page_cursor = btr_cur_get_page_cur(cursor);
cursor->index = index;
@@ -731,7 +746,7 @@
page_no = dict_tree_get_page(tree);
height = ULINT_UNDEFINED;
-
+
for (;;) {
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
@@ -751,7 +766,7 @@
latch_mode, cursor, mtr);
}
- page_cur_open_on_rnd_user_rec(page, page_cursor);
+ page_cur_open_on_rnd_user_rec(page, page_cursor);
if (height == 0) {
@@ -772,7 +787,7 @@
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
-}
+}
/*==================== B-TREE INSERT =========================*/
@@ -799,7 +814,7 @@
rec_t* rec;
ut_ad(dtuple_check_typed(tuple));
-
+
*reorg = FALSE;
page = btr_cur_get_page(cursor);
@@ -807,7 +822,7 @@
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
page_cursor = btr_cur_get_page_cur(cursor);
-
+
/* Now, try the insert */
rec = page_cur_tuple_insert(page_cursor, tuple, cursor->index, mtr);
@@ -856,9 +871,9 @@
rec = btr_cur_get_rec(cursor);
index = cursor->index;
-
+
err = lock_rec_insert_check_and_lock(flags, rec, index, thr, inherit);
-
+
if (err != DB_SUCCESS) {
return(err);
@@ -943,7 +958,7 @@
ibool inherit;
ulint rec_size;
ulint type;
- ulint err;
+ ulint err;
*big_rec = NULL;
@@ -976,11 +991,11 @@
/* The record is so big that we have to store some fields
externally on separate database pages */
-
- big_rec_vec = dtuple_convert_big_rec(index, entry, NULL, 0);
+
+ big_rec_vec = dtuple_convert_big_rec(index, entry, NULL, 0);
if (big_rec_vec == NULL) {
-
+
return(DB_TOO_BIG_RECORD);
}
@@ -992,38 +1007,38 @@
for future updates of records. */
type = index->type;
-
+
if ((type & DICT_CLUSTERED)
- && (dict_tree_get_space_reserve(index->tree) + rec_size > max_size)
- && (page_get_n_recs(page) >= 2)
- && (0 == level)
- && (btr_page_get_split_rec_to_right(cursor, &dummy_rec)
- || btr_page_get_split_rec_to_left(cursor, &dummy_rec))) {
+ && (dict_tree_get_space_reserve(index->tree) + rec_size > max_size)
+ && (page_get_n_recs(page) >= 2)
+ && (0 == level)
+ && (btr_page_get_split_rec_to_right(cursor, &dummy_rec)
+ || btr_page_get_split_rec_to_left(cursor, &dummy_rec))) {
- if (big_rec_vec) {
+ if (big_rec_vec) {
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
}
return(DB_FAIL);
}
-
+
if (!(((max_size >= rec_size)
- && (max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT))
- || (page_get_max_insert_size(page, 1) >= rec_size)
- || (page_get_n_recs(page) <= 1))) {
+ && (max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT))
+ || (page_get_max_insert_size(page, 1) >= rec_size)
+ || (page_get_n_recs(page) <= 1))) {
- if (big_rec_vec) {
+ if (big_rec_vec) {
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
}
return(DB_FAIL);
}
- /* Check locks and write to the undo log, if specified */
- err = btr_cur_ins_lock_and_undo(flags, cursor, entry, thr, &inherit);
+ /* Check locks and write to the undo log, if specified */
+ err = btr_cur_ins_lock_and_undo(flags, cursor, entry, thr, &inherit);
if (err != DB_SUCCESS) {
- if (big_rec_vec) {
+ if (big_rec_vec) {
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
}
return(err);
@@ -1042,7 +1057,7 @@
btr_page_reorganize(page, index, mtr);
ut_ad(page_get_max_insert_size(page, 1) == max_size);
-
+
reorg = TRUE;
page_cur_search(page, index, entry, PAGE_CUR_LE, page_cursor);
@@ -1077,7 +1092,7 @@
" rec %lu ind type %lu\n",
buf_frame_get_page_no(page), max_size,
rec_size + PAGE_DIR_SLOT_SIZE, type);
-*/
+*/
if (!(type & DICT_CLUSTERED)) {
/* We have added a record to page: update its free bits */
ibuf_update_free_bits_if_full(cursor->index, page, max_size,
@@ -1124,7 +1139,7 @@
ibool success;
ulint n_extents = 0;
ulint n_reserved;
-
+
ut_ad(dtuple_check_typed(entry));
*big_rec = NULL;
@@ -1159,7 +1174,7 @@
return(err);
}
- if (!(flags & BTR_NO_UNDO_LOG_FLAG)) {
+ if (!(flags & BTR_NO_UNDO_LOG_FLAG)) {
/* First reserve enough free space for the file segments
of the index tree, so that the insert will not fail because
of lack of space */
@@ -1181,13 +1196,13 @@
/* The record is so big that we have to store some fields
externally on separate database pages */
-
- big_rec_vec = dtuple_convert_big_rec(index, entry, NULL, 0);
+
+ big_rec_vec = dtuple_convert_big_rec(index, entry, NULL, 0);
if (big_rec_vec == NULL) {
-
+
if (n_extents > 0) {
- fil_space_release_free_extents(index->space,
+ fil_space_release_free_extents(index->space,
n_reserved);
}
return(DB_TOO_BIG_RECORD);
@@ -1203,7 +1218,7 @@
*rec = btr_page_split_and_insert(cursor, entry, mtr);
}
- btr_cur_position(index, page_rec_get_prev(*rec), cursor);
+ btr_cur_position(index, page_rec_get_prev(*rec), cursor);
#ifdef BTR_CUR_ADAPT
btr_search_update_hash_on_insert(cursor);
@@ -1245,12 +1260,12 @@
dict_index_t* index;
rec_t* rec;
ulint err;
-
+
ut_ad(cursor && update && thr && roll_ptr);
rec = btr_cur_get_rec(cursor);
index = cursor->index;
-
+
if (!(index->type & DICT_CLUSTERED)) {
/* We do undo logging only when we update a clustered index
record */
@@ -1305,7 +1320,7 @@
byte* log_ptr;
page_t* page = ut_align_down(rec, UNIV_PAGE_SIZE);
ut_ad(flags < 256);
- ut_ad(!!page_is_comp(page) == index->table->comp);
+ ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
log_ptr = mlog_open_and_write_index(mtr, rec, index, page_is_comp(page)
? MLOG_COMP_REC_UPDATE_IN_PLACE
@@ -1333,7 +1348,7 @@
log_ptr += 2;
row_upd_index_write_log(update, log_ptr, mtr);
-}
+}
/***************************************************************
Parses a redo log record of updating a record in-place. */
@@ -1361,7 +1376,7 @@
return(NULL);
}
-
+
flags = mach_read_from_1(ptr);
ptr++;
@@ -1383,7 +1398,7 @@
ut_a(rec_offset <= UNIV_PAGE_SIZE);
heap = mem_heap_create(256);
-
+
ptr = row_upd_index_parse(ptr, end_ptr, heap, &update);
if (!ptr || !page) {
@@ -1391,9 +1406,9 @@
goto func_exit;
}
- ut_a((ibool)!!page_is_comp(page) == index->table->comp);
+ ut_a((ibool)!!page_is_comp(page) == dict_table_is_comp(index->table));
rec = page + rec_offset;
-
+
/* We do not need to reserve btr_search_latch, as the page is only
being recovered, and there cannot be a hash index to it. */
@@ -1444,7 +1459,7 @@
rec = btr_cur_get_rec(cursor);
index = cursor->index;
- ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
+ ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
trx = thr_get_trx(thr);
offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
#ifdef UNIV_DEBUG
@@ -1467,19 +1482,19 @@
block = buf_block_align(rec);
ut_ad(!!page_is_comp(buf_block_get_frame(block))
- == index->table->comp);
+ == dict_table_is_comp(index->table));
if (block->is_hashed) {
/* The function row_upd_changes_ord_field_binary works only
if the update vector was built for a clustered index, we must
NOT call it if index is secondary */
- if (!(index->type & DICT_CLUSTERED)
- || row_upd_changes_ord_field_binary(NULL, index, update)) {
+ if (!(index->type & DICT_CLUSTERED)
+ || row_upd_changes_ord_field_binary(NULL, index, update)) {
- /* Remove possible hash index pointer to this record */
- btr_search_update_hash_on_delete(cursor);
- }
+ /* Remove possible hash index pointer to this record */
+ btr_search_update_hash_on_delete(cursor);
+ }
rw_lock_x_lock(&btr_search_latch);
}
@@ -1559,8 +1574,8 @@
page = btr_cur_get_page(cursor);
rec = btr_cur_get_rec(cursor);
index = cursor->index;
- ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
-
+ ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
+
heap = mem_heap_create(1024);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
@@ -1601,20 +1616,20 @@
mem_heap_free(heap);
return(DB_OVERFLOW);
}
-
+
page_cursor = btr_cur_get_page_cur(cursor);
-
+
new_entry = row_rec_to_index_entry(ROW_COPY_DATA, index, rec, heap);
row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update,
- NULL);
+ FALSE, NULL);
old_rec_size = rec_offs_size(offsets);
new_rec_size = rec_get_converted_size(index, new_entry);
-
+
if (UNIV_UNLIKELY(new_rec_size >= page_get_free_space_of_empty(
page_is_comp(page)) / 2)) {
- mem_heap_free(heap);
+ mem_heap_free(heap);
return(DB_OVERFLOW);
}
@@ -1634,14 +1649,14 @@
}
if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT)
- && (max_size >= new_rec_size))
- || (page_get_n_recs(page) <= 1))) {
+ && (max_size >= new_rec_size))
+ || (page_get_n_recs(page) <= 1))) {
/* There was not enough space, or it did not pay to
reorganize: for simplicity, we decide what to do assuming a
reorganization is needed, though it might not be necessary */
- mem_heap_free(heap);
+ mem_heap_free(heap);
return(DB_OVERFLOW);
}
@@ -1655,8 +1670,8 @@
return(err);
}
-
- /* Ok, we may do the replacement. Store on the page infimum the
+
+ /* Ok, we may do the replacement. Store on the page infimum the
explicit locks on rec, before deleting rec (see the comment in
.._pessimistic_update). */
@@ -1667,7 +1682,7 @@
page_cur_delete_rec(page_cursor, index, offsets, mtr);
page_cur_move_to_prev(page_cursor);
-
+
trx = thr_get_trx(thr);
if (!(flags & BTR_KEEP_SYS_FLAG)) {
@@ -1694,9 +1709,9 @@
lock_rec_restore_from_page_infimum(rec, page);
- page_cur_move_to_next(page_cursor);
+ page_cur_move_to_next(page_cursor);
- mem_heap_free(heap);
+ mem_heap_free(heap);
return(DB_SUCCESS);
}
@@ -1718,24 +1733,28 @@
page_t* prev_page;
ulint space;
ulint prev_page_no;
-
+
page = buf_frame_align(rec);
if (page_rec_get_next(page_get_infimum_rec(page)) != rec) {
- /* Updated record is not the first user record on its page */
-
+ /* Updated record is not the first user record on its page */
+
return;
}
space = buf_frame_get_space_id(page);
prev_page_no = btr_page_get_prev(page, mtr);
-
+
ut_ad(prev_page_no != FIL_NULL);
prev_page = buf_page_get_with_no_latch(space, prev_page_no, mtr);
+#ifdef UNIV_BTR_DEBUG
+ ut_a(btr_page_get_next(prev_page, mtr)
+ == buf_frame_get_page_no(page));
+#endif /* UNIV_BTR_DEBUG */
/* We must already have an x-latch to prev_page! */
ut_ad(mtr_memo_contains(mtr, buf_block_align(prev_page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
lock_rec_reset_and_inherit_gap_locks(page_get_supremum_rec(prev_page),
rec);
@@ -1787,9 +1806,9 @@
ulint n_ext_vect;
ulint reserve_flag;
ulint* offsets = NULL;
-
+
*big_rec = NULL;
-
+
page = btr_cur_get_page(cursor);
rec = btr_cur_get_rec(cursor);
index = cursor->index;
@@ -1828,7 +1847,7 @@
} else {
reserve_flag = FSP_NORMAL;
}
-
+
success = fsp_reserve_free_extents(&n_reserved,
index->space,
n_extents, reserve_flag, mtr);
@@ -1838,16 +1857,16 @@
return(err);
}
}
-
+
heap = mem_heap_create(1024);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
trx = thr_get_trx(thr);
-
+
new_entry = row_rec_to_index_entry(ROW_COPY_DATA, index, rec, heap);
row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update,
- heap);
+ FALSE, heap);
if (!(flags & BTR_KEEP_SYS_FLAG)) {
row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR,
roll_ptr);
@@ -1864,7 +1883,7 @@
update it back again. */
ut_a(big_rec_vec == NULL);
-
+
btr_rec_free_updated_extern_fields(index, rec, offsets,
update, TRUE, mtr);
}
@@ -1883,8 +1902,8 @@
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,
- ext_vect, n_ext_vect);
+ big_rec_vec = dtuple_convert_big_rec(index, new_entry,
+ ext_vect, n_ext_vect);
if (big_rec_vec == NULL) {
err = DB_TOO_BIG_RECORD;
@@ -2010,7 +2029,7 @@
ut_ad(flags < 256);
ut_ad(val <= 1);
- ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
+ ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
log_ptr = mlog_open_and_write_index(mtr, rec, index,
page_rec_is_comp(rec)
@@ -2057,13 +2076,14 @@
ulint offset;
rec_t* rec;
- ut_ad(!page || !!page_is_comp(page) == index->table->comp);
+ ut_ad(!page
+ || !!page_is_comp(page) == dict_table_is_comp(index->table));
if (end_ptr < ptr + 2) {
return(NULL);
}
-
+
flags = mach_read_from_1(ptr);
ptr++;
val = mach_read_from_1(ptr);
@@ -2088,7 +2108,7 @@
if (page) {
rec = page + offset;
-
+
if (!(flags & BTR_KEEP_SYS_FLAG)) {
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
@@ -2109,7 +2129,7 @@
rec_set_deleted_flag(rec, page_is_comp(page), val);
}
-
+
return(ptr);
}
@@ -2143,7 +2163,7 @@
rec = btr_cur_get_rec(cursor);
index = cursor->index;
- ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
+ ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
#ifdef UNIV_DEBUG
@@ -2187,11 +2207,11 @@
rec_set_deleted_flag(rec, rec_offs_comp(offsets), val);
trx = thr_get_trx(thr);
-
+
if (!(flags & BTR_KEEP_SYS_FLAG)) {
row_upd_rec_sys_fields(rec, index, offsets, trx, roll_ptr);
}
-
+
if (block->is_hashed) {
rw_lock_x_unlock(&btr_search_latch);
}
@@ -2257,7 +2277,7 @@
return(NULL);
}
-
+
val = mach_read_from_1(ptr);
ptr++;
@@ -2268,17 +2288,17 @@
if (page) {
rec = page + offset;
-
+
/* We do not need to reserve btr_search_latch, as the page
is only being recovered, and there cannot be a hash index to
it. */
rec_set_deleted_flag(rec, page_is_comp(page), val);
}
-
+
return(ptr);
}
-
+
/***************************************************************
Sets a secondary index record delete mark to TRUE or FALSE. */
@@ -2316,8 +2336,8 @@
block = buf_block_align(rec);
ut_ad(!!page_is_comp(buf_block_get_frame(block))
- == cursor->index->table->comp);
-
+ == dict_table_is_comp(cursor->index->table));
+
if (block->is_hashed) {
rw_lock_x_lock(&btr_search_latch);
}
@@ -2371,12 +2391,11 @@
ut_ad(mtr_memo_contains(mtr,
dict_tree_get_lock(btr_cur_get_tree(cursor)),
MTR_MEMO_X_LOCK));
- ut_ad(mtr_memo_contains(mtr, buf_block_align(
- btr_cur_get_page(cursor)),
+ ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_rec(cursor)),
MTR_MEMO_PAGE_X_FIX));
ut_ad(btr_page_get_level(btr_cur_get_page(cursor), mtr) == 0);
- btr_compress(cursor, mtr);
+ btr_compress(cursor, mtr);
}
/*****************************************************************
@@ -2398,8 +2417,7 @@
ut_ad(mtr_memo_contains(mtr,
dict_tree_get_lock(btr_cur_get_tree(cursor)),
MTR_MEMO_X_LOCK));
- ut_ad(mtr_memo_contains(mtr, buf_block_align(
- btr_cur_get_page(cursor)),
+ ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_rec(cursor)),
MTR_MEMO_PAGE_X_FIX));
if (btr_cur_compress_recommendation(cursor, mtr)) {
@@ -2437,12 +2455,12 @@
ibool no_compress_needed;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
- ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_page(cursor)),
+ ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_rec(cursor)),
MTR_MEMO_PAGE_X_FIX));
/* This is intended only for leaf page deletions */
page = btr_cur_get_page(cursor);
-
+
ut_ad(btr_page_get_level(page, mtr) == 0);
rec = btr_cur_get_rec(cursor);
@@ -2514,7 +2532,7 @@
ulint level;
mem_heap_t* heap;
ulint* offsets;
-
+
page = btr_cur_get_page(cursor);
tree = btr_cur_get_tree(cursor);
@@ -2556,26 +2574,26 @@
}
if (UNIV_UNLIKELY(page_get_n_recs(page) < 2)
- && UNIV_UNLIKELY(dict_tree_get_page(btr_cur_get_tree(cursor))
- != buf_frame_get_page_no(page))) {
+ && UNIV_UNLIKELY(dict_tree_get_page(btr_cur_get_tree(cursor))
+ != buf_frame_get_page_no(page))) {
/* If there is only one record, drop the whole page in
btr_discard_page, if this is not the root page */
-
+
btr_discard_page(cursor, mtr);
*err = DB_SUCCESS;
ret = TRUE;
- goto return_after_reservations;
+ goto return_after_reservations;
}
lock_update_delete(rec);
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);
@@ -2603,7 +2621,7 @@
btr_insert_on_non_leaf_level(tree,
level + 1, node_ptr, mtr);
}
- }
+ }
btr_search_update_hash_on_delete(cursor);
@@ -2613,7 +2631,7 @@
ut_ad(btr_check_node_ptr(tree, page, mtr));
*err = DB_SUCCESS;
-
+
return_after_reservations:
mem_heap_free(heap);
@@ -2662,7 +2680,7 @@
}
rec = btr_cur_get_rec(cursor);
-
+
slot = cursor->path_arr + (root_height - height);
slot->nth_rec = page_rec_get_n_recs_before(rec);
@@ -2688,8 +2706,8 @@
btr_path_t* slot1;
btr_path_t* slot2;
ibool diverged;
- ibool diverged_lot;
- ulint divergence_level;
+ ibool diverged_lot;
+ ulint divergence_level;
ib_longlong n_rows;
ulint i;
mtr_t mtr;
@@ -2699,7 +2717,7 @@
cursor.path_arr = path1;
if (dtuple_get_n_fields(tuple1) > 0) {
-
+
btr_cur_search_to_nth_level(index, 0, tuple1, mode1,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, 0, &mtr);
@@ -2708,7 +2726,7 @@
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, &mtr);
}
-
+
mtr_commit(&mtr);
mtr_start(&mtr);
@@ -2716,7 +2734,7 @@
cursor.path_arr = path2;
if (dtuple_get_n_fields(tuple2) > 0) {
-
+
btr_cur_search_to_nth_level(index, 0, tuple2, mode2,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, 0, &mtr);
@@ -2725,48 +2743,48 @@
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, &mtr);
}
-
+
mtr_commit(&mtr);
/* We have the path information for the range in path1 and path2 */
n_rows = 1;
- diverged = FALSE; /* This becomes true when the path is not
- the same any more */
- diverged_lot = FALSE; /* This becomes true when the paths are
- not the same or adjacent any more */
+ diverged = FALSE; /* This becomes true when the path is not
+ the same any more */
+ diverged_lot = FALSE; /* This becomes true when the paths are
+ not the same or adjacent any more */
divergence_level = 1000000; /* This is the level where paths diverged
- a lot */
- for (i = 0; ; i++) {
+ a lot */
+ for (i = 0; ; i++) {
ut_ad(i < BTR_PATH_ARRAY_N_SLOTS);
-
+
slot1 = path1 + i;
slot2 = path2 + i;
if (slot1->nth_rec == ULINT_UNDEFINED
|| slot2->nth_rec == ULINT_UNDEFINED) {
- if (i > divergence_level + 1) {
- /* In trees whose height is > 1 our algorithm
- tends to underestimate: multiply the estimate
- by 2: */
+ if (i > divergence_level + 1) {
+ /* In trees whose height is > 1 our algorithm
+ tends to underestimate: multiply the estimate
+ by 2: */
- n_rows = n_rows * 2;
- }
+ n_rows = n_rows * 2;
+ }
/* Do not estimate the number of rows in the range
- to over 1 / 2 of the estimated rows in the whole
+ to over 1 / 2 of the estimated rows in the whole
table */
if (n_rows > index->table->stat_n_rows / 2) {
- n_rows = index->table->stat_n_rows / 2;
+ n_rows = index->table->stat_n_rows / 2;
/* If there are just 0 or 1 rows in the table,
then we estimate all rows are in the range */
-
- if (n_rows == 0) {
- n_rows = index->table->stat_n_rows;
- }
+
+ if (n_rows == 0) {
+ n_rows = index->table->stat_n_rows;
+ }
}
return(n_rows);
@@ -2780,7 +2798,7 @@
n_rows = slot2->nth_rec - slot1->nth_rec;
if (n_rows > 1) {
- diverged_lot = TRUE;
+ diverged_lot = TRUE;
divergence_level = i;
}
} else {
@@ -2792,28 +2810,28 @@
} else if (diverged && !diverged_lot) {
- if (slot1->nth_rec < slot1->n_recs
- || slot2->nth_rec > 1) {
+ if (slot1->nth_rec < slot1->n_recs
+ || slot2->nth_rec > 1) {
- diverged_lot = TRUE;
+ diverged_lot = TRUE;
divergence_level = i;
n_rows = 0;
- if (slot1->nth_rec < slot1->n_recs) {
- n_rows += slot1->n_recs
- - slot1->nth_rec;
+ if (slot1->nth_rec < slot1->n_recs) {
+ n_rows += slot1->n_recs
+ - slot1->nth_rec;
}
if (slot2->nth_rec > 1) {
- n_rows += slot2->nth_rec - 1;
+ n_rows += slot2->nth_rec - 1;
}
- }
+ }
} else if (diverged_lot) {
n_rows = (n_rows * (slot1->n_recs + slot2->n_recs))
/ 2;
- }
+ }
}
}
@@ -2856,13 +2874,13 @@
memset(n_diff, 0, (n_cols + 1) * sizeof(ib_longlong));
/* We sample some pages in the index to get an estimate */
-
+
for (i = 0; i < BTR_KEY_VAL_ESTIMATE_N_PAGES; i++) {
rec_t* supremum;
mtr_start(&mtr);
btr_cur_open_at_rnd_pos(index, BTR_SEARCH_LEAF, &cursor, &mtr);
-
+
/* Count the number of different key values for each prefix of
the key on this index page. If the prefix does not determine
the index record uniquely in te B-tree, then we subtract one
@@ -2907,7 +2925,7 @@
total_external_size +=
btr_rec_get_externally_stored_len(
rec, offsets_rec);
-
+
rec = next_rec;
/* Initialize offsets_rec for the next round
and assign the old offsets_rec buffer to
@@ -2918,7 +2936,7 @@
offsets_next_rec = offsets_tmp;
}
}
-
+
if (n_cols == dict_index_get_n_unique_in_tree(index)) {
@@ -2932,7 +2950,7 @@
in the table. */
if (btr_page_get_prev(page, &mtr) != FIL_NULL
- || btr_page_get_next(page, &mtr) != FIL_NULL) {
+ || btr_page_get_next(page, &mtr) != FIL_NULL) {
n_diff[n_cols]++;
}
@@ -2949,10 +2967,10 @@
/* If we saw k borders between different key values on
BTR_KEY_VAL_ESTIMATE_N_PAGES leaf pages, we can estimate how many
there will be in index->stat_n_leaf_pages */
-
+
/* We must take into account that our sample actually represents
also the pages used for external storage of fields (those pages are
- included in index->stat_n_leaf_pages) */
+ included in index->stat_n_leaf_pages) */
for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j] =
@@ -2961,9 +2979,9 @@
+ BTR_KEY_VAL_ESTIMATE_N_PAGES - 1
+ total_external_size
+ not_empty_flag)
- / (BTR_KEY_VAL_ESTIMATE_N_PAGES
- + total_external_size);
-
+ / (BTR_KEY_VAL_ESTIMATE_N_PAGES
+ + total_external_size);
+
/* If the tree is small, smaller than <
10 * BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size, then
the above estimate is ok. For bigger trees it is common that we
@@ -2978,10 +2996,10 @@
if (add_on > BTR_KEY_VAL_ESTIMATE_N_PAGES) {
add_on = BTR_KEY_VAL_ESTIMATE_N_PAGES;
}
-
+
index->stat_n_diff_key_vals[j] += add_on;
}
-
+
mem_free(n_diff);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -3017,7 +3035,7 @@
data = rec_get_nth_field(rec, offsets, i, &local_len);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
-
+
extern_len = mach_read_from_4(data + local_len
+ BTR_EXTERN_LEN + 4);
@@ -3046,7 +3064,7 @@
ulint byte_val;
data = rec_get_nth_field(rec, offsets, i, &local_len);
-
+
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
@@ -3058,7 +3076,7 @@
} else {
byte_val = byte_val | BTR_EXTERN_OWNER_FLAG;
}
-
+
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN, byte_val,
MLOG_1BYTE, mtr);
}
@@ -3088,7 +3106,7 @@
for (i = 0; i < n; i++) {
if (rec_offs_nth_extern(offsets, i)) {
-
+
/* Check it is not in updated fields */
is_updated = FALSE;
@@ -3137,7 +3155,7 @@
return;
}
-
+
for (i = 0; i < n_ext_vec; i++) {
/* Check ext_vec[i] is in updated fields */
@@ -3155,14 +3173,14 @@
data = (byte*) dfield_get_data(dfield);
len = dfield_get_len(dfield);
-
+
len -= BTR_EXTERN_FIELD_REF_SIZE;
byte_val = mach_read_from_1(data + len
+ BTR_EXTERN_LEN);
byte_val = byte_val | BTR_EXTERN_INHERITED_FLAG;
-
+
mach_write_to_1(data + len + BTR_EXTERN_LEN, byte_val);
}
}
@@ -3192,7 +3210,7 @@
btr_cur_set_ownership_of_extern_field(rec, offsets, i,
TRUE, mtr);
}
- }
+ }
}
/***********************************************************************
@@ -3217,15 +3235,15 @@
data = (byte*) dfield_get_data(dfield);
len = dfield_get_len(dfield);
-
+
len -= BTR_EXTERN_FIELD_REF_SIZE;
byte_val = mach_read_from_1(data + len + BTR_EXTERN_LEN);
byte_val = byte_val & (~BTR_EXTERN_OWNER_FLAG);
-
+
mach_write_to_1(data + len + BTR_EXTERN_LEN, byte_val);
- }
+ }
}
/***********************************************************************
@@ -3252,7 +3270,7 @@
if (update) {
n = upd_get_n_fields(update);
-
+
for (i = 0; i < n; i++) {
if (upd_get_nth_field(update, i)->extern_storage) {
@@ -3269,7 +3287,7 @@
for (i = 0; i < n; i++) {
if (rec_offs_nth_extern(offsets, i)) {
-
+
/* Check it is not in updated fields */
is_updated = FALSE;
@@ -3288,7 +3306,7 @@
n_pushed++;
}
}
- }
+ }
return(n_pushed);
}
@@ -3337,8 +3355,8 @@
big_rec_t* big_rec_vec, /* in: vector containing fields
to be stored externally */
mtr_t* local_mtr __attribute__((unused))) /* in: mtr
- containing the latch to rec and to the
- tree */
+ containing the latch to rec and to the
+ tree */
{
byte* data;
ulint local_len;
@@ -3360,9 +3378,9 @@
ut_ad(mtr_memo_contains(local_mtr, buf_block_align(rec),
MTR_MEMO_PAGE_X_FIX));
ut_a(index->type & DICT_CLUSTERED);
-
+
space_id = buf_frame_get_space_id(rec);
-
+
/* We have to create a file segment to the tablespace
for each field and put the pointer to the field in rec */
@@ -3386,7 +3404,7 @@
} else {
hint_page_no = prev_page_no + 1;
}
-
+
page = btr_page_alloc(index->tree, hint_page_no,
FSP_NO_DIR, 0, &mtr);
if (page == NULL) {
@@ -3396,6 +3414,9 @@
return(DB_OUT_OF_FILE_SPACE);
}
+ mlog_write_ulint(page + FIL_PAGE_TYPE,
+ FIL_PAGE_TYPE_BLOB, MLOG_2BYTES, &mtr);
+
page_no = buf_frame_get_page_no(page);
if (prev_page_no != FIL_NULL) {
@@ -3407,7 +3428,7 @@
buf_page_dbg_add_level(prev_page,
SYNC_EXTERN_STORAGE);
#endif /* UNIV_SYNC_DEBUG */
-
+
mlog_write_ulint(prev_page + FIL_PAGE_DATA
+ BTR_BLOB_HDR_NEXT_PAGE_NO,
page_no, MLOG_4BYTES, &mtr);
@@ -3435,7 +3456,7 @@
mlog_write_ulint(page + FIL_PAGE_DATA
+ BTR_BLOB_HDR_NEXT_PAGE_NO,
FIL_NULL, MLOG_4BYTES, &mtr);
-
+
extern_len -= store_len;
rec_page = buf_page_get(space_id,
@@ -3461,7 +3482,7 @@
+ BTR_EXTERN_PAGE_NO,
page_no,
MLOG_4BYTES, &mtr);
-
+
mlog_write_ulint(data + local_len
+ BTR_EXTERN_OFFSET,
FIL_PAGE_DATA,
@@ -3508,9 +3529,9 @@
ibool do_not_free_inherited,/* in: TRUE if called in a
rollback and we do not want to free
inherited fields */
- mtr_t* local_mtr __attribute__((unused))) /* in: mtr
- containing the latch to data an an
- X-latch to the index tree */
+ mtr_t* local_mtr __attribute__((unused))) /* in: mtr
+ containing the latch to data an an
+ X-latch to the index tree */
{
page_t* page;
page_t* rec_page;
@@ -3529,7 +3550,7 @@
MTR_MEMO_PAGE_X_FIX));
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
-
+
for (;;) {
mtr_start(&mtr);
@@ -3578,7 +3599,7 @@
return;
}
-
+
page = buf_page_get(space_id, page_no, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_EXTERN_STORAGE);
@@ -3641,7 +3662,7 @@
MTR_MEMO_PAGE_X_FIX));
/* Free possible externally stored fields in the record */
- ut_ad(index->table->comp == !!rec_offs_comp(offsets));
+ ut_ad(dict_table_is_comp(index->table) == !!rec_offs_comp(offsets));
n_fields = rec_offs_n_fields(offsets);
for (i = 0; i < n_fields; i++) {
@@ -3688,7 +3709,7 @@
for (i = 0; i < n_fields; i++) {
ufield = upd_get_nth_field(update, i);
-
+
if (rec_offs_nth_extern(offsets, ufield->field_no)) {
data = rec_get_nth_field(rec, offsets,
@@ -3739,7 +3760,7 @@
/* Currently a BLOB cannot be bigger that 4 GB; we
leave the 4 upper bytes in the length field unused */
-
+
extern_len = mach_read_from_4(data + local_len + BTR_EXTERN_LEN + 4);
buf = mem_heap_alloc(heap, local_len + extern_len);
@@ -3749,11 +3770,11 @@
if (extern_len == 0) {
*len = copied_len;
-
+
return(buf);
}
- for (;;) {
+ for (;;) {
mtr_start(&mtr);
page = buf_page_get(space_id, page_no, RW_S_LATCH, &mtr);
@@ -3770,20 +3791,20 @@
page_no = btr_blob_get_next_page_no(blob_header);
- /* On other BLOB pages except the first the BLOB header
- always is at the page data start: */
-
- offset = FIL_PAGE_DATA;
-
mtr_commit(&mtr);
if (page_no == FIL_NULL) {
ut_a(copied_len == local_len + extern_len);
*len = copied_len;
-
+
return(buf);
}
+
+ /* On other BLOB pages except the first the BLOB header
+ always is at the page data start: */
+
+ offset = FIL_PAGE_DATA;
ut_a(copied_len < local_len + extern_len);
}
--- 1.36.4.2/innobase/ibuf/ibuf0ibuf.c 2006-07-26 08:25:57 +04:00
+++ 1.44/storage/innobase/ibuf/ibuf0ibuf.c 2006-07-26 08:28:46 +04:00
@@ -29,7 +29,7 @@
#include "log0recv.h"
#include "que0que.h"
-/* STRUCTURE OF AN INSERT BUFFER RECORD
+/* STRUCTURE OF AN INSERT BUFFER RECORD
In versions < 4.1.x:
@@ -140,11 +140,11 @@
/* The insert buffer control structure */
ibuf_t* ibuf = NULL;
-static
-ulint ibuf_rnd = 986058871;
+static ulint ibuf_rnd = 986058871;
ulint ibuf_flush_count = 0;
+#ifdef UNIV_IBUF_DEBUG
/* Dimensions for the ibuf_count array */
#define IBUF_COUNT_N_SPACES 500
#define IBUF_COUNT_N_PAGES 2000
@@ -153,6 +153,7 @@
static ulint* ibuf_counts[IBUF_COUNT_N_SPACES];
static ibool ibuf_counts_inited = FALSE;
+#endif
/* The start address for an insert buffer bitmap page bitmap */
#define IBUF_BITMAP PAGE_DATA
@@ -315,6 +316,7 @@
return(page);
}
+#ifdef UNIV_IBUF_DEBUG
/**********************************************************************
Gets the ibuf count for a given page. */
@@ -339,7 +341,6 @@
/**********************************************************************
Sets the ibuf count for a given page. */
-#ifdef UNIV_IBUF_DEBUG
static
void
ibuf_count_set(
@@ -369,14 +370,14 @@
/* Note that also a pessimistic delete can sometimes make a B-tree
grow in size, as the references on the upper levels of the tree can
change */
-
+
ibuf->max_size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE
/ IBUF_POOL_SIZE_PER_MAX_SIZE;
ibuf->meter = IBUF_THRESHOLD + 1;
UT_LIST_INIT(ibuf->data_list);
- ibuf->size = 0;
+ ibuf->size = 0;
#ifdef UNIV_IBUF_DEBUG
{
@@ -390,23 +391,18 @@
ibuf_count_set(i, j, 0);
}
}
- }
-#endif
- mutex_create(&ibuf_pessimistic_insert_mutex);
- mutex_set_level(&ibuf_pessimistic_insert_mutex,
- SYNC_IBUF_PESS_INSERT_MUTEX);
- mutex_create(&ibuf_mutex);
-
- mutex_set_level(&ibuf_mutex, SYNC_IBUF_MUTEX);
+ ibuf_counts_inited = TRUE;
+ }
+#endif
+ mutex_create(&ibuf_pessimistic_insert_mutex,
+ SYNC_IBUF_PESS_INSERT_MUTEX);
- mutex_create(&ibuf_bitmap_mutex);
+ mutex_create(&ibuf_mutex, SYNC_IBUF_MUTEX);
- mutex_set_level(&ibuf_bitmap_mutex, SYNC_IBUF_BITMAP_MUTEX);
+ mutex_create(&ibuf_bitmap_mutex, SYNC_IBUF_BITMAP_MUTEX);
fil_ibuf_init_at_db_start();
-
- ibuf_counts_inited = TRUE;
}
/**********************************************************************
@@ -427,7 +423,7 @@
#endif /* UNIV_SYNC_DEBUG */
old_size = data->size;
-
+
data->free_list_len = flst_get_len(root + PAGE_HEADER
+ PAGE_BTR_IBUF_FREE_LIST, mtr);
@@ -473,7 +469,7 @@
dict_table_t* table;
dict_index_t* index;
ulint n_used;
-
+
ut_a(space == 0);
#ifdef UNIV_LOG_DEBUG
@@ -499,11 +495,11 @@
fseg_n_reserved_pages(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
&n_used, &mtr);
ibuf_enter();
-
+
ut_ad(n_used >= 2);
data->seg_size = n_used;
-
+
root = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
&mtr);
#ifdef UNIV_SYNC_DEBUG
@@ -514,7 +510,7 @@
data->n_inserts = 0;
data->n_merges = 0;
data->n_merged_recs = 0;
-
+
ibuf_data_sizes_update(data, root, &mtr);
/*
if (!data->empty) {
@@ -533,7 +529,7 @@
sprintf(buf, "SYS_IBUF_TABLE_%lu", (ulong) space);
/* use old-style record format for the insert buffer */
- table = dict_mem_table_create(buf, space, 2, FALSE);
+ 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);
@@ -545,8 +541,8 @@
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, 0);
- dict_mem_index_add_field(index, "TYPES", 0, 0);
+ dict_mem_index_add_field(index, "PAGE_NO", 0);
+ dict_mem_index_add_field(index, "TYPES", 0);
index->id = ut_dulint_add(DICT_IBUF_ID_MIN, space);
@@ -574,18 +570,18 @@
{
ulint bit_offset;
ulint byte_offset;
- ulint i;
/* Write all zeros to the bitmap */
bit_offset = XDES_DESCRIBED_PER_PAGE * IBUF_BITS_PER_PAGE;
- byte_offset = bit_offset / 8 + 1;
+ byte_offset = bit_offset / 8 + 1; /* better: (bit_offset + 7) / 8 */
- for (i = IBUF_BITMAP; i < IBUF_BITMAP + byte_offset; i++) {
+ fil_page_set_type(page, FIL_PAGE_IBUF_BITMAP);
- *(page + i) = (byte)0;
- }
+ memset(page + IBUF_BITMAP, 0, byte_offset);
+
+ /* The remaining area (up to the page trailer) is uninitialized. */
mlog_write_initial_log_record(page, MLOG_IBUF_BITMAP_INIT, mtr);
}
@@ -621,8 +617,9 @@
page_t* page, /* in: bitmap page */
ulint page_no,/* in: page whose bits to get */
ulint bit, /* in: IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... */
- mtr_t* mtr __attribute__((unused))) /* in: mtr containing an x-latch
- to the bitmap page */
+ mtr_t* mtr __attribute__((unused))) /* in: mtr containing an
+ x-latch to the bitmap
+ page */
{
ulint byte_offset;
ulint bit_offset;
@@ -630,12 +627,14 @@
ulint value;
ut_ad(bit < IBUF_BITS_PER_PAGE);
- ut_ad(IBUF_BITS_PER_PAGE % 2 == 0);
+#if IBUF_BITS_PER_PAGE % 2
+# error "IBUF_BITS_PER_PAGE % 2 != 0"
+#endif
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
bit_offset = (page_no % XDES_DESCRIBED_PER_PAGE) * IBUF_BITS_PER_PAGE
- + bit;
+ + bit;
byte_offset = bit_offset / 8;
bit_offset = bit_offset % 8;
@@ -648,7 +647,7 @@
if (bit == IBUF_BITMAP_FREE) {
ut_ad(bit_offset + 1 < 8);
-
+
value = value * 2 + ut_bit_get_nth(map_byte, bit_offset + 1);
}
@@ -672,15 +671,18 @@
ulint map_byte;
ut_ad(bit < IBUF_BITS_PER_PAGE);
- ut_ad(IBUF_BITS_PER_PAGE % 2 == 0);
+#if IBUF_BITS_PER_PAGE % 2
+# error "IBUF_BITS_PER_PAGE % 2 != 0"
+#endif
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
#ifdef UNIV_IBUF_DEBUG
ut_a((bit != IBUF_BITMAP_BUFFERED) || (val != FALSE)
- || (0 == ibuf_count_get(buf_frame_get_space_id(page), page_no)));
+ || (0 == ibuf_count_get(buf_frame_get_space_id(page),
+ page_no)));
#endif
bit_offset = (page_no % XDES_DESCRIBED_PER_PAGE) * IBUF_BITS_PER_PAGE
- + bit;
+ + bit;
byte_offset = bit_offset / 8;
bit_offset = bit_offset % 8;
@@ -692,14 +694,14 @@
if (bit == IBUF_BITMAP_FREE) {
ut_ad(bit_offset + 1 < 8);
ut_ad(val <= 3);
-
+
map_byte = ut_bit_set_nth(map_byte, bit_offset, val / 2);
map_byte = ut_bit_set_nth(map_byte, bit_offset + 1, val % 2);
} else {
ut_ad(val <= 1);
map_byte = ut_bit_set_nth(map_byte, bit_offset, val);
}
-
+
mlog_write_ulint(page + IBUF_BITMAP + byte_offset, map_byte,
MLOG_1BYTE, mtr);
}
@@ -715,8 +717,8 @@
ulint page_no) /* in: tablespace page number */
{
return(FSP_IBUF_BITMAP_OFFSET
- + XDES_DESCRIBED_PER_PAGE
- * (page_no / XDES_DESCRIBED_PER_PAGE));
+ + XDES_DESCRIBED_PER_PAGE
+ * (page_no / XDES_DESCRIBED_PER_PAGE));
}
/************************************************************************
@@ -779,7 +781,7 @@
"Setting page no %lu free bits to %lu should be %lu\n",
buf_frame_get_page_no(page), val,
ibuf_index_page_calc_free(page)); */
-
+
ut_a(val <= ibuf_index_page_calc_free(page));
#endif
ibuf_bitmap_page_set_bits(bitmap_page, buf_frame_get_page_no(page),
@@ -818,7 +820,7 @@
}
mtr_start(&mtr);
-
+
bitmap_page = ibuf_bitmap_get_map_page(buf_frame_get_space_id(page),
buf_frame_get_page_no(page), &mtr);
@@ -844,7 +846,7 @@
ibuf_index_page_calc_free(page)); */
ut_a(val <= ibuf_index_page_calc_free(page));
-#endif
+#endif
ibuf_bitmap_page_set_bits(bitmap_page, buf_frame_get_page_no(page),
IBUF_BITMAP_FREE, val, &mtr);
mtr_commit(&mtr);
@@ -931,7 +933,7 @@
performed by another OS thread. */
mutex_enter(&ibuf_bitmap_mutex);
-
+
state = ibuf_index_page_calc_free(page1);
ibuf_set_free_bits_low(index->type, page1, state, mtr);
@@ -950,11 +952,14 @@
ibuf_fixed_addr_page(
/*=================*/
/* out: TRUE if a fixed address ibuf i/o page */
- ulint space, /* in: space id */
ulint page_no)/* in: page number */
{
- return((space == 0 && page_no == IBUF_TREE_ROOT_PAGE_NO)
- || ibuf_bitmap_page(page_no));
+ if ((ibuf_bitmap_page(page_no))
+ || (page_no == IBUF_TREE_ROOT_PAGE_NO)) {
+ return(TRUE);
+ }
+
+ return(FALSE);
}
/***************************************************************************
@@ -978,7 +983,7 @@
return(FALSE);
}
- if (ibuf_fixed_addr_page(space, page_no)) {
+ if (ibuf_fixed_addr_page(page_no)) {
return(TRUE);
}
@@ -1025,8 +1030,8 @@
return(FALSE);
}
-#endif
- if (ibuf_fixed_addr_page(space, page_no)) {
+#endif
+ if (ibuf_fixed_addr_page(page_no)) {
return(TRUE);
}
@@ -1119,13 +1124,18 @@
{
dict_table_t* table;
dict_index_t* index;
+
table = dict_mem_table_create("IBUF_DUMMY",
- DICT_HDR_SPACE, n, comp);
+ DICT_HDR_SPACE, n, comp ? DICT_TF_COMPACT : 0);
+
index = dict_mem_index_create("IBUF_DUMMY", "IBUF_DUMMY",
- DICT_HDR_SPACE, 0, n);
+ DICT_HDR_SPACE, 0, n);
+
index->table = table;
+
/* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */
index->cached = TRUE;
+
return(index);
}
/************************************************************************
@@ -1133,7 +1143,7 @@
static
void
ibuf_dummy_index_add_col(
-/*====================*/
+/*=====================*/
dict_index_t* index, /* in: dummy index */
dtype_t* type, /* in: the data type of the column */
ulint len) /* in: length of the column */
@@ -1145,7 +1155,7 @@
dtype_get_len(type),
dtype_get_prec(type));
dict_index_add_col(index,
- dict_table_get_nth_col(index->table, i), 0, len);
+ dict_table_get_nth_col(index->table, i), len);
}
/************************************************************************
Deallocates a dummy index for inserting a record to a non-clustered index.
@@ -1153,7 +1163,7 @@
static
void
ibuf_dummy_index_free(
-/*====================*/
+/*==================*/
dict_index_t* index) /* in: dummy index */
{
dict_table_t* table = index->table;
@@ -1375,7 +1385,7 @@
byte* buf;
byte* buf2;
ulint i;
-
+
/* Starting from 4.1.x, we have to build a tuple whose
(1) first field is the space id,
(2) the second field a single marker byte (0) to tell that this
@@ -1464,7 +1474,7 @@
dtuple_set_types_binary(tuple, n_fields + 4);
return(tuple);
-}
+}
/*************************************************************************
Builds a search tuple used to search buffered inserts for an index page.
@@ -1481,7 +1491,7 @@
dtuple_t* tuple;
dfield_t* field;
byte* buf;
-
+
ut_a(space == 0);
ut_a(trx_doublewrite_must_reset_space_ids);
ut_a(!trx_sys_multiple_tablespace_format);
@@ -1518,7 +1528,7 @@
dtuple_t* tuple;
dfield_t* field;
byte* buf;
-
+
ut_a(trx_sys_multiple_tablespace_format);
tuple = dtuple_create(heap, 3);
@@ -1634,7 +1644,7 @@
/* Acquire the fsp latch before the ibuf header, obeying the latching
order */
mtr_x_lock(fil_space_get_latch(space), &mtr);
-
+
header_page = ibuf_header_page_get(space, &mtr);
/* Allocate a new page: NOTE that if the page has been a part of a
@@ -1671,9 +1681,10 @@
/* Add the page to the free list and update the ibuf size data */
flst_add_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
- page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
+ page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
- fil_page_set_type(page, FIL_PAGE_IBUF_FREE_LIST);
+ mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_IBUF_FREE_LIST,
+ MLOG_2BYTES, &mtr);
ibuf_data->seg_size++;
ibuf_data->free_list_len++;
@@ -1718,7 +1729,7 @@
/* Acquire the fsp latch before the ibuf header, obeying the latching
order */
mtr_x_lock(fil_space_get_latch(space), &mtr);
-
+
header_page = ibuf_header_page_get(space, &mtr);
/* Prevent pessimistic inserts to insert buffer trees for a while */
@@ -1733,16 +1744,16 @@
mutex_exit(&ibuf_mutex);
ibuf_exit();
-
+
mutex_exit(&ibuf_pessimistic_insert_mutex);
mtr_commit(&mtr);
return;
}
-
+
mtr_start(&mtr2);
-
+
root = ibuf_tree_root_get(ibuf_data, space, &mtr2);
page_no = flst_get_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
@@ -1752,32 +1763,32 @@
/* NOTE that we must release the latch on the ibuf tree root
because in fseg_free_page we access level 1 pages, and the root
is a level 2 page. */
-
+
mtr_commit(&mtr2);
mutex_exit(&ibuf_mutex);
ibuf_exit();
-
+
/* Since pessimistic inserts were prevented, we know that the
page is still in the free list. NOTE that also deletes may take
pages from the free list, but they take them from the start, and
the free list was so long that they cannot have taken the last
page from it. */
-
+
fseg_free_page(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
space, page_no, &mtr);
#ifdef UNIV_DEBUG_FILE_ACCESSES
buf_page_reset_file_page_was_freed(space, page_no);
#endif
ibuf_enter();
-
+
mutex_enter(&ibuf_mutex);
root = ibuf_tree_root_get(ibuf_data, space, &mtr);
ut_ad(page_no == flst_get_last(root + PAGE_HEADER
+ PAGE_BTR_IBUF_FREE_LIST, &mtr)
- .page);
+ .page);
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
@@ -1786,13 +1797,13 @@
#endif /* UNIV_SYNC_DEBUG */
/* Remove the page from the free list and update the ibuf size data */
-
+
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
- page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
+ page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
ibuf_data->seg_size--;
ibuf_data->free_list_len--;
-
+
mutex_exit(&ibuf_pessimistic_insert_mutex);
/* Set the bit indicating that this page is no more an ibuf tree page
@@ -1815,7 +1826,7 @@
/***************************************************************************
Frees excess pages from the ibuf free list. This function is called when an OS
thread calls fsp services to allocate a new file segment, or a new page to a
-file segment, and the thread did not own the fsp latch before this call. */
+file segment, and the thread did not own the fsp latch before this call. */
void
ibuf_free_excess_pages(
@@ -1826,7 +1837,7 @@
ulint i;
if (space != 0) {
- fprintf(stderr,
+ fprintf(stderr,
"InnoDB: Error: calling ibuf_free_excess_pages for space %lu\n", (ulong) space);
return;
}
@@ -1836,7 +1847,7 @@
#endif /* UNIV_SYNC_DEBUG */
ut_ad(rw_lock_get_x_lock_count(fil_space_get_latch(space)) == 1);
ut_ad(!ibuf_inside());
-
+
/* NOTE: We require that the thread did not own the latch before,
because then we know that we can obey the correct latching order
for ibuf latches */
@@ -1934,7 +1945,7 @@
n_pages = 0;
prev_page_no = 0;
prev_space_id = 0;
-
+
/* Go backwards from the first rec until we reach the border of the
'merge area', or the page start or the limit of storeable pages is
reached */
@@ -1945,14 +1956,14 @@
rec_space_id = ibuf_rec_get_space(rec);
if (rec_space_id != first_space_id
- || rec_page_no / IBUF_MERGE_AREA
- != first_page_no / IBUF_MERGE_AREA) {
+ || rec_page_no / IBUF_MERGE_AREA
+ != first_page_no / IBUF_MERGE_AREA) {
- break;
+ break;
}
-
+
if (rec_page_no != prev_page_no
- || rec_space_id != prev_space_id) {
+ || rec_space_id != prev_space_id) {
n_pages++;
}
@@ -1972,7 +1983,7 @@
prev_space_id = 0;
sum_volumes = 0;
volume_for_page = 0;
-
+
while (*n_stored < limit) {
if (page_rec_is_supremum(rec)) {
/* When no more records available, mark this with
@@ -1989,19 +2000,19 @@
ut_a(*n_stored < IBUF_MAX_N_PAGES_MERGED);
#endif
if ((rec_space_id != prev_space_id
- || rec_page_no != prev_page_no)
- && (prev_space_id != 0 || prev_page_no != 0)) {
+ || rec_page_no != prev_page_no)
+ && (prev_space_id != 0 || prev_page_no != 0)) {
if ((prev_page_no == first_page_no
- && prev_space_id == first_space_id)
- || contract
- || (volume_for_page >
- ((IBUF_MERGE_THRESHOLD - 1)
- * 4 * UNIV_PAGE_SIZE
- / IBUF_PAGE_SIZE_PER_FREE_SPACE)
- / IBUF_MERGE_THRESHOLD)) {
+ && prev_space_id == first_space_id)
+ || contract
+ || (volume_for_page >
+ ((IBUF_MERGE_THRESHOLD - 1)
+ * 4 * UNIV_PAGE_SIZE
+ / IBUF_PAGE_SIZE_PER_FREE_SPACE)
+ / IBUF_MERGE_THRESHOLD)) {
- space_ids[*n_stored] = prev_space_id;
+ space_ids[*n_stored] = prev_space_id;
space_versions[*n_stored]
= fil_space_get_version(
prev_space_id);
@@ -2013,10 +2024,10 @@
}
if (rec_space_id != first_space_id
- || rec_page_no / IBUF_MERGE_AREA
- != first_page_no / IBUF_MERGE_AREA) {
+ || rec_page_no / IBUF_MERGE_AREA
+ != first_page_no / IBUF_MERGE_AREA) {
- break;
+ break;
}
volume_for_page = 0;
@@ -2031,7 +2042,7 @@
rec_volume = ibuf_rec_get_volume(rec);
volume_for_page += rec_volume;
-
+
prev_page_no = rec_page_no;
prev_space_id = rec_space_id;
@@ -2078,7 +2089,7 @@
mutex_enter(&ibuf_mutex);
- ut_ad(ibuf_validate_low());
+ ut_ad(ibuf_validate_low());
/* Choose an ibuf tree at random (though there really is only one tree
in the current implementation) */
@@ -2093,15 +2104,15 @@
for (;;) {
if (!data->empty) {
all_trees_empty = FALSE;
-
+
if (rnd_pos < data->size) {
break;
}
-
+
rnd_pos -= data->size;
}
-
+
data = UT_LIST_GET_NEXT(data_list, data);
if (data == NULL) {
@@ -2110,7 +2121,7 @@
return(0);
}
-
+
data = UT_LIST_GET_FIRST(ibuf->data_list);
}
}
@@ -2124,7 +2135,7 @@
mtr_start(&mtr);
ibuf_enter();
-
+
/* Open a cursor to a randomly chosen leaf of the tree, at a random
position within the leaf */
@@ -2133,19 +2144,19 @@
if (0 == page_get_n_recs(btr_pcur_get_page(&pcur))) {
/* This tree is empty */
-
- data->empty = TRUE;
- ibuf_exit();
+ data->empty = TRUE;
- mtr_commit(&mtr);
- btr_pcur_close(&pcur);
+ ibuf_exit();
+
+ mtr_commit(&mtr);
+ btr_pcur_close(&pcur);
- mutex_exit(&ibuf_mutex);
+ mutex_exit(&ibuf_mutex);
- goto loop;
+ goto loop;
}
-
+
mutex_exit(&ibuf_mutex);
sum_sizes = ibuf_get_merge_page_nos(TRUE, btr_pcur_get_rec(&pcur),
@@ -2162,7 +2173,7 @@
buf_read_ibuf_merge_pages(sync, space_ids, space_versions, page_nos,
n_stored);
*n_pages = n_stored;
-
+
return(sum_sizes + 1);
}
@@ -2201,13 +2212,13 @@
them */
{
ulint sum_bytes = 0;
- ulint sum_pages = 0;
+ ulint sum_pages = 0;
ulint n_bytes;
ulint n_pag2;
-
+
while (sum_pages < n_pages) {
n_bytes = ibuf_contract_ext(&n_pag2, sync);
-
+
if (n_bytes == 0) {
return(sum_bytes);
}
@@ -2241,7 +2252,7 @@
}
sync = FALSE;
-
+
if (ibuf->size >= ibuf->max_size + IBUF_CONTRACT_ON_INSERT_SYNC) {
sync = TRUE;
@@ -2288,7 +2299,7 @@
page_t* prev_page;
ulint next_page_no;
page_t* next_page;
-
+
ut_a(trx_sys_multiple_tablespace_format);
ut_ad((pcur->latch_mode == BTR_MODIFY_PREV)
@@ -2298,7 +2309,7 @@
pcur */
volume = 0;
-
+
rec = btr_pcur_get_rec(pcur);
page = buf_frame_align(rec);
@@ -2312,9 +2323,9 @@
break;
}
-
+
if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ || space != ibuf_rec_get_space(rec)) {
goto count_later;
}
@@ -2325,7 +2336,7 @@
}
/* Look at the previous page */
-
+
prev_page_no = btr_page_get_prev(page, mtr);
if (prev_page_no == FIL_NULL) {
@@ -2334,6 +2345,10 @@
}
prev_page = buf_page_get(0, prev_page_no, RW_X_LATCH, mtr);
+#ifdef UNIV_BTR_DEBUG
+ ut_a(btr_page_get_next(prev_page, mtr)
+ == buf_frame_get_page_no(page));
+#endif /* UNIV_BTR_DEBUG */
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(prev_page, SYNC_TREE_NODE);
@@ -2341,19 +2356,19 @@
rec = page_get_supremum_rec(prev_page);
rec = page_rec_get_prev(rec);
-
+
for (;;) {
if (page_rec_is_infimum(rec)) {
/* We cannot go to yet a previous page, because we
do not have the x-latch on it, and cannot acquire one
because of the latching order: we have to give up */
-
+
return(UNIV_PAGE_SIZE);
}
-
+
if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ || space != ibuf_rec_get_space(rec)) {
goto count_later;
}
@@ -2362,7 +2377,7 @@
rec = page_rec_get_prev(rec);
}
-
+
count_later:
rec = btr_pcur_get_rec(pcur);
@@ -2375,9 +2390,9 @@
break;
}
-
+
if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ || space != ibuf_rec_get_space(rec)) {
return(volume);
}
@@ -2388,7 +2403,7 @@
}
/* Look at the next page */
-
+
next_page_no = btr_page_get_next(page, mtr);
if (next_page_no == FIL_NULL) {
@@ -2397,6 +2412,10 @@
}
next_page = buf_page_get(0, next_page_no, RW_X_LATCH, mtr);
+#ifdef UNIV_BTR_DEBUG
+ ut_a(btr_page_get_prev(next_page, mtr)
+ == buf_frame_get_page_no(page));
+#endif /* UNIV_BTR_DEBUG */
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(next_page, SYNC_TREE_NODE);
@@ -2409,12 +2428,12 @@
if (page_rec_is_supremum(rec)) {
/* We give up */
-
+
return(UNIV_PAGE_SIZE);
}
-
+
if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ || space != ibuf_rec_get_space(rec)) {
return(volume);
}
@@ -2445,7 +2464,7 @@
ibuf_data = fil_space_get_ibuf_data(0);
ibuf_index = ibuf_data->index;
- ut_a(!ibuf_index->table->comp);
+ ut_a(!dict_table_is_comp(ibuf_index->table));
ibuf_enter();
@@ -2465,7 +2484,7 @@
field = rec_get_nth_field_old(rec, 0, &len);
ut_a(len == 4);
-
+
max_space_id = mach_read_from_4(field);
}
@@ -2515,7 +2534,7 @@
ulint bits;
mtr_t mtr;
mtr_t bitmap_mtr;
-
+
ut_a(!(index->type & DICT_CLUSTERED));
ut_ad(dtuple_check_typed(entry));
@@ -2540,7 +2559,7 @@
#ifdef UNIV_IBUF_DEBUG
fputs("Ibuf too big\n", stderr);
-#endif
+#endif
/* Use synchronous contract (== TRUE) */
ibuf_contract(TRUE);
@@ -2561,7 +2580,7 @@
mutex_exit(&ibuf_mutex);
ibuf_exit();
-
+
mutex_exit(&ibuf_pessimistic_insert_mutex);
err = ibuf_add_free_page(0, ibuf_data);
@@ -2574,7 +2593,7 @@
mutex_enter(&ibuf_pessimistic_insert_mutex);
ibuf_enter();
-
+
mutex_enter(&ibuf_mutex);
}
} else {
@@ -2585,12 +2604,12 @@
heap = mem_heap_create(512);
- /* Build the entry which contains the space id and the page number as
+ /* Build the entry which contains the space id and the page number as
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, index->table->comp,
- space, page_no, heap);
+ ibuf_entry = ibuf_entry_build(entry, dict_table_is_comp(index->table),
+ 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
@@ -2607,7 +2626,7 @@
#ifdef UNIV_IBUF_DEBUG
ut_a((buffered == 0) || ibuf_count_get(space, page_no));
#endif
- mtr_start(&bitmap_mtr);
+ mtr_start(&bitmap_mtr);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, &bitmap_mtr);
@@ -2629,16 +2648,16 @@
> ibuf_index_page_calc_free_from_bits(bits)) {
mtr_commit(&bitmap_mtr);
- /* It may not fit */
+ /* It may not fit */
err = DB_STRONG_FAIL;
- do_merge = TRUE;
+ do_merge = TRUE;
ibuf_get_merge_page_nos(FALSE, btr_pcur_get_rec(&pcur),
space_ids, space_versions,
page_nos, &n_stored);
goto function_exit;
- }
+ }
/* Set the bitmap bit denoting that the insert buffer contains
buffered entries for this index page, if the bit is not set yet */
@@ -2651,9 +2670,9 @@
}
mtr_commit(&bitmap_mtr);
-
+
cursor = btr_pcur_get_btr_cur(&pcur);
-
+
if (mode == BTR_MODIFY_PREV) {
err = btr_cur_optimistic_insert(BTR_NO_LOCKING_FLAG, cursor,
ibuf_entry, &ins_rec,
@@ -2671,7 +2690,7 @@
because a pessimistic insert releases the tree x-latch,
which would cause the x-latching of the root after that to
break the latching order. */
-
+
root = ibuf_tree_root_get(ibuf_data, 0, &mtr);
err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG
@@ -2700,18 +2719,18 @@
ibuf_count_get(space, page_no) + 1);
}
#endif
- if (mode == BTR_MODIFY_TREE) {
+ if (mode == BTR_MODIFY_TREE) {
ut_ad(ibuf_validate_low());
mutex_exit(&ibuf_mutex);
mutex_exit(&ibuf_pessimistic_insert_mutex);
}
-
+
mtr_commit(&mtr);
- btr_pcur_close(&pcur);
+ btr_pcur_close(&pcur);
ibuf_exit();
- mem_heap_free(heap);
+ mem_heap_free(heap);
mutex_enter(&ibuf_mutex);
@@ -2719,13 +2738,13 @@
ibuf_data->empty = FALSE;
ibuf_data->n_inserts++;
}
-
+
mutex_exit(&ibuf_mutex);
- if ((mode == BTR_MODIFY_TREE) && (err == DB_SUCCESS)) {
+ if ((mode == BTR_MODIFY_TREE) && (err == DB_SUCCESS)) {
ibuf_contract_after_insert(entry_size);
}
-
+
if (do_merge) {
#ifdef UNIV_IBUF_DEBUG
ut_a(n_stored <= IBUF_MAX_N_PAGES_MERGED);
@@ -2733,7 +2752,7 @@
buf_read_ibuf_merge_pages(FALSE, space_ids, space_versions,
page_nos, n_stored);
}
-
+
return(err);
}
@@ -2758,19 +2777,20 @@
ut_ad(dtuple_check_typed(entry));
ut_a(!(index->type & DICT_CLUSTERED));
-
+
if (rec_get_converted_size(index, entry)
- >= page_get_free_space_of_empty(index->table->comp) / 2) {
+ >= page_get_free_space_of_empty(
+ dict_table_is_comp(index->table)) / 2) {
return(FALSE);
}
-
+
err = ibuf_insert_low(BTR_MODIFY_PREV, entry, index, space, page_no,
thr);
if (err == DB_FAIL) {
err = ibuf_insert_low(BTR_MODIFY_TREE, entry, index, space,
page_no, thr);
}
-
+
if (err == DB_SUCCESS) {
#ifdef UNIV_IBUF_DEBUG
/* fprintf(stderr, "Ibuf insert for page no %lu of index %s\n",
@@ -2784,7 +2804,7 @@
return(FALSE);
}
}
-
+
/************************************************************************
During merge, inserts to an index page a secondary index entry extracted
from the insert buffer. */
@@ -2807,7 +2827,8 @@
ut_ad(ibuf_inside());
ut_ad(dtuple_check_typed(entry));
- if (UNIV_UNLIKELY(index->table->comp != (ibool)!!page_is_comp(page))) {
+ if (UNIV_UNLIKELY(dict_table_is_comp(index->table)
+ != (ibool)!!page_is_comp(page))) {
fputs(
"InnoDB: Trying to insert a record from the insert buffer to an index page\n"
"InnoDB: but the 'compact' flag does not match!\n", stderr);
@@ -2824,7 +2845,7 @@
dump:
buf_page_print(page);
- dtuple_print(stderr, entry);
+ dtuple_print(stderr, entry);
fputs(
"InnoDB: The table where where this index record belongs\n"
@@ -2837,14 +2858,14 @@
low_match = page_cur_search(page, index, entry,
PAGE_CUR_LE, &page_cur);
-
+
if (low_match == dtuple_get_n_fields(entry)) {
rec = page_cur_get_rec(&page_cur);
-
+
btr_cur_del_unmark_for_ibuf(rec, mtr);
} else {
rec = page_cur_tuple_insert(&page_cur, entry, index, mtr);
-
+
if (rec == NULL) {
/* If the record did not fit, reorganize */
@@ -2870,7 +2891,7 @@
"\nInnoDB: The table where where this index record belongs\n"
"InnoDB: is now probably corrupt. 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),
@@ -2884,7 +2905,7 @@
fputs(
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
- }
+ }
}
}
}
@@ -2912,7 +2933,7 @@
ibuf_data_t* ibuf_data;
page_t* root;
ulint err;
-
+
ut_ad(ibuf_inside());
success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr);
@@ -2927,7 +2948,7 @@
#endif
return(FALSE);
}
-
+
/* We have to resort to a pessimistic delete from ibuf */
btr_pcur_store_position(pcur, mtr);
@@ -2941,7 +2962,7 @@
mutex_enter(&ibuf_mutex);
mtr_start(mtr);
-
+
success = btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr);
if (!success) {
@@ -3048,8 +3069,8 @@
return;
}
-#endif
- if (ibuf_fixed_addr_page(space, page_no) || fsp_descr_page(page_no)
+#endif
+ if (ibuf_fixed_addr_page(page_no) || fsp_descr_page(page_no)
|| trx_sys_hdr_page(space, page_no)) {
return;
}
@@ -3100,12 +3121,12 @@
if (!trx_sys_multiple_tablespace_format) {
ut_a(trx_doublewrite_must_reset_space_ids);
- search_tuple = ibuf_search_tuple_build(space, page_no, heap);
+ search_tuple = ibuf_search_tuple_build(space, page_no, heap);
} else {
- search_tuple = ibuf_new_search_tuple_build(space, page_no,
+ search_tuple = ibuf_new_search_tuple_build(space, page_no,
heap);
}
-
+
if (page) {
/* Move the ownership of the x-latch on the page to this OS
thread, so that we can acquire a second x-latch on it. This
@@ -3114,22 +3135,22 @@
block = buf_block_align(page);
rw_lock_x_lock_move_ownership(&(block->lock));
-
+
if (fil_page_get_type(page) != FIL_PAGE_INDEX) {
corruption_noticed = TRUE;
-
+
ut_print_timestamp(stderr);
mtr_start(&mtr);
fputs(" InnoDB: Dump of the ibuf bitmap page:\n",
stderr);
-
+
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
&mtr);
buf_page_print(bitmap_page);
-
+
mtr_commit(&mtr);
fputs("\nInnoDB: Dump of the page:\n", stderr);
@@ -3166,7 +3187,7 @@
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
}
-
+
/* Position pcur in the insert buffer at the first entry for this
index page */
btr_pcur_open_on_user_rec(ibuf_data->index, search_tuple, PAGE_CUR_GE,
@@ -3184,7 +3205,7 @@
/* Check if the entry is for this index page */
if (ibuf_rec_get_page_no(ibuf_rec) != page_no
- || ibuf_rec_get_space(ibuf_rec) != space) {
+ || ibuf_rec_get_space(ibuf_rec) != space) {
if (page) {
page_header_reset_last_insert(page, &mtr);
}
@@ -3195,7 +3216,7 @@
fputs("InnoDB: Discarding record\n ", stderr);
rec_print_old(stderr, ibuf_rec);
fputs("\n from the insert buffer!\n\n", stderr);
- } else if (page) {
+ } else if (page) {
/* Now we have at pcur a record which should be
inserted to the index page; NOTE that the call below
copies pointers to fields in ibuf_rec, and we must
@@ -3205,12 +3226,12 @@
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);
#ifdef UNIV_IBUF_DEBUG
volume += rec_get_converted_size(dummy_index, entry)
- + page_dir_calc_reserved_space(1);
+ + page_dir_calc_reserved_space(1);
ut_a(volume <= 4 * UNIV_PAGE_SIZE
/ IBUF_PAGE_SIZE_PER_FREE_SPACE);
#endif
@@ -3220,7 +3241,7 @@
}
n_inserts++;
-
+
/* Delete the record from ibuf */
if (ibuf_delete_rec(space, page_no, &pcur, search_tuple,
&mtr)) {
@@ -3232,7 +3253,7 @@
if (btr_pcur_is_after_last_on_page(&pcur, &mtr)) {
mtr_commit(&mtr);
- btr_pcur_close(&pcur);
+ btr_pcur_close(&pcur);
goto loop;
}
@@ -3271,13 +3292,13 @@
n_inserts, volume, page_no); */
#endif
mtr_commit(&mtr);
- btr_pcur_close(&pcur);
+ btr_pcur_close(&pcur);
mem_heap_free(heap);
/* Protect our statistics keeping from race conditions */
mutex_enter(&ibuf_mutex);
- ibuf_data->n_merges++;
+ ibuf_data->n_merges++;
ibuf_data->n_merged_recs += n_inserts;
mutex_exit(&ibuf_mutex);
@@ -3325,7 +3346,7 @@
cursor positioned at the first entry for this space id */
search_tuple = ibuf_new_search_tuple_build(space, 0, heap);
-
+
n_inserts = 0;
loop:
ibuf_enter();
@@ -3356,7 +3377,7 @@
page_no = ibuf_rec_get_page_no(ibuf_rec);
n_inserts++;
-
+
/* Delete the record from ibuf */
closed = ibuf_delete_rec(space, page_no, &pcur, search_tuple,
&mtr);
@@ -3371,7 +3392,7 @@
if (btr_pcur_is_after_last_on_page(&pcur, &mtr)) {
mtr_commit(&mtr);
- btr_pcur_close(&pcur);
+ btr_pcur_close(&pcur);
ibuf_exit();
@@ -3381,12 +3402,12 @@
leave_loop:
mtr_commit(&mtr);
- btr_pcur_close(&pcur);
+ btr_pcur_close(&pcur);
/* Protect our statistics keeping from race conditions */
mutex_enter(&ibuf_mutex);
- ibuf_data->n_merges++;
+ ibuf_data->n_merges++;
ibuf_data->n_merged_recs += n_inserts;
mutex_exit(&ibuf_mutex);
@@ -3417,12 +3438,12 @@
#endif /* UNIV_SYNC_DEBUG */
sum_sizes = 0;
-
+
data = UT_LIST_GET_FIRST(ibuf->data_list);
while (data) {
sum_sizes += data->size;
-
+
data = UT_LIST_GET_NEXT(data_list, data);
}
@@ -3465,7 +3486,7 @@
"InnoDB: run to completion.\n");
}
} else {
- ut_a(data->empty == FALSE);
+ ut_a(data->empty == FALSE);
is_empty = FALSE;
}
@@ -3500,10 +3521,10 @@
while (data) {
fprintf(file,
- "Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,",
- (ulong) data->space, (ulong) data->size,
- (ulong) data->free_list_len,
- (ulong) data->seg_size);
+ "Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,",
+ (ulong) data->space, (ulong) data->size,
+ (ulong) data->free_list_len,
+ (ulong) data->seg_size);
if (data->empty) {
fputs(" is empty\n", file);
@@ -3513,21 +3534,21 @@
fprintf(file,
"Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,\n"
"%lu inserts, %lu merged recs, %lu merges\n",
- (ulong) data->space,
- (ulong) data->size,
- (ulong) data->free_list_len,
- (ulong) data->seg_size,
- (ulong) data->n_inserts,
- (ulong) data->n_merged_recs,
- (ulong) data->n_merges);
+ (ulong) data->space,
+ (ulong) data->size,
+ (ulong) data->free_list_len,
+ (ulong) data->seg_size,
+ (ulong) data->n_inserts,
+ (ulong) data->n_merged_recs,
+ (ulong) data->n_merges);
#ifdef UNIV_IBUF_DEBUG
for (i = 0; i < IBUF_COUNT_N_PAGES; i++) {
if (ibuf_count_get(data->space, i) > 0) {
fprintf(stderr,
"Ibuf count for page %lu is %lu\n",
- (ulong) i,
- (ulong) ibuf_count_get(data->space, i));
+ (ulong) i,
+ (ulong) ibuf_count_get(data->space, i));
}
}
#endif
--- 1.9.2.1/innobase/include/sync0rw.ic 2006-07-26 08:25:57 +04:00
+++ 1.13/storage/innobase/include/sync0rw.ic 2006-07-26 08:28:48 +04:00
@@ -15,7 +15,7 @@
void
rw_lock_s_lock_spin(
/*================*/
- rw_lock_t* lock, /* in: pointer to rw-lock */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/* in: file name where lock requested */
@@ -126,9 +126,9 @@
rw_lock_s_lock_low(
/*===============*/
/* out: TRUE if success */
- rw_lock_t* lock, /* in: pointer to rw-lock */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass __attribute__((unused)),
- /* in: pass value; != 0, if the lock will be
+ /* in: pass value; != 0, if the lock will be
passed to another thread to unlock */
const char* file_name, /* in: file name where lock requested */
ulint line) /* in: line where requested */
@@ -169,7 +169,7 @@
{
ut_ad(lock->writer == RW_LOCK_NOT_LOCKED);
ut_ad(rw_lock_get_reader_count(lock) == 0);
-
+
/* Set the shared lock by incrementing the reader count */
lock->reader_count++;
@@ -193,7 +193,7 @@
const char* file_name, /* in: file name where requested */
ulint line) /* in: line where lock requested */
{
- ut_ad(rw_lock_validate(lock));
+ ut_ad(rw_lock_validate(lock));
ut_ad(rw_lock_get_reader_count(lock) == 0);
ut_ad(rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED);
@@ -201,7 +201,7 @@
lock->writer_thread = os_thread_get_curr_id();
lock->writer_count++;
lock->pass = 0;
-
+
lock->last_x_file_name = file_name;
lock->last_x_line = line;
@@ -220,7 +220,7 @@
void
rw_lock_s_lock_func(
/*================*/
- rw_lock_t* lock, /* in: pointer to rw-lock */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/* in: file name where lock requested */
@@ -236,7 +236,7 @@
safe recursive s-locking, we should keep in a list the thread ids of
the threads which have s-locked a latch. This would use some CPU
time. */
-
+
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */
#endif /* UNIV_SYNC_DEBUG */
@@ -266,7 +266,7 @@
rw_lock_s_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
- rw_lock_t* lock, /* in: pointer to rw-lock */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
@@ -285,7 +285,7 @@
lock->last_s_file_name = file_name;
lock->last_s_line = line;
-
+
success = TRUE;
}
@@ -303,7 +303,7 @@
rw_lock_x_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
- rw_lock_t* lock, /* in: pointer to rw-lock */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
@@ -313,13 +313,13 @@
if (UNIV_UNLIKELY(rw_lock_get_reader_count(lock) != 0)) {
} else if (UNIV_LIKELY(rw_lock_get_writer(lock)
- == RW_LOCK_NOT_LOCKED)) {
+ == RW_LOCK_NOT_LOCKED)) {
rw_lock_set_writer(lock, RW_LOCK_EX);
lock->writer_thread = curr_thread;
lock->pass = 0;
relock:
lock->writer_count++;
-
+
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, 0, RW_LOCK_EX, file_name, line);
#endif
@@ -336,7 +336,7 @@
mutex_exit(rw_lock_get_mutex(lock));
- ut_ad(rw_lock_validate(lock));
+ ut_ad(rw_lock_validate(lock));
return(success);
}
@@ -355,37 +355,37 @@
)
{
mutex_t* mutex = &(lock->mutex);
- ibool sg = FALSE;
+ ibool sg = FALSE;
- /* Acquire the mutex protecting the rw-lock fields */
+ /* Acquire the mutex protecting the rw-lock fields */
mutex_enter(mutex);
/* Reset the shared lock by decrementing the reader count */
- ut_a(lock->reader_count > 0);
+ ut_ad(lock->reader_count > 0);
lock->reader_count--;
#ifdef UNIV_SYNC_DEBUG
rw_lock_remove_debug_info(lock, pass, RW_LOCK_SHARED);
#endif
-
+
/* If there may be waiters and this was the last s-lock,
signal the object */
if (UNIV_UNLIKELY(lock->waiters)
&& lock->reader_count == 0) {
- sg = TRUE;
+ sg = TRUE;
rw_lock_set_waiters(lock, 0);
}
-
+
mutex_exit(mutex);
if (UNIV_UNLIKELY(sg)) {
sync_array_signal_object(sync_primary_wait_array, lock);
}
- ut_ad(rw_lock_validate(lock));
+ ut_ad(rw_lock_validate(lock));
#ifdef UNIV_SYNC_PERF_STAT
rw_s_exit_count++;
@@ -412,7 +412,7 @@
#endif
ut_ad(!lock->waiters);
- ut_ad(rw_lock_validate(lock));
+ ut_ad(rw_lock_validate(lock));
#ifdef UNIV_SYNC_PERF_STAT
rw_s_exit_count++;
#endif
@@ -431,9 +431,9 @@
#endif
)
{
- ibool sg = FALSE;
+ ibool sg = FALSE;
- /* Acquire the mutex protecting the rw-lock fields */
+ /* Acquire the mutex protecting the rw-lock fields */
mutex_enter(&(lock->mutex));
/* Reset the exclusive lock if this thread no longer has an x-mode
@@ -450,22 +450,22 @@
#ifdef UNIV_SYNC_DEBUG
rw_lock_remove_debug_info(lock, pass, RW_LOCK_EX);
#endif
-
+
/* If there may be waiters, signal the lock */
if (UNIV_UNLIKELY(lock->waiters)
&& lock->writer_count == 0) {
- sg = TRUE;
+ sg = TRUE;
rw_lock_set_waiters(lock, 0);
}
-
+
mutex_exit(&(lock->mutex));
if (UNIV_UNLIKELY(sg)) {
sync_array_signal_object(sync_primary_wait_array, lock);
}
- ut_ad(rw_lock_validate(lock));
+ ut_ad(rw_lock_validate(lock));
#ifdef UNIV_SYNC_PERF_STAT
rw_x_exit_count++;
@@ -497,7 +497,7 @@
#endif
ut_ad(!lock->waiters);
- ut_ad(rw_lock_validate(lock));
+ ut_ad(rw_lock_validate(lock));
#ifdef UNIV_SYNC_PERF_STAT
rw_x_exit_count++;
| Thread |
|---|
| • bk commit into 5.1 tree (aivanov:1.2251) | Alex Ivanov Notebook | 25 Jul |