Skip to content
Snippets Groups Projects
Commit dfb21acb authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

recovery: restore recovery_atfork()

There is still a valid case for fork() after start, it's box.coredump().

The assert that replaced recovery_atfork() call would sporadically fail
even in our own test suite.

Revert the change.
parent 298df246
No related branches found
No related tags found
No related merge requests found
......@@ -502,7 +502,8 @@ box_load_cfg()
void
box_atfork()
{
assert(recovery == NULL);
/* box.coredump() forks to save a core. */
recovery_atfork(recovery);
}
int
......
......@@ -242,6 +242,18 @@ recovery_exit(struct recovery_state *r)
recovery_delete(r);
}
void
recovery_atfork(struct recovery_state *r)
{
xlog_atfork(&r->current_wal);
/*
* Make sure that atexit() handlers in the child do
* not try to stop the non-existent thread.
* The writer is not used in the child.
*/
r->writer = NULL;
}
void
recovery_apply_row(struct recovery_state *r, struct xrow_header *row)
{
......
......@@ -158,6 +158,12 @@ recovery_apply_row(struct recovery_state *r, struct xrow_header *packet);
int64_t
recovery_last_checkpoint(struct recovery_state *r);
/**
* Ensure we don't corrupt the current WAL file in the child.
*/
void
recovery_atfork(struct recovery_state *r);
#if defined(__cplusplus)
} /* extern "C" */
#endif /* defined(__cplusplus) */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment