fix fclose and switch context
This commit is contained in:
@ -2720,8 +2720,14 @@ static void do_switchover(uint32 term)
|
|||||||
pg_log(PG_WARNING, _("\n switchover timeout after %d seconds. please manually check the cluster status or backtrack log.\n"), wait_seconds);
|
pg_log(PG_WARNING, _("\n switchover timeout after %d seconds. please manually check the cluster status or backtrack log.\n"), wait_seconds);
|
||||||
|
|
||||||
if ((sofile = fopen(switchover_timeout_file, "w")) == NULL) {
|
if ((sofile = fopen(switchover_timeout_file, "w")) == NULL) {
|
||||||
pg_log(
|
pg_log(PG_WARNING, _(" could not create switchover timeout signal file \"%s\": %s\n"),
|
||||||
PG_WARNING, _(" could not create switchover timeout signal file \"%s\": %s\n"), switchover_timeout_file, strerror(errno));
|
switchover_timeout_file, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (fclose(sofile)) {
|
||||||
|
pg_log(PG_WARNING, _(" could not write switchover timeout signal file \"%s\": %s\n"), switchover_timeout_file,
|
||||||
|
strerror(errno));
|
||||||
|
sofile = NULL;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
sig = SIGUSR1;
|
sig = SIGUSR1;
|
||||||
|
@ -662,7 +662,6 @@ void print_all_stack()
|
|||||||
PG_CATCH();
|
PG_CATCH();
|
||||||
{
|
{
|
||||||
/* Must reset elog.c's state */
|
/* Must reset elog.c's state */
|
||||||
(void)MemoryContextSwitchTo(g_instance.stat_cxt.GsStackContext);
|
|
||||||
ErrorData* edata = CopyErrorData();
|
ErrorData* edata = CopyErrorData();
|
||||||
FlushErrorState();
|
FlushErrorState();
|
||||||
appendStringInfo(&result, "%s", edata->message);
|
appendStringInfo(&result, "%s", edata->message);
|
||||||
|
Reference in New Issue
Block a user