From: Date: August 11 2006 12:44pm Subject: bk commit into 5.0 tree (dli:1.2244) BUG#19047 List-Archive: http://lists.mysql.com/commits/10305 X-Bug: 19047 Message-Id: <200608111044.k7BAinB2032420@dev3-76.dev.cn.tlan> Below is the list of changes that have just been committed into a local 5.0 repository of root. When root 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, 2006-08-11 18:44:45+08:00, dli@stripped +4 -0 Bug#19047, not start event thread in ndb_mgm client execute (-e) mode. BitKeeper/etc/ignore@stripped, 2006-08-11 18:44:42+08:00, dli@stripped +1 -0 Added ndb/src/mgmclient/1 to the ignore list ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2006-08-11 18:44:42+08:00, dli@stripped +72 -68 Not start event thread in ndb_mgm client execute (-e) mode. ndb/src/mgmclient/main.cpp@stripped, 2006-08-11 18:44:42+08:00, dli@stripped +2 -2 Not start event thread in ndb_mgm client execute (-e) mode. ndb/src/mgmclient/ndb_mgmclient.hpp@stripped, 2006-08-11 18:44:42+08:00, dli@stripped +2 -2 Not start event thread in ndb_mgm client execute (-e) thread. # 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: dli # Host: dev3-76.dev.cn.tlan # Root: /home/lisj/mysql/mysql-5.0/bug-19047 --- 1.61/ndb/src/mgmclient/CommandInterpreter.cpp 2006-08-11 18:44:50 +08:00 +++ 1.62/ndb/src/mgmclient/CommandInterpreter.cpp 2006-08-11 18:44:50 +08:00 @@ -55,11 +55,11 @@ * * @return true until quit/bye/exit has been typed */ - int execute(const char *_line, int _try_reconnect=-1, int *error= 0); + int execute(const char *_line, int _try_reconnect=-1, bool interactive=1, int *error= 0); private: void printError(); - int execute_impl(const char *_line); + int execute_impl(const char *_line, bool interactive=1); /** * Analyse the command line, after the first token. @@ -99,7 +99,7 @@ */ void executeHelp(char* parameters); void executeShow(char* parameters); - void executeConnect(char* parameters); + void executeConnect(char* parameters, bool interactive); void executePurge(char* parameters); int executeShutdown(char* parameters); void executeRun(char* parameters); @@ -137,7 +137,7 @@ void executeCpc(char * parameters); public: - bool connect(); + bool connect(bool interactive); bool disconnect(); /** @@ -191,9 +191,9 @@ { delete m_cmd; } -int Ndb_mgmclient::execute(const char *_line, int _try_reconnect, int *error) +int Ndb_mgmclient::execute(const char *_line, int _try_reconnect, bool interactive, int *error) { - return m_cmd->execute(_line,_try_reconnect,error); + return m_cmd->execute(_line,_try_reconnect,interactive, error); } int Ndb_mgmclient::disconnect() @@ -239,7 +239,7 @@ #include #include -int Ndb_mgmclient::execute(int argc, char** argv, int _try_reconnect, int *error) +int Ndb_mgmclient::execute(int argc, char** argv, int _try_reconnect, bool interactive, int *error) { if (argc <= 0) return 0; @@ -248,7 +248,7 @@ { _line.appfmt(" %s", argv[i]); } - return m_cmd->execute(_line.c_str(),_try_reconnect, error); + return m_cmd->execute(_line.c_str(),_try_reconnect, interactive, error); } /***************************************************************************** @@ -480,7 +480,7 @@ } bool -CommandInterpreter::connect() +CommandInterpreter::connect(bool interactive) { DBUG_ENTER("CommandInterpreter::connect"); @@ -492,10 +492,12 @@ ndbout_c("Cannot create handle to management server."); exit(-1); } - m_mgmsrv2 = ndb_mgm_create_handle(); - if(m_mgmsrv2 == NULL) { - ndbout_c("Cannot create 2:nd handle to management server."); - exit(-1); + if (interactive) { + m_mgmsrv2 = ndb_mgm_create_handle(); + if(m_mgmsrv2 == NULL) { + ndbout_c("Cannot create 2:nd handle to management server."); + exit(-1); + } } if (ndb_mgm_set_connectstring(m_mgmsrv, m_constr)) @@ -509,59 +511,61 @@ const char *host= ndb_mgm_get_connected_host(m_mgmsrv); unsigned port= ndb_mgm_get_connected_port(m_mgmsrv); - BaseString constr; - constr.assfmt("%s:%d",host,port); - if(!ndb_mgm_set_connectstring(m_mgmsrv2, constr.c_str()) && - !ndb_mgm_connect(m_mgmsrv2, try_reconnect-1, 5, 1)) - { - DBUG_PRINT("info",("2:ndb connected to Management Server ok at: %s:%d", - host, port)); - assert(m_event_thread == 0); - assert(do_event_thread == 0); - do_event_thread= 0; - m_event_thread = NdbThread_Create(event_thread_run, - (void**)&m_mgmsrv2, - 32768, - "CommandInterpreted_event_thread", - NDB_THREAD_PRIO_LOW); - if (m_event_thread != 0) + if (interactive) { + BaseString constr; + constr.assfmt("%s:%d",host,port); + if(!ndb_mgm_set_connectstring(m_mgmsrv2, constr.c_str()) && + !ndb_mgm_connect(m_mgmsrv2, try_reconnect-1, 5, 1)) { - DBUG_PRINT("info",("Thread created ok, waiting for started...")); - int iter= 1000; // try for 30 seconds - while(do_event_thread == 0 && - iter-- > 0) - NdbSleep_MilliSleep(30); - } - if (m_event_thread == 0 || - do_event_thread == 0 || - do_event_thread == -1) - { - DBUG_PRINT("info",("Warning, event thread startup failed, " - "degraded printouts as result, errno=%d", - errno)); - printf("Warning, event thread startup failed, " - "degraded printouts as result, errno=%d\n", errno); + DBUG_PRINT("info",("2:ndb connected to Management Server ok at: %s:%d", + host, port)); + assert(m_event_thread == 0); + assert(do_event_thread == 0); do_event_thread= 0; - if (m_event_thread) + m_event_thread = NdbThread_Create(event_thread_run, + (void**)&m_mgmsrv2, + 32768, + "CommandInterpreted_event_thread", + NDB_THREAD_PRIO_LOW); + if (m_event_thread != 0) { - void *res; - NdbThread_WaitFor(m_event_thread, &res); - NdbThread_Destroy(&m_event_thread); + DBUG_PRINT("info",("Thread created ok, waiting for started...")); + int iter= 1000; // try for 30 seconds + while(do_event_thread == 0 && + iter-- > 0) + NdbSleep_MilliSleep(30); + } + if (m_event_thread == 0 || + do_event_thread == 0 || + do_event_thread == -1) + { + DBUG_PRINT("info",("Warning, event thread startup failed, " + "degraded printouts as result, errno=%d", + errno)); + printf("Warning, event thread startup failed, " + "degraded printouts as result, errno=%d\n", errno); + do_event_thread= 0; + if (m_event_thread) + { + void *res; + NdbThread_WaitFor(m_event_thread, &res); + NdbThread_Destroy(&m_event_thread); + } + ndb_mgm_disconnect(m_mgmsrv2); } - ndb_mgm_disconnect(m_mgmsrv2); } - } - else - { - DBUG_PRINT("warning", - ("Could not do 2:nd connect to mgmtserver for event listening")); - DBUG_PRINT("info", ("code: %d, msg: %s", - ndb_mgm_get_latest_error(m_mgmsrv2), - ndb_mgm_get_latest_error_msg(m_mgmsrv2))); - printf("Warning, event connect failed, degraded printouts as result\n"); - printf("code: %d, msg: %s\n", - ndb_mgm_get_latest_error(m_mgmsrv2), - ndb_mgm_get_latest_error_msg(m_mgmsrv2)); + else + { + DBUG_PRINT("warning", + ("Could not do 2:nd connect to mgmtserver for event listening")); + DBUG_PRINT("info", ("code: %d, msg: %s", + ndb_mgm_get_latest_error(m_mgmsrv2), + ndb_mgm_get_latest_error_msg(m_mgmsrv2))); + printf("Warning, event connect failed, degraded printouts as result\n"); + printf("code: %d, msg: %s\n", + ndb_mgm_get_latest_error(m_mgmsrv2), + ndb_mgm_get_latest_error_msg(m_mgmsrv2)); + } } m_connected= true; DBUG_PRINT("info",("Connected to Management Server at: %s:%d", host, port)); @@ -600,11 +604,11 @@ int CommandInterpreter::execute(const char *_line, int _try_reconnect, - int *error) + bool interactive, int *error) { if (_try_reconnect >= 0) try_reconnect=_try_reconnect; - int result= execute_impl(_line); + int result= execute_impl(_line, interactive); if (error) *error= m_error; return result; @@ -618,7 +622,7 @@ } int -CommandInterpreter::execute_impl(const char *_line) +CommandInterpreter::execute_impl(const char *_line, bool interactive) { DBUG_ENTER("CommandInterpreter::execute_impl"); DBUG_PRINT("enter",("line=\"%s\"",_line)); @@ -667,7 +671,7 @@ DBUG_RETURN(true); } else if (strcasecmp(firstToken, "CONNECT") == 0) { - executeConnect(allAfterFirstToken); + executeConnect(allAfterFirstToken, interactive); DBUG_RETURN(true); } else if (strcasecmp(firstToken, "SLEEP") == 0) { @@ -682,7 +686,7 @@ DBUG_RETURN(false); } - if (!connect()) + if (!connect(interactive)) DBUG_RETURN(true); if (strcasecmp(firstToken, "SHOW") == 0) { @@ -1291,13 +1295,13 @@ } void -CommandInterpreter::executeConnect(char* parameters) +CommandInterpreter::executeConnect(char* parameters, bool interactive) { disconnect(); if (!emptyString(parameters)) { m_constr= BaseString(parameters).trim().c_str(); } - connect(); + connect(interactive); } //***************************************************************************** --- 1.13/ndb/src/mgmclient/ndb_mgmclient.hpp 2006-08-11 18:44:50 +08:00 +++ 1.14/ndb/src/mgmclient/ndb_mgmclient.hpp 2006-08-11 18:44:50 +08:00 @@ -23,8 +23,8 @@ public: Ndb_mgmclient(const char*,int verbose=0); ~Ndb_mgmclient(); - int execute(const char *_line, int _try_reconnect=-1, int *error= 0); - int execute(int argc, char** argv, int _try_reconnect=-1, int *error= 0); + int execute(const char *_line, int _try_reconnect=-1, bool interactive=1, int *error= 0); + int execute(int argc, char** argv, int _try_reconnect=-1, bool interactive=1, int *error= 0); int disconnect(); private: CommandInterpreter *m_cmd; --- 1.21/ndb/src/mgmclient/main.cpp 2006-08-11 18:44:50 +08:00 +++ 1.22/ndb/src/mgmclient/main.cpp 2006-08-11 18:44:50 +08:00 @@ -121,7 +121,7 @@ line_read= strdup(linebuffer); } #endif - return com->execute(line_read,_try_reconnect); + return com->execute(line_read, _try_reconnect, 1); } int main(int argc, char** argv){ @@ -163,7 +163,7 @@ } else { - com->execute(opt_execute_str,_try_reconnect, &ret); + com->execute(opt_execute_str,_try_reconnect, 0, &ret); } delete com; --- 1.228/BitKeeper/etc/ignore 2006-08-11 18:44:50 +08:00 +++ 1.229/BitKeeper/etc/ignore 2006-08-11 18:44:50 +08:00 @@ -1297,3 +1297,4 @@ zlib/*.ds? zlib/*.vcproj ndb/src/common/util/testBitmask.cpp +ndb/src/mgmclient/1