* 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.
* ---------------------------------------------------------------------------------------
*
* datasender_private.h
* Private definitions from replication/datasender.cpp.
*
*
* IDENTIFICATION
* src/include/replication/datasender_private.h
*
* ---------------------------------------------------------------------------------------
*/
#ifndef _DATASENDER_PRIVATE_H
#define _DATASENDER_PRIVATE_H
#include "nodes/nodes.h"
#include "replication/syncrep.h"
#include "replication/walsender_private.h"
#include "replication/repl_gramparse.h"
#include "storage/latch.h"
#include "storage/shmem.h"
#include "storage/spin.h"
#include "postgres.h"
#include "knl/knl_variable.h"
typedef enum DataSndState { DATASNDSTATE_STARTUP = 0, DATASNDSTATE_CATCHUP, DATASNDSTATE_STREAMING } DataSndState;
* Each datasender has a DataSnd struct in shared memory.
*/
typedef struct DataSnd {
ThreadId pid;
int lwpId;
DataSndState state;
TimestampTz catchupTime[2];
SndRole sendRole;
bool sendKeepalive;
bool sending;
DataQueuePtr sendPosition;
DataQueuePtr receivePosition;
slock_t mutex;
* Latch used by backends to wake up this datasender when it has work to
* do.
*/
Latch latch;
} DataSnd;
typedef struct DataSndCtlData {
* Synchronous replication queue with one queue per request type.
* Protected by SyncRepLock.
*/
SHM_QUEUE SyncRepQueue;
DataQueuePtr queue_offset;
slock_t mutex;
DataSnd datasnds[FLEXIBLE_ARRAY_MEMBER];
} DataSndCtlData;
extern void DataSndSetState(DataSndState state);
#endif