Commit 7fc2434c authored by osku's avatar osku

Unify dict_table_get_and_increment_handle_count() with dict_table_get() by

adding a second parameter, adjust callers.
parent ccd40036
......@@ -801,43 +801,20 @@ dict_init(void)
}
/**************************************************************************
Returns a table object. NOTE! This is a high-level function to be used
mainly from outside the 'dict' directory. Inside this directory
dict_table_get_low is usually the appropriate function. */
Returns a table object and optionally increment its MySQL open handle count.
NOTE! This is a high-level function to be used mainly from outside the
'dict' directory. Inside this directory dict_table_get_low is usually the
appropriate function. */
dict_table_t*
dict_table_get(
/*===========*/
/* out: table, NULL if
does not exist */
const char* table_name) /* in: table name */
{
dict_table_t* table;
mutex_enter(&(dict_sys->mutex));
table = dict_table_get_low(table_name);
mutex_exit(&(dict_sys->mutex));
if (table != NULL) {
if (!table->stat_initialized) {
dict_update_statistics(table);
}
}
return(table);
}
/**************************************************************************
Returns a table object and increments MySQL open handle count on the table. */
dict_table_t*
dict_table_get_and_increment_handle_count(
/*======================================*/
/* out: table, NULL if
does not exist */
const char* table_name) /* in: table name */
const char* table_name, /* in: table name */
ibool inc_mysql_count)
/* in: whether to increment the open
handle count on the table */
{
dict_table_t* table;
......@@ -845,15 +822,17 @@ dict_table_get_and_increment_handle_count(
table = dict_table_get_low(table_name);
if (table != NULL) {
if (inc_mysql_count && table) {
table->n_mysql_handles_opened++;
}
mutex_exit(&(dict_sys->mutex));
if (table != NULL) {
if (!table->stat_initialized && !table->ibd_file_missing) {
if (!table->stat_initialized) {
/* If table->ibd_file_missing == TRUE, this will
print an error message and return without doing
anything. */
dict_update_statistics(table);
}
}
......
......@@ -2345,7 +2345,7 @@ ha_innobase::open(
/* Get pointer to a table object in InnoDB dictionary cache */
ib_table = dict_table_get_and_increment_handle_count(norm_name);
ib_table = dict_table_get(norm_name, TRUE);
if (NULL == ib_table) {
ut_print_timestamp(stderr);
......@@ -4923,7 +4923,7 @@ ha_innobase::create(
log_buffer_flush_to_disk();
innobase_table = dict_table_get(norm_name);
innobase_table = dict_table_get(norm_name, FALSE);
DBUG_ASSERT(innobase_table != 0);
......
......@@ -326,26 +326,20 @@ dict_foreign_parse_drop_constraints(
const char*** constraints_to_drop); /* out: id's of the
constraints to drop */
/**************************************************************************
Returns a table object. NOTE! This is a high-level function to be used
mainly from outside the 'dict' directory. Inside this directory
dict_table_get_low is usually the appropriate function. */
Returns a table object and optionally increment its MySQL open handle count.
NOTE! This is a high-level function to be used mainly from outside the
'dict' directory. Inside this directory dict_table_get_low is usually the
appropriate function. */
dict_table_t*
dict_table_get(
/*===========*/
/* out: table, NULL if
does not exist */
const char* table_name); /* in: table name */
/**************************************************************************
Returns a table object and increments MySQL open handle count on the table.
*/
dict_table_t*
dict_table_get_and_increment_handle_count(
/*======================================*/
/* out: table, NULL if
does not exist */
const char* table_name); /* in: table name */
const char* table_name, /* in: table name */
ibool inc_mysql_count);
/* in: whether to increment the open
handle count on the table */
/**************************************************************************
Returns a table object based on table id. */
......
......@@ -1524,7 +1524,8 @@ row_ins_check_foreign_constraints(
if (foreign->foreign_index == index) {
if (foreign->referenced_table == NULL) {
dict_table_get(foreign->referenced_table_name);
dict_table_get(foreign->referenced_table_name,
FALSE);
}
if (0 == trx->dict_operation_lock_mode) {
......
......@@ -4453,7 +4453,7 @@ row_search_check_if_query_cache_permitted(
dict_table_t* table;
ibool ret = FALSE;
table = dict_table_get(norm_name);
table = dict_table_get(norm_name, FALSE);
if (table == NULL) {
......
......@@ -202,7 +202,8 @@ row_upd_check_references_constraints(
foreign->n_fields))) {
if (foreign->foreign_table == NULL) {
dict_table_get(foreign->foreign_table_name);
dict_table_get(foreign->foreign_table_name,
FALSE);
}
if (foreign->foreign_table) {
......
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