diff options
author | unknown <jimw@mysql.com> | 2005-12-08 12:33:33 -0800 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-12-08 12:33:33 -0800 |
commit | ab597139a7e96d8e3194739299b9dbde5a6cf961 (patch) | |
tree | 17c25f1452a24b4c5142a7cd6aa2a37e7558efcf /sql/sql_insert.cc | |
parent | 5aeb69296a4e134f0215da3e6bcce4956b7d76ad (diff) | |
download | mariadb-git-ab597139a7e96d8e3194739299b9dbde5a6cf961.tar.gz |
Fix calls to free_underlaid_joins() in INSERT, DELETE, and UPDATE
handling so that indexes are closed before trying to commit the
transaction. (Bug #15536)
mysql-test/r/bdb.result:
Add new results
mysql-test/t/bdb.test:
Add new test
sql/sql_delete.cc:
Move call to free_underlaid_joins() to before ha_autocommit_or_rollback().
sql/sql_insert.cc:
Move call to free_underlaid_joins() to before ha_autocommit_or_rollback().
sql/sql_update.cc:
Move call to free_underlaid_joins() to before ha_autocommit_or_rollback().
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 8c6fed26f8e..283fe571d53 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -194,7 +194,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, runs without --log-update or --log-bin). */ int log_on= DELAYED_LOG_UPDATE | DELAYED_LOG_BIN ; - bool transactional_table, log_delayed; + bool transactional_table, log_delayed, joins_freed= FALSE; uint value_count; ulong counter = 1; ulonglong id; @@ -386,6 +386,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, thd->row_count++; } + free_underlaid_joins(thd, &thd->lex->select_lex); + joins_freed= TRUE; + /* Now all rows are inserted. Time to update logs and sends response to user @@ -480,7 +483,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, (ulong) (info.deleted+info.updated), (ulong) thd->cuted_fields); ::send_ok(thd,info.copied+info.deleted+info.updated,(ulonglong)id,buff); } - free_underlaid_joins(thd, &thd->lex->select_lex); table->insert_values=0; DBUG_RETURN(0); @@ -489,7 +491,8 @@ abort: if (lock_type == TL_WRITE_DELAYED) end_delayed_insert(thd); #endif - free_underlaid_joins(thd, &thd->lex->select_lex); + if (!joins_freed) + free_underlaid_joins(thd, &thd->lex->select_lex); table->insert_values=0; DBUG_RETURN(-1); } |