1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Move HA_EXTRA_NO_READCHECK to ha_open

Fixed bug in multi-table-delete


Docs/manual.texi:
  Changelog
include/mysql_com.h:
  Define MAX_CHAR_WIDTH
myisam/mi_extra.c:
  Cleanup
mysql-test/r/bdb.result:
  Bug test
mysql-test/r/group_by.result:
  Bug test
mysql-test/t/bdb.test:
  Bug test
mysql-test/t/group_by.test:
  Bug test
sql/ha_berkeley.cc:
  More debug statements
sql/handler.cc:
  Move HA_EXTRA_NO_READCHECK to ha_open
sql/records.cc:
  More DBUG statements
sql/sql_analyse.cc:
  Cleanup
sql/sql_base.cc:
  Move HA_EXTRA_NO_READCHECK to ha_open
sql/sql_delete.cc:
  Fixed bug in multi-table-delete
  Cleanup
sql/sql_select.cc:
  Move HA_EXTRA_NO_READCHECK to ha_open
sql/sql_update.cc:
  Move HA_EXTRA_NO_READCHECK to ha_open
This commit is contained in:
unknown
2002-01-16 23:02:26 +02:00
parent 40c146f6a2
commit 088582035e
15 changed files with 126 additions and 64 deletions

View File

@@ -98,7 +98,6 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
DBUG_RETURN(1);
}
}
(void) table->file->extra(HA_EXTRA_NO_READCHECK);
if (options & OPTION_QUICK)
(void) table->file->extra(HA_EXTRA_QUICK);
@@ -157,8 +156,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
}
thd->proc_info="end";
end_read_record(&info);
/* if (order) free_io_cache(table); */ /* QQ Should not be needed */
(void) table->file->extra(HA_EXTRA_READCHECK);
free_io_cache(table); // Will not do any harm
if (options & OPTION_QUICK)
(void) table->file->extra(HA_EXTRA_NORMAL);
@@ -219,15 +217,11 @@ multi_delete::multi_delete(THD *thd_arg, TABLE_LIST *dt,
not_trans_safe=false;
tempfiles = (Unique **) sql_calloc(sizeof(Unique *) * (num_of_tables-1));
(void) dt->table->file->extra(HA_EXTRA_NO_READCHECK);
/* Don't use key read with MULTI-TABLE-DELETE */
(void) dt->table->file->extra(HA_EXTRA_NO_KEYREAD);
dt->table->used_keys=0;
for (dt=dt->next ; dt ; dt=dt->next,counter++)
{
TABLE *table=dt->table;
(void) table->file->extra(HA_EXTRA_NO_READCHECK);
(void) table->file->extra(HA_EXTRA_NO_KEYREAD);
table->used_keys=0;
tempfiles[counter] = new Unique (refposcmp2,
(void *) &table->file->ref_length,
@@ -291,13 +285,12 @@ multi_delete::initialize_tables(JOIN *join)
multi_delete::~multi_delete()
{
/* Add back EXTRA_READCHECK; In 4.0.1 we shouldn't need this anymore */
for (table_being_deleted=delete_tables ;
table_being_deleted ;
table_being_deleted=table_being_deleted->next)
{
TABLE *t=table_being_deleted->table;
(void) t->file->extra(HA_EXTRA_READCHECK);
free_io_cache(t); // Alloced by unique
t->no_keyread=0;
}
@@ -353,19 +346,17 @@ void multi_delete::send_error(uint errcode,const char *err)
/* First send error what ever it is ... */
::send_error(&thd->net,errcode,err);
/* reset used flags */
// delete_tables->table->no_keyread=0;
/* If nothing deleted return */
if (!deleted)
return;
/* Below can happen when thread is killed early ... */
if (!table_being_deleted)
table_being_deleted=delete_tables;
/*
If rows from the first table only has been deleted and it is transactional,
just do rollback.
If rows from the first table only has been deleted and it is
transactional, just do rollback.
The same if all tables are transactional, regardless of where we are.
In all other cases do attempt deletes ...
*/
@@ -411,27 +402,6 @@ int multi_delete::do_deletes (bool from_send_error)
break;
}
#if USE_REGENERATE_TABLE
// nice little optimization ....
// but Monty has to fix generate_table...
// This will not work for transactional tables because for other types
// records is not absolute
if (num_of_positions == table->file->records)
{
TABLE_LIST table_list;
bzero((char*) &table_list,sizeof(table_list));
table_list.name=table->table_name;
table_list.real_name=table_being_deleted->real_name;
table_list.table=table;
table_list.grant=table->grant;
table_list.db = table_being_deleted->db;
error=generate_table(thd,&table_list,(TABLE *)0);
if (error <= 0) {error = 1; break;}
deleted += num_of_positions;
continue;
}
#endif /* USE_REGENERATE_TABLE */
READ_RECORD info;
init_read_record(&info,thd,table,NULL,0,0);
while (!(error=info.read_record(&info)) &&
@@ -452,15 +422,19 @@ int multi_delete::do_deletes (bool from_send_error)
}
/*
return: 0 sucess
1 error
*/
bool multi_delete::send_eof()
{
thd->proc_info="deleting from reference tables"; /* out: 1 if error, 0 if success */
thd->proc_info="deleting from reference tables";
/* Does deletes for the last n - 1 tables, returns 0 if ok */
int error = do_deletes(false); /* do_deletes returns 0 if success */
int error = do_deletes(false); // returns 0 if success
/* reset used flags */
// delete_tables->table->no_keyread=0; // Will stay in comment until Monty approves changes
thd->proc_info="end";
if (error)
{
@@ -468,11 +442,12 @@ bool multi_delete::send_eof()
return 1;
}
/* Write the SQL statement to the binlog if we deleted
rows and we succeeded, or also in an error case when there
was a non-transaction-safe table involved, since
modifications in it cannot be rolled back. */
/*
Write the SQL statement to the binlog if we deleted
rows and we succeeded, or also in an error case when there
was a non-transaction-safe table involved, since
modifications in it cannot be rolled back.
*/
if (deleted || not_trans_safe)
{
mysql_update_log.write(thd,thd->query,thd->query_length);