MySQL 5.6.14 Source Code Document
|
... More...
#include <TransporterRegistry.hpp>
Classes | |
struct | ErrorState |
struct | SendBuffer |
struct | SendBufferPage |
class | Transporter_interface |
Public Types | |
enum | PerformState { CONNECTED = 0, CONNECTING = 1, DISCONNECTED = 2, DISCONNECTING = 3 } |
Public Member Functions | |
TransporterRegistry (TransporterCallback *callback, bool use_default_send_buffer=true, unsigned maxTransporters=MAX_NTRANSPORTERS, unsigned sizeOfLongSignalMemory=100) | |
void | set_mgm_handle (NdbMgmHandle h) |
NdbMgmHandle | get_mgm_handle (void) |
bool | init (NodeId localNodeId) |
bool | connect_server (NDB_SOCKET_TYPE sockfd, BaseString &errormsg) const |
bool | connect_client (NdbMgmHandle *h) |
NDB_SOCKET_TYPE | connect_ndb_mgmd (SocketClient *sc) |
NDB_SOCKET_TYPE | connect_ndb_mgmd (NdbMgmHandle *h) |
void | removeAll () |
void | disconnectAll () |
virtual | ~TransporterRegistry () |
bool | start_service (SocketServer &server) |
struct NdbThread * | start_clients () |
bool | stop_clients () |
void | start_clients_thread () |
void | update_connections () |
void | startReceiving () |
void | stopReceiving () |
void | startSending () |
void | stopSending () |
const char * | getPerformStateString (NodeId nodeId) const |
PerformState | getPerformState (NodeId nodeId) const |
void | do_connect (NodeId node_id) |
void | do_disconnect (NodeId node_id, int errnum=0) |
bool | is_connected (NodeId node_id) |
void | report_connect (NodeId node_id) |
void | report_disconnect (NodeId node_id, int errnum) |
void | report_error (NodeId nodeId, TransporterError errorCode, const char *errorInfo=0) |
IOState | ioState (NodeId nodeId) |
void | setIOState (NodeId nodeId, IOState state) |
bool | configureTransporter (TransporterConfiguration *config) |
void | allocate_send_buffers (Uint64 total_send_buffer) |
Uint64 | get_total_max_send_buffer () |
bool | get_using_default_send_buffer () const |
void | set_status_overloaded (Uint32 nodeId, bool val) |
const NodeBitmask & | get_status_overloaded () const |
SendStatus | prepareSend (TransporterSendBufferHandle *sendHandle, const SignalHeader *const signalHeader, Uint8 prio, const Uint32 *const signalData, NodeId nodeId, const LinearSectionPtr ptr[3]) |
SendStatus | prepareSend (TransporterSendBufferHandle *sendHandle, const SignalHeader *const signalHeader, Uint8 prio, const Uint32 *const signalData, NodeId nodeId, class SectionSegmentPool &pool, const SegmentedSectionPtr ptr[3]) |
SendStatus | prepareSend (TransporterSendBufferHandle *sendHandle, const SignalHeader *const signalHeader, Uint8 prio, const Uint32 *const signalData, NodeId nodeId, const GenericSectionPtr ptr[3]) |
SendStatus | prepareSend (const SignalHeader *const signalHeader, Uint8 prio, const Uint32 *const signalData, NodeId nodeId, const LinearSectionPtr ptr[3]) |
SendStatus | prepareSend (const SignalHeader *const signalHeader, Uint8 prio, const Uint32 *const signalData, NodeId nodeId, class SectionSegmentPool &pool, const SegmentedSectionPtr ptr[3]) |
SendStatus | prepareSend (const SignalHeader *const signalHeader, Uint8 prio, const Uint32 *const signalData, NodeId nodeId, const GenericSectionPtr ptr[3]) |
void | external_IO (Uint32 timeOutMillis) |
Uint32 | pollReceive (Uint32 timeOutMillis) |
Uint32 | pollReceive (Uint32 timeOutMillis, NodeBitmask &mask) |
void | performReceive () |
int | performSend (NodeId nodeId) |
void | performSend () |
int | forceSendCheck (int sendLimit) |
void | add_transporter_interface (NodeId remoteNodeId, const char *interf, int s_port) |
Transporter * | get_transporter (NodeId nodeId) |
struct in_addr | get_connect_address (NodeId node_id) const |
bool | setup_wakeup_socket () |
void | wakeup () |
Uint32 | get_bytes_to_send_iovec (NodeId node, struct iovec *dst, Uint32 max) |
Uint32 | bytes_sent (NodeId node, Uint32 bytes) |
bool | has_data_to_send (NodeId node) |
void | reset_send_buffer (NodeId node, bool should_be_empty) |
void | print_transporters (const char *where, NdbOut &out=ndbout) |
Public Attributes | |
Vector< Transporter_interface > | m_transporter_interface |
Friends | |
class | SHM_Transporter |
class | SHM_Writer |
class | Transporter |
class | TransporterService |
Additional Inherited Members | |
Private Member Functions inherited from TransporterSendBufferHandle | |
virtual Uint32 * | getWritePtr (NodeId node, Uint32 lenBytes, Uint32 prio, Uint32 max_use)=0 |
virtual Uint32 | updateWritePtr (NodeId node, Uint32 lenBytes, Uint32 prio)=0 |
virtual bool | forceSend (NodeId node)=0 |
...
Definition at line 91 of file TransporterRegistry.hpp.
TransporterRegistry::TransporterRegistry | ( | TransporterCallback * | callback, |
bool | use_default_send_buffer = true , |
||
unsigned | maxTransporters = MAX_NTRANSPORTERS , |
||
unsigned | sizeOfLongSignalMemory = 100 |
||
) |
Constructor
Definition at line 77 of file TransporterRegistry.cpp.
|
virtual |
Stops the server, disconnects all the transporter and deletes them and remove it from the transporter arrays
Definition at line 237 of file TransporterRegistry.cpp.
void TransporterRegistry::allocate_send_buffers | ( | Uint64 | total_send_buffer | ) |
Allocate send buffer for default send buffer handling.
Upper layer that implements their own TransporterSendBufferHandle do not use this, instead they manage their own send buffers.
Argument is the value of config parameter TotalSendBufferMemory. If 0, a default will be used of sum(max send buffer) over all transporters.
Definition at line 160 of file TransporterRegistry.cpp.
bool TransporterRegistry::configureTransporter | ( | TransporterConfiguration * | config | ) |
configureTransporter
Configure a transporter, ie. create new if it does not exist otherwise try to reconfigure it
Definition at line 416 of file TransporterRegistry.cpp.
NDB_SOCKET_TYPE TransporterRegistry::connect_ndb_mgmd | ( | SocketClient * | sc | ) |
Given a SocketClient, creates a NdbMgmHandle, turns it into a transporter and returns the socket.
Set connectstring
Definition at line 2104 of file TransporterRegistry.cpp.
NDB_SOCKET_TYPE TransporterRegistry::connect_ndb_mgmd | ( | NdbMgmHandle * | h | ) |
Given a connected NdbMgmHandle, turns it into a transporter and returns the socket.
convert_to_transporter also disposes of the handle (i.e. we don't leak memory here.
Definition at line 2046 of file TransporterRegistry.cpp.
bool TransporterRegistry::connect_server | ( | NDB_SOCKET_TYPE | sockfd, |
BaseString & | errormsg | ||
) | const |
Handle the handshaking with a new client connection on the server port. NOTE! Connection should be closed if function returns false
Definition at line 309 of file TransporterRegistry.cpp.
void TransporterRegistry::disconnectAll | ( | ) |
Disconnect all transporters
Definition at line 284 of file TransporterRegistry.cpp.
void TransporterRegistry::do_connect | ( | NodeId | node_id | ) |
Get and set methods for PerformState
This method is used to initiate connection, called from the CMVMI blockx.
This works asynchronously, no actions are taken directly in the calling thread.
Definition at line 1527 of file TransporterRegistry.cpp.
void TransporterRegistry::do_disconnect | ( | NodeId | node_id, |
int | errnum = 0 |
||
) |
This method is used to initiate disconnect from CMVMI. It is also called from the TCP transporter in case of an I/O error on the socket.
This works asynchronously, similar to do_connect().
Definition at line 1560 of file TransporterRegistry.cpp.
void TransporterRegistry::external_IO | ( | Uint32 | timeOutMillis | ) |
external_IO
Equal to: poll(...); perform_IO()
Definition at line 881 of file TransporterRegistry.cpp.
int TransporterRegistry::forceSendCheck | ( | int | sendLimit | ) |
Force sending if more than or equal to sendLimit number have asked for send. Returns 0 if not sending and 1 if sending.
Definition at line 1418 of file TransporterRegistry.cpp.
|
inline |
Get sum of max send buffer over all transporters, to be used as a default for allocate_send_buffers eg.
Must be called after creating all transporters for returned value to be correct.
Definition at line 236 of file TransporterRegistry.hpp.
IOState TransporterRegistry::ioState | ( | NodeId | nodeId | ) |
Get and set methods for IOState
Definition at line 1498 of file TransporterRegistry.cpp.
void TransporterRegistry::performReceive | ( | ) |
In multi-threaded cases, this must be protected by a global receive lock.
Definition at line 1231 of file TransporterRegistry.cpp.
int TransporterRegistry::performSend | ( | NodeId | nodeId | ) |
In multi-threaded cases, this must be protected by send lock (can use different locks for each node).
Definition at line 1331 of file TransporterRegistry.cpp.
Uint32 TransporterRegistry::pollReceive | ( | Uint32 | timeOutMillis, |
NodeBitmask & | mask | ||
) |
If any transporters have left-over data that was not fully executed in last loop, don't wait and return 'data available' even if nothing new
Definition at line 955 of file TransporterRegistry.cpp.
SendStatus TransporterRegistry::prepareSend | ( | TransporterSendBufferHandle * | sendHandle, |
const SignalHeader *const | signalHeader, | ||
Uint8 | prio, | ||
const Uint32 *const | signalData, | ||
NodeId | nodeId, | ||
const LinearSectionPtr | ptr[3] | ||
) |
prepareSend
When IOState is HaltOutput or HaltIO do not send or insert any signals in the SendBuffer, unless it is intended for the remote CMVMI block (blockno 252) Perform prepareSend on the transporter.
NOTE signalHeader->xxxBlockRef should contain block numbers and not references
Send buffer full, but resend works
Definition at line 643 of file TransporterRegistry.cpp.
SendStatus TransporterRegistry::prepareSend | ( | TransporterSendBufferHandle * | sendHandle, |
const SignalHeader *const | signalHeader, | ||
Uint8 | prio, | ||
const Uint32 *const | signalData, | ||
NodeId | nodeId, | ||
class SectionSegmentPool & | pool, | ||
const SegmentedSectionPtr | ptr[3] | ||
) |
Send buffer full, but resend works
Definition at line 725 of file TransporterRegistry.cpp.
SendStatus TransporterRegistry::prepareSend | ( | TransporterSendBufferHandle * | sendHandle, |
const SignalHeader *const | signalHeader, | ||
Uint8 | prio, | ||
const Uint32 *const | signalData, | ||
NodeId | nodeId, | ||
const GenericSectionPtr | ptr[3] | ||
) |
Send buffer full, but resend works
Definition at line 809 of file TransporterRegistry.cpp.
|
inline |
Backwards compatiple methods with default send buffer handling.
Definition at line 278 of file TransporterRegistry.hpp.
void TransporterRegistry::removeAll | ( | ) |
Remove all transporters
Definition at line 276 of file TransporterRegistry.cpp.
void TransporterRegistry::report_error | ( | NodeId | nodeId, |
TransporterError | errorCode, | ||
const char * | errorInfo = 0 |
||
) |
We only call TransporterCallback::reportError() from TransporterRegistry::update_connections().
In other places we call this method to enqueue the error that will later be picked up by update_connections().
Definition at line 1643 of file TransporterRegistry.cpp.
void TransporterRegistry::set_mgm_handle | ( | NdbMgmHandle | h | ) |
this handle will be used in the client connect thread to fetch information on dynamic ports. The old handle (if set) is destroyed, and this is destroyed by the destructor
Definition at line 215 of file TransporterRegistry.cpp.
|
inline |
Set or clear overloaded bit. Query if any overloaded bit is set.
Definition at line 534 of file TransporterRegistry.hpp.
void TransporterRegistry::start_clients_thread | ( | ) |
First, we try to connect (if we have a port number).
If dynamic, get the port for connecting from the management server
Server_port == 0 just means that that a mgmt server has not received a new port yet. Keep the old.
else We will not be able to get a new port unless the m_mgm_handle is connected. Note that not being connected is an ok state, just continue until it is able to connect. Continue using the old port until we can connect again and get a new port.
Definition at line 1697 of file TransporterRegistry.cpp.
void TransporterRegistry::startReceiving | ( | ) |
Start/Stop receiving
Definition at line 1947 of file TransporterRegistry.cpp.
void TransporterRegistry::startSending | ( | ) |
Start/Stop sending
Definition at line 1988 of file TransporterRegistry.cpp.
void TransporterRegistry::stopReceiving | ( | ) |
Disconnect all transporters, this includes detach from remote node and since that must be done from the same process that called attach it's done here in the receive thread
Definition at line 1978 of file TransporterRegistry.cpp.
void TransporterRegistry::update_connections | ( | ) |
update_connections(), together with the thread running in start_clients_thread(), handle the state changes for transporters as they connect and disconnect.
Definition at line 1660 of file TransporterRegistry.cpp.