Commit bf1ebe98 authored by unknown's avatar unknown
Browse files

Merge mysql.com:/home/jimw/my/mysql-5.0-14212

into  mysql.com:/home/jimw/my/mysql-5.0-clean


sql/ha_ndbcluster.cc:
  Auto merged
sql/handler.cc:
  Auto merged
mysql-test/r/bdb.result:
  Resolve conflict
mysql-test/t/bdb.test:
  Resolve conflict
parents f3915a41 4d096730
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1923,4 +1923,9 @@ d varchar(255) character set utf8,
e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=bdb;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
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
+9 −0
Original line number Diff line number Diff line
@@ -1010,4 +1010,13 @@ create table t1 (a varchar(255) character set utf8,
                 e varchar(255) character set utf8,
                 key (a,b,c,d,e)) engine=bdb;

#
# 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;

--echo End of 5.0 tests
+8 −6
Original line number Diff line number Diff line
@@ -3256,6 +3256,10 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
  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);
@@ -3270,6 +3274,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
          ERR_RETURN(ndb->getNdbError());
        no_uncommitted_rows_reset(thd);
        thd_ndb->stmt= trans;
        if (m_transaction_on)
          trans_register_ha(thd, FALSE, &ndbcluster_hton);
      } 
      else 
@@ -3285,6 +3290,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
            ERR_RETURN(ndb->getNdbError());
          no_uncommitted_rows_reset(thd);
          thd_ndb->all= trans; 
          if (m_transaction_on)
            trans_register_ha(thd, TRUE, &ndbcluster_hton);

          /*
@@ -3319,10 +3325,6 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
    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);
+2 −1
Original line number Diff line number Diff line
@@ -1926,6 +1926,7 @@ int ha_enable_transaction(THD *thd, bool on)
      is an optimization hint that storage engine is free to ignore.
      So, let's commit an open transaction (if any) now.
    */
    if (!(error= ha_commit_stmt(thd)))
      error= end_trans(thd, COMMIT);
  }
  DBUG_RETURN(error);