From 534848558df08f3e0cfa9d126567d81ba332a764 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Mon, 4 Oct 2004 11:50:31 +0500 Subject: [PATCH 1/3] sql_show.cc: ctype_recode does not hang anymore. Small fix after Marko's change. --- sql/sql_show.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 714fb0a2efe..1a7185c3679 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1136,7 +1136,7 @@ static const char *require_quotes(const char *name, uint name_length) for ( ; name < end ; name++) { uchar chr= (uchar) *name; - length= my_mbcharlen(system_charset_info, chr); + length= my_mbcharlen(system_charset_info, (uchar) chr); if (length == 1 && !system_charset_info->ident_map[chr]) return name; } @@ -1165,7 +1165,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length) for (name_end= name+length ; name < name_end ; name+= length) { char chr= *name; - length= my_mbcharlen(system_charset_info, chr); + length= my_mbcharlen(system_charset_info, (uchar) chr); if (length == 1 && chr == quote_char) packet->append("e_char, 1, system_charset_info); packet->append(name, length, packet->charset()); From 0cadd78db725a65bb6360f579ef6401261833f33 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Mon, 4 Oct 2004 14:14:30 +0400 Subject: [PATCH 2/3] A couple of typos fixed. --- sql/item.cc | 2 +- sql/sql_class.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index 7b0dcc664c7..b7523478be3 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1999,7 +1999,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) } else if (tmp != not_found_field) { - ref= 0; // To prevent "delete *ref;" on ~Item_erf() of this item + ref= 0; // To prevent "delete *ref;" on ~Item_ref() of this item Item_field* fld; if (!((*reference)= fld= new Item_field(tmp))) return 1; diff --git a/sql/sql_class.h b/sql/sql_class.h index 68d187168d3..fbbb7fc7383 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1264,8 +1264,6 @@ public: bool send_fields(List &list, uint flag) { return 0; }; bool send_data(List &items)=0; bool send_eof() { return 0; }; - - friend class Ttem_subselect; }; /* Single value subselect interface class */ From e13b136c9a4439f0171af898e111a46bbb86b312 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Mon, 4 Oct 2004 12:26:26 +0000 Subject: [PATCH 3/3] bug #5872, transactions should only be restarted with transaction.on flag off if execute_commit has been performed added testcase for this use force send for all executes --- mysql-test/r/ndb_blob.result | 5 ++++ mysql-test/t/ndb_blob.test | 5 ++++ sql/ha_ndbcluster.cc | 54 ++++++++++++++++++++++++------------ 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result index bb606b46902..cf64ec41ae3 100644 --- a/mysql-test/r/ndb_blob.result +++ b/mysql-test/r/ndb_blob.result @@ -397,4 +397,9 @@ select * from t1 order by a; a b 1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +alter table t1 engine=myisam; +select * from t1 order by a; +a b +1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB drop table t1; diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test index afa1a2c1455..5454dd91d26 100644 --- a/mysql-test/t/ndb_blob.test +++ b/mysql-test/t/ndb_blob.test @@ -309,6 +309,7 @@ select count(*) from t1; drop table t1; drop database mysqltest; +# bug #5349 set autocommit=1; use test; CREATE TABLE t1 ( @@ -325,4 +326,8 @@ INSERT INTO t1 VALUES select * from t1 order by a; alter table t1 engine=ndb; select * from t1 order by a; + +# bug #5872 +alter table t1 engine=myisam; +select * from t1 order by a; drop table t1; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index e48ac8cc75e..045db961c70 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -147,7 +147,25 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans) int m_batch_execute= 0; if (false && m_batch_execute) return 0; - return trans->execute(NoCommit); + return trans->execute(NoCommit,AbortOnError,1); +} + +inline +int execute_commit(ha_ndbcluster *h, NdbConnection *trans) +{ + int m_batch_execute= 0; + if (false && m_batch_execute) + return 0; + return trans->execute(Commit,AbortOnError,1); +} + +inline +int execute_no_commit_ie(ha_ndbcluster *h, NdbConnection *trans) +{ + int m_batch_execute= 0; + if (false && m_batch_execute) + return 0; + return trans->execute(NoCommit,IgnoreError,1); } /* @@ -1006,7 +1024,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf) } } - if (trans->execute(NoCommit, IgnoreError) != 0) + if (execute_no_commit_ie(this,trans) != 0) { table->status= STATUS_NOT_FOUND; DBUG_RETURN(ndb_err(trans)); @@ -1127,7 +1145,7 @@ int ha_ndbcluster::unique_index_read(const byte *key, } } - if (trans->execute(NoCommit, IgnoreError) != 0) + if (execute_no_commit_ie(this,trans) != 0) { table->status= STATUS_NOT_FOUND; DBUG_RETURN(ndb_err(trans)); @@ -1197,18 +1215,20 @@ inline int ha_ndbcluster::next_result(byte *buf) be sent to NDB */ DBUG_PRINT("info", ("ops_pending: %d", ops_pending)); - if (current_thd->transaction.on) { - if (ops_pending && (execute_no_commit(this,trans) != 0)) - DBUG_RETURN(ndb_err(trans)); + if (current_thd->transaction.on) + { + if (execute_no_commit(this,trans) != 0) + DBUG_RETURN(ndb_err(trans)); + } + else + { + if (execute_commit(this,trans) != 0) + DBUG_RETURN(ndb_err(trans)); + DBUG_ASSERT(trans->restart() == 0); + } + ops_pending= 0; } - else - { - if (ops_pending && (trans->execute(Commit) != 0)) - DBUG_RETURN(ndb_err(trans)); - trans->restart(); - } - ops_pending= 0; contact_ndb= (check == 2); } @@ -1639,13 +1659,13 @@ int ha_ndbcluster::write_row(byte *record) } else { - if (trans->execute(Commit) != 0) + if (execute_commit(this,trans) != 0) { skip_auto_increment= true; no_uncommitted_rows_execute_failure(); DBUG_RETURN(ndb_err(trans)); } - trans->restart(); + DBUG_ASSERT(trans->restart() == 0); } } if ((has_auto_increment) && (skip_auto_increment)) @@ -2282,7 +2302,7 @@ int ha_ndbcluster::rnd_init(bool scan) { if (!scan) DBUG_RETURN(1); - cursor->restart(); + DBUG_ASSERT(cursor->restart() == 0); } index_init(table->primary_key); DBUG_RETURN(0); @@ -2929,7 +2949,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction) "stmt" : "all")); DBUG_ASSERT(ndb && trans); - if (trans->execute(Commit) != 0) + if (execute_commit(0,trans) != 0) { const NdbError err= trans->getNdbError(); const NdbOperation *error_op= trans->getNdbErrorOperation();