!4392 资源池化网络双集群

Merge pull request !4392 from Carl/sdr
This commit is contained in:
opengauss_bot
2024-01-16 06:49:32 +00:00
committed by Gitee
38 changed files with 866 additions and 327 deletions

View File

@ -43,7 +43,8 @@ int SSReadXlogInternal(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, XL
int readLen);
XLogReaderState *SSXLogReaderAllocate(XLogPageReadCB pagereadfunc, void *private_data, Size alignedSize);
void SSGetRecoveryXlogPath();
void SSDoradoGetXlogPathList();
char* SSGetNextXLogPath(TimeLineID tli, XLogRecPtr startptr);
void SSDisasterGetXlogPathList();
void SSUpdateReformerCtrl();
void SSReadControlFile(int id, bool updateDmsCtx = false);
void SSClearSegCache();
@ -51,6 +52,6 @@ int SSCancelTransactionOfAllStandby(SSBroadcastOp type);
int SSProcessCancelTransaction(SSBroadcastOp type);
int SSXLogFileOpenAnyTLI(XLogSegNo segno, int emode, uint32 sources, char* xlog_path);
void SSStandbySetLibpqswConninfo();
void SSDoradoRefreshMode();
void SSDoradoUpdateHAmode();
void SSDisasterRefreshMode();
void SSDisasterUpdateHAmode();
bool SSPerformingStandbyScenario();

View File

@ -227,6 +227,7 @@ typedef struct knl_instance_attr_storage {
int parallel_recovery_timeout;
int parallel_recovery_batch;
bool ss_enable_dorado;
bool ss_stream_cluster;
bool enable_uwal;
char* uwal_config;

View File

@ -342,7 +342,6 @@ extern void ParallelDecodeWorkerMain(void* point);
extern void LogicalReadWorkerMain(void* point);
extern void ParseProcessRecord(ParallelLogicalDecodingContext *ctx, XLogReaderState *record, ParallelDecodeReaderWorker
*worker);
extern void XLogSendParallelLogical();
extern void StartLogicalLogWorkers(char* dbUser, char* dbName, char* slotname, List *options, int parallelDecodeNum);
extern void CheckBooleanOption(DefElem *elem, bool *booleanOption, bool defaultValue);
extern void CheckIntOption(DefElem *elem, int *intOption, int defaultValue, int minVal, int maxVal);

View File

@ -1,72 +0,0 @@
/*
* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
* Portions Copyright (c) 2021, openGauss Contributors
*
* Description: 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.
* ---------------------------------------------------------------------------------------
*
*
*
* IDENTIFICATION
* src/include/replication/ss_cluster_replication.h
*
* ---------------------------------------------------------------------------------------
*/
#ifndef INCLUDE_REPLICATION_SS_CLUSTER_REPLICATION_H_
#define INCLUDE_REPLICATION_SS_CLUSTER_REPLICATION_H_
#include "postgres.h"
#include "replication/walprotocol.h"
#include "knl/knl_instance.h"
#include <vector>
const uint32 SS_DORADO_CTL_INFO_SIZE = 512;
#define SS_REPLICATION_DORADO_CLUSTER \
(ENABLE_DMS && ENABLE_DSS && g_instance.attr.attr_storage.ss_enable_dorado)
/* Primary Cluster in SS replication */
#define SS_REPLICATION_PRIMARY_CLUSTER \
(SS_REPLICATION_DORADO_CLUSTER && (g_instance.dms_cxt.SSReformerControl.clusterRunMode == RUN_MODE_PRIMARY))
/* Standby Cluster in SS replication */
#define SS_REPLICATION_STANDBY_CLUSTER \
(SS_REPLICATION_DORADO_CLUSTER && (g_instance.dms_cxt.SSReformerControl.clusterRunMode == RUN_MODE_STANDBY))
/* Primary node in SS replication, means primary node in main cluster. */
#define SS_REPLICATION_PRIMARY_NODE \
(SS_REPLICATION_PRIMARY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == PRIMARY_MODE))
/* Standby node in SS replication, means standby node in main cluster. */
#define SS_REPLICATION_PRIMARY_CLUSTER_STANDBY_NODE \
(SS_REPLICATION_PRIMARY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE))
/* Main standby node in SS replication, means primary node in standby cluster. */
#define SS_REPLICATION_MAIN_STANBY_NODE \
(SS_REPLICATION_STANDBY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == STANDBY_MODE))
/* Standby node in SS replication, means standby node in standby cluster. */
#define SS_REPLICATION_STANDBY_CLUSTER_STANDBY_NODE \
(SS_REPLICATION_STANDBY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE))
/* All Standby in SS replication, means nodes other than primary node in primary cluster and standby cluster */
#define SS_REPLICATION_STANBY_NODE \
(SS_REPLICATION_DORADO_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE))
void SSClusterDoradoStorageInit();
void InitSSDoradoCtlInfo(ShareStorageXLogCtl *ctlInfo, uint64 sysidentifier);
void UpdateSSDoradoCtlInfoAndSync();
void ReadSSDoradoCtlInfoFile();
void CheckSSDoradoCtlInfo(XLogRecPtr localEnd);
#endif // INCLUDE_REPLICATION_SS_CLUSTER_REPLICATION_H_

