diff options
author | unknown <monty@hundin.mysql.fi> | 2001-11-27 02:50:20 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-11-27 02:50:20 +0200 |
commit | 312e5e82c0b17983bc3ac43b50fac891cccf0ea2 (patch) | |
tree | 390d698047d7a779d20d1f8db12dc8a715816aee /sql/sql_insert.cc | |
parent | 0c9d051c1624b6c097b6c254b9350f919ad01eb9 (diff) | |
download | mariadb-git-312e5e82c0b17983bc3ac43b50fac891cccf0ea2.tar.gz |
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
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index f7ff3ed159c..d8861390d87 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -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"; } |