summaryrefslogtreecommitdiff
path: root/src/replication.c
diff options
context:
space:
mode:
authorJohannes Truschnigg <johannes@truschnigg.info>2019-04-27 18:07:30 +0200
committermax ulidtko <ulidtko@gmail.com>2019-11-19 18:55:44 +0200
commit641c64ada10404356fc76c0b56a69b32c76f253c (patch)
treea1310ebd0116c69bd3953afcc8590ceb1a52835a /src/replication.c
parent45025713a8b284d649af540c0cab2e5af52e1a9f (diff)
downloadredis-641c64ada10404356fc76c0b56a69b32c76f253c.tar.gz
Use libsystemd's sd_notify for communicating redis status to systemd
Instead of replicating a subset of libsystemd's sd_notify(3) internally, use the dynamic library provided by systemd to communicate with the service manager. When systemd supervision was auto-detected or configured, communicate the actual server status (i.e. "Loading dataset", "Waiting for master<->replica sync") to systemd, instead of declaring readiness right after initializing the server process.
Diffstat (limited to 'src/replication.c')
-rw-r--r--src/replication.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/replication.c b/src/replication.c
index c9a2e0fe1..68dc77a61 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -1665,6 +1665,11 @@ void readSyncBulkPayload(connection *conn) {
if (server.repl_backlog == NULL) createReplicationBacklog();
serverLog(LL_NOTICE, "MASTER <-> REPLICA sync: Finished with success");
+ if (server.supervised_mode == SUPERVISED_SYSTEMD) {
+ redisCommunicateSystemd("STATUS=MASTER <-> REPLICA sync: Finished with success. Ready to accept connections.\n");
+ redisCommunicateSystemd("READY=1\n");
+ }
+
/* Restart the AOF subsystem now that we finished the sync. This
* will trigger an AOF rewrite, and when done will start appending
* to the new file. */