View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
* Portions Copyright (c) 2021, openGauss Contributors
*
* Description: 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.
* ---------------------------------------------------------------------------------------
*
*
*
* IDENTIFICATION
* src/include/replication/ss_disaster_cluster.h
*
* ---------------------------------------------------------------------------------------
*/
#ifndef INCLUDE_SS_DISASTER_CLUSTER_H_
#define INCLUDE_SS_DISASTER_CLUSTER_H_
#include "postgres.h"
#include "replication/walprotocol.h"
#include "knl/knl_instance.h"
/* stream cluster in share storage mode */
#define SS_STREAM_CLUSTER \
(ENABLE_DSS && g_instance.attr.attr_storage.ss_stream_cluster)
/* Primary Cluster in SS disaster */
#define SS_STREAM_PRIMARY_CLUSTER \
(SS_STREAM_CLUSTER && (g_instance.dms_cxt.SSReformerControl.clusterRunMode == RUN_MODE_PRIMARY))
/* Standby Cluster in SS disaster */
#define SS_STREAM_STANDBY_CLUSTER \
(SS_STREAM_CLUSTER && (g_instance.dms_cxt.SSReformerControl.clusterRunMode == RUN_MODE_STANDBY))
/* Primary node in SS disaster, means primary node in main cluster. */
#define SS_STREAM_PRIMARY_NODE \
(SS_STREAM_PRIMARY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == PRIMARY_MODE))
/* Standby node in SS disaster, means standby node in main cluster. */
#define SS_STREAM_PRIMARY_CLUSTER_STANDBY_NODE \
(SS_STREAM_PRIMARY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE))
/* Main standby node in SS disaster, means primary node in standby cluster. */
#define SS_STREAM_MAIN_STANDBY_NODE \
(SS_STREAM_STANDBY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == STANDBY_MODE))
/* Standby node in SS disaster, means standby node in standby cluster. */
#define SS_STREAM_STANDBY_CLUSTER_STANDBY_NODE \
(SS_STREAM_STANDBY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE))
/* All Standby in SS disaster, means nodes other than primary node in primary cluster and standby cluster */
#define SS_STREAM_STANDBY_NODE \
(SS_STREAM_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE))
/* dorado replication cluster in share storage mode */
const uint32 SS_DORADO_CTL_INFO_SIZE = 512;
#define SS_DORADO_CLUSTER \
(ENABLE_DMS && ENABLE_DSS && g_instance.attr.attr_storage.ss_enable_dorado)
/* Primary Cluster in SS replication */
#define SS_DORADO_PRIMARY_CLUSTER \
(SS_DORADO_CLUSTER && (g_instance.dms_cxt.SSReformerControl.clusterRunMode == RUN_MODE_PRIMARY))
/* Standby Cluster in SS replication */
#define SS_DORADO_STANDBY_CLUSTER \
(SS_DORADO_CLUSTER && (g_instance.dms_cxt.SSReformerControl.clusterRunMode == RUN_MODE_STANDBY))
/* Primary node in SS replication, means primary node in main cluster. */
#define SS_DORADO_PRIMARY_NODE \
(SS_DORADO_PRIMARY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == PRIMARY_MODE))
/* Standby node in SS replication, means standby node in main cluster. */
#define SS_DORADO_PRIMARY_CLUSTER_STANDBY_NODE \
(SS_DORADO_PRIMARY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE))
/* Main standby node in SS replication, means primary node in standby cluster. */
#define SS_DORADO_MAIN_STANDBY_NODE \
(SS_DORADO_STANDBY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == STANDBY_MODE))
/* Standby node in SS replication, means standby node in standby cluster. */
#define SS_DORADO_STANDBY_CLUSTER_STANDBY_NODE \
(SS_DORADO_STANDBY_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE))
/* All Standby in SS replication, means nodes other than primary node in primary cluster and standby cluster */
#define SS_DORADO_STANDBY_NODE \
(SS_DORADO_CLUSTER && (t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE))
/* there are some same logic between ss dorado cluster and ss stream cluster */
#define SS_DISASTER_CLUSTER (SS_DORADO_CLUSTER || SS_STREAM_CLUSTER)
#define SS_DISASTER_PRIMARY_CLUSTER (SS_DORADO_PRIMARY_CLUSTER || SS_STREAM_PRIMARY_CLUSTER)
#define SS_DISASTER_STANDBY_CLUSTER (SS_DORADO_STANDBY_CLUSTER || SS_STREAM_STANDBY_CLUSTER)
#define SS_DISASTER_PRIMARY_NODE (SS_DORADO_PRIMARY_NODE || SS_STREAM_PRIMARY_NODE)
#define SS_DISASTER_MAIN_STANDBY_NODE (SS_DORADO_MAIN_STANDBY_NODE || SS_STREAM_MAIN_STANDBY_NODE)
void SSClusterDoradoStorageInit();
void InitSSDoradoCtlInfo(ShareStorageXLogCtl *ctlInfo, uint64 sysidentifier);
void UpdateSSDoradoCtlInfoAndSync();
void ReadSSDoradoCtlInfoFile();
void CheckSSDoradoCtlInfo(XLogRecPtr localEnd);
#endif // INCLUDE_SS_DISASTER_CLUSTER_H_