MgmtSrvr.hpp 20.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/* Copyright (C) 2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#ifndef MgmtSrvr_H
#define MgmtSrvr_H

#include <kernel_types.h>
#include "Config.hpp"
#include <NdbCondition.h>
#include <mgmapi.h>

25 26
#include <NdbTCP.h>
#include <ConfigRetriever.hpp>
27 28 29
#include <Vector.hpp>
#include <NodeBitmask.hpp>
#include <signaldata/ManagementServer.hpp>
30
#include <ndb_version.h>
unknown's avatar
unknown committed
31 32
#include <EventLogger.hpp>
#include <signaldata/EventSubscribeReq.hpp>
33

34 35
#include <SignalSender.hpp>

36 37 38 39 40 41 42 43 44 45 46 47
/**
 * @desc Block number for Management server.
 * @todo This should probably be somewhere else. I don't know where atm.
 */
#define MGMSRV 1

class ConfigInfoServer;
class NdbApiSignal;
class Config;
class SetLogLevelOrd;
class SocketServer;

unknown's avatar
unknown committed
48
class Ndb_mgmd_event_service : public EventLoggerBase 
unknown's avatar
unknown committed
49 50 51
{
  friend class MgmtSrvr;
public:
unknown's avatar
unknown committed
52
  struct Event_listener : public EventLoggerBase {
unknown's avatar
unknown committed
53
    NDB_SOCKET_TYPE m_socket;
unknown's avatar
unknown committed
54
    Uint32 m_parsable;
unknown's avatar
unknown committed
55 56 57 58
  };
  
private:  
  class MgmtSrvr * m_mgmsrv;
unknown's avatar
unknown committed
59
  MutexVector<Event_listener> m_clients;
unknown's avatar
unknown committed
60
public:
unknown's avatar
unknown committed
61
  Ndb_mgmd_event_service(class MgmtSrvr * m) : m_clients(5) {
unknown's avatar
unknown committed
62 63 64
    m_mgmsrv = m;
  }
  
unknown's avatar
unknown committed
65
  void add_listener(const Event_listener&);
66
  void check_listeners();
unknown's avatar
unknown committed
67 68
  void update_max_log_level(const LogLevel&);
  void update_log_level(const LogLevel&);
unknown's avatar
unknown committed
69 70 71
  
  void log(int eventType, const Uint32* theData, NodeId nodeId);
  
unknown's avatar
unknown committed
72 73 74 75
  void stop_sessions();

  Event_listener& operator[](unsigned i) { return m_clients[i]; }
  const Event_listener& operator[](unsigned i) const { return m_clients[i]; }
unknown's avatar
unknown committed
76 77
  void lock() { m_clients.lock(); }
  void unlock(){ m_clients.unlock(); }
unknown's avatar
unknown committed
78 79
};

80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
/**
 * @class MgmtSrvr
 * @brief Main class for the management server. 
 *
 * It has one interface to be used by a local client. 
 * With the methods it's possible to send different kind of commands to 
 * DB processes, as log level, set trace number etc. 
 *
 * A MgmtSrvr creates a ConfigInfoServer which serves request on TCP sockets. 
 * The requests come typical from DB and API processes which want
 * to fetch its configuration parameters. The MgmtSrvr knows about the
 * configuration by reading a configuration file.
 *
 * The MgmtSrvr class corresponds in some ways to the Ndb class in API. 
 * It creates a TransporterFacade, receives signals and defines signals
 * to send and receive.
 */
class MgmtSrvr {
  
public:
unknown's avatar
unknown committed
100 101 102
  // some compilers need all of this
  class Allocated_resources;
  friend class Allocated_resources;
unknown's avatar
unknown committed
103 104 105 106 107 108 109
  class Allocated_resources {
  public:
    Allocated_resources(class MgmtSrvr &m);
    ~Allocated_resources();
    // methods to reserve/allocate resources which
    // will be freed when running destructor
    void reserve_node(NodeId id);
110 111 112 113
    bool is_reserved(NodeId nodeId) { return m_reserved_nodes.get(nodeId); }
    bool is_reserved(NodeBitmask mask) { return !mask.bitAND(m_reserved_nodes).isclear(); }
    bool isclear() { return m_reserved_nodes.isclear(); }
    NodeId get_nodeid() const;
unknown's avatar
unknown committed
114 115 116 117
  private:
    MgmtSrvr &m_mgmsrv;
    NodeBitmask m_reserved_nodes;
  };
118
  NdbMutex *m_node_id_mutex;
unknown's avatar
unknown committed
119

120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
  /**
   * Start/initate the event log.
   */
  void startEventLog();

