From f4a9a591e3a68bc871122ec6e43fad3933109934 Mon Sep 17 00:00:00 2001 From: "lzhou/zhl@dev3-63.(none)" <> Date: Mon, 29 Jan 2007 15:17:40 +0000 Subject: [PATCH 1/4] Bug#23354 Add explaination when ndb_mgm do restart --- ndb/src/mgmclient/CommandInterpreter.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index 420dbd121a1..d6952f0b0eb 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -2029,6 +2029,9 @@ CommandInterpreter::executeRestart(Vector &command_list, return -1; } + if (!nostart) + ndbout_c("Shutting down nodes with \"-n, no start\" option, to subsequently start the nodes."); + result= ndb_mgm_restart3(m_mgmsrv, no_of_nodes, node_ids, initialstart, nostart, abort, &need_disconnect); From bd9dd63be59b13d43a5d1f6327dbd07b26ff6a08 Mon Sep 17 00:00:00 2001 From: "Justin.He/justin.he@dev3-240.dev.cn.tlan" <> Date: Wed, 21 Mar 2007 15:36:22 +0800 Subject: [PATCH 2/4] Bug#24568, NdbScanFilter NAND/NOR operations sometimes do not works as expected this patch is an absolutely necessary supplement of the previous patch, the previous patch doesnot cover isnull() and isnotnull() methods' effect. --- ndb/src/ndbapi/NdbScanFilter.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ndb/src/ndbapi/NdbScanFilter.cpp b/ndb/src/ndbapi/NdbScanFilter.cpp index 89abba2eddc..eb0ef4ba391 100644 --- a/ndb/src/ndbapi/NdbScanFilter.cpp +++ b/ndb/src/ndbapi/NdbScanFilter.cpp @@ -328,12 +328,18 @@ NdbScanFilterImpl::cond_col(Interpreter::UnaryCondition op, Uint32 AttrId){ int NdbScanFilter::isnull(int AttrId){ - return m_impl.cond_col(Interpreter::IS_NULL, AttrId); + if(m_impl.m_negative == 1) + return m_impl.cond_col(Interpreter::IS_NOT_NULL, AttrId); + else + return m_impl.cond_col(Interpreter::IS_NULL, AttrId); } int NdbScanFilter::isnotnull(int AttrId){ - return m_impl.cond_col(Interpreter::IS_NOT_NULL, AttrId); + if(m_impl.m_negative == 1) + return m_impl.cond_col(Interpreter::IS_NULL, AttrId); + else + return m_impl.cond_col(Interpreter::IS_NOT_NULL, AttrId); } struct tab3 { From 2b2ad6d605612f6553f15f7bf85f84678ddc2581 Mon Sep 17 00:00:00 2001 From: "lzhou/zhl@dev3-63.(none)" <> Date: Fri, 30 Mar 2007 15:01:03 +0000 Subject: [PATCH 3/4] BUG#24793 Add SO_KEEPALIVE socket option to avoid cluster nodes keeping dead connections forever. --- ndb/src/common/transporter/TCP_Transporter.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ndb/src/common/transporter/TCP_Transporter.cpp b/ndb/src/common/transporter/TCP_Transporter.cpp index 91a5fb50c57..897bad8b787 100644 --- a/ndb/src/common/transporter/TCP_Transporter.cpp +++ b/ndb/src/common/transporter/TCP_Transporter.cpp @@ -155,6 +155,8 @@ TCP_Transporter::initTransporter() { void TCP_Transporter::setSocketOptions(){ + int sockOptKeepAlive = 1; + if (setsockopt(theSocket, SOL_SOCKET, SO_RCVBUF, (char*)&sockOptRcvBufSize, sizeof(sockOptRcvBufSize)) < 0) { #ifdef DEBUG_TRANSPORTER @@ -169,6 +171,11 @@ TCP_Transporter::setSocketOptions(){ #endif }//if + if (setsockopt(theSocket, SOL_SOCKET, SO_KEEPALIVE, + (char*)&sockOptKeepAlive, sizeof(sockOptKeepAlive)) < 0) { + ndbout_c("The setsockopt SO_KEEPALIVE error code = %d", InetErrno); + }//if + //----------------------------------------------- // Set the TCP_NODELAY option so also small packets are sent // as soon as possible From 98e5757618b6ff48c0284f86a08cac3b22db17dc Mon Sep 17 00:00:00 2001 From: "gni/root@dev3-221.dev.cn.tlan" <> Date: Tue, 3 Apr 2007 18:44:29 +0800 Subject: [PATCH 4/4] BUG#18676 when cluster storage engine is down, misleading error message on create table with 4009. --- mysql-test/r/ndb_autodiscover.result | 2 +- sql/ha_ndbcluster.cc | 11 +++++------ sql/handler.cc | 8 ++++---- sql/sql_table.cc | 25 +++++++++++++++++++------ 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result index 6d1b7eb152d..01ea884a8ba 100644 --- a/mysql-test/r/ndb_autodiscover.result +++ b/mysql-test/r/ndb_autodiscover.result @@ -382,7 +382,7 @@ create table t1 (a int primary key) engine=ndb; select * from t1; a select * from t1; -ERROR HY000: Can't lock file (errno: 4009) +ERROR HY000: Can't lock file (errno: 157) use test; drop database test_only_ndb_tables; CREATE TABLE t9 ( diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 7a9c7d0d021..ead7343db88 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -203,6 +203,8 @@ static const err_code_mapping err_map[]= { 284, HA_ERR_TABLE_DEF_CHANGED, 0 }, + {4009, HA_ERR_NO_CONNECTION, 1 }, + { 0, 1, 0 }, { -1, -1, 1 } @@ -5042,14 +5044,11 @@ int ndbcluster_table_exists_in_engine(THD* thd, const char *db, const char *name dict->invalidateTable(name); if (!(tab= dict->getTable(name))) { - const NdbError err= dict->getNdbError(); - if (err.code == 709) - DBUG_RETURN(0); - ERR_RETURN(err); + ERR_RETURN(dict->getNdbError()); } DBUG_PRINT("info", ("Found table %s", tab->getName())); - DBUG_RETURN(1); + DBUG_RETURN(HA_ERR_TABLE_EXIST); } @@ -5234,7 +5233,7 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path, DBUG_PRINT("info", ("%s existed on disk", name)); // The .ndb file exists on disk, but it's not in list of tables in ndb // Verify that handler agrees table is gone. - if (ndbcluster_table_exists_in_engine(thd, db, file_name) == 0) + if (ndbcluster_table_exists_in_engine(thd, db, file_name) == HA_ERR_NO_SUCH_TABLE) { DBUG_PRINT("info", ("NDB says %s does not exists", file_name)); it.remove(); diff --git a/sql/handler.cc b/sql/handler.cc index 5a27e470d70..62f765f0d22 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2442,14 +2442,14 @@ ha_find_files(THD *thd,const char *db,const char *path, Ask handler if the table exists in engine RETURN - 0 Table does not exist - 1 Table exists - # Error code + HA_ERR_NO_SUCH_TABLE Table does not exist + HA_ERR_TABLE_EXIST Table exists + # Error code */ int ha_table_exists_in_engine(THD* thd, const char* db, const char* name) { - int error= 0; + int error= HA_ERR_NO_SUCH_TABLE; DBUG_ENTER("ha_table_exists_in_engine"); DBUG_PRINT("enter", ("db: %s, name: %s", db, name)); #ifdef HAVE_NDBCLUSTER_DB diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 512d990347f..1ad1cb6426b 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1696,6 +1696,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, alias); DBUG_RETURN(FALSE); } + DBUG_PRINT("info",("1")); my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias); DBUG_RETURN(TRUE); } @@ -1706,6 +1707,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, { if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS) goto warn; + DBUG_PRINT("info",("2")); my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); goto end; } @@ -1724,14 +1726,25 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, { bool create_if_not_exists = create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS; - if (ha_table_exists_in_engine(thd, db, table_name)) + int retcode = ha_table_exists_in_engine(thd, db, table_name); + DBUG_PRINT("info", ("exists_in_engine: %u",retcode)); + switch (retcode) { - DBUG_PRINT("info", ("Table with same name already existed in handler")); + case HA_ERR_NO_SUCH_TABLE: + /* Normal case, no table exists. we can go and create it */ + break; + case HA_ERR_TABLE_EXIST: + DBUG_PRINT("info", ("Table existed in handler")); - if (create_if_not_exists) - goto warn; - my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); - goto end; + if (create_if_not_exists) + goto warn; + my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); + goto end; + break; + default: + DBUG_PRINT("info", ("error: %u from storage engine", retcode)); + my_error(retcode, MYF(0),table_name); + goto end; } }