Commit 5352a761 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 26c08ffa
This diff is collapsed.
...@@ -2159,7 +2159,7 @@ fil_op_log_parse_or_replay( ...@@ -2159,7 +2159,7 @@ fil_op_log_parse_or_replay(
switch (type) { switch (type) {
case MLOG_FILE_DELETE: case MLOG_FILE_DELETE:
if (fil_tablespace_exists_in_mem(space_id)) { if (fil_tablespace_exists_in_mem(space_id)) {
ut_a(fil_delete_tablespace(space_id)); ut_a(fil_delete_tablespace(space_id, TRUE));
} }
break; break;
...@@ -2229,7 +2229,9 @@ UNIV_INTERN ...@@ -2229,7 +2229,9 @@ UNIV_INTERN
ibool ibool
fil_delete_tablespace( 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; ibool success;
fil_space_t* space; fil_space_t* space;
...@@ -2351,7 +2353,10 @@ try_again: ...@@ -2351,7 +2353,10 @@ try_again:
completely and permanently. The flag is_being_deleted also prevents completely and permanently. The flag is_being_deleted also prevents
fil_flush() from being applied to this tablespace. */ 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 #endif
/* printf("Deleting tablespace %s id %lu\n", space->name, id); */ /* printf("Deleting tablespace %s id %lu\n", space->name, id); */
...@@ -2439,7 +2444,7 @@ fil_discard_tablespace( ...@@ -2439,7 +2444,7 @@ fil_discard_tablespace(
{ {
ibool success; ibool success;
success = fil_delete_tablespace(id); success = fil_delete_tablespace(id, TRUE);
if (!success) { if (!success) {
fprintf(stderr, fprintf(stderr,
......
...@@ -64,15 +64,14 @@ These are low-level functions ...@@ -64,15 +64,14 @@ These are low-level functions
#define BUF_LRU_FREE_SEARCH_LEN(b) (5 + 2 * BUF_READ_AHEAD_AREA(b)) #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 Removes all pages belonging to a given tablespace. */
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? */
UNIV_INTERN UNIV_INTERN
void 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 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//** /********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */ Insert a compressed block into buf_pool->zip_clean in the LRU order. */
......
...@@ -63,6 +63,15 @@ enum buf_io_fix { ...@@ -63,6 +63,15 @@ enum buf_io_fix {
the flush_list */ 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) */ /** Parameters of binary buddy system for compressed pages (buf0buddy.h) */
/* @{ */ /* @{ */
#define BUF_BUDDY_LOW_SHIFT PAGE_ZIP_MIN_SIZE_SHIFT #define BUF_BUDDY_LOW_SHIFT PAGE_ZIP_MIN_SIZE_SHIFT
......
...@@ -397,7 +397,9 @@ UNIV_INTERN ...@@ -397,7 +397,9 @@ UNIV_INTERN
ibool ibool
fil_delete_tablespace( 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 #ifndef UNIV_HOTBACKUP
/*******************************************************************//** /*******************************************************************//**
Discards a single-table tablespace. The tablespace must be cached in the Discards a single-table tablespace. The tablespace must be cached in the
......
...@@ -1994,7 +1994,8 @@ err_exit: ...@@ -1994,7 +1994,8 @@ err_exit:
case DB_TOO_MANY_CONCURRENT_TRXS: case DB_TOO_MANY_CONCURRENT_TRXS:
/* We already have .ibd file here. it should be deleted. */ /* 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); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: not able to" " InnoDB: Error: not able to"
...@@ -3433,7 +3434,7 @@ check_next_foreign: ...@@ -3433,7 +3434,7 @@ check_next_foreign:
"InnoDB: of table "); "InnoDB: of table ");
ut_print_name(stderr, trx, TRUE, name); ut_print_name(stderr, trx, TRUE, name);
fprintf(stderr, ".\n"); fprintf(stderr, ".\n");
} else if (!fil_delete_tablespace(space_id)) { } else if (!fil_delete_tablespace(space_id, FALSE)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: We removed now the InnoDB" "InnoDB: We removed now the InnoDB"
" internal data dictionary entry\n" " 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