mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
branches/zip: Enclose the definition of dict_index_t::trx_id in
#ifdef ROW_MERGE_IS_INDEX_USABLE, to avoid growing the memory footprint until MySQL implements and calls the virtual method handler::is_index_available() or something equivalent.
This commit is contained in:
parent
c056d2c3f5
commit
a2943ec761
6 changed files with 25 additions and 6 deletions
|
@ -554,8 +554,10 @@ dict_build_index_def_step(
|
|||
|
||||
ins_node_set_new_row(node->ind_def, row);
|
||||
|
||||
#ifdef ROW_MERGE_IS_INDEX_USABLE
|
||||
/* Note that the index was created by this transaction. */
|
||||
index->trx_id = trx->id;
|
||||
#endif /* ROW_MERGE_IS_INDEX_USABLE */
|
||||
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
|
|
@ -3906,6 +3906,7 @@ ha_innobase::try_semi_consistent_read(bool yes)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ROW_MERGE_IS_INDEX_USABLE
|
||||
/**********************************************************************
|
||||
Check if an index can be used by the optimizer. */
|
||||
|
||||
|
@ -3915,11 +3916,11 @@ ha_innobase::is_index_available(
|
|||
/* out: true if available else false*/
|
||||
uint keynr) /* in: index number to check */
|
||||
{
|
||||
DBUG_ENTER("is_index_available");
|
||||
DBUG_ENTER("ha_innobase::is_index_available");
|
||||
|
||||
if (table && keynr != MAX_KEY && table->s->keys > 0) {
|
||||
dict_index_t* index;
|
||||
KEY* key = table->key_info + keynr;
|
||||
const dict_index_t* index;
|
||||
const KEY* key = table->key_info + keynr;
|
||||
|
||||
ut_ad(user_thd == ha_thd());
|
||||
ut_a(prebuilt->trx == thd_to_trx(user_thd));
|
||||
|
@ -3935,6 +3936,7 @@ ha_innobase::is_index_available(
|
|||
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
#endif /* ROW_MERGE_IS_INDEX_USABLE */
|
||||
|
||||
/**********************************************************************
|
||||
Initializes a handle to use an index. */
|
||||
|
|
|
@ -121,7 +121,14 @@ class ha_innobase: public handler
|
|||
void try_semi_consistent_read(bool yes);
|
||||
void unlock_row();
|
||||
|
||||
bool is_index_available(uint index);
|
||||
#ifdef ROW_MERGE_IS_INDEX_USABLE
|
||||
/** Check if an index can be used by this transaction.
|
||||
* @param keynr key number to check
|
||||
* @return true if available, false if the index
|
||||
* does not contain old records that exist
|
||||
* in the read view of this transaction */
|
||||
bool is_index_available(uint keynr);
|
||||
#endif /* ROW_MERGE_IS_INDEX_USABLE */
|
||||
int index_init(uint index, bool sorted);
|
||||
int index_end();
|
||||
int index_read(uchar * buf, const uchar * key,
|
||||
|
|
|
@ -239,9 +239,11 @@ struct dict_index_struct{
|
|||
index tree */
|
||||
rw_lock_t lock; /* read-write lock protecting the upper levels
|
||||
of the index tree */
|
||||
#ifdef ROW_MERGE_IS_INDEX_USABLE
|
||||
dulint trx_id; /* id of the transaction that created this
|
||||
index. It can be zero which implies that
|
||||
it was created on database startup.*/
|
||||
index, or ut_dulint_zero if the index existed
|
||||
when InnoDB was started up */
|
||||
#endif /* ROW_MERGE_IS_INDEX_USABLE */
|
||||
#ifdef UNIV_DEBUG
|
||||
ulint magic_n;/* magic number */
|
||||
# define DICT_INDEX_MAGIC_N 76789786
|
||||
|
|
|
@ -122,6 +122,7 @@ row_merge_create_index(
|
|||
dict_table_t* table, /* in: the index is on this table */
|
||||
const merge_index_def_t* /* in: the index definition */
|
||||
index_def);
|
||||
#ifdef ROW_MERGE_IS_INDEX_USABLE
|
||||
/*************************************************************************
|
||||
Check if a transaction can use an index. */
|
||||
|
||||
|
@ -132,6 +133,7 @@ row_merge_is_index_usable(
|
|||
the transaction else FALSE*/
|
||||
const trx_t* trx, /* in: transaction */
|
||||
const dict_index_t* index); /* in: index to check */
|
||||
#endif /* ROW_MERGE_IS_INDEX_USABLE */
|
||||
/*************************************************************************
|
||||
If there are views that refer to the old table name then we "attach" to
|
||||
the new instance of the table else we drop it immediately. */
|
||||
|
|
|
@ -1876,10 +1876,12 @@ row_merge_create_index(
|
|||
|
||||
ut_a(index);
|
||||
|
||||
#ifdef ROW_MERGE_IS_INDEX_USABLE
|
||||
/* Note the id of the transaction that created this
|
||||
index, we use it to restrict readers from accessing
|
||||
this index, to ensure read consistency. */
|
||||
index->trx_id = trx->id;
|
||||
#endif /* ROW_MERGE_IS_INDEX_USABLE */
|
||||
|
||||
/* Create element and append to list in trx. So that
|
||||
we can rename from temp name to real name. */
|
||||
|
@ -1899,6 +1901,7 @@ row_merge_create_index(
|
|||
return(index);
|
||||
}
|
||||
|
||||
#ifdef ROW_MERGE_IS_INDEX_USABLE
|
||||
/*************************************************************************
|
||||
Check if a transaction can use an index. */
|
||||
|
||||
|
@ -1914,6 +1917,7 @@ row_merge_is_index_usable(
|
|||
|
||||
return(ut_dulint_cmp(index->trx_id, trx->read_view->low_limit_id) < 0);
|
||||
}
|
||||
#endif /* ROW_MERGE_IS_INDEX_USABLE */
|
||||
|
||||
/*************************************************************************
|
||||
Drop the old table. */
|
||||
|
|
Loading…
Add table
Reference in a new issue