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; }