mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 22:12:30 +01:00
d33b523271
Fixed BUGS: #3300: "UPDATE statement with no index column in where condition locks all rows" Implement semi-consistent read to reduce lock conflicts at the cost of breaking serializability. ha_innobase::unlock_row(): reset the "did semi consistent read" flag ha_innobase::was_semi_consistent_read(), ha_innobase::try_semi_consistent_read(): new methods row_prebuilt_t, row_create_prebuilt(): add field row_read_type for keeping track of semi-consistent reads row_vers_build_for_semi_consistent_read(), row_sel_build_committed_vers_for_mysql(): new functions row_search_for_mysql(): implement semi-consistent reads #9802: "Foreign key checks disallow alter table". Added test cases. #12456: "Cursor shows incorrect data - DML does not affect, probably caching" This patch implements a high-granularity read view to be used with cursors. In this high-granularity consistent read view modifications done by the creating transaction after the cursor is created or future transactions are not visible. But those modifications that transaction did before the cursor was created are visible. #12701: "Support >4GB buffer pool and log files on 64-bit Windows" Do not call os_file_create_tmpfile() at runtime. Instead, create all tempfiles at startup and guard access to them with mutexes. #13778: "If FOREIGN_KEY_CHECKS=0, one can create inconsistent FOREIGN KEYs". When FOREIGN_KEY_CHECKS=0 we still need to check that datatypes between foreign key references are compatible. #14189: "VARBINARY and BINARY variables: trailing space ignored with InnoDB" innobase_init(): Assert that DATA_MYSQL_BINARY_CHARSET_COLL == my_charset_bin.number. dtype_get_pad_char(): Do not pad VARBINARY or BINARY columns. row_ins_cascade_calc_update_vec(): Refuse ON UPDATE CASCADE when trying to change the length of a VARBINARY column that refers to or is referenced by a BINARY column. BINARY columns are no longer padded on comparison, and thus they cannot be padded on storage either. #14747: "Race condition can cause btr_search_drop_page_hash_index() to crash" Note that buf_block_t::index should be protected by btr_search_latch or an s-latch or x-latch on the index page. btr_search_drop_page_hash_index(): Read block->index while holding btr_search_latch and use the cached value in the loop. Remove some redundant assertions. #15108: "mysqld crashes when innodb_log_file_size is set > 4G" #15308: "Problem of Order with Enum Column in Primary Key" #15550: "mysqld crashes in printing a FOREIGN KEY error in InnoDB" row_ins_foreign_report_add_err(): When printing the parent record, use the index in the parent table rather than the index in the child table. #15653: "Slow inserts to InnoDB if many thousands of .ibd files" Keep track on unflushed modifications to file spaces. When there are tens of thousands of file spaces, flushing all files in fil_flush_file_spaces() would be very slow. fil_flush_file_spaces(): Only flush unflushed file spaces. fil_space_t, fil_system_t: Add a list of unflushed spaces. #15991: "innodb-file-per-table + symlink database + rename = cr" os_file_handle_error(): Map the error codes EXDEV, ENOTDIR, and EISDIR to the new code OS_FILE_PATH_ERROR. Treat this code as OS_FILE_PATH_ERROR. This fixes the crash on RENAME TABLE when the .ibd file is a symbolic link to a different file system. #16157: "InnoDB crashes when main location settings are empty" This patch is from Heikki. #16298: "InnoDB segfaults in INSERTs in upgrade of 4.0 -> 5.0 tables with VARCHAR BINARY" dict_load_columns(): Set the charset-collation code DATA_MYSQL_BINARY_CHARSET_COLL for those binary string columns that lack a charset-collation code, i.e., the tables were created with an older version of MySQL/InnoDB than 4.1.2. #16229: "MySQL/InnoDB uses full explicit table locks in trigger processing" Take a InnoDB table lock only if user has explicitly requested a table lock. Added some additional comments to store_lock() and external_lock(). #16387: "InnoDB crash when dropping a foreign key <table>_ibfk_0" Do not mistake TABLENAME_ibfk_0 for auto-generated id. dict_table_get_highest_foreign_id(): Ignore foreign constraint identifiers starting with the pattern TABLENAME_ibfk_0. #16582: "InnoDB: Error in an adaptive hash index pointer to page" Account for a race condition when dropping the adaptive hash index for a B-tree page. btr_search_drop_page_hash_index(): Retry the operation if a hash index with different parameters was built meanwhile. Add diagnostics for the case that hash node pointers to the page remain. btr_search_info_update_hash(), btr_search_info_update_slow(): Document the parameter "info" as in/out. #16814: "SHOW INNODB STATUS format error in LATEST FOREIGN KEY ERROR section" Add a missing newline to the LAST FOREIGN KEY ERROR section in SHOW INNODB STATUS output. dict_foreign_error_report(): Always print a newline after invoking dict_print_info_on_foreign_key_in_create_format(). #16827: "Better InnoDB error message if ibdata files omitted from my.cnf" #17126: "CHECK TABLE on InnoDB causes a short hang during check of adaptive hash" CHECK TABLE blocking other queries, by releasing the btr_search_latch periodically during the adaptive hash table validation. #17405: "Valgrind: conditional jump or move depends on unititialised values" buf_block_init(): Reset magic_n, buf_fix_count and io_fix to avoid testing uninitialized variables.
518 lines
14 KiB
C
518 lines
14 KiB
C
/**********************************************************************
|
|
File-based list utilities
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
Created 11/28/1995 Heikki Tuuri
|
|
***********************************************************************/
|
|
|
|
#include "fut0lst.h"
|
|
|
|
#ifdef UNIV_NONINL
|
|
#include "fut0lst.ic"
|
|
#endif
|
|
|
|
#include "buf0buf.h"
|
|
|
|
|
|
/************************************************************************
|
|
Adds a node to an empty list. */
|
|
static
|
|
void
|
|
flst_add_to_empty(
|
|
/*==============*/
|
|
flst_base_node_t* base, /* in: pointer to base node of
|
|
empty list */
|
|
flst_node_t* node, /* in: node to add */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
ulint space;
|
|
fil_addr_t node_addr;
|
|
ulint len;
|
|
|
|
ut_ad(mtr && base && node);
|
|
ut_ad(base != node);
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(node),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
len = flst_get_len(base, mtr);
|
|
ut_a(len == 0);
|
|
|
|
buf_ptr_get_fsp_addr(node, &space, &node_addr);
|
|
|
|
/* Update first and last fields of base node */
|
|
flst_write_addr(base + FLST_FIRST, node_addr, mtr);
|
|
flst_write_addr(base + FLST_LAST, node_addr, mtr);
|
|
|
|
/* Set prev and next fields of node to add */
|
|
flst_write_addr(node + FLST_PREV, fil_addr_null, mtr);
|
|
flst_write_addr(node + FLST_NEXT, fil_addr_null, mtr);
|
|
|
|
/* Update len of base node */
|
|
mlog_write_ulint(base + FLST_LEN, len + 1, MLOG_4BYTES, mtr);
|
|
}
|
|
|
|
/************************************************************************
|
|
Adds a node as the last node in a list. */
|
|
|
|
void
|
|
flst_add_last(
|
|
/*==========*/
|
|
flst_base_node_t* base, /* in: pointer to base node of list */
|
|
flst_node_t* node, /* in: node to add */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
ulint space;
|
|
fil_addr_t node_addr;
|
|
ulint len;
|
|
fil_addr_t last_addr;
|
|
flst_node_t* last_node;
|
|
|
|
ut_ad(mtr && base && node);
|
|
ut_ad(base != node);
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(node),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
len = flst_get_len(base, mtr);
|
|
last_addr = flst_get_last(base, mtr);
|
|
|
|
buf_ptr_get_fsp_addr(node, &space, &node_addr);
|
|
|
|
/* If the list is not empty, call flst_insert_after */
|
|
if (len != 0) {
|
|
if (last_addr.page == node_addr.page) {
|
|
last_node = buf_frame_align(node) + last_addr.boffset;
|
|
} else {
|
|
last_node = fut_get_ptr(space, last_addr, RW_X_LATCH,
|
|
mtr);
|
|
}
|
|
|
|
flst_insert_after(base, last_node, node, mtr);
|
|
} else {
|
|
/* else call flst_add_to_empty */
|
|
flst_add_to_empty(base, node, mtr);
|
|
}
|
|
}
|
|
|
|
/************************************************************************
|
|
Adds a node as the first node in a list. */
|
|
|
|
void
|
|
flst_add_first(
|
|
/*===========*/
|
|
flst_base_node_t* base, /* in: pointer to base node of list */
|
|
flst_node_t* node, /* in: node to add */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
ulint space;
|
|
fil_addr_t node_addr;
|
|
ulint len;
|
|
fil_addr_t first_addr;
|
|
flst_node_t* first_node;
|
|
|
|
ut_ad(mtr && base && node);
|
|
ut_ad(base != node);
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(node),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
len = flst_get_len(base, mtr);
|
|
first_addr = flst_get_first(base, mtr);
|
|
|
|
buf_ptr_get_fsp_addr(node, &space, &node_addr);
|
|
|
|
/* If the list is not empty, call flst_insert_before */
|
|
if (len != 0) {
|
|
if (first_addr.page == node_addr.page) {
|
|
first_node = buf_frame_align(node)
|
|
+ first_addr.boffset;
|
|
} else {
|
|
first_node = fut_get_ptr(space, first_addr,
|
|
RW_X_LATCH, mtr);
|
|
}
|
|
|
|
flst_insert_before(base, node, first_node, mtr);
|
|
} else {
|
|
/* else call flst_add_to_empty */
|
|
flst_add_to_empty(base, node, mtr);
|
|
}
|
|
}
|
|
|
|
/************************************************************************
|
|
Inserts a node after another in a list. */
|
|
|
|
void
|
|
flst_insert_after(
|
|
/*==============*/
|
|
flst_base_node_t* base, /* in: pointer to base node of list */
|
|
flst_node_t* node1, /* in: node to insert after */
|
|
flst_node_t* node2, /* in: node to add */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
ulint space;
|
|
fil_addr_t node1_addr;
|
|
fil_addr_t node2_addr;
|
|
flst_node_t* node3;
|
|
fil_addr_t node3_addr;
|
|
ulint len;
|
|
|
|
ut_ad(mtr && node1 && node2 && base);
|
|
ut_ad(base != node1);
|
|
ut_ad(base != node2);
|
|
ut_ad(node2 != node1);
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(node1),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
|
|
buf_ptr_get_fsp_addr(node1, &space, &node1_addr);
|
|
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
|
|
|
|
node3_addr = flst_get_next_addr(node1, mtr);
|
|
|
|
/* Set prev and next fields of node2 */
|
|
flst_write_addr(node2 + FLST_PREV, node1_addr, mtr);
|
|
flst_write_addr(node2 + FLST_NEXT, node3_addr, mtr);
|
|
|
|
if (!fil_addr_is_null(node3_addr)) {
|
|
/* Update prev field of node3 */
|
|
node3 = fut_get_ptr(space, node3_addr, RW_X_LATCH, mtr);
|
|
flst_write_addr(node3 + FLST_PREV, node2_addr, mtr);
|
|
} else {
|
|
/* node1 was last in list: update last field in base */
|
|
flst_write_addr(base + FLST_LAST, node2_addr, mtr);
|
|
}
|
|
|
|
/* Set next field of node1 */
|
|
flst_write_addr(node1 + FLST_NEXT, node2_addr, mtr);
|
|
|
|
/* Update len of base node */
|
|
len = flst_get_len(base, mtr);
|
|
mlog_write_ulint(base + FLST_LEN, len + 1, MLOG_4BYTES, mtr);
|
|
}
|
|
|
|
/************************************************************************
|
|
Inserts a node before another in a list. */
|
|
|
|
void
|
|
flst_insert_before(
|
|
/*===============*/
|
|
flst_base_node_t* base, /* in: pointer to base node of list */
|
|
flst_node_t* node2, /* in: node to insert */
|
|
flst_node_t* node3, /* in: node to insert before */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
ulint space;
|
|
flst_node_t* node1;
|
|
fil_addr_t node1_addr;
|
|
fil_addr_t node2_addr;
|
|
fil_addr_t node3_addr;
|
|
ulint len;
|
|
|
|
ut_ad(mtr && node2 && node3 && base);
|
|
ut_ad(base != node2);
|
|
ut_ad(base != node3);
|
|
ut_ad(node2 != node3);
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(node3),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
|
|
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
|
|
buf_ptr_get_fsp_addr(node3, &space, &node3_addr);
|
|
|
|
node1_addr = flst_get_prev_addr(node3, mtr);
|
|
|
|
/* Set prev and next fields of node2 */
|
|
flst_write_addr(node2 + FLST_PREV, node1_addr, mtr);
|
|
flst_write_addr(node2 + FLST_NEXT, node3_addr, mtr);
|
|
|
|
if (!fil_addr_is_null(node1_addr)) {
|
|
/* Update next field of node1 */
|
|
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH, mtr);
|
|
flst_write_addr(node1 + FLST_NEXT, node2_addr, mtr);
|
|
} else {
|
|
/* node3 was first in list: update first field in base */
|
|
flst_write_addr(base + FLST_FIRST, node2_addr, mtr);
|
|
}
|
|
|
|
/* Set prev field of node3 */
|
|
flst_write_addr(node3 + FLST_PREV, node2_addr, mtr);
|
|
|
|
/* Update len of base node */
|
|
len = flst_get_len(base, mtr);
|
|
mlog_write_ulint(base + FLST_LEN, len + 1, MLOG_4BYTES, mtr);
|
|
}
|
|
|
|
/************************************************************************
|
|
Removes a node. */
|
|
|
|
void
|
|
flst_remove(
|
|
/*========*/
|
|
flst_base_node_t* base, /* in: pointer to base node of list */
|
|
flst_node_t* node2, /* in: node to remove */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
ulint space;
|
|
flst_node_t* node1;
|
|
fil_addr_t node1_addr;
|
|
fil_addr_t node2_addr;
|
|
flst_node_t* node3;
|
|
fil_addr_t node3_addr;
|
|
ulint len;
|
|
|
|
ut_ad(mtr && node2 && base);
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
|
|
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
|
|
|
|
node1_addr = flst_get_prev_addr(node2, mtr);
|
|
node3_addr = flst_get_next_addr(node2, mtr);
|
|
|
|
if (!fil_addr_is_null(node1_addr)) {
|
|
|
|
/* Update next field of node1 */
|
|
|
|
if (node1_addr.page == node2_addr.page) {
|
|
|
|
node1 = buf_frame_align(node2) + node1_addr.boffset;
|
|
} else {
|
|
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH,
|
|
mtr);
|
|
}
|
|
|
|
ut_ad(node1 != node2);
|
|
|
|
flst_write_addr(node1 + FLST_NEXT, node3_addr, mtr);
|
|
} else {
|
|
/* node2 was first in list: update first field in base */
|
|
flst_write_addr(base + FLST_FIRST, node3_addr, mtr);
|
|
}
|
|
|
|
if (!fil_addr_is_null(node3_addr)) {
|
|
/* Update prev field of node3 */
|
|
|
|
if (node3_addr.page == node2_addr.page) {
|
|
|
|
node3 = buf_frame_align(node2) + node3_addr.boffset;
|
|
} else {
|
|
node3 = fut_get_ptr(space, node3_addr, RW_X_LATCH,
|
|
mtr);
|
|
}
|
|
|
|
ut_ad(node2 != node3);
|
|
|
|
flst_write_addr(node3 + FLST_PREV, node1_addr, mtr);
|
|
} else {
|
|
/* node2 was last in list: update last field in base */
|
|
flst_write_addr(base + FLST_LAST, node1_addr, mtr);
|
|
}
|
|
|
|
/* Update len of base node */
|
|
len = flst_get_len(base, mtr);
|
|
ut_ad(len > 0);
|
|
|
|
mlog_write_ulint(base + FLST_LEN, len - 1, MLOG_4BYTES, mtr);
|
|
}
|
|
|
|
/************************************************************************
|
|
Cuts off the tail of the list, including the node given. The number of
|
|
nodes which will be removed must be provided by the caller, as this function
|
|
does not measure the length of the tail. */
|
|
|
|
void
|
|
flst_cut_end(
|
|
/*=========*/
|
|
flst_base_node_t* base, /* in: pointer to base node of list */
|
|
flst_node_t* node2, /* in: first node to remove */
|
|
ulint n_nodes,/* in: number of nodes to remove,
|
|
must be >= 1 */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
ulint space;
|
|
flst_node_t* node1;
|
|
fil_addr_t node1_addr;
|
|
fil_addr_t node2_addr;
|
|
ulint len;
|
|
|
|
ut_ad(mtr && node2 && base);
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(n_nodes > 0);
|
|
|
|
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
|
|
|
|
node1_addr = flst_get_prev_addr(node2, mtr);
|
|
|
|
if (!fil_addr_is_null(node1_addr)) {
|
|
|
|
/* Update next field of node1 */
|
|
|
|
if (node1_addr.page == node2_addr.page) {
|
|
|
|
node1 = buf_frame_align(node2) + node1_addr.boffset;
|
|
} else {
|
|
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH,
|
|
mtr);
|
|
}
|
|
|
|
flst_write_addr(node1 + FLST_NEXT, fil_addr_null, mtr);
|
|
} else {
|
|
/* node2 was first in list: update the field in base */
|
|
flst_write_addr(base + FLST_FIRST, fil_addr_null, mtr);
|
|
}
|
|
|
|
flst_write_addr(base + FLST_LAST, node1_addr, mtr);
|
|
|
|
/* Update len of base node */
|
|
len = flst_get_len(base, mtr);
|
|
ut_ad(len >= n_nodes);
|
|
|
|
mlog_write_ulint(base + FLST_LEN, len - n_nodes, MLOG_4BYTES, mtr);
|
|
}
|
|
|
|
/************************************************************************
|
|
Cuts off the tail of the list, not including the given node. The number of
|
|
nodes which will be removed must be provided by the caller, as this function
|
|
does not measure the length of the tail. */
|
|
|
|
void
|
|
flst_truncate_end(
|
|
/*==============*/
|
|
flst_base_node_t* base, /* in: pointer to base node of list */
|
|
flst_node_t* node2, /* in: first node not to remove */
|
|
ulint n_nodes,/* in: number of nodes to remove */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
fil_addr_t node2_addr;
|
|
ulint len;
|
|
ulint space;
|
|
|
|
ut_ad(mtr && node2 && base);
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
if (n_nodes == 0) {
|
|
|
|
ut_ad(fil_addr_is_null(flst_get_next_addr(node2, mtr)));
|
|
|
|
return;
|
|
}
|
|
|
|
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
|
|
|
|
/* Update next field of node2 */
|
|
flst_write_addr(node2 + FLST_NEXT, fil_addr_null, mtr);
|
|
|
|
flst_write_addr(base + FLST_LAST, node2_addr, mtr);
|
|
|
|
/* Update len of base node */
|
|
len = flst_get_len(base, mtr);
|
|
ut_ad(len >= n_nodes);
|
|
|
|
mlog_write_ulint(base + FLST_LEN, len - n_nodes, MLOG_4BYTES, mtr);
|
|
}
|
|
|
|
/************************************************************************
|
|
Validates a file-based list. */
|
|
|
|
ibool
|
|
flst_validate(
|
|
/*==========*/
|
|
/* out: TRUE if ok */
|
|
flst_base_node_t* base, /* in: pointer to base node of list */
|
|
mtr_t* mtr1) /* in: mtr */
|
|
{
|
|
ulint space;
|
|
flst_node_t* node;
|
|
fil_addr_t node_addr;
|
|
fil_addr_t base_addr;
|
|
ulint len;
|
|
ulint i;
|
|
mtr_t mtr2;
|
|
|
|
ut_ad(base);
|
|
ut_ad(mtr_memo_contains(mtr1, buf_block_align(base),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
|
|
/* We use two mini-transaction handles: the first is used to
|
|
lock the base node, and prevent other threads from modifying the
|
|
list. The second is used to traverse the list. We cannot run the
|
|
second mtr without committing it at times, because if the list
|
|
is long, then the x-locked pages could fill the buffer resulting
|
|
in a deadlock. */
|
|
|
|
/* Find out the space id */
|
|
buf_ptr_get_fsp_addr(base, &space, &base_addr);
|
|
|
|
len = flst_get_len(base, mtr1);
|
|
node_addr = flst_get_first(base, mtr1);
|
|
|
|
for (i = 0; i < len; i++) {
|
|
mtr_start(&mtr2);
|
|
|
|
node = fut_get_ptr(space, node_addr, RW_X_LATCH, &mtr2);
|
|
node_addr = flst_get_next_addr(node, &mtr2);
|
|
|
|
mtr_commit(&mtr2); /* Commit mtr2 each round to prevent buffer
|
|
becoming full */
|
|
}
|
|
|
|
ut_a(fil_addr_is_null(node_addr));
|
|
|
|
node_addr = flst_get_last(base, mtr1);
|
|
|
|
for (i = 0; i < len; i++) {
|
|
mtr_start(&mtr2);
|
|
|
|
node = fut_get_ptr(space, node_addr, RW_X_LATCH, &mtr2);
|
|
node_addr = flst_get_prev_addr(node, &mtr2);
|
|
|
|
mtr_commit(&mtr2); /* Commit mtr2 each round to prevent buffer
|
|
becoming full */
|
|
}
|
|
|
|
ut_a(fil_addr_is_null(node_addr));
|
|
|
|
return(TRUE);
|
|
}
|
|
|
|
/************************************************************************
|
|
Prints info of a file-based list. */
|
|
|
|
void
|
|
flst_print(
|
|
/*=======*/
|
|
flst_base_node_t* base, /* in: pointer to base node of list */
|
|
mtr_t* mtr) /* in: mtr */
|
|
{
|
|
buf_frame_t* frame;
|
|
ulint len;
|
|
|
|
ut_ad(base && mtr);
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
|
|
MTR_MEMO_PAGE_X_FIX));
|
|
frame = buf_frame_align(base);
|
|
|
|
len = flst_get_len(base, mtr);
|
|
|
|
fprintf(stderr,
|
|
"FILE-BASED LIST:\n"
|
|
"Base node in space %lu page %lu byte offset %lu; len %lu\n",
|
|
(ulong) buf_frame_get_space_id(frame),
|
|
(ulong) buf_frame_get_page_no(frame),
|
|
(ulong) (base - frame), (ulong) len);
|
|
}
|