#include "btr0pcur.h"#include "ut0byte.h"#include "rem0cmp.h"#include "trx0trx.h"Include dependency graph for btr0pcur.c:

Go to the source code of this file.
Functions | |
| btr_pcur_t * | btr_pcur_create_for_mysql (void) |
| void | btr_pcur_free_for_mysql (btr_pcur_t *cursor) |
| void | btr_pcur_store_position (btr_pcur_t *cursor, mtr_t *mtr) |
| void | btr_pcur_copy_stored_position (btr_pcur_t *pcur_receive, btr_pcur_t *pcur_donate) |
| ibool | btr_pcur_restore_position (ulint latch_mode, btr_pcur_t *cursor, mtr_t *mtr) |
| void | btr_pcur_release_leaf (btr_pcur_t *cursor, mtr_t *mtr) |
| void | btr_pcur_move_to_next_page (btr_pcur_t *cursor, mtr_t *mtr) |
| void | btr_pcur_move_backward_from_page (btr_pcur_t *cursor, mtr_t *mtr) |
| ibool | btr_pcur_move_to_prev (btr_pcur_t *cursor, mtr_t *mtr) |
| void | btr_pcur_open_on_user_rec (dict_index_t *index, dtuple_t *tuple, ulint mode, ulint latch_mode, btr_pcur_t *cursor, mtr_t *mtr) |
| void btr_pcur_copy_stored_position | ( | btr_pcur_t * | pcur_receive, | |
| btr_pcur_t * | pcur_donate | |||
| ) |
Definition at line 150 of file btr0pcur.c.
References btr_pcur_struct::buf_size, mem_alloc, mem_free, btr_pcur_struct::old_n_fields, btr_pcur_struct::old_rec, btr_pcur_struct::old_rec_buf, and ut_memcpy().
Referenced by row_update_for_mysql().
00152 : pcur which will receive the 00153 position info */ 00154 btr_pcur_t* pcur_donate) /* in: pcur from which the info is 00155 copied */ 00156 { 00157 if (pcur_receive->old_rec_buf) { 00158 mem_free(pcur_receive->old_rec_buf); 00159 } 00160 00161 ut_memcpy(pcur_receive, pcur_donate, sizeof(btr_pcur_t)); 00162 00163 if (pcur_donate->old_rec_buf) { 00164 00165 pcur_receive->old_rec_buf = mem_alloc(pcur_donate->buf_size); 00166 00167 ut_memcpy(pcur_receive->old_rec_buf, pcur_donate->old_rec_buf, 00168 pcur_donate->buf_size); 00169 pcur_receive->old_rec = pcur_receive->old_rec_buf 00170 + (pcur_donate->old_rec - pcur_donate->old_rec_buf); 00171 } 00172 00173 pcur_receive->old_n_fields = pcur_donate->old_n_fields; 00174 }
Here is the call graph for this function:

Here is the caller graph for this function:

