1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-recoverd: Add log reopening on SIGHUP to helpers

Recovery and takeover helpers can run for a while and generate
non-trivial logs.  They should support log reopening.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2021-09-30 21:14:14 +10:00 committed by Amitay Isaacs
parent 51f0380e83
commit 97a45f6f25
2 changed files with 15 additions and 0 deletions

View File

@ -3121,6 +3121,7 @@ int main(int argc, char *argv[])
TALLOC_CTX *mem_ctx = NULL; TALLOC_CTX *mem_ctx = NULL;
struct tevent_context *ev; struct tevent_context *ev;
struct ctdb_client_context *client; struct ctdb_client_context *client;
bool status;
int ret = 0; int ret = 0;
struct tevent_req *req; struct tevent_req *req;
uint32_t generation; uint32_t generation;
@ -3160,6 +3161,12 @@ int main(int argc, char *argv[])
goto failed; goto failed;
} }
status = logging_setup_sighup_handler(ev, mem_ctx, NULL, NULL);
if (!status) {
D_ERR("logging_setup_sighup_handler() failed\n");
goto failed;
}
ret = ctdb_client_init(mem_ctx, ev, sockpath, &client); ret = ctdb_client_init(mem_ctx, ev, sockpath, &client);
if (ret != 0) { if (ret != 0) {
D_ERR("ctdb_client_init() failed, ret=%d\n", ret); D_ERR("ctdb_client_init() failed, ret=%d\n", ret);

View File

@ -1193,6 +1193,7 @@ int main(int argc, const char *argv[])
TALLOC_CTX *mem_ctx; TALLOC_CTX *mem_ctx;
struct tevent_context *ev; struct tevent_context *ev;
struct ctdb_client_context *client; struct ctdb_client_context *client;
bool status;
int ret; int ret;
struct tevent_req *req; struct tevent_req *req;
uint32_t *force_rebalance_nodes = NULL; uint32_t *force_rebalance_nodes = NULL;
@ -1235,6 +1236,13 @@ int main(int argc, const char *argv[])
goto done; goto done;
} }
status = logging_setup_sighup_handler(ev, mem_ctx, NULL, NULL);
if (!status) {
D_ERR("logging_setup_sighup_handler() failed\n");
ret = ENOMEM;
goto done;
}
ret = ctdb_client_init(mem_ctx, ev, sockpath, &client); ret = ctdb_client_init(mem_ctx, ev, sockpath, &client);
if (ret != 0) { if (ret != 0) {
D_ERR("ctdb_client_init() failed, ret=%d\n", ret); D_ERR("ctdb_client_init() failed, ret=%d\n", ret);