Commit 160c5ddd authored by Inaam Rana's avatar Inaam Rana

Bug#13704145: ELIMINATE LRU SCAN WHEN DROPPING A TABLE

rb://942
approved by: Marko Makela

We don't need to scan LRU for dropping AHI entries when DROPing a table.
AHI entries are already removed when we free up extents for the btree.
parent b80c6a29
This diff is collapsed.
......@@ -2159,7 +2159,7 @@ fil_op_log_parse_or_replay(
switch (type) {
case MLOG_FILE_DELETE:
if (fil_tablespace_exists_in_mem(space_id)) {
ut_a(fil_delete_tablespace(space_id));
ut_a(fil_delete_tablespace(space_id, TRUE));
}
break;
......@@ -2229,7 +2229,9 @@ UNIV_INTERN
ibool
fil_delete_tablespace(
/*==================*/
ulint id) /*!< in: space id */
ulint id, /*!< in: space id */
ibool evict_all) /*!< in: TRUE if we want all pages
evicted from LRU. */
{
ibool success;
fil_space_t* space;
......@@ -2351,7 +2353,10 @@ try_again:
completely and permanently. The flag is_being_deleted also prevents
fil_flush() from being applied to this tablespace. */
buf_LRU_invalidate_tablespace(id);
buf_LRU_flush_or_remove_pages(
id, evict_all
? BUF_REMOVE_ALL_NO_WRITE
: BUF_REMOVE_FLUSH_NO_WRITE);
#endif
/* printf("Deleting tablespace %s id %lu\n", space->name, id); */
......@@ -2439,7 +2444,7 @@ fil_discard_tablespace(
{
ibool success;
success = fil_delete_tablespace(id);
success = fil_delete_tablespace(id, TRUE);
if (!success) {
fprintf(stderr,
......
......@@ -64,15 +64,14 @@ These are low-level functions
#define BUF_LRU_FREE_SEARCH_LEN(b) (5 + 2 * BUF_READ_AHEAD_AREA(b))
/******************************************************************//**
Invalidates all pages belonging to a given tablespace when we are deleting
the data file(s) of that tablespace. A PROBLEM: if readahead is being started,
what guarantees that it will not try to read in pages after this operation has
completed? */
Removes all pages belonging to a given tablespace. */
UNIV_INTERN
void
buf_LRU_invalidate_tablespace(
buf_LRU_flush_or_remove_pages(
/*==========================*/
ulint id); /*!< in: space id */
ulint id, /*!< in: space id */
enum buf_remove_t buf_remove);/*!< in: remove or flush
strategy */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
......
......@@ -63,6 +63,15 @@ enum buf_io_fix {
the flush_list */
};
/** Algorithm to remove the pages for a tablespace from the buffer pool.
@See buf_LRU_flush_or_remove_pages(). */
enum buf_remove_t {
BUF_REMOVE_ALL_NO_WRITE, /*!< Remove all pages from the buffer
pool, don't write or sync to disk */
BUF_REMOVE_FLUSH_NO_WRITE, /*!< Remove only, from the flush list,
don't write or sync to disk */
};
/** Parameters of binary buddy system for compressed pages (buf0buddy.h) */
/* @{ */
#define BUF_BUDDY_LOW_SHIFT PAGE_ZIP_MIN_SIZE_SHIFT
......
......@@ -397,7 +397,9 @@ UNIV_INTERN
ibool
fil_delete_tablespace(
/*==================*/
ulint id); /*!< in: space id */
ulint id, /*!< in: space id */
ibool evict_all); /*!< in: TRUE if we want all pages
evicted from LRU. */
#ifndef UNIV_HOTBACKUP
/*******************************************************************//**
Discards a single-table tablespace. The tablespace must be cached in the
......
......@@ -1994,7 +1994,8 @@ err_exit:
case DB_TOO_MANY_CONCURRENT_TRXS:
/* We already have .ibd file here. it should be deleted. */
if (table->space && !fil_delete_tablespace(table->space)) {
if (table->space && !fil_delete_tablespace(table->space,
FALSE)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: not able to"
......@@ -3433,7 +3434,7 @@ check_next_foreign:
"InnoDB: of table ");
ut_print_name(stderr, trx, TRUE, name);
fprintf(stderr, ".\n");
} else if (!fil_delete_tablespace(space_id)) {
} else if (!fil_delete_tablespace(space_id, FALSE)) {
fprintf(stderr,
"InnoDB: We removed now the InnoDB"
" internal data dictionary entry\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment