Below is the list of changes that have just been committed into a local
5.1 repository of kostja. When kostja does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-11-16 19:32:51+03:00, kostja@bodhi.(none) +5 -0
Bug#12713. Changes to make the test suite pass after an explicit
statement commit was added after every and each statement.
sql/handler.cc@stripped, 2007-11-16 19:32:48+03:00, kostja@bodhi.(none) +16 -3
Auxiliary asserts.
sql/rpl_injector.cc@stripped, 2007-11-16 19:32:48+03:00, kostja@bodhi.(none) +1 -0
Enforce the assert: do not commit the transaction if there is an uncommitted
statement.
sql/sql_base.cc@stripped, 2007-11-16 19:32:48+03:00, kostja@bodhi.(none) +5 -5
Move statement transaction commit before mysql_unlock_tables.
Transational engines currently do lock counting in external_lock and
commit statement transaction implicitly when lock count is 0.
NDB has an assert that an explicit commit never happens after the implicit
one described above. Fulfill the assert.
sql/sql_insert.cc@stripped, 2007-11-16 19:32:48+03:00, kostja@bodhi.(none) +3 -0
Before committing a transaction, commit the statement (CREATE TABLE ..
SELECT).
sql/sql_parse.cc@stripped, 2007-11-16 19:32:48+03:00, kostja@bodhi.(none) +1 -0
Before rolling back a transaction, roll back the statement (LOCK TABLES).
diff -Nrup a/sql/handler.cc b/sql/handler.cc
--- a/sql/handler.cc 2007-11-14 17:46:37 +03:00
+++ b/sql/handler.cc 2007-11-16 19:32:48 +03:00
@@ -681,6 +681,11 @@ int ha_commit_trans(THD *thd, bool all)
my_xid xid= thd->transaction.xid_state.xid.get_my_xid();
DBUG_ENTER("ha_commit_trans");
+ if (trans == &thd->transaction.all)
+ {
+ DBUG_ASSERT(thd->transaction.stmt.ha_list == NULL);
+ }
+
if (thd->in_sub_stmt)
{
/*
@@ -830,6 +835,12 @@ int ha_rollback_trans(THD *thd, bool all
Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
bool is_real_trans=all || thd->transaction.all.ha_list == 0;
DBUG_ENTER("ha_rollback_trans");
+
+ if (trans == &thd->transaction.all)
+ {
+ DBUG_ASSERT(thd->transaction.stmt.ha_list == NULL);
+ }
+
if (thd->in_sub_stmt)
{
/*
@@ -913,10 +924,12 @@ int ha_autocommit_or_rollback(THD *thd,
if (ha_commit_stmt(thd))
error=1;
}
- else if (thd->transaction_rollback_request && !thd->in_sub_stmt)
- (void) ha_rollback(thd);
- else
+ else
+ {
(void) ha_rollback_stmt(thd);
+ if (thd->transaction_rollback_request && !thd->in_sub_stmt)
+ (void) ha_rollback(thd);
+ }
thd->variables.tx_isolation=thd->session_tx_isolation;
}
diff -Nrup a/sql/rpl_injector.cc b/sql/rpl_injector.cc
--- a/sql/rpl_injector.cc 2007-04-12 18:13:46 +04:00
+++ b/sql/rpl_injector.cc 2007-11-16 19:32:48 +03:00
@@ -62,6 +62,7 @@ int injector::transaction::commit()
{
DBUG_ENTER("injector::transaction::commit()");
m_thd->binlog_flush_pending_rows_event(true);
+ ha_autocommit_or_rollback(m_thd, 0);
end_trans(m_thd, COMMIT);
DBUG_RETURN(0);
}
diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc
--- a/sql/sql_base.cc 2007-11-14 17:46:37 +03:00
+++ b/sql/sql_base.cc 2007-11-16 19:32:48 +03:00
@@ -1255,6 +1255,11 @@ void close_thread_tables(THD *thd)
/* Fallthrough */
}
+ /* If commit fails, we should be able to reset the OK status. */
+ thd->main_da.can_overwrite_status= TRUE;
+ ha_autocommit_or_rollback(thd, thd->is_error());
+ thd->main_da.can_overwrite_status= FALSE;
+
if (thd->lock)
{
/*
@@ -1270,11 +1275,6 @@ void close_thread_tables(THD *thd)
mysql_unlock_tables(thd, thd->lock);
thd->lock=0;
}
-
- /* If commit fails, we should be able to reset the OK status. */
- thd->main_da.can_overwrite_status= TRUE;
- ha_autocommit_or_rollback(thd, thd->is_error());
- thd->main_da.can_overwrite_status= FALSE;
thd->transaction.stmt.reset();
diff -Nrup a/sql/sql_insert.cc b/sql/sql_insert.cc
--- a/sql/sql_insert.cc 2007-11-14 17:46:37 +03:00
+++ b/sql/sql_insert.cc 2007-11-16 19:32:48 +03:00
@@ -3669,7 +3669,10 @@ bool select_create::send_eof()
nevertheless.
*/
if (!table->s->tmp_table)
+ {
+ ha_autocommit_or_rollback(thd, 0);
ha_commit(thd); // Can fail, but we proceed anyway
+ }
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc
--- a/sql/sql_parse.cc 2007-11-14 17:46:37 +03:00
+++ b/sql/sql_parse.cc 2007-11-16 19:32:48 +03:00
@@ -3107,6 +3107,7 @@ end_with_restore_list:
can free its locks if LOCK TABLES locked some tables before finding
that it can't lock a table in its list
*/
+ ha_autocommit_or_rollback(thd, 1);
end_active_trans(thd);
thd->options&= ~(ulong) (OPTION_TABLE_LOCK);
}
| Thread |
|---|
| • bk commit into 5.1 tree (kostja:1.2608) BUG#12713 | konstantin | 16 Nov |