diff options
author | unknown <guilhem@mysql.com> | 2003-03-12 01:05:04 +0100 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2003-03-12 01:05:04 +0100 |
commit | 5dd8180a8ef7de8310c9c1e4888f90eedb5df691 (patch) | |
tree | 8d17b1cb59b0343dfae427b3a144ec9cff7d37a4 /sql/sql_select.cc | |
parent | 3223245de3177fb42ce415b35f9edd050a5733b1 (diff) | |
download | mariadb-git-5dd8180a8ef7de8310c9c1e4888f90eedb5df691.tar.gz |
Fix for bug #136. We must write the
INSERT into u SELECT * from t
to the binlog
BEFORE unlocking t (which was read-locked at least in MyISAM),
and not the contrary.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d3934fbd620..ec6b7961267 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4469,9 +4469,16 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure) error=0; if (!table) // If sending data to client { - join_free(join); // Unlock all cursors + //note that the call below may trigger binlog writing for some commands... if (join->result->send_eof()) error= 1; // Don't send error + /* + ...which must be done before unlocking the read tables (otherwise + another thread may, quickly between unlock and binlog-write, + update the read table and write to the binlog, which will + result in badly ordered binlog events (and replication breaks). + */ + join_free(join); // Unlock all cursors } DBUG_PRINT("info",("%ld records output",join->send_records)); } |