Commit 1542ec0a authored by osku's avatar osku

Remove remnants of the obsolete concept of memoryfixing tables and indexes.

Remove unused dict_table_LRU_trim().

Remove unused 'trx' parameter from the functions dict_table_get_on_id_low,
dict_table_get and dict_table_get_and_increment_handle_count.
parent d4947369
...@@ -607,7 +607,7 @@ dict_index_get_nth_field_pos( ...@@ -607,7 +607,7 @@ dict_index_get_nth_field_pos(
} }
/************************************************************************** /**************************************************************************
Returns a table object, based on table id, and memoryfixes it. */ Returns a table object based on table id. */
dict_table_t* dict_table_t*
dict_table_get_on_id( dict_table_get_on_id(
...@@ -629,12 +629,12 @@ dict_table_get_on_id( ...@@ -629,12 +629,12 @@ dict_table_get_on_id(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
return(dict_table_get_on_id_low(table_id, trx)); return(dict_table_get_on_id_low(table_id));
} }
mutex_enter(&(dict_sys->mutex)); mutex_enter(&(dict_sys->mutex));
table = dict_table_get_on_id_low(table_id, trx); table = dict_table_get_on_id_low(table_id);
mutex_exit(&(dict_sys->mutex)); mutex_exit(&(dict_sys->mutex));
...@@ -742,22 +742,19 @@ dict_init(void) ...@@ -742,22 +742,19 @@ dict_init(void)
} }
/************************************************************************** /**************************************************************************
Returns a table object and memoryfixes it. NOTE! This is a high-level Returns a table object. NOTE! This is a high-level function to be used
function to be used mainly from outside the 'dict' directory. Inside this mainly from outside the 'dict' directory. Inside this directory
directory dict_table_get_low is usually the appropriate function. */ dict_table_get_low is usually the appropriate function. */
dict_table_t* dict_table_t*
dict_table_get( dict_table_get(
/*===========*/ /*===========*/
/* out: table, NULL if /* out: table, NULL if
does not exist */ does not exist */
const char* table_name, /* in: table name */ const char* table_name) /* in: table name */
trx_t* trx) /* in: transaction handle or NULL */
{ {
dict_table_t* table; dict_table_t* table;
UT_NOT_USED(trx);
mutex_enter(&(dict_sys->mutex)); mutex_enter(&(dict_sys->mutex));
table = dict_table_get_low(table_name); table = dict_table_get_low(table_name);
...@@ -781,13 +778,10 @@ dict_table_get_and_increment_handle_count( ...@@ -781,13 +778,10 @@ dict_table_get_and_increment_handle_count(
/*======================================*/ /*======================================*/
/* out: table, NULL if /* out: table, NULL if
does not exist */ does not exist */
const char* table_name, /* in: table name */ const char* table_name) /* in: table name */
trx_t* trx) /* in: transaction handle or NULL */
{ {
dict_table_t* table; dict_table_t* table;
UT_NOT_USED(trx);
mutex_enter(&(dict_sys->mutex)); mutex_enter(&(dict_sys->mutex));
table = dict_table_get_low(table_name); table = dict_table_get_low(table_name);
...@@ -897,10 +891,7 @@ dict_table_add_to_cache( ...@@ -897,10 +891,7 @@ dict_table_add_to_cache(
/* Add table to LRU list of tables */ /* Add table to LRU list of tables */
UT_LIST_ADD_FIRST(table_LRU, dict_sys->table_LRU, table); UT_LIST_ADD_FIRST(table_LRU, dict_sys->table_LRU, table);
/* If the dictionary cache grows too big, trim the table LRU list */
dict_sys->size += mem_heap_get_size(table->heap); dict_sys->size += mem_heap_get_size(table->heap);
/* dict_table_LRU_trim(); */
} }
/************************************************************************** /**************************************************************************
...@@ -1265,38 +1256,6 @@ dict_table_remove_from_cache( ...@@ -1265,38 +1256,6 @@ dict_table_remove_from_cache(
dict_mem_table_free(table); dict_mem_table_free(table);
} }
/**************************************************************************
Frees tables from the end of table_LRU if the dictionary cache occupies
too much space. Currently not used! */
void
dict_table_LRU_trim(void)
/*=====================*/
{
dict_table_t* table;
dict_table_t* prev_table;
ut_error;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
table = UT_LIST_GET_LAST(dict_sys->table_LRU);
while (table && (dict_sys->size >
buf_pool_get_max_size() / DICT_POOL_PER_VARYING)) {
prev_table = UT_LIST_GET_PREV(table_LRU, table);
if (table->mem_fix == 0) {
dict_table_remove_from_cache(table);
}
table = prev_table;
}
}
/************************************************************************** /**************************************************************************
Adds a column to the data dictionary hash table. */ Adds a column to the data dictionary hash table. */
static static
...@@ -1526,10 +1485,7 @@ dict_index_add_to_cache( ...@@ -1526,10 +1485,7 @@ dict_index_add_to_cache(
/* Add the index to the list of indexes stored in the tree */ /* Add the index to the list of indexes stored in the tree */
tree->tree_index = new_index; tree->tree_index = new_index;
/* If the dictionary cache grows too big, trim the table LRU list */
dict_sys->size += mem_heap_get_size(new_index->heap); dict_sys->size += mem_heap_get_size(new_index->heap);
/* dict_table_LRU_trim(); */
dict_mem_index_free(index); dict_mem_index_free(index);
......
...@@ -58,7 +58,6 @@ dict_mem_table_create( ...@@ -58,7 +58,6 @@ dict_mem_table_create(
table->tablespace_discarded = FALSE; table->tablespace_discarded = FALSE;
table->n_def = 0; table->n_def = 0;
table->n_cols = n_cols + DATA_N_SYS_COLS; table->n_cols = n_cols + DATA_N_SYS_COLS;
table->mem_fix = 0;
table->n_mysql_handles_opened = 0; table->n_mysql_handles_opened = 0;
table->n_foreign_key_checks_running = 0; table->n_foreign_key_checks_running = 0;
......
...@@ -2444,8 +2444,7 @@ ha_innobase::open( ...@@ -2444,8 +2444,7 @@ ha_innobase::open(
/* Get pointer to a table object in InnoDB dictionary cache */ /* Get pointer to a table object in InnoDB dictionary cache */
ib_table = dict_table_get_and_increment_handle_count( ib_table = dict_table_get_and_increment_handle_count(norm_name);
norm_name, NULL);
if (NULL == ib_table) { if (NULL == ib_table) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
...@@ -5026,7 +5025,7 @@ ha_innobase::create( ...@@ -5026,7 +5025,7 @@ ha_innobase::create(
log_buffer_flush_to_disk(); log_buffer_flush_to_disk();
innobase_table = dict_table_get(norm_name, NULL); innobase_table = dict_table_get(norm_name);
DBUG_ASSERT(innobase_table != 0); DBUG_ASSERT(innobase_table != 0);
......
...@@ -265,17 +265,16 @@ dict_foreign_parse_drop_constraints( ...@@ -265,17 +265,16 @@ dict_foreign_parse_drop_constraints(
const char*** constraints_to_drop); /* out: id's of the const char*** constraints_to_drop); /* out: id's of the
constraints to drop */ constraints to drop */
/************************************************************************** /**************************************************************************
Returns a table object and memoryfixes it. NOTE! This is a high-level Returns a table object. NOTE! This is a high-level function to be used
function to be used mainly from outside the 'dict' directory. Inside this mainly from outside the 'dict' directory. Inside this directory
directory dict_table_get_low is usually the appropriate function. */ dict_table_get_low is usually the appropriate function. */
dict_table_t* dict_table_t*
dict_table_get( dict_table_get(
/*===========*/ /*===========*/
/* out: table, NULL if /* out: table, NULL if
does not exist */ does not exist */
const char* table_name, /* in: table name */ const char* table_name); /* in: table name */
trx_t* trx); /* in: transaction handle */
/************************************************************************** /**************************************************************************
Returns a table object and increments MySQL open handle count on the table. Returns a table object and increments MySQL open handle count on the table.
*/ */
...@@ -285,10 +284,9 @@ dict_table_get_and_increment_handle_count( ...@@ -285,10 +284,9 @@ dict_table_get_and_increment_handle_count(
/*======================================*/ /*======================================*/
/* out: table, NULL if /* out: table, NULL if
does not exist */ does not exist */
const char* table_name, /* in: table name */ const char* table_name); /* in: table name */
trx_t* trx); /* in: transaction handle or NULL */
/************************************************************************** /**************************************************************************
Returns a table object, based on table id, and memoryfixes it. */ Returns a table object based on table id. */
dict_table_t* dict_table_t*
dict_table_get_on_id( dict_table_get_on_id(
...@@ -297,21 +295,13 @@ dict_table_get_on_id( ...@@ -297,21 +295,13 @@ dict_table_get_on_id(
dulint table_id, /* in: table id */ dulint table_id, /* in: table id */
trx_t* trx); /* in: transaction handle */ trx_t* trx); /* in: transaction handle */
/************************************************************************** /**************************************************************************
Returns a table object, based on table id, and memoryfixes it. */ Returns a table object based on table id. */
UNIV_INLINE UNIV_INLINE
dict_table_t* dict_table_t*
dict_table_get_on_id_low( dict_table_get_on_id_low(
/*=====================*/ /*=====================*/
/* out: table, NULL if does not exist */ /* out: table, NULL if does not exist */
dulint table_id, /* in: table id */ dulint table_id); /* in: table id */
trx_t* trx); /* in: transaction handle */
/**************************************************************************
Releases a table from being memoryfixed. Currently this has no relevance. */
UNIV_INLINE
void
dict_table_release(
/*===============*/
dict_table_t* table); /* in: table to be released */
/************************************************************************** /**************************************************************************
Checks if a table is in the dictionary cache. */ Checks if a table is in the dictionary cache. */
UNIV_INLINE UNIV_INLINE
......
...@@ -545,14 +545,13 @@ dict_table_get_low( ...@@ -545,14 +545,13 @@ dict_table_get_low(
} }
/************************************************************************** /**************************************************************************
Returns a table object, based on table id, and memoryfixes it. */ Returns a table object based on table id. */
UNIV_INLINE UNIV_INLINE
dict_table_t* dict_table_t*
dict_table_get_on_id_low( dict_table_get_on_id_low(
/*=====================*/ /*=====================*/
/* out: table, NULL if does not exist */ /* out: table, NULL if does not exist */
dulint table_id, /* in: table id */ dulint table_id) /* in: table id */
trx_t* trx) /* in: transaction handle */
{ {
dict_table_t* table; dict_table_t* table;
ulint fold; ulint fold;
...@@ -560,7 +559,6 @@ dict_table_get_on_id_low( ...@@ -560,7 +559,6 @@ dict_table_get_on_id_low(
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
UT_NOT_USED(trx);
/* Look for the table name in the hash table */ /* Look for the table name in the hash table */
fold = ut_fold_dulint(table_id); fold = ut_fold_dulint(table_id);
...@@ -571,32 +569,11 @@ dict_table_get_on_id_low( ...@@ -571,32 +569,11 @@ dict_table_get_on_id_low(
table = dict_load_table_on_id(table_id); table = dict_load_table_on_id(table_id);
} }
if (table != NULL) {
table->mem_fix++;
/* lock_push(trx, table, LOCK_DICT_MEM_FIX) */
}
/* TODO: should get the type information from MySQL */ /* TODO: should get the type information from MySQL */
return(table); return(table);
} }
/**************************************************************************
Releases a table from being memoryfixed. Currently this has no relevance. */
UNIV_INLINE
void
dict_table_release(
/*===============*/
dict_table_t* table) /* in: table to be released */
{
mutex_enter(&(dict_sys->mutex));
table->mem_fix--;
mutex_exit(&(dict_sys->mutex));
}
/************************************************************************** /**************************************************************************
Returns an index object. */ Returns an index object. */
UNIV_INLINE UNIV_INLINE
......
...@@ -169,10 +169,6 @@ struct dict_tree_struct{ ...@@ -169,10 +169,6 @@ struct dict_tree_struct{
the same memory cache line */ the same memory cache line */
rw_lock_t lock; /* read-write lock protecting the upper levels rw_lock_t lock; /* read-write lock protecting the upper levels
of the index tree */ of the index tree */
ulint mem_fix;/* count of how many times this tree
struct has been memoryfixed (by mini-
transactions wanting to access the index
tree) */
dict_index_t* tree_index; /* the index stored in the dict_index_t* tree_index; /* the index stored in the
index tree */ index tree */
ulint magic_n;/* magic number */ ulint magic_n;/* magic number */
...@@ -315,9 +311,6 @@ struct dict_table_struct{ ...@@ -315,9 +311,6 @@ struct dict_table_struct{
which refer to this table */ which refer to this table */
UT_LIST_NODE_T(dict_table_t) UT_LIST_NODE_T(dict_table_t)
table_LRU; /* node of the LRU list of tables */ table_LRU; /* node of the LRU list of tables */
ulint mem_fix;/* count of how many times the table
and its indexes has been fixed in memory;
currently NOT used */
ulint n_mysql_handles_opened; ulint n_mysql_handles_opened;
/* count of how many handles MySQL has opened /* count of how many handles MySQL has opened
to this table; dropping of the table is to this table; dropping of the table is
......
...@@ -56,9 +56,7 @@ struct purge_node_struct{ ...@@ -56,9 +56,7 @@ struct purge_node_struct{
determined by ref was found in the clustered determined by ref was found in the clustered
index, and we were able to position pcur on index, and we were able to position pcur on
it */ it */
dict_table_t* table; /* table where purge is done; NOTE that the dict_table_t* table; /* table where purge is done */
table has to be released explicitly with
dict_table_release */
ulint cmpl_info;/* compiler analysis info of an update */ ulint cmpl_info;/* compiler analysis info of an update */
upd_t* update; /* update vector for a clustered index record */ upd_t* update; /* update vector for a clustered index record */
dtuple_t* ref; /* NULL, or row reference to the next row to dtuple_t* ref; /* NULL, or row reference to the next row to
......
...@@ -84,9 +84,7 @@ struct undo_node_struct{ ...@@ -84,9 +84,7 @@ struct undo_node_struct{
record */ record */
btr_pcur_t pcur; /* persistent cursor used in searching the btr_pcur_t pcur; /* persistent cursor used in searching the
clustered index record */ clustered index record */
dict_table_t* table; /* table where undo is done; NOTE that the dict_table_t* table; /* table where undo is done */
table has to be released explicitly with
dict_table_release */
ulint cmpl_info;/* compiler analysis of an update */ ulint cmpl_info;/* compiler analysis of an update */
upd_t* update; /* update vector for a clustered index record */ upd_t* update; /* update vector for a clustered index record */
dtuple_t* ref; /* row reference to the next row to handle */ dtuple_t* ref; /* row reference to the next row to handle */
......
...@@ -1513,8 +1513,7 @@ row_ins_check_foreign_constraints( ...@@ -1513,8 +1513,7 @@ row_ins_check_foreign_constraints(
if (foreign->foreign_index == index) { if (foreign->foreign_index == index) {
if (foreign->referenced_table == NULL) { if (foreign->referenced_table == NULL) {
dict_table_get(foreign->referenced_table_name, dict_table_get(foreign->referenced_table_name);
trx);
} }
if (0 == trx->dict_operation_lock_mode) { if (0 == trx->dict_operation_lock_mode) {
......
...@@ -520,7 +520,7 @@ row_purge_parse_undo_rec( ...@@ -520,7 +520,7 @@ row_purge_parse_undo_rec(
mutex_enter(&(dict_sys->mutex)); mutex_enter(&(dict_sys->mutex));
node->table = dict_table_get_on_id_low(table_id, trx); node->table = dict_table_get_on_id_low(table_id);
mutex_exit(&(dict_sys->mutex)); mutex_exit(&(dict_sys->mutex));
......
...@@ -4402,7 +4402,7 @@ row_search_check_if_query_cache_permitted( ...@@ -4402,7 +4402,7 @@ row_search_check_if_query_cache_permitted(
dict_table_t* table; dict_table_t* table;
ibool ret = FALSE; ibool ret = FALSE;
table = dict_table_get(norm_name, trx); table = dict_table_get(norm_name);
if (table == NULL) { if (table == NULL) {
......
...@@ -202,8 +202,7 @@ row_upd_check_references_constraints( ...@@ -202,8 +202,7 @@ row_upd_check_references_constraints(
foreign->n_fields))) { foreign->n_fields))) {
if (foreign->foreign_table == NULL) { if (foreign->foreign_table == NULL) {
dict_table_get(foreign->foreign_table_name, dict_table_get(foreign->foreign_table_name);
trx);
} }
if (foreign->foreign_table) { if (foreign->foreign_table) {
......
...@@ -540,7 +540,7 @@ loop: ...@@ -540,7 +540,7 @@ loop:
(ulong) ut_dulint_get_high(trx->table_id), (ulong) ut_dulint_get_high(trx->table_id),
(ulong) ut_dulint_get_low(trx->table_id)); (ulong) ut_dulint_get_low(trx->table_id));
table = dict_table_get_on_id_low(trx->table_id, trx); table = dict_table_get_on_id_low(trx->table_id);
if (table) { if (table) {
fputs("InnoDB: Table found: dropping table ", stderr); fputs("InnoDB: Table found: dropping table ", stderr);
......
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