解决issue:故障注入服务器重启后openGauss启动异常

This commit is contained in:
lukeman
2023-12-21 16:48:38 +08:00
committed by zhang_xubo
parent e2a141d881
commit a8c7759c7c

View File

@ -927,7 +927,7 @@ bool SetDBStateFileState(DbState state, bool optional)
securec_check_intval(rc, , false);
/* Write the new content into a temp file and rename it at last. */
int fd = open(gaussdb_state_file, O_RDWR, 0);
int fd = open(gaussdb_state_file, O_RDONLY, 0);
if (fd == -1) {
if (errno == ENOENT && optional) {
write_stderr("gaussdb.state does not exist, and skipt setting since it is optional.");
@ -945,7 +945,7 @@ bool SetDBStateFileState(DbState state, bool optional)
write_stderr("Failed to read gaussdb.state: %d, len: %d", errno, len);
(void)close(fd);
(void)unlink(gaussdb_state_file);
return false;
return true;
}
if (close(fd) != 0) {