Commit 520e7f2d authored by unknown's avatar unknown
Browse files

revert "LOCK TABLES ... WHERE ENGINE=INNODB"

parent 6499169d
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -480,13 +480,6 @@ class handler :public Sql_alloc
  { 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;}
  /*
+0 −58
Original line number Diff line number Diff line
@@ -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);
}
+0 −1
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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
};

+2 −23
Original line number Diff line number Diff line
@@ -3252,27 +3252,6 @@ mysql_execute_command(THD *thd)
      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;
Loading