  /**
   * Stop the event log.
   */
  void stopEventLog();

  /**
   * Enable/disable eventlog log levels/severities.
   *
   * @param serverity the log level/serverity.
   * @return true if the severity was enabled.
   */
unknown's avatar
unknown committed
136
  bool setEventLogFilter(int severity, int enable);
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176

  /**
   * Returns true if the log level/severity is enabled.
   *
   * @param severity the severity level.
   */
  bool isEventLogFilterEnabled(int severity);

  STATIC_CONST( NO_CONTACT_WITH_PROCESS = 5000 );
  STATIC_CONST( PROCESS_NOT_CONFIGURED = 5001 );
  STATIC_CONST( WRONG_PROCESS_TYPE = 5002 );
  STATIC_CONST( COULD_NOT_ALLOCATE_MEMORY = 5003 );
  STATIC_CONST( SEND_OR_RECEIVE_FAILED = 5005 );
  STATIC_CONST( INVALID_LEVEL = 5006 );
  STATIC_CONST( INVALID_ERROR_NUMBER = 5007 );
  STATIC_CONST( INVALID_TRACE_NUMBER = 5008 );
  STATIC_CONST( NOT_IMPLEMENTED = 5009 );
  STATIC_CONST( INVALID_BLOCK_NAME = 5010 );

  STATIC_CONST( CONFIG_PARAM_NOT_EXIST = 5011 );
  STATIC_CONST( CONFIG_PARAM_NOT_UPDATEABLE = 5012 );
  STATIC_CONST( VALUE_WRONG_FORMAT_INT_EXPECTED = 5013 );
  STATIC_CONST( VALUE_TOO_LOW = 5014 );
  STATIC_CONST( VALUE_TOO_HIGH = 5015 );
  STATIC_CONST( VALUE_WRONG_FORMAT_BOOL_EXPECTED = 5016 );

  STATIC_CONST( CONFIG_FILE_OPEN_WRITE_ERROR = 5017 );
  STATIC_CONST( CONFIG_FILE_OPEN_READ_ERROR = 5018 );
  STATIC_CONST( CONFIG_FILE_WRITE_ERROR = 5019 );
  STATIC_CONST( CONFIG_FILE_READ_ERROR = 5020 );
  STATIC_CONST( CONFIG_FILE_CLOSE_ERROR = 5021 );

  STATIC_CONST( CONFIG_CHANGE_REFUSED_BY_RECEIVER = 5022 );
  STATIC_CONST( COULD_NOT_SYNC_CONFIG_CHANGE_AGAINST_PHYSICAL_MEDIUM = 5023 );
  STATIC_CONST( CONFIG_FILE_CHECKSUM_ERROR = 5024 );
  STATIC_CONST( NOT_POSSIBLE_TO_SEND_CONFIG_UPDATE_TO_PROCESS_TYPE = 5025 );

  STATIC_CONST( NODE_SHUTDOWN_IN_PROGESS = 5026 );
  STATIC_CONST( SYSTEM_SHUTDOWN_IN_PROGRESS = 5027 );
  STATIC_CONST( NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH = 5028 );
177

178
  STATIC_CONST( NO_CONTACT_WITH_DB_NODES = 5030 );
179
  STATIC_CONST( UNSUPPORTED_NODE_SHUTDOWN = 5031 );
180 181 182 183

  STATIC_CONST( NODE_NOT_API_NODE = 5062 );
  STATIC_CONST( OPERATION_NOT_ALLOWED_START_STOP = 5063 );

184 185 186 187 188 189 190
  /**
   *   This enum specifies the different signal loggig modes possible to set 
   *   with the setSignalLoggingMode method.
   */
  enum LogMode {In, Out, InOut, Off};

