mco_HA_keep_alive

This function is used by the master in order to send the "KEEP_ALIVE" signal to replicas.

For an overview see page HA Applications

Prototype

    MCO_RET mco_HA_keep_alive(mco_db_h db,
                               timer_unit timeout);

Arguments

db
Connection handle to the master database.
timeout
Time window for the KEEP_ALIVE message.

Description

This function is used by the master in order to send the KEEP_ALIVE signal to replicas. It is used by master applications that will be idle longer than the timeout value specified by the wait_data_timeout of the mco_connection_param_t structure in the mco_HA_attach_master() call. (Please note that keep-alive and the mco_HA_attach_replica() threads need to have their own separate database connections.)

Also note that in shared-memory applications, the mco_HA_keep_alive() function works only with “primary” connections. This is because if the master database is a shared-memory database and several processes access it, only one process (called "primary") handles connections to replicas. So only the primary master process can call network-related functions, such as mco_HA_keep_alive(), mco_HA_attach_replica(), and mco_HA_detach_replica().

Return Codes

MCO_S_OK
Successful.
MCO_E_HA_NOT_INITIALIZED
The HA subsystem has not been initialized; the mco_HA_start function must be called first.
MCO_E_HA_TIMEOUT
The specified timeout has been exceeded.
MCO_E_HA_IOERROR
The master was unable to send the KEEP_ALIVE message to replicas.