| btr_pcur_t* btr_pcur_create_for_mysql | ( | void | ) |
Definition at line 23 of file btr0pcur.c.
References btr_pcur_struct::btr_cur, btr_pcur_init(), btr_cur_struct::index, mem_alloc, and NULL.
Referenced by row_create_prebuilt(), and row_create_update_node_for_mysql().
00025 : persistent cursor */ 00026 { 00027 btr_pcur_t* pcur; 00028 00029 pcur = mem_alloc(sizeof(btr_pcur_t)); 00030 00031 pcur->btr_cur.index = NULL; 00032 btr_pcur_init(pcur); 00033 00034 return(pcur); 00035 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void btr_pcur_free_for_mysql | ( | btr_pcur_t * | cursor | ) |
Definition at line 41 of file btr0pcur.c.
References btr_pcur_struct::btr_cur, BTR_NO_LATCHES, BTR_PCUR_NOT_POSITIONED, BTR_PCUR_OLD_NOT_STORED, btr_pcur_struct::latch_mode, mem_free, NULL, btr_pcur_struct::old_n_fields, btr_pcur_struct::old_rec, btr_pcur_struct::old_rec_buf, btr_pcur_struct::old_stored, btr_cur_struct::page_cur, btr_pcur_struct::pos_state, and page_cur_struct::rec.
Referenced by que_graph_free_recursive(), and row_prebuilt_free().
00043 : persistent cursor */ 00044 { 00045 if (cursor->old_rec_buf != NULL) { 00046 00047 mem_free(cursor->old_rec_buf); 00048 00049 cursor->old_rec_buf = NULL; 00050 } 00051 00052 cursor->btr_cur.page_cur.rec = NULL; 00053 cursor->old_rec = NULL; 00054 cursor->old_n_fields = 0; 00055 cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; 00056 00057 cursor->latch_mode = BTR_NO_LATCHES; 00058 cursor->pos_state = BTR_PCUR_NOT_POSITIONED; 00059 00060 mem_free(cursor); 00061 }
Here is the caller graph for this function:

| void btr_pcur_move_backward_from_page | ( | btr_pcur_t * | cursor, | |
| mtr_t * | mtr | |||
| ) |
Definition at line 424 of file btr0pcur.c.
References btr_leaf_page_release(), BTR_MODIFY_LEAF, BTR_MODIFY_PREV, BTR_NO_LATCHES, btr_page_get_prev(), btr_pcur_get_btr_cur(), btr_pcur_get_page(), btr_pcur_get_page_cur(), btr_pcur_is_before_first_in_tree(), btr_pcur_is_before_first_on_page(), BTR_PCUR_IS_POSITIONED, BTR_PCUR_OLD_NOT_STORED, btr_pcur_restore_position(), btr_pcur_store_position(), BTR_SEARCH_LEAF, BTR_SEARCH_PREV, buf_frame_get_space_id(), FIL_NULL, btr_pcur_struct::latch_mode, btr_cur_struct::left_page, mtr_commit(), mtr_start(), btr_pcur_struct::old_stored, page, page_cur_set_after_last(), page_t, btr_pcur_struct::pos_state, ut_a, ut_ad, and ut_error.
Referenced by btr_pcur_move_to_prev().
00426 : persistent cursor, must be on the first 00427 record of the current page */ 00428 mtr_t* mtr) /* in: mtr */ 00429 { 00430 ulint prev_page_no; 00431 ulint space; 00432 page_t* page; 00433 page_t* prev_page; 00434 ulint latch_mode; 00435 ulint latch_mode2; 00436 00437 ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); 00438 ut_ad(cursor->latch_mode != BTR_NO_LATCHES); 00439 ut_ad(btr_pcur_is_before_first_on_page(cursor, mtr)); 00440 ut_ad(!btr_pcur_is_before_first_in_tree(cursor, mtr)); 00441 00442 latch_mode = cursor->latch_mode; 00443 00444 if (latch_mode == BTR_SEARCH_LEAF) { 00445 00446 latch_mode2 = BTR_SEARCH_PREV; 00447 00448 } else if (latch_mode == BTR_MODIFY_LEAF) { 00449 00450 latch_mode2 = BTR_MODIFY_PREV; 00451 } else { 00452 latch_mode2 = 0; /* To eliminate compiler warning */ 00453 ut_error; 00454 } 00455 00456 btr_pcur_store_position(cursor, mtr); 00457 00458 mtr_commit(mtr); 00459 00460 mtr_start(mtr); 00461 00462 btr_pcur_restore_position(latch_mode2, cursor, mtr); 00463 00464 page = btr_pcur_get_page(cursor); 00465 00466 prev_page_no = btr_page_get_prev(page, mtr); 00467 space = buf_frame_get_space_id(page); 00468 00469 if (btr_pcur_is_before_first_on_page(cursor, mtr) 00470 && (prev_page_no != FIL_NULL)) { 00471 00472 prev_page = btr_pcur_get_btr_cur(cursor)->left_page; 00473 00474 btr_leaf_page_release(page, latch_mode, mtr); 00475 00476 page_cur_set_after_last(prev_page, 00477 btr_pcur_get_page_cur(cursor)); 00478 } else if (prev_page_no != FIL_NULL) { 00479 00480 /* The repositioned cursor did not end on an infimum record on 00481 a page. Cursor repositioning acquired a latch also on the 00482 previous page, but we do not need the latch: release it. */ 00483 00484 prev_page = btr_pcur_get_btr_cur(cursor)->left_page; 00485 00486 btr_leaf_page_release(prev_page, latch_mode, mtr); 00487 } 00488 00489 cursor->latch_mode = latch_mode; 00490 00491 cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; 00492 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void btr_pcur_move_to_next_page | ( | btr_pcur_t * | cursor, | |
| mtr_t * | mtr | |||
| ) |
Definition at line 375 of file btr0pcur.c.
References btr_leaf_page_release(), BTR_NO_LATCHES, btr_page_get(), btr_page_get_next(), btr_page_get_prev(), btr_pcur_get_page(), btr_pcur_get_page_cur(), btr_pcur_is_after_last_on_page(), BTR_PCUR_IS_POSITIONED, BTR_PCUR_OLD_NOT_STORED, buf_block_align(), buf_frame_get_page_no(), buf_frame_get_space_id(), buf_block_struct::check_index_page_at_flush, FIL_NULL, btr_pcur_struct::latch_mode, btr_pcur_struct::old_stored, page, page_check_dir(), page_cur_set_before_first(), page_is_comp(), page_t, btr_pcur_struct::pos_state, TRUE, ut_a, and ut_ad.
00377 : persistent cursor; must be on the 00378 last record of the current page */ 00379 mtr_t* mtr) /* in: mtr */ 00380 { 00381 ulint next_page_no; 00382 ulint space; 00383 page_t* page; 00384 page_t* next_page; 00385 00386 ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); 00387 ut_ad(cursor->latch_mode != BTR_NO_LATCHES); 00388 ut_ad(btr_pcur_is_after_last_on_page(cursor, mtr)); 00389 00390 cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; 00391 00392 page = btr_pcur_get_page(cursor); 00393 00394 next_page_no = btr_page_get_next(page, mtr); 00395 space = buf_frame_get_space_id(page); 00396 00397 ut_ad(next_page_no != FIL_NULL); 00398 00399 next_page = btr_page_get(space, next_page_no, cursor->latch_mode, mtr); 00400 #ifdef UNIV_BTR_DEBUG 00401 ut_a(btr_page_get_prev(next_page, mtr) == buf_frame_get_page_no(page)); 00402 #endif /* UNIV_BTR_DEBUG */ 00403 ut_a(page_is_comp(next_page) == page_is_comp(page)); 00404 buf_block_align(next_page)->check_index_page_at_flush = TRUE; 00405 00406 btr_leaf_page_release(page, cursor->latch_mode, mtr); 00407 00408 page_cur_set_before_first(next_page, btr_pcur_get_page_cur(cursor)); 00409 00410 page_check_dir(next_page); 00411 }
Here is the call graph for this function:

