]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-recoverd: Add log reopening on SIGHUP to helpers
authorMartin Schwenke <martin@meltin.net>
Thu, 30 Sep 2021 11:14:14 +0000 (21:14 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 17 Jan 2022 03:43:30 +0000 (03:43 +0000)
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>
ctdb/server/ctdb_recovery_helper.c
ctdb/server/ctdb_takeover_helper.c

index aa41aca8680e35c30c07ba3042e376bdf34cc60e..e0d32199ab90413e68f08b1d6a017f6b23997ba9 100644 (file)
@@ -3121,6 +3121,7 @@ int main(int argc, char *argv[])
        TALLOC_CTX *mem_ctx = NULL;
        struct tevent_context *ev;
        struct ctdb_client_context *client;
+       bool status;
        int ret = 0;
        struct tevent_req *req;
        uint32_t generation;
@@ -3160,6 +3161,12 @@ int main(int argc, char *argv[])
                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);
        if (ret != 0) {
                D_ERR("ctdb_client_init() failed, ret=%d\n", ret);
index ab8fb9bbe24ae290dbfa4632018b33cc3558e1a3..c088970e256218665fedb1a3b6213c28b75dd1e7 100644 (file)
@@ -1193,6 +1193,7 @@ int main(int argc, const char *argv[])
        TALLOC_CTX *mem_ctx;
        struct tevent_context *ev;
        struct ctdb_client_context *client;
+       bool status;
        int ret;
        struct tevent_req *req;
        uint32_t *force_rebalance_nodes = NULL;
@@ -1235,6 +1236,13 @@ int main(int argc, const char *argv[])
                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);
        if (ret != 0) {
                D_ERR("ctdb_client_init() failed, ret=%d\n", ret);