From 6f266bcb3e118e9b57d0e9fc3c96b17b17f475ef Mon Sep 17 00:00:00 2001 From: chenzhikai <895543892@qq.com> Date: Thu, 2 Nov 2023 17:29:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=8C=E9=9B=86=E7=BE=A4ct?= =?UTF-8?q?linfo=E6=9B=B4=E6=96=B0=EF=BC=8C=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ddes/adapter/ss_reform_common.cpp | 4 +- .../storage/access/transam/xlog.cpp | 63 ------------------- .../replication/ss_cluster_replication.cpp | 2 +- 3 files changed, 3 insertions(+), 66 deletions(-) diff --git a/src/gausskernel/ddes/adapter/ss_reform_common.cpp b/src/gausskernel/ddes/adapter/ss_reform_common.cpp index 22407f41a..7dc9892a0 100644 --- a/src/gausskernel/ddes/adapter/ss_reform_common.cpp +++ b/src/gausskernel/ddes/adapter/ss_reform_common.cpp @@ -278,12 +278,12 @@ void SSUpdateReformerCtrl() } if (fd < 0) { - ereport(FATAL, (errcode_for_file_access(), errmsg("could not open control file \"%s\": %m", fname[i]))); + ereport(FATAL, (errcode_for_file_access(), errmsg("could not open control file \"%s\": %s", fname[i], TRANSLATE_ERRNO))); } SSWriteInstanceControlFile(fd, buffer, REFORM_CTRL_PAGE, write_size); if (close(fd)) { - ereport(PANIC, (errcode_for_file_access(), errmsg("could not close control file: %m"))); + ereport(PANIC, (errcode_for_file_access(), errmsg("could not close control file: %s", TRANSLATE_ERRNO))); } } } diff --git a/src/gausskernel/storage/access/transam/xlog.cpp b/src/gausskernel/storage/access/transam/xlog.cpp index 1de7a444b..050c7bb8a 100755 --- a/src/gausskernel/storage/access/transam/xlog.cpp +++ b/src/gausskernel/storage/access/transam/xlog.cpp @@ -6633,35 +6633,6 @@ static uint64 GetMACAddr(void) return macAddr; } -void UpdateCtlInfoToFile(ShareStorageXLogCtl *ctlInfo) -{ - int fd = BasicOpenFile(SS_DORADO_CTRL_FILE, O_RDWR | PG_BINARY | O_DIRECT, S_IRUSR | S_IWUSR); - if (fd < 0) { - ereport(FATAL, (errcode_for_file_access(), errmsg("could not open ss ctl into file \"%s\": %s", SS_DORADO_CTRL_FILE, TRANSLATE_ERRNO))); - } - - Assert(fd > 0); - - errno = EOK; - if (pwrite(fd, ctlInfo, SS_DORADO_CTL_INFO_SIZE, 0) != SS_DORADO_CTL_INFO_SIZE) { - if (errno == 0) { - errno = ENOSPC; - } - ereport(PANIC, (errcode_for_file_access(), errmsg("could not write to ss ctl info file: %s", TRANSLATE_ERRNO))); - } - - if (pg_fsync(fd) != 0) { - int save_errno = errno; - close(fd); - errno = save_errno; - ereport(PANIC, (errcode_for_file_access(), errmsg("could not fsync ss ctl info file: %s", TRANSLATE_ERRNO))); - } - - if (close(fd)) { - ereport(ERROR, (errcode_for_file_access(), errmsg("could not close file \"%s\": %s", SS_DORADO_CTRL_FILE, TRANSLATE_ERRNO))); - } -} - /* * This func must be called ONCE on system install. It creates pg_control * and the initial XLOG segment. @@ -19053,40 +19024,6 @@ void UpdatePostgresqlFile(const char *optName, const char *gucLine) release_file_lock(&filelock); } -void SSWriteDoradoCtlInfoFile(int fd, char* buffer) -{ - Assert(ENABLE_DSS && SS_REPLICATION_DORADO_CLUSTER); - Assert(fd > 0); - errno = EOK; - if (pwrite(fd, buffer, SS_DORADO_CTL_INFO_SIZE, 0) != SS_DORADO_CTL_INFO_SIZE) { - if (errno == 0) { - errno = ENOSPC; - } - ereport(PANIC, (errcode_for_file_access(), errmsg("could not write to ss ctl info file: %s", TRANSLATE_ERRNO))); - } - - if (pg_fsync(fd) != 0) { - ereport(PANIC, (errcode_for_file_access(), errmsg("could not fsync ss ctl info file: %s", TRANSLATE_ERRNO))); - } -} - -void SSReadDoradoCtlInfoFile() -{ - Assert(ENABLE_DSS && SS_REPLICATION_DORADO_CLUSTER); - int fd = BasicOpenFile(SS_DORADO_CTRL_FILE, O_RDWR | PG_BINARY | O_DIRECT, S_IRUSR | S_IWUSR); - if (fd < 0) { - ereport(FATAL, (errcode_for_file_access(), errmsg("could not open ss ctl into file \"%s\": %s", - SS_DORADO_CTRL_FILE, TRANSLATE_ERRNO))); - } - int readSize = CalShareStorageCtlSize(); - char buffer[readSize] __attribute__ ((__aligned__(ALIGNOF_BUFFER))); - - if (pread(fd, buffer, SS_DORADO_CTL_INFO_SIZE, 0) != SS_DORADO_CTL_INFO_SIZE) { - ereport(PANIC, (errcode_for_file_access(), errmsg("could not read ss ctl into file: %s", TRANSLATE_ERRNO))); - } - -} - void NormalClusterDoradoStorageInit() { bool found = false; diff --git a/src/gausskernel/storage/replication/ss_cluster_replication.cpp b/src/gausskernel/storage/replication/ss_cluster_replication.cpp index b61e2dcc6..dd7beafa9 100644 --- a/src/gausskernel/storage/replication/ss_cluster_replication.cpp +++ b/src/gausskernel/storage/replication/ss_cluster_replication.cpp @@ -169,7 +169,7 @@ void SSClusterDoradoStorageInit() void UpdateSSDoradoCtlInfoAndSync() { - if (!SS_REPLICATION_DORADO_CLUSTER) { + if (!SS_REPLICATION_PRIMARY_NODE) { return; }