| ibool btr_pcur_move_to_prev | ( | btr_pcur_t * | cursor, | |
| mtr_t * | mtr | |||
| ) |
Definition at line 499 of file btr0pcur.c.
References BTR_NO_LATCHES, btr_pcur_is_before_first_in_tree(), btr_pcur_is_before_first_on_page(), BTR_PCUR_IS_POSITIONED, btr_pcur_move_backward_from_page(), btr_pcur_move_to_prev_on_page(), BTR_PCUR_OLD_NOT_STORED, FALSE, btr_pcur_struct::latch_mode, btr_pcur_struct::old_stored, btr_pcur_struct::pos_state, TRUE, and ut_ad.
Referenced by ibuf_update_max_tablespace_id(), row_search_for_mysql(), row_sel(), and sel_restore_position_for_mysql().
00501 : TRUE if the cursor was not before first 00502 in tree */ 00503 btr_pcur_t* cursor, /* in: persistent cursor; NOTE that the 00504 function may release the page latch */ 00505 mtr_t* mtr) /* in: mtr */ 00506 { 00507 ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); 00508 ut_ad(cursor->latch_mode != BTR_NO_LATCHES); 00509 00510 cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; 00511 00512 if (btr_pcur_is_before_first_on_page(cursor, mtr)) { 00513 00514 if (btr_pcur_is_before_first_in_tree(cursor, mtr)) { 00515 00516 return(FALSE); 00517 } 00518 00519 btr_pcur_move_backward_from_page(cursor, mtr); 00520 00521 return(TRUE); 00522 } 00523 00524 btr_pcur_move_to_prev_on_page(cursor, mtr); 00525 00526 return(TRUE); 00527 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void btr_pcur_open_on_user_rec | ( | dict_index_t * | index, | |
| dtuple_t * | tuple, | |||
| ulint | mode, | |||
| ulint | latch_mode, | |||
| btr_pcur_t * | cursor, | |||
| mtr_t * | mtr | |||
| ) |
Definition at line 538 of file btr0pcur.c.
References btr_pcur_is_after_last_on_page(), btr_pcur_move_to_next_user_rec(), btr_pcur_open(), index(), PAGE_CUR_G, PAGE_CUR_GE, PAGE_CUR_L, PAGE_CUR_LE, ut_ad, and ut_error.
Referenced by btr_search_guess_on_hash(), dict_get_first_table_name_in_db(), dict_load_columns(), dict_load_fields(), dict_load_foreign(), dict_load_foreign_cols(), dict_load_foreigns(), dict_load_indexes(), dict_load_table(), dict_load_table_on_id(), ibuf_delete_for_discarded_space(), ibuf_merge_or_delete_for_page(), and row_truncate_table_for_mysql().
00540 : index */ 00541 dtuple_t* tuple, /* in: tuple on which search done */ 00542 ulint mode, /* in: PAGE_CUR_L, ... */ 00543 ulint latch_mode, /* in: BTR_SEARCH_LEAF or 00544 BTR_MODIFY_LEAF */ 00545 btr_pcur_t* cursor, /* in: memory buffer for persistent 00546 cursor */ 00547 mtr_t* mtr) /* in: mtr */ 00548 { 00549 btr_pcur_open(index, tuple, mode, latch_mode, cursor, mtr); 00550 00551 if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) { 00552 00553 if (btr_pcur_is_after_last_on_page(cursor, mtr)) { 00554 00555 btr_pcur_move_to_next_user_rec(cursor, mtr); 00556 } 00557 } else { 00558 ut_ad((mode == PAGE_CUR_LE) || (mode == PAGE_CUR_L)); 00559 00560 /* Not implemented yet */ 00561 00562 ut_error; 00563 } 00564 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void btr_pcur_release_leaf | ( | btr_pcur_t * | cursor, | |
| mtr_t * | mtr | |||
| ) |
Definition at line 349 of file btr0pcur.c.
References btr_cur_get_page(), btr_leaf_page_release(), BTR_NO_LATCHES, btr_pcur_get_btr_cur(), BTR_PCUR_IS_POSITIONED, BTR_PCUR_WAS_POSITIONED, btr_pcur_struct::latch_mode, page, page_t, btr_pcur_struct::pos_state, ut_a, and ut_ad.
00351 : persistent cursor */ 00352 mtr_t* mtr) /* in: mtr */ 00353 { 00354 page_t* page; 00355 00356 ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); 00357 ut_ad(cursor->latch_mode != BTR_NO_LATCHES); 00358 00359 page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor)); 00360 00361 btr_leaf_page_release(page, cursor->latch_mode, mtr); 00362 00363 cursor->latch_mode = BTR_NO_LATCHES; 00364 00365 cursor->pos_state = BTR_PCUR_WAS_POSITIONED; 00366 }
Here is the call graph for this function:

| ibool btr_pcur_restore_position | ( | ulint | latch_mode, | |
| btr_pcur_t * | cursor, | |||
| mtr_t * | mtr | |||
| ) |
Definition at line 190 of file btr0pcur.c.
References btr_pcur_struct::block_when_stored, btr_cur_get_page(), btr_cur_get_tree(), btr_cur_open_at_index_side(), BTR_MODIFY_LEAF, BTR_PCUR_AFTER, BTR_PCUR_AFTER_LAST_IN_TREE, BTR_PCUR_BEFORE, BTR_PCUR_BEFORE_FIRST_IN_TREE, btr_pcur_get_btr_cur(), btr_pcur_get_page(), btr_pcur_get_rec(), btr_pcur_is_on_user_rec(), BTR_PCUR_IS_POSITIONED, BTR_PCUR_OLD_STORED, BTR_PCUR_ON, btr_pcur_open_with_no_init(), btr_pcur_store_position(), BTR_PCUR_WAS_POSITIONED, BTR_SEARCH_LEAF, buf_block_align(), buf_block_get_modify_clock(), buf_page_optimistic_get, cmp_dtuple_rec(), cmp_rec_rec(), dict_tree_build_data_tuple(), FALSE, index(), btr_cur_struct::index, btr_pcur_struct::latch_mode, mem_heap_create, mem_heap_free, btr_pcur_struct::modify_clock, NULL, btr_pcur_struct::old_n_fields, btr_pcur_struct::old_rec, btr_pcur_struct::old_stored, page, PAGE_CUR_G, PAGE_CUR_L, PAGE_CUR_LE, page_t, btr_pcur_struct::pos_state, rec_get_offsets, btr_pcur_struct::rel_pos, btr_pcur_struct::search_mode, SYNC_TREE_NODE, TRUE, btr_pcur_struct::trx_if_known, trx_print(), ut_a, ut_ad, ut_error, and ut_print_buf().
Referenced by btr_pcur_move_backward_from_page(), dict_check_tablespaces_and_store_max_id(), dict_load_foreigns(), dict_print(), ibuf_delete_rec(), row_purge_reposition_pcur(), row_sel_restore_pcur_pos(), row_truncate_table_for_mysql(), row_undo_ins_remove_clust_rec(), row_undo_mod_clust_low(), row_undo_mod_del_mark_or_remove_sec_low(), row_undo_mod_remove_clust_low(), row_unlock_for_mysql(), row_upd_clust_rec(), row_upd_clust_step(), and sel_restore_position_for_mysql().
00192 : TRUE if the cursor position 00193 was stored when it was on a user record 00194 and it can be restored on a user record 00195 whose ordering fields are identical to 00196 the ones of the original user record */ 00197 ulint latch_mode, /* in: BTR_SEARCH_LEAF, ... */ 00198 btr_pcur_t* cursor, /* in: detached persistent cursor */ 00199 mtr_t* mtr) /* in: mtr */ 00200 { 00201 dict_tree_t* tree; 00202 page_t* page; 00203 dtuple_t* tuple; 00204 ulint mode; 00205 ulint old_mode; 00206 mem_heap_t* heap; 00207 00208 if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED) 00209 || UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED 00210 && cursor->pos_state != BTR_PCUR_IS_POSITIONED)) { 00211 ut_print_buf(stderr, cursor, sizeof(btr_pcur_t)); 00212 if (cursor->trx_if_known) { 00213 trx_print(stderr, cursor->trx_if_known, 0); 00214 } 00215 00216 ut_error; 00217 } 00218 00219 if (UNIV_UNLIKELY(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE 00220 || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) { 00221 00222 /* In these cases we do not try an optimistic restoration, 00223 but always do a search */ 00224 00225 btr_cur_open_at_index_side( 00226 cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE, 00227 btr_pcur_get_btr_cur(cursor)->index, latch_mode, 00228 btr_pcur_get_btr_cur(cursor), mtr); 00229 00230 cursor->block_when_stored = 00231 buf_block_align(btr_pcur_get_page(cursor)); 00232 00233 return(FALSE); 00234 } 00235 00236 ut_a(cursor->old_rec); 00237 ut_a(cursor->old_n_fields); 00238 00239 page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor)); 00240 00241 if (UNIV_LIKELY(latch_mode == BTR_SEARCH_LEAF) 00242 || UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) { 00243 /* Try optimistic restoration */ 00244 00245 if (UNIV_LIKELY(buf_page_optimistic_get(latch_mode, 00246 cursor->block_when_stored, page, 00247 cursor->modify_clock, mtr))) { 00248 cursor->pos_state = BTR_PCUR_IS_POSITIONED; 00249 #ifdef UNIV_SYNC_DEBUG 00250 buf_page_dbg_add_level(page, SYNC_TREE_NODE); 00251 #endif /* UNIV_SYNC_DEBUG */ 00252 if (cursor->rel_pos == BTR_PCUR_ON) { 00253 #ifdef UNIV_DEBUG 00254 rec_t* rec; 00255 ulint* offsets1; 00256 ulint* offsets2; 00257 dict_index_t* index; 00258 #endif /* UNIV_DEBUG */ 00259 cursor->latch_mode = latch_mode; 00260 #ifdef UNIV_DEBUG 00261 rec = btr_pcur_get_rec(cursor); 00262 index = btr_pcur_get_btr_cur(cursor)->index; 00263 00264 heap = mem_heap_create(256); 00265 offsets1 = rec_get_offsets(cursor->old_rec, 00266 index, NULL, 00267 cursor->old_n_fields, &heap); 00268 offsets2 = rec_get_offsets(rec, index, NULL, 00269 cursor->old_n_fields, &heap); 00270 00271 ut_ad(cmp_rec_rec(cursor->old_rec, 00272 rec, offsets1, offsets2, index) == 0); 00273 mem_heap_free(heap); 00274 #endif /* UNIV_DEBUG */ 00275 return(TRUE); 00276 } 00277 00278 return(FALSE); 00279 } 00280 } 00281 00282 /* If optimistic restoration did not succeed, open the cursor anew */ 00283 00284 heap = mem_heap_create(256); 00285 00286 tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor)); 00287 tuple = dict_tree_build_data_tuple(tree, cursor->old_rec, 00288 cursor->old_n_fields, heap); 00289 00290 /* Save the old search mode of the cursor */ 00291 old_mode = cursor->search_mode; 00292 00293 if (UNIV_LIKELY(cursor->rel_pos == BTR_PCUR_ON)) { 00294 mode = PAGE_CUR_LE; 00295 } else if (cursor->rel_pos == BTR_PCUR_AFTER) { 00296 mode = PAGE_CUR_G; 00297 } else { 00298 ut_ad(cursor->rel_pos == BTR_PCUR_BEFORE); 00299 mode = PAGE_CUR_L; 00300 } 00301 00302 btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple, 00303 mode, latch_mode, cursor, 0, mtr); 00304 00305 /* Restore the old search mode */ 00306 cursor->search_mode = old_mode; 00307 00308 if (cursor->rel_pos == BTR_PCUR_ON 00309 && btr_pcur_is_on_user_rec(cursor, mtr) 00310 && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor), 00311 rec_get_offsets(btr_pcur_get_rec(cursor), 00312 btr_pcur_get_btr_cur(cursor)->index, 00313 NULL, ULINT_UNDEFINED, &heap))) { 00314 00315 /* We have to store the NEW value for the modify clock, since 00316 the cursor can now be on a different page! But we can retain 00317 the value of old_rec */ 00318 00319 cursor->block_when_stored = 00320 buf_block_align(btr_pcur_get_page(cursor)); 00321 cursor->modify_clock = 00322 buf_block_get_modify_clock(cursor->block_when_stored); 00323 cursor->old_stored = BTR_PCUR_OLD_STORED; 00324 00325 mem_heap_free(heap); 00326 00327 return(TRUE); 00328 } 00329 00330 mem_heap_free(heap); 00331 00332 /* We have to store new position information, modify_clock etc., 00333 to the cursor because it can now be on a different page, the record 00334 under it may have been removed, etc. */ 00335 00336 btr_pcur_store_position(cursor, mtr); 00337 00338 return(FALSE); 00339 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void btr_pcur_store_position | ( | btr_pcur_t * | cursor, | |
| mtr_t * | mtr | |||
| ) |
Definition at line 72 of file btr0pcur.c.
References btr_pcur_struct::block_when_stored, btr_cur_get_tree(), BTR_NO_LATCHES, btr_page_get_next(), btr_page_get_prev(), BTR_PCUR_AFTER, BTR_PCUR_AFTER_LAST_IN_TREE, BTR_PCUR_BEFORE, BTR_PCUR_BEFORE_FIRST_IN_TREE, btr_pcur_get_btr_cur(), btr_pcur_get_page_cur(), BTR_PCUR_IS_POSITIONED, BTR_PCUR_OLD_STORED, BTR_PCUR_ON, buf_block_align(), buf_block_get_modify_clock(), btr_pcur_struct::buf_size, dict_tree_copy_rec_order_prefix(), FIL_NULL, btr_pcur_struct::latch_mode, btr_pcur_struct::modify_clock, mtr_memo_contains(), MTR_MEMO_PAGE_S_FIX, MTR_MEMO_PAGE_X_FIX, btr_pcur_struct::old_n_fields, btr_pcur_struct::old_rec, btr_pcur_struct::old_rec_buf, btr_pcur_struct::old_stored, page, page_cur_get_rec(), page_get_n_recs(), page_rec_get_next(), page_rec_get_prev(), page_rec_is_infimum_low(), page_rec_is_supremum_low(), page_t, btr_pcur_struct::pos_state, btr_pcur_struct::rel_pos, UNIV_PAGE_SIZE, ut_a, ut_ad, ut_align_down(), and ut_align_offset().
Referenced by btr_pcur_move_backward_from_page(), btr_pcur_restore_position(), dict_check_tablespaces_and_store_max_id(), dict_load_foreigns(), dict_print(), ibuf_delete_rec(), row_purge_reposition_pcur(), row_search_for_mysql(), row_sel(), row_sel_get_clust_rec_for_mysql(), row_truncate_table_for_mysql(), and row_undo_search_clust_to_pcur().
00074 : persistent cursor */ 00075 mtr_t* mtr) /* in: mtr */ 00076 { 00077 page_cur_t* page_cursor; 00078 rec_t* rec; 00079 dict_tree_t* tree; 00080 page_t* page; 00081 ulint offs; 00082 00083 ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); 00084 ut_ad(cursor->latch_mode != BTR_NO_LATCHES); 00085 00086 tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor)); 00087 00088 page_cursor = btr_pcur_get_page_cur(cursor); 00089 00090 rec = page_cur_get_rec(page_cursor); 00091 page = ut_align_down(rec, UNIV_PAGE_SIZE); 00092 offs = ut_align_offset(rec, UNIV_PAGE_SIZE); 00093 00094 ut_ad(mtr_memo_contains(mtr, buf_block_align(page), 00095 MTR_MEMO_PAGE_S_FIX) 00096 || mtr_memo_contains(mtr, buf_block_align(page), 00097 MTR_MEMO_PAGE_X_FIX)); 00098 ut_a(cursor->latch_mode != BTR_NO_LATCHES); 00099 00100 if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) { 00101 /* It must be an empty index tree; NOTE that in this case 00102 we do not store the modify_clock, but always do a search 00103 if we restore the cursor position */ 00104 00105 ut_a(btr_page_get_next(page, mtr) == FIL_NULL); 00106 ut_a(btr_page_get_prev(page, mtr) == FIL_NULL); 00107 00108 cursor->old_stored = BTR_PCUR_OLD_STORED; 00109 00110 if (page_rec_is_supremum_low(offs)) { 00111 00112 cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE; 00113 } else { 00114 cursor->rel_pos = BTR_PCUR_BEFORE_FIRST_IN_TREE; 00115 } 00116 00117 return; 00118 } 00119 00120 if (page_rec_is_supremum_low(offs)) { 00121 00122 rec = page_rec_get_prev(rec); 00123 00124 cursor->rel_pos = BTR_PCUR_AFTER; 00125 00126 } else if (page_rec_is_infimum_low(offs)) { 00127 00128 rec = page_rec_get_next(rec); 00129 00130 cursor->rel_pos = BTR_PCUR_BEFORE; 00131 } else { 00132 cursor->rel_pos = BTR_PCUR_ON; 00133 } 00134 00135 cursor->old_stored = BTR_PCUR_OLD_STORED; 00136 cursor->old_rec = dict_tree_copy_rec_order_prefix(tree, rec, 00137 &cursor->old_n_fields, 00138 &cursor->old_rec_buf, 00139 &cursor->buf_size); 00140 00141 cursor->block_when_stored = buf_block_align(page); 00142 cursor->modify_clock = buf_block_get_modify_clock( 00143 cursor->block_when_stored); 00144 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

