From 19e3c001f43c0501972ad28a1bd896e8f78b1891 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Mon, 27 Dec 2004 12:08:22 +0100 Subject: [PATCH] revert "LOCK TABLES ... WHERE ENGINE=INNODB" --- sql/handler.h | 7 ------ sql/lock.cc | 58 ------------------------------------------------ sql/mysql_priv.h | 1 - sql/sql_lex.h | 4 ++-- sql/sql_parse.cc | 25 ++------------------- sql/sql_yacc.yy | 13 ++--------- 6 files changed, 6 insertions(+), 102 deletions(-) diff --git a/sql/handler.h b/sql/handler.h index 62638ee456b..b10e6bfe88c 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -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;} /* diff --git a/sql/lock.cc b/sql/lock.cc index 393cf4cf142..973e82b7b10 100644 --- a/sql/lock.cc +++ b/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); -} diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index fc06893c281..d69669d097a 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -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); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 19af2d9f243..c5b3abb93d2 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -63,7 +63,7 @@ enum enum_sql_command { SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB, SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT, SQLCOM_CREATE_FUNCTION, SQLCOM_DROP_FUNCTION, - SQLCOM_REVOKE,SQLCOM_OPTIMIZE, SQLCOM_CHECK, + SQLCOM_REVOKE,SQLCOM_OPTIMIZE, SQLCOM_CHECK, SQLCOM_ASSIGN_TO_KEYCACHE, SQLCOM_PRELOAD_KEYS, SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE, SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT, @@ -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 }; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1e232f064ba..4a357c6eefe 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -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; @@ -3284,12 +3263,12 @@ create_error: /* If in a slave thread : CREATE DATABASE DB was certainly not preceded by USE DB. - For that reason, db_ok() in sql/slave.cc did not check the + For that reason, db_ok() in sql/slave.cc did not check the do_db/ignore_db. And as this query involves no tables, tables_ok() above was not called. So we have to check rules again here. */ #ifdef HAVE_REPLICATION - if (thd->slave_thread && + if (thd->slave_thread && (!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || !db_ok_with_wild_table(lex->name))) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 75db6e332f9..5c03a4c98ef 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7418,8 +7418,8 @@ lock: { Lex->sql_command=SQLCOM_LOCK_TABLES; } - table_lock_list lock_engine_opt - {} + table_lock_list + {} ; table_or_tables: @@ -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; } ;