  /* Constructor */
unknown's avatar
unknown committed
191

192 193 194 195
  MgmtSrvr(SocketServer *socket_server,
	   const char *config_filename,      /* Where to save config */
	   const char *connect_string); 
  int init();
unknown's avatar
unknown committed
196
  NodeId getOwnNodeId() const {return _ownNodeId;};
197 198 199 200 201 202 203

  /**
   *   Read (initial) config file, create TransporterFacade, 
   *   define signals, create ConfigInfoServer.
   *   @return true if succeeded, otherwise false
   */
  bool check_start(); // may be run before start to check that some things are ok
204
  bool start(BaseString &error_string);
205 206 207

  ~MgmtSrvr();

208 209 210 211 212 213 214 215
  /**
   * Get status on a node.
   * address may point to a common area (e.g. from inet_addr)
   * There is no gaurentee that it is preserved across calls.
   * Copy the string if you are not going to use it immediately.
   */
  int status(int nodeId,
	     ndb_mgm_node_status * status,
216 217 218 219
	     Uint32 * version,
	     Uint32 * phase,
	     bool * systemShutdown,
	     Uint32 * dynamicId,
220
	     Uint32 * nodeGroup,
221 222
	     Uint32 * connectCount,
	     const char **address);
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
  
  // All the functions below may return any of this error codes:
  // NO_CONTACT_WITH_PROCESS, PROCESS_NOT_CONFIGURED, WRONG_PROCESS_TYPE,
  // COULD_NOT_ALLOCATE_MEMORY, SEND_OR_RECEIVE_FAILED

  /**
   * Save a configuration to permanent storage
   */
  int saveConfig(const Config *);

  /**
   * Save the running configuration
   */
  int saveConfig() {
    return saveConfig(_config);
  };

  /**
   * Read configuration from file, or from another MGM server
   */
  Config *readConfig();

  /**
   * Fetch configuration from another MGM server
   */
  Config *fetchConfig();

  /**
   *   Stop a node
   * 
   *   @param   processId: Id of the DB process to stop
   *   @return  0 if succeeded, otherwise: as stated above, plus:
   */
256
  int stopNodes(const Vector<NodeId> &node_ids, int *stopCount, bool abort);
257 258 259 260

  /**
   *   Stop the system
   */
261
  int stop(int * cnt = 0, bool abort = false);
262 263 264 265 266 267 268

  /**
   *   print version info about a node
   * 
   *   @param   processId: Id of the DB process to stop
   *   @return  0 if succeeded, otherwise: as stated above, plus:
   */
269
  int versionNode(int nodeId, Uint32 &version, const char **address);
270 271 272 273

  /**
   *   Maintenance on the system
   */
274
  int enterSingleUser(int * cnt = 0, Uint32 singleuserNodeId = 0);
275 276 277 278 279


  /**
   *   Resume from maintenance on the system
   */
280
  int exitSingleUser(int * cnt = 0, bool abort = false);
281 282 283 284 285 286 287 288 289

  /**
   *   Start DB process.
   *   @param   processId: Id of the DB process to start
   *   @return 0 if succeeded, otherwise: as stated above, plus:
   */
 int start(int processId);

  /**
290
   *   Restart nodes
291 292
   *   @param processId: Id of the DB process to start
   */
293 294 295
  int restartNodes(const Vector<NodeId> &node_ids,
                   int *stopCount, bool nostart,
                   bool initialStart, bool abort);
296 297 298 299 300 301
  
  /**
   *   Restart the system
   */
  int restart(bool nostart, bool initialStart, 
	      bool abort = false,
302
	      int * stopCount = 0);
303 304 305 306 307 308 309 310 311
  
  struct BackupEvent {
    enum Event {
      BackupStarted = 1,
      BackupFailedToStart = 2,
      BackupCompleted = 3,
      BackupAborted = 4
    } Event;
    
312
    NdbNodeBitmask Nodes;
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
    union {
      struct {
	Uint32 BackupId;
      } Started ;
      struct {
	Uint32 ErrorCode;
      } FailedToStart ;
      struct {
	Uint32 BackupId;
	Uint32 NoOfBytes;
	Uint32 NoOfRecords;
	Uint32 NoOfLogBytes;
	Uint32 NoOfLogRecords;
	Uint32 startGCP;
	Uint32 stopGCP;
      } Completed ;
      struct {
	Uint32 BackupId;
	Uint32 Reason;
	Uint32 ErrorCode;
      } Aborted ;
    };
  };
  
