diff options
author | heikki@hundin.mysql.fi <> | 2002-12-03 18:16:48 +0200 |
---|---|---|
committer | heikki@hundin.mysql.fi <> | 2002-12-03 18:16:48 +0200 |
commit | 5783e800e4bb8510059311ef33f47d344f3fa3cf (patch) | |
tree | be3662ab070894e6454aa4eb70c64398002d3d7d /innobase | |
parent | 8830eb4aa9fcfd4467407a8c1236d24c2af6bdfb (diff) | |
download | mariadb-git-5783e800e4bb8510059311ef33f47d344f3fa3cf.tar.gz |
row0sel.c:
Fix a hang introduced in 4.0.5 in INSERT INTO ... SELECT ... when binlogging is not on
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/row/row0sel.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index ce6ed091a48..a3744089258 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2702,14 +2702,22 @@ row_search_for_mysql( unique_search_from_clust_index = TRUE; - if (prebuilt->select_lock_type == LOCK_NONE + if (trx->mysql_n_tables_locked == 0 + && prebuilt->select_lock_type == LOCK_NONE && trx->isolation_level > TRX_ISO_READ_UNCOMMITTED && trx->read_view) { /* This is a SELECT query done as a consistent read, and the read view has already been allocated: let us try a search shortcut through the hash - index */ + index. + NOTE that we must also test that + mysql_n_tables_locked == 0, because this might + also be INSERT INTO ... SELECT ... or + CREATE TABLE ... SELECT ... . Our algorithm is + NOT prepared to inserts interleaved with the SELECT, + and if we try that, we can deadlock on the adaptive + hash index semaphore! */ if (btr_search_latch.writer != RW_LOCK_NOT_LOCKED) { /* There is an x-latch request: release |