Files
openGauss-server/src/include/replication/heartbeat.h
dengxuyue 1567043064 同步source code
日期: 12-26
    revision: ee5b054c
2020-12-28 22:19:21 +08:00

54 lines
1.5 KiB
C

/*
* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
*
* openGauss is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* ---------------------------------------------------------------------------------------
*
* heartbeat.h
* Data struct to store heartbeat thread variables.
*
*
* IDENTIFICATION
* src/include/replication/heartbeat.h
*
* ---------------------------------------------------------------------------------------
*/
#ifndef _HEARTBEAT_H
#define _HEARTBEAT_H
const int MAX_EVENTS = 512;
typedef struct channel_info {
TimestampTz connect_time;
TimestampTz last_reply_timestamp;
} channel_info;
/*
* Heartbeat struct in shared memory.
*/
typedef struct heartbeat_state {
ThreadId pid; /* this heartbeat's process id, or 0 */
int lwpId;
channel_info channel_array[MAX_REPLNODE_NUM];
/* Protects shared variables shown above. */
slock_t mutex;
} heartbeat_state;
extern void heartbeat_main(void);
extern TimestampTz get_last_reply_timestamp(int replindex);
void heartbeat_shmem_init(void);
Size heartbeat_shmem_size(void);
#endif /* _HEARTBEAT_H */