Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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-09-07 16:05:53+02:00, jonas@stripped +4 -0
ndb - bug#19047
Fix possible degraded output if using "ndb_mgm -e"
storage/ndb/src/mgmapi/mgmapi.cpp@stripped, 2006-09-07 16:05:52+02:00,
jonas@stripped +3 -1
Fix desotry *null
storage/ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2006-09-07 16:05:52+02:00,
jonas@stripped +72 -58
Add interavtive flags to signal if one should start event thread
storage/ndb/src/mgmclient/main.cpp@stripped, 2006-09-07 16:05:52+02:00,
jonas@stripped +1 -1
Add interavtive flags to signal if one should start event thread
storage/ndb/src/mgmclient/ndb_mgmclient.hpp@stripped, 2006-09-07 16:05:52+02:00,
jonas@stripped +1 -1
Add interavtive flags to signal if one should start event 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: jonas
# Host: perch.ndb.mysql.com
# Root: /home/jonas/src/mysql-5.1-wl2325-5.0
--- 1.60/storage/ndb/src/mgmapi/mgmapi.cpp 2006-09-07 16:05:56 +02:00
+++ 1.61/storage/ndb/src/mgmapi/mgmapi.cpp 2006-09-07 16:05:56 +02:00
@@ -199,8 +199,10 @@
ndb_mgm_destroy_handle(NdbMgmHandle * handle)
{
DBUG_ENTER("ndb_mgm_destroy_handle");
- if(!handle)
+ if(handle == NULL || * handle == NULL)
+ {
DBUG_VOID_RETURN;
+ }
DBUG_PRINT("info", ("handle=0x%x", (UintPtr)(* handle)));
/**
* important! only disconnect if connected
--- 1.59/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2006-09-07 16:05:56 +02:00
+++ 1.60/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2006-09-07 16:05:56 +02:00
@@ -38,7 +38,7 @@
* Constructor
* @param mgmtSrvr: Management server to use when executing commands
*/
- CommandInterpreter(const char *, int verbose);
+ CommandInterpreter(const char *, int verbose, bool interactive);
~CommandInterpreter();
/**
@@ -157,6 +157,7 @@
NdbMgmHandle m_mgmsrv2;
bool m_connected;
int m_verbose;
+ bool m_interactive;
int try_reconnect;
int m_error;
struct NdbThread* m_event_thread;
@@ -170,9 +171,9 @@
#include "ndb_mgmclient.hpp"
#include "ndb_mgmclient.h"
-Ndb_mgmclient::Ndb_mgmclient(const char *host,int verbose)
+Ndb_mgmclient::Ndb_mgmclient(const char *host,int verbose, bool interactive)
{
- m_cmd= new CommandInterpreter(host,verbose);
+ m_cmd= new CommandInterpreter(host,verbose, interactive);
}
Ndb_mgmclient::~Ndb_mgmclient()
{
@@ -332,25 +333,31 @@
/*
* Constructor
*/
-CommandInterpreter::CommandInterpreter(const char *_host,int verbose)
- : m_verbose(verbose)
+CommandInterpreter::CommandInterpreter(const char *_host,
+ int verbose,
+ bool interactive)
+ : m_verbose(verbose), m_interactive(interactive)
{
m_mgmsrv = ndb_mgm_create_handle();
+ m_mgmsrv2 = NULL;
if(m_mgmsrv == NULL) {
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 (m_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, _host))
{
printError();
exit(-1);
}
-
+
m_connected= false;
m_event_thread= 0;
try_reconnect = 0;
@@ -446,62 +453,69 @@
{
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))
+ if (m_interactive)
{
- 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)
- {
- 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)
+ 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",("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));
+ DBUG_PRINT("info",("Connected to Management Server at: %s:%d",
+ host, port));
if (m_verbose)
{
printf("Connected to Management Server at: %s:%d\n",
--- 1.14/storage/ndb/src/mgmclient/ndb_mgmclient.hpp 2006-09-07 16:05:56 +02:00
+++ 1.15/storage/ndb/src/mgmclient/ndb_mgmclient.hpp 2006-09-07 16:05:56 +02:00
@@ -21,7 +21,7 @@
class Ndb_mgmclient
{
public:
- Ndb_mgmclient(const char*,int verbose=0);
+ Ndb_mgmclient(const char*,int verbose=0, bool interactive = true);
~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);
--- 1.23/storage/ndb/src/mgmclient/main.cpp 2006-09-07 16:05:56 +02:00
+++ 1.24/storage/ndb/src/mgmclient/main.cpp 2006-09-07 16:05:56 +02:00
@@ -154,7 +154,7 @@
}
signal(SIGPIPE, handler);
- com = new Ndb_mgmclient(opt_connect_str,1);
+ com = new Ndb_mgmclient(opt_connect_str,1, opt_execute_str ? false : true);
int ret= 0;
if (!opt_execute_str)
{
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2046) BUG#19047 | jonas | 7 Sep |