  /**
   * Backup functionallity
   */
unknown's avatar
unknown committed
340
  int startBackup(Uint32& backupId, int waitCompleted= 2);
341 342 343 344 345 346 347 348 349 350 351 352 353
  int abortBackup(Uint32 backupId);
  int performBackup(Uint32* backupId);

  //**************************************************************************
  // Description: Set event report level for a DB process
  // Parameters:
  //  processId: Id of the DB process
  //  level: Event report level
  //  isResend: Flag to indicate for resending log levels during node restart
  // Returns: 0 if succeeded, otherwise: as stated above, plus:
  //  INVALID_LEVEL
  //**************************************************************************

unknown's avatar
unknown committed
354 355
  int setEventReportingLevelImpl(int processId, const EventSubscribeReq& ll);
  int setNodeLogLevelImpl(int processId, const SetLogLevelOrd & ll);
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428

  /**
   *   Insert an error in a DB process.
   *   @param   processId: Id of the DB process
   *   @param   errorNo: The error number. > 0.
   *   @return  0 if succeeded, otherwise: as stated above, plus:
   *            INVALID_ERROR_NUMBER
   */
  int insertError(int processId, int errorNo);



  int setTraceNo(int processId, int traceNo);
  //**************************************************************************
  // Description: Set trace number in a DB process.
  // Parameters:
  //  processId: Id of the DB process
  //  trace: Trace number
  // Returns: 0 if succeeded, otherwise: as stated above, plus:
  //  INVALID_TRACE_NUMBER
  //**************************************************************************


  int setSignalLoggingMode(int processId, LogMode mode, 
			   const Vector<BaseString> &blocks);

  int setSignalLoggingMode(int processId, LogMode mode,
			   BaseString &block) {
    Vector<BaseString> v;
    v.push_back(block);
    return setSignalLoggingMode(processId, mode, v);
  }
  //**************************************************************************
  // Description: Set signal logging mode for blocks in a DB process.
  // Parameters:
  //  processId: Id of the DB process
  //  mode: The log mode
  //  blocks: Which blocks to be affected (container of strings)
  // Returns: 0 if succeeded, otherwise: as stated above, plus:
  //  INVALID_BLOCK_NAME
  //**************************************************************************


  int startSignalTracing(int processId);
  //**************************************************************************
  // Description: Start signal tracing for a DB process.
  // Parameters:
  //  processId: Id of the DB process
  // Returns: 0 if succeeded, otherwise: as stated above.
  //**************************************************************************


  int stopSignalTracing(int processId);
  //**************************************************************************
  // Description: Stop signal tracing for a DB process.
  // Parameters:
  //  processId: Id of the DB process
  // Returns: 0 if succeeded, otherwise: as stated above.
  //**************************************************************************

  /**
   *   Dump State 
   */
  int dumpState(int processId, const Uint32 args[], Uint32 argNo);
  int dumpState(int processId, const char* args);

  /**
   * Get next node id (node id gt that _nodeId)
   *  of specified type and save it in _nodeId
   *
   *   @return false if none found
   */
  bool getNextNodeId(NodeId * _nodeId, enum ndb_mgm_node_type type) const ;
unknown's avatar
unknown committed
429
  bool alloc_node_id(NodeId * _nodeId, enum ndb_mgm_node_type type,
430 431
		     struct sockaddr *client_addr, SOCKET_SIZE_TYPE *client_addr_len,
		     BaseString &error_string);
432 433 434 435 436 437 438 439 440 441 442 443
  
  /**
   *
   */
  enum ndb_mgm_node_type getNodeType(NodeId) const;

  /**
   *   Get error text
   * 
   *   @param   errorCode: Error code to get a match error text for.
   *   @return  The error text.
   */
444
  const char* getErrorText(int errorCode, char *buf, int buf_sz);
445 446 447 448 449 450 451 452 453 454 455 456 457 458

  /**
   *   Get configuration
   */
  const Config * getConfig() const;

  /**
   * Returns the node count for the specified node type.
   *
   *  @param type The node type.
   *  @return The number of nodes of the specified type.
   */
  int getNodeCount(enum ndb_mgm_node_type type) const;

unknown's avatar
unknown committed
459 460 461 462 463
  /**
   * Returns the port number.
   * @return port number.
   */
  int getPort() const;
464

465
  int setDbParameter(int node, int parameter, const char * value, BaseString&);
466 467
  int setConnectionDbParameter(int node1, int node2, int param, int value,
			       BaseString& msg);
468
  int getConnectionDbParameter(int node1, int node2, int param,
469
			       int *value, BaseString& msg);
470

471
  int connect_to_self(void);
472

473 474
  void transporter_connect(NDB_SOCKET_TYPE sockfd);

475
  ConfigRetriever *get_config_retriever() { return m_config_retriever; };
476

477
  const char *get_connect_address(Uint32 node_id);
478 479 480
  void get_connected_nodes(NodeBitmask &connected_nodes) const;
  SocketServer *get_socket_server() { return m_socket_server; }

481 482 483 484
  //**************************************************************************
private:
  //**************************************************************************

485
  int send(SignalSender &ss, SimpleSignal &ssig, Uint32 node, Uint32 node_type);
486

487 488 489 490 491 492 493
  int sendStopMgmd(NodeId nodeId,
                   bool abort,
                   bool stop,
                   bool restart,
                   bool nostart,
                   bool initialStart);

494
  int sendSTOP_REQ(const Vector<NodeId> &node_ids,
495 496 497 498 499 500 501 502
		   NodeBitmask &stoppedNodes,
		   Uint32 singleUserNodeId,
		   bool abort,
		   bool stop,
		   bool restart,
		   bool nostart,
		   bool initialStart);
 
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
  /**
   *   Check if it is possible to send a signal to a (DB) process
   *
   *   @param   processId: Id of the process to send to
   *   @return  0 OK, 1 process dead, 2 API or MGMT process, 3 not configured
   */
  int okToSendTo(NodeId nodeId, bool unCond = false);

  /**
   *   Get block number for a block
   *
   *   @param   blockName: Block to get number for
   *   @return  -1 if block not found, otherwise block number
   */
  int getBlockNumber(const BaseString &blockName);
518 519

  int alloc_node_id_req(Uint32 free_node_id);
520 521 522 523
  //**************************************************************************
  
  int _blockNumber;
  NodeId _ownNodeId;
524 525
  SocketServer *m_socket_server;

526
  BlockReference _ownReference; 
527
  NdbMutex *m_configMutex;
528 529 530 531
  const Config * _config;
  Config * m_newConfig;
  BaseString m_configFilename;
  Uint32 m_nextConfigGenerationNumber;
unknown's avatar
unknown committed
532 533
  
  NodeBitmask m_reserved_nodes;
unknown's avatar
unknown committed
534
  struct in_addr m_connect_address[MAX_NODES];
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558

  //**************************************************************************
  // Specific signal handling methods
  //**************************************************************************

  static void defineSignals(int blockNumber);
  //**************************************************************************
  // Description: Define all signals to be sent or received for a block
  // Parameters:
  //  blockNumber: The block number send/receive
  // Returns: -
  //**************************************************************************

  void handleReceivedSignal(NdbApiSignal* signal);
  //**************************************************************************
  // Description: This method is called from "another" thread when a signal
  //  is received. If expect the received signal and succeed to handle it
  //  we signal with a condition variable to the waiting
  //  thread (receiveOptimisedResponse) that the signal has arrived.
  // Parameters:
  //  signal: The recieved signal
  // Returns: -
  //**************************************************************************

unknown's avatar
unknown committed
559
  void handleStatus(NodeId nodeId, bool alive, bool nfComplete);
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
  //**************************************************************************
  // Description: Handle the death of a process
  // Parameters:
  //  processId: Id of the dead process.
  // Returns: -
  //**************************************************************************

  //**************************************************************************
  // Specific signal handling data
  //**************************************************************************


  //**************************************************************************
  //**************************************************************************
  // General signal handling methods
  // This functions are more or less copied from the Ndb class.

  
  /**
   * WaitSignalType defines states where each state define a set of signals
   * we accept to receive. 
   * The state is set after we have sent a signal.
   * When a signal arrives we first check current state (handleReceivedSignal)
   * to verify that we expect the arrived signal. 
   * It's only then we are in state accepting the arrived signal 
   * we handle the signal.
   */
  enum WaitSignalType { 
    NO_WAIT,			// We don't expect to receive any signal
    WAIT_SET_VAR,		// Accept SET_VAR_CONF and SET_VAR_REF
590
    WAIT_SUBSCRIBE_CONF 	// Accept event subscription confirmation
591 592 593 594 595 596 597 598 599 600
  };
  
  /**
   *   This function is called from "outside" of MgmtSrvr
   *   when a signal is sent to MgmtSrvr.
   *   @param  mgmtSrvr: The MgmtSrvr object which shall recieve the signal.
   *   @param  signal: The received signal.
   */
  static void signalReceivedNotification(void* mgmtSrvr, 
					 NdbApiSignal* signal, 
unknown's avatar
unknown committed
601
					 struct LinearSectionPtr ptr[3]);
602

603 604 605 606 607 608
  /**
   *   Called from "outside" of MgmtSrvr when a DB process has died.
   *   @param  mgmtSrvr:   The MgmtSrvr object wreceiveOptimisedResponsehich 
   *                       shall receive the notification.
   *   @param  processId:  Id of the dead process.
   */
609
  static void nodeStatusNotification(void* mgmSrv, Uint32 nodeId, 
610 611 612 613 614
				     bool alive, bool nfCompleted);
  
  /**
   * An event from <i>nodeId</i> has arrived
   */
unknown's avatar
unknown committed
615
  void eventReport(const Uint32 * theData);
616 617 618 619 620 621
 

  //**************************************************************************
  //**************************************************************************
  // General signal handling data

unknown's avatar
unknown committed
622
  STATIC_CONST( WAIT_FOR_RESPONSE_TIMEOUT = 300000 ); // Milliseconds
623 624 625 626 627
  // Max time to wait for a signal to arrive

  NdbApiSignal* theSignalIdleList;
  // List of unused signals
  
628
  Uint32 theWaitNode;
629 630 631 632 633 634 635 636
  WaitSignalType theWaitState;
  // State denoting a set of signals we accept to recieve.

  NdbCondition* theMgmtWaitForResponseCondPtr; 
  // Condition variable used when we wait for a signal to arrive/a 
  // signal arrives.
  // We wait in receiveOptimisedResponse and signal in handleReceivedSignal.

637 638
  NdbMgmHandle m_local_mgm_handle;
  char m_local_mgm_connect_string[20];
639 640
  class TransporterFacade * theFacade;

641
  int  sendVersionReq( int processId, Uint32 &version, const char **address);
642
  int translateStopRef(Uint32 errCode);
unknown's avatar
unknown committed
643
  
644 645
  bool _isStopThread;
  int _logLevelThreadSleep;
unknown's avatar
unknown committed
646 647 648 649 650
  MutexVector<NodeId> m_started_nodes;
  MutexVector<EventSubscribeReq> m_log_level_requests;
  LogLevel m_nodeLogLevel[MAX_NODES];
  enum ndb_mgm_node_type nodeTypes[MAX_NODES];
  friend class MgmApiSession;
unknown's avatar
unknown committed
651 652
  friend class Ndb_mgmd_event_service;
  Ndb_mgmd_event_service m_event_listner;
653
  
654 655
  NodeId m_master_node;

656 657 658 659 660 661 662 663 664 665
  /**
   * Handles the thread wich upon a 'Node is started' event will
   * set the node's previous loglevel settings.
   */
  struct NdbThread* _logLevelThread;
  static void *logLevelThread_C(void *);
  void logLevelThreadRun();
  
  Config *_props;

666
  ConfigRetriever *m_config_retriever;
667 668 669 670 671 672 673 674 675
};

inline
const Config *
MgmtSrvr::getConfig() const {
  return _config;
}

#endif // MgmtSrvr_H