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

Write binlog before commit when doing INSERT ... SELECT

mysql-test/r/create.result:
  After merge fix
sql/sql_insert.cc:
  Write binlog before commit
sql/sql_update.cc:
  Added comment
This commit is contained in:
unknown
2003-03-16 16:28:30 +02:00
parent 11117565a3
commit 9681f4a8cd
3 changed files with 27 additions and 7 deletions

View File

@@ -1361,6 +1361,14 @@ bool select_insert::send_eof()
if (!(error=table->file->extra(HA_EXTRA_NO_CACHE)))
error=table->file->activate_all_index(thd);
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
/* Write to binlog before commiting transaction */
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
table->file->has_transactions());
mysql_bin_log.write(&qinfo);
}
if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error)
error=error2;
if (info.copied || info.deleted)
@@ -1386,12 +1394,6 @@ bool select_insert::send_eof()
thd->insert_id(last_insert_id); // For update log
::send_ok(&thd->net,info.copied,last_insert_id,buff);
mysql_update_log.write(thd,thd->query,thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
table->file->has_transactions());
mysql_bin_log.write(&qinfo);
}
return 0;
}
}