summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2019-11-19 17:59:29 +0200
committerOran Agra <oran@redislabs.com>2019-11-19 17:59:29 +0200
commit8d8d68ddf39f902a2ca085f1e94479e6c2e1efc3 (patch)
tree703ad12f568d00bd25fb8196cb15a281c46bfbef
parent7a7fbe708a31bc1e9b152b37b01f32900b5f5237 (diff)
downloadredis-8d8d68ddf39f902a2ca085f1e94479e6c2e1efc3.tar.gz
module documentation mismatches: loading and fork child for 5.0 branch
loading flag was missing from docs, and fork chidl indicator was removed from the code but left int he doc and header, re-adding it to the doc together with the missing function that was needed for it to work.
-rw-r--r--src/module.c5
-rw-r--r--src/server.c5
-rw-r--r--src/server.h1
3 files changed, 11 insertions, 0 deletions
diff --git a/src/module.c b/src/module.c
index 12b30d215..dd323e823 100644
--- a/src/module.c
+++ b/src/module.c
@@ -1518,6 +1518,8 @@ int RM_GetSelectedDb(RedisModuleCtx *ctx) {
* * REDISMODULE_CTX_FLAGS_OOM_WARNING: Less than 25% of memory remains before
* reaching the maxmemory level.
*
+ * * REDISMODULE_CTX_FLAGS_LOADING: Server is loading RDB/AOF
+ *
* * REDISMODULE_CTX_FLAGS_REPLICA_IS_STALE: No active link with the master.
*
* * REDISMODULE_CTX_FLAGS_REPLICA_IS_CONNECTING: The replica is trying to
@@ -1596,6 +1598,9 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) {
if (retval == C_ERR) flags |= REDISMODULE_CTX_FLAGS_OOM;
if (level > 0.75) flags |= REDISMODULE_CTX_FLAGS_OOM_WARNING;
+ /* Presence of children processes. */
+ if (hasActiveChildProcess()) flags |= REDISMODULE_CTX_FLAGS_ACTIVE_CHILD;
+
return flags;
}
diff --git a/src/server.c b/src/server.c
index caf943f80..7f735d638 100644
--- a/src/server.c
+++ b/src/server.c
@@ -779,6 +779,11 @@ void updateDictResizePolicy(void) {
dictDisableResize();
}
+int hasActiveChildProcess() {
+ return server.rdb_child_pid != -1 ||
+ server.aof_child_pid != -1;
+}
+
/* ======================= Cron: called every 100 ms ======================== */
/* Add a sample to the operations per second array of samples. */
diff --git a/src/server.h b/src/server.h
index 8c0ec3809..3c91d9680 100644
--- a/src/server.h
+++ b/src/server.h
@@ -1653,6 +1653,7 @@ void openChildInfoPipe(void);
void closeChildInfoPipe(void);
void sendChildInfo(int process_type);
void receiveChildInfo(void);
+int hasActiveChildProcess();
/* Sorted sets data type */