From: Date: December 10 2005 12:00am Subject: bk commit into 5.0 tree (jimw:1.1946) BUG#14212 List-Archive: http://lists.mysql.com/internals/33197 X-Bug: 14212 Message-Id: <20051209230040.6B133A8903@rama.trainedmonkey.com> Below is the list of changes that have just been committed into a local 5.0 repository of jimw. When jimw 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 1.1946 05/12/09 15:00:33 jimw@stripped +4 -0 Fix crash in BDB from improper cleanup of transactions, and avoid problem in NDB that the fix would cause due to improper registration of a transaction that isn't meant to be seen by the handler layer. (Bug #14212) Thanks to Sergei Golubchik for helping with this. sql/handler.cc 1.201 05/12/09 15:00:30 jimw@stripped +2 -1 Commit statement before trying to end transaction. sql/ha_ndbcluster.cc 1.217 05/12/09 15:00:30 jimw@stripped +8 -6 Don't register transaction if transactions are "disabled". mysql-test/t/bdb.test 1.48 05/12/09 15:00:30 jimw@stripped +11 -0 Add new regression test mysql-test/r/bdb.result 1.45 05/12/09 15:00:30 jimw@stripped +5 -0 Add new result # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jimw # Host: rama.(none) # Root: /home/jimw/my/mysql-5.0-14212 --- 1.200/sql/handler.cc 2005-10-13 09:40:43 -07:00 +++ 1.201/sql/handler.cc 2005-12-09 15:00:30 -08:00 @@ -1910,7 +1910,8 @@ is an optimization hint that storage engine is free to ignore. So, let's commit an open transaction (if any) now. */ - error= end_trans(thd, COMMIT); + if (!(error= ha_commit_stmt(thd))) + error= end_trans(thd, COMMIT); } DBUG_RETURN(error); } --- 1.216/sql/ha_ndbcluster.cc 2005-10-14 02:27:56 -07:00 +++ 1.217/sql/ha_ndbcluster.cc 2005-12-09 15:00:30 -08:00 @@ -3221,6 +3221,10 @@ if (lock_type != F_UNLCK) { DBUG_PRINT("info", ("lock_type != F_UNLCK")); + if (!thd->transaction.on) + m_transaction_on= FALSE; + else + m_transaction_on= thd->variables.ndb_use_transactions; if (!thd_ndb->lock_count++) { PRINT_OPTION_FLAGS(thd); @@ -3235,7 +3239,8 @@ ERR_RETURN(ndb->getNdbError()); no_uncommitted_rows_reset(thd); thd_ndb->stmt= trans; - trans_register_ha(thd, FALSE, &ndbcluster_hton); + if (m_transaction_on) + trans_register_ha(thd, FALSE, &ndbcluster_hton); } else { @@ -3250,7 +3255,8 @@ ERR_RETURN(ndb->getNdbError()); no_uncommitted_rows_reset(thd); thd_ndb->all= trans; - trans_register_ha(thd, TRUE, &ndbcluster_hton); + if (m_transaction_on) + trans_register_ha(thd, TRUE, &ndbcluster_hton); /* If this is the start of a LOCK TABLE, a table look @@ -3284,10 +3290,6 @@ m_ha_not_exact_count= !thd->variables.ndb_use_exact_count; m_autoincrement_prefetch= (ha_rows) thd->variables.ndb_autoincrement_prefetch_sz; - if (!thd->transaction.on) - m_transaction_on= FALSE; - else - m_transaction_on= thd->variables.ndb_use_transactions; m_active_trans= thd_ndb->all ? thd_ndb->all : thd_ndb->stmt; DBUG_ASSERT(m_active_trans); --- 1.44/mysql-test/r/bdb.result 2005-09-29 20:05:59 -07:00 +++ 1.45/mysql-test/r/bdb.result 2005-12-09 15:00:30 -08:00 @@ -1895,3 +1895,8 @@ ) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 drop table t1; set storage_engine=MyISAM; +set autocommit=0; +create table t1 (a int) engine=bdb; +commit; +alter table t1 add primary key(a); +drop table t1; --- 1.47/mysql-test/t/bdb.test 2005-08-23 08:08:01 -07:00 +++ 1.48/mysql-test/t/bdb.test 2005-12-09 15:00:30 -08:00 @@ -973,3 +973,14 @@ # End varchar test eval set storage_engine=$default; + +# +# Bug #14212: Server crash after COMMIT + ALTER TABLE +# +set autocommit=0; +create table t1 (a int) engine=bdb; +commit; +alter table t1 add primary key(a); +drop table t1; + +# End of 5.0 tests