mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
revert "LOCK TABLES ... WHERE ENGINE=INNODB"
This commit is contained in:
@ -480,13 +480,6 @@ public:
|
||||
{ return extra(operation); }
|
||||
virtual int reset() { return extra(HA_EXTRA_RESET); }
|
||||
virtual int external_lock(THD *thd, int lock_type) { return 0; }
|
||||
/*
|
||||
This is called to set transactional table lock to a table.
|
||||
If the handler don't support this, then this function will
|
||||
return HA_ERR_WRONG_COMMAND and MySQL will give
|
||||
ER_ILLEGAL_HA error message.
|
||||
*/
|
||||
virtual int transactional_table_lock(THD *thd, int lock_type) {return HA_ERR_WRONG_COMMAND;}
|
||||
virtual void unlock_row() {}
|
||||
virtual int start_stmt(THD *thd) {return 0;}
|
||||
/*
|
||||
|
58
sql/lock.cc
58
sql/lock.cc
@ -939,61 +939,3 @@ bool make_global_read_lock_block_commit(THD *thd)
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
/*
|
||||
Take transactional table lock for all tables in the list
|
||||
|
||||
SYNOPSIS
|
||||
transactional_lock_tables
|
||||
thd Thread THD
|
||||
tables list of tables
|
||||
counter number of tables in the list
|
||||
|
||||
NOTES
|
||||
|
||||
RETURN
|
||||
0 - OK
|
||||
-1 - error
|
||||
|
||||
*/
|
||||
int transactional_lock_tables(THD *thd, TABLE_LIST *tables, uint counter)
|
||||
{
|
||||
uint i;
|
||||
int lock_type,error=0;
|
||||
TABLE_LIST *table;
|
||||
TABLE **start,**ptr;
|
||||
|
||||
DBUG_ENTER("transactional_lock_tables");
|
||||
|
||||
if (!(ptr=start=(TABLE**) sql_alloc(sizeof(TABLE*) * counter)))
|
||||
return -1;
|
||||
|
||||
for (table= tables; table; table= table->next_global)
|
||||
{
|
||||
if (!table->placeholder() && !table->schema_table)
|
||||
*(ptr++)= table->table;
|
||||
}
|
||||
|
||||
for (i=1 ; i <= counter ; i++, start++)
|
||||
{
|
||||
DBUG_ASSERT((*start)->reginfo.lock_type >= TL_READ);
|
||||
lock_type=F_WRLCK; /* Lock exclusive */
|
||||
|
||||
if ((*start)->db_stat & HA_READ_ONLY ||
|
||||
((*start)->reginfo.lock_type >= TL_READ &&
|
||||
(*start)->reginfo.lock_type <= TL_READ_NO_INSERT))
|
||||
lock_type=F_RDLCK;
|
||||
|
||||
if ((error=(*start)->file->transactional_table_lock(thd, lock_type)))
|
||||
{
|
||||
print_lock_error(error, (*start)->file->table_type());
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*start)->db_stat &= ~ HA_BLOCK_LOCK;
|
||||
(*start)->current_lock= lock_type;
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -830,7 +830,6 @@ int open_tables(THD *thd, TABLE_LIST *tables, uint *counter);
|
||||
int simple_open_n_lock_tables(THD *thd,TABLE_LIST *tables);
|
||||
bool open_and_lock_tables(THD *thd,TABLE_LIST *tables);
|
||||
int lock_tables(THD *thd, TABLE_LIST *tables, uint counter);
|
||||
int transactional_lock_tables(THD *thd, TABLE_LIST *tables, uint counter);
|
||||
TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
|
||||
const char *table_name, bool link_in_list);
|
||||
bool rm_temporary_table(enum db_type base, char *path);
|
||||
|
@ -87,8 +87,8 @@ enum enum_sql_command {
|
||||
SQLCOM_PREPARE, SQLCOM_EXECUTE, SQLCOM_DEALLOCATE_PREPARE,
|
||||
SQLCOM_CREATE_VIEW, SQLCOM_DROP_VIEW,
|
||||
SQLCOM_CREATE_TRIGGER, SQLCOM_DROP_TRIGGER,
|
||||
SQLCOM_LOCK_TABLES_TRANSACTIONAL,
|
||||
/* This should be the last !!! */
|
||||
|
||||
SQLCOM_END
|
||||
};
|
||||
|
||||
|
@ -3252,27 +3252,6 @@ create_error:
|
||||
thd->options&= ~(ulong) (OPTION_TABLE_LOCK);
|
||||
thd->in_lock_tables=0;
|
||||
break;
|
||||
case SQLCOM_LOCK_TABLES_TRANSACTIONAL:
|
||||
{
|
||||
uint counter = 0;
|
||||
|
||||
if (check_db_used(thd, all_tables))
|
||||
goto error;
|
||||
if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables, 0))
|
||||
goto error;
|
||||
|
||||
thd->in_lock_tables=1;
|
||||
thd->options|= OPTION_TABLE_LOCK;
|
||||
|
||||
if (open_tables(thd, all_tables, &counter) == 0 &&
|
||||
transactional_lock_tables(thd, all_tables, counter) == 0)
|
||||
send_ok(thd);
|
||||
else
|
||||
thd->options&= ~(ulong) (OPTION_TABLE_LOCK);
|
||||
|
||||
thd->in_lock_tables=0;
|
||||
break;
|
||||
}
|
||||
case SQLCOM_CREATE_DB:
|
||||
{
|
||||
char *alias;
|
||||
|
@ -7418,7 +7418,7 @@ lock:
|
||||
{
|
||||
Lex->sql_command=SQLCOM_LOCK_TABLES;
|
||||
}
|
||||
table_lock_list lock_engine_opt
|
||||
table_lock_list
|
||||
{}
|
||||
;
|
||||
|
||||
@ -7445,15 +7445,6 @@ lock_option:
|
||||
| READ_SYM LOCAL_SYM { $$= TL_READ; }
|
||||
;
|
||||
|
||||
lock_engine_opt:
|
||||
/* empty */
|
||||
| WHERE
|
||||
{
|
||||
Lex->sql_command=SQLCOM_LOCK_TABLES_TRANSACTIONAL;
|
||||
}
|
||||
ENGINE_SYM opt_equal storage_engines
|
||||
;
|
||||
|
||||
unlock:
|
||||
UNLOCK_SYM table_or_tables { Lex->sql_command=SQLCOM_UNLOCK_TABLES; }
|
||||
;
|
||||
|
Reference in New Issue
Block a user