1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fixed bug when joining with caching.

Fixed race condition when using the binary log and INSERT DELAYED which could cause the binary log to have rows that was not yet written to MyISAM tables.


Docs/manual.texi:
  Changelog
mysql-test/r/null_key.result:
  Fix of testcase after changing optimizer to only use range keys if it would use a long part of the SAME key.
sql/sql_insert.cc:
  Fixed race condition with binary log and INSERT DELAYED
sql/sql_select.cc:
  Fixed bug when joining with caching
This commit is contained in:
unknown
2001-11-27 02:50:20 +02:00
parent 0c9d051c16
commit 312e5e82c0
4 changed files with 65 additions and 44 deletions

View File

@ -1099,7 +1099,7 @@ bool delayed_insert::handle_inserts(void)
{
int error;
uint max_rows;
bool using_ignore=0;
bool using_ignore=0, using_bin_log=mysql_bin_log.is_open();
delayed_row *row;
DBUG_ENTER("handle_inserts");
@ -1124,7 +1124,13 @@ bool delayed_insert::handle_inserts(void)
max_rows= ~0; // Do as much as possible
}
table->file->extra(HA_EXTRA_WRITE_CACHE);
/*
We can't use row caching when using the binary log because if
we get a crash, then binary log will contain rows that are not yet
written to disk, which will cause problems in replication.
*/
if (!using_bin_log)
table->file->extra(HA_EXTRA_WRITE_CACHE);
pthread_mutex_lock(&mutex);
while ((row=rows.get()))
{
@ -1161,7 +1167,7 @@ bool delayed_insert::handle_inserts(void)
if (row->query && row->log_query)
{
mysql_update_log.write(&thd,row->query, row->query_length);
if (mysql_bin_log.is_open())
if (using_bin_log)
{
thd.query_length = row->query_length;
Query_log_event qinfo(&thd, row->query);
@ -1197,7 +1203,8 @@ bool delayed_insert::handle_inserts(void)
/* This should never happen */
sql_print_error(ER(ER_DELAYED_CANT_CHANGE_LOCK),table->real_name);
}
table->file->extra(HA_EXTRA_WRITE_CACHE);
if (!using_bin_log)
table->file->extra(HA_EXTRA_WRITE_CACHE);
pthread_mutex_lock(&mutex);
thd.proc_info="insert";
}