This function is called by the master application (primary master process for shared memory application) to wait for a connection request from a replica.
mco_HA_attach_replica( mco_db_h db, char* masterport, timer_unit timeout );
db | Database connection handle |
masterport | Transport layer dependent address of master. For example, port number for TCP and UDP (eg."10000"), or pipe name for pipes (eg. "/tmp/test00"). |
timeout | Connection timeout period. If no replicas connect within this period, the function returns MCO_E_NW_TIMEOUT . |
This function is called by the master application (primary master process for shared memory application) to wait for a connection request from a replica. Upon receiving a connection request, it sets up a communication channel and performs initial replica synchronization if needed. Usually this function is called in a separate thread.
(Please note that
and the mco_HA_keep_alive
mco_HA_attach_replica()
threads need to have their own separate database connections.)
MCO_S_OK | The replica was connected successfully |
MCO_E_HA_PROTOCOLERR | Incompatible protocol |
MCO_E_HA_IOERROR |
The master was unable to send or receive a message to/from the replica. |
MCO_E_NW_KILLED_BY_REPLICA |
The replica has completed initial synchronization and has sent the |
MCO_E_NW_TIMEOUT |
No replicas connected within the specified timeout period. |
other MCO_E_NW_* codes |
Errors in the network transport layer. |