• unknown's avatar
    BUG#12124 ndb_mgm -e "# stop" does not allow stopping ndb_mgmd processes on other systems · 38229d74
    unknown authored
    WL#2703 restart for ndb_mgmd
    
    Solving two problems with one stone.
    
    Allows the stopping and restarting of mgm nodes other than the one the mgmclient
    is connected to.
    
    
    ndb/include/mgmapi/mgmapi.h:
      Add the internal ndb_mgm_end_session command.
      
      This will unreserve the nodeid we have allocated synchronously.
      
      Otherwise we can't do a restart of a node really quickly as the nodeids are cleaned
      up after the connection to mgmd is closed.
    ndb/include/mgmcommon/ConfigRetriever.hpp:
      Allow configuration on if end_session is going to be called on object destruction.
      
      We need to set this to false for ndbd as we fork()
    ndb/src/common/mgmcommon/ConfigRetriever.cpp:
      When destroying ConfigRetreiver, ndb_mgm_end_session - i.e. deallocate the nodeid
    ndb/src/common/util/SocketServer.cpp:
      When destroying a SocketServer, close the server socket.
    ndb/src/kernel/main.cpp:
      don't purge allocated resources when cleaning up in parent process (nodeid)
    ndb/src/kernel/vm/Configuration.cpp:
      have option end_session to closeConfiguration
    ndb/src/kernel/vm/Configuration.hpp:
      have option end_session to closeConfiguration
    ndb/src/mgmapi/mgmapi.cpp:
      Implement ndb_mgm_end_session
    ndb/src/mgmclient/CommandInterpreter.cpp:
      Correct output of STOP as we can now stop mgmd as well as ndbd
    ndb/src/mgmsrv/MgmtSrvr.cpp:
      Add code into start for connecting to our own mgmd.
      
      Create sendStopMgmd() which does the same job as sendSTOP_REQ, but for ndb_mgmd
      
      Allow stopping of other ndb_mgmd processes by creating a connection to them
      and issuing the stop command
      
      When stopping all nodes, stop other ndb_mgmd processes as well.
      
      Remove set_connect_string. Replace with connect_to_self. This is a much better
      way of doing things.
    ndb/src/mgmsrv/MgmtSrvr.hpp:
      add connect_to_self and remove set_connect_string.
    ndb/src/mgmsrv/Services.cpp:
      Add endSession.
      
      - delete Allocated_resources for this connection
      - create new Allocated_resources for this connection
      
      conceivably you could keep the socket open across node restarts (and even
      possibly get a different node id). But I wouldn't try it and expect happiness.
    ndb/src/mgmsrv/Services.hpp:
      Add endSession
    ndb/src/mgmsrv/main.cpp:
      allow mgmd to be restarted.
      
      - add g_RestartServer flag
      - move connecting to our own mgmd into MgmtSrvr (where it belongs)
      - output correct Shutdown/Restart message on shutdown/restart
    38229d74
Configuration.cpp 21.8 KB