mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
ha_innodb.cc, ha_innodb.h:
Fix assertion when a temporary table is created and used inside LOCK TABLES
This commit is contained in:
@ -3638,10 +3638,43 @@ ha_innobase::reset(void)
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
When we create a temporary table inside MySQL LOCK TABLES, MySQL will
|
||||
not call external_lock for the temporary table when it uses it. Instead,
|
||||
it will call this function. */
|
||||
|
||||
int
|
||||
start_stmt(
|
||||
/*=======*/
|
||||
/* out: 0 or error code */
|
||||
THD* thd) /* in: handle to the user thread */
|
||||
{
|
||||
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
|
||||
trx_t* trx;
|
||||
|
||||
DBUG_ENTER("ha_innobase::external_lock");
|
||||
|
||||
update_thd(thd);
|
||||
|
||||
trx = prebuilt->trx;
|
||||
|
||||
innobase_release_stat_resources(trx);
|
||||
trx_mark_sql_stat_end(trx);
|
||||
|
||||
auto_inc_counter_for_this_stat = 0;
|
||||
prebuilt->sql_stat_start = TRUE;
|
||||
prebuilt->hint_no_need_to_fetch_extra_cols = TRUE;
|
||||
prebuilt->read_just_key = 0;
|
||||
prebuilt->select_lock_type = LOCK_NONE;
|
||||
|
||||
thd->transaction.all.innodb_active_trans = 1;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
As MySQL will execute an external lock for every new table it uses when it
|
||||
starts to process an SQL statement, we can use this function to store the
|
||||
pointer to the THD in the handle. We will also use this function to communicate
|
||||
starts to process an SQL statement (an exception is when MySQL calls
|
||||
start_stmt for the handle) we can use this function to store the pointer to
|
||||
the THD in the handle. We will also use this function to communicate
|
||||
to InnoDB that a new SQL statement has started and that we must store a
|
||||
savepoint to our transaction handle, so that we are able to roll back
|
||||
the SQL statement in case of an error. */
|
||||
@ -3649,6 +3682,7 @@ the SQL statement in case of an error. */
|
||||
int
|
||||
ha_innobase::external_lock(
|
||||
/*=======================*/
|
||||
/* out: 0 or error code */
|
||||
THD* thd, /* in: handle to the user thread */
|
||||
int lock_type) /* in: lock type */
|
||||
{
|
||||
|
@ -146,6 +146,8 @@ class ha_innobase: public handler
|
||||
int extra(enum ha_extra_function operation);
|
||||
int reset(void);
|
||||
int external_lock(THD *thd, int lock_type);
|
||||
int start_stmt(THD *thd);
|
||||
|
||||
void position(byte *record);
|
||||
ha_rows records_in_range(int inx,
|
||||
const byte *start_key,uint start_key_len,
|
||||
|
Reference in New Issue
Block a user