summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-09-27 12:03:09 +0200
committerantirez <antirez@gmail.com>2019-09-27 12:03:09 +0200
commitde1f82aa3302461c21f6cfcb8e8972e865b02174 (patch)
tree10137b03577deb48edd48c6db7b7da7c6c9eebef
parent82845f8d045a1fdbac17cf1959ad51906a8840ed (diff)
downloadredis-de1f82aa3302461c21f6cfcb8e8972e865b02174.tar.gz
Function renamed hasForkChild() -> hasActiveChildProcess().
-rw-r--r--src/aof.c10
-rw-r--r--src/db.c2
-rw-r--r--src/defrag.c2
-rw-r--r--src/module.c2
-rw-r--r--src/rdb.c6
-rw-r--r--src/replication.c4
-rw-r--r--src/server.c14
-rw-r--r--src/server.h2
8 files changed, 21 insertions, 21 deletions
diff --git a/src/aof.c b/src/aof.c
index 8bc6c543d..4e6af7c1c 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -264,7 +264,7 @@ int startAppendOnly(void) {
strerror(errno));
return C_ERR;
}
- if (hasForkChild() && server.aof_child_pid == -1) {
+ if (hasActiveChildProcess() && server.aof_child_pid == -1) {
server.aof_rewrite_scheduled = 1;
serverLog(LL_WARNING,"AOF was enabled but there is already another background operation. An AOF background was scheduled to start when possible.");
} else {
@@ -395,7 +395,7 @@ void flushAppendOnlyFile(int force) {
* useful for graphing / monitoring purposes. */
if (sync_in_progress) {
latencyAddSampleIfNeeded("aof-write-pending-fsync",latency);
- } else if (hasForkChild()) {
+ } else if (hasActiveChildProcess()) {
latencyAddSampleIfNeeded("aof-write-active-child",latency);
} else {
latencyAddSampleIfNeeded("aof-write-alone",latency);
@@ -491,7 +491,7 @@ void flushAppendOnlyFile(int force) {
try_fsync:
/* Don't fsync if no-appendfsync-on-rewrite is set to yes and there are
* children doing I/O in the background. */
- if (server.aof_no_fsync_on_rewrite && hasForkChild())
+ if (server.aof_no_fsync_on_rewrite && hasActiveChildProcess())
return;
/* Perform the fsync if needed. */
@@ -1563,7 +1563,7 @@ void aofClosePipes(void) {
int rewriteAppendOnlyFileBackground(void) {
pid_t childpid;
- if (hasForkChild()) return C_ERR;
+ if (hasActiveChildProcess()) return C_ERR;
if (aofCreatePipes() != C_OK) return C_ERR;
openChildInfoPipe();
if ((childpid = redisFork()) == 0) {
@@ -1607,7 +1607,7 @@ int rewriteAppendOnlyFileBackground(void) {
void bgrewriteaofCommand(client *c) {
if (server.aof_child_pid != -1) {
addReplyError(c,"Background append only file rewriting already in progress");
- } else if (hasForkChild()) {
+ } else if (hasActiveChildProcess()) {
server.aof_rewrite_scheduled = 1;
addReplyStatus(c,"Background append only file rewriting scheduled");
} else if (rewriteAppendOnlyFileBackground() == C_OK) {
diff --git a/src/db.c b/src/db.c
index a46e0251f..afedc6aec 100644
--- a/src/db.c
+++ b/src/db.c
@@ -60,7 +60,7 @@ robj *lookupKey(redisDb *db, robj *key, int flags) {
/* Update the access time for the ageing algorithm.
* Don't do it if we have a saving child, as this will trigger
* a copy on write madness. */
- if (!hasForkChild() && !(flags & LOOKUP_NOTOUCH)){
+ if (!hasActiveChildProcess() && !(flags & LOOKUP_NOTOUCH)){
if (server.maxmemory_policy & MAXMEMORY_FLAG_LFU) {
updateLFU(val);
} else {
diff --git a/src/defrag.c b/src/defrag.c
index 93c6a4619..50f6b41f2 100644
--- a/src/defrag.c
+++ b/src/defrag.c
@@ -1039,7 +1039,7 @@ void activeDefragCycle(void) {
mstime_t latency;
int quit = 0;
- if (hasForkChild())
+ if (hasActiveChildProcess())
return; /* Defragging memory while there's a fork will just do damage. */
/* Once a second, check if we the fragmentation justfies starting a scan
diff --git a/src/module.c b/src/module.c
index cee7a85a9..4e6ad6cf9 100644
--- a/src/module.c
+++ b/src/module.c
@@ -5157,7 +5157,7 @@ int RM_CommandFilterArgDelete(RedisModuleCommandFilterCtx *fctx, int pos)
int RM_Fork(RedisModuleForkDoneHandler cb, void *user_data)
{
pid_t childpid;
- if (hasForkChild()) {
+ if (hasActiveChildProcess()) {
return -1;
}
diff --git a/src/rdb.c b/src/rdb.c
index e1cedf6f9..e430bcd58 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -1336,7 +1336,7 @@ werr:
int rdbSaveBackground(char *filename, rdbSaveInfo *rsi) {
pid_t childpid;
- if (hasForkChild()) return C_ERR;
+ if (hasActiveChildProcess()) return C_ERR;
server.dirty_before_bgsave = server.dirty;
server.lastbgsave_try = time(NULL);
@@ -2417,7 +2417,7 @@ int rdbSaveToSlavesSockets(rdbSaveInfo *rsi) {
pid_t childpid;
int pipefds[2];
- if (hasForkChild()) return C_ERR;
+ if (hasActiveChildProcess()) return C_ERR;
/* Before to fork, create a pipe that will be used in order to
* send back to the parent the IDs of the slaves that successfully
@@ -2584,7 +2584,7 @@ void bgsaveCommand(client *c) {
if (server.rdb_child_pid != -1) {
addReplyError(c,"Background save already in progress");
- } else if (hasForkChild()) {
+ } else if (hasActiveChildProcess()) {
if (schedule) {
server.rdb_bgsave_scheduled = 1;
addReplyStatus(c,"Background saving scheduled");
diff --git a/src/replication.c b/src/replication.c
index 8039e06ae..76090a9e5 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -751,7 +751,7 @@ void syncCommand(client *c) {
/* Target is disk (or the slave is not capable of supporting
* diskless replication) and we don't have a BGSAVE in progress,
* let's start one. */
- if (!hasForkChild()) {
+ if (!hasActiveChildProcess()) {
startBgsaveForReplication(c->slave_capa);
} else {
serverLog(LL_NOTICE,
@@ -2930,7 +2930,7 @@ void replicationCron(void) {
* In case of diskless replication, we make sure to wait the specified
* number of seconds (according to configuration) so that other slaves
* have the time to arrive before we start streaming. */
- if (!hasForkChild()) {
+ if (!hasActiveChildProcess()) {
time_t idle, max_idle = 0;
int slaves_waiting = 0;
int mincapa = -1;
diff --git a/src/server.c b/src/server.c
index 046694e1f..b2ab653a2 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1449,13 +1449,13 @@ int incrementallyRehash(int dbid) {
* for dict.c to resize the hash tables accordingly to the fact we have o not
* running childs. */
void updateDictResizePolicy(void) {
- if (!hasForkChild())
+ if (!hasActiveChildProcess())
dictEnableResize();
else
dictDisableResize();
}
-int hasForkChild() {
+int hasActiveChildProcess() {
return server.rdb_child_pid != -1 ||
server.aof_child_pid != -1 ||
server.module_child_pid != -1;
@@ -1697,7 +1697,7 @@ void databasesCron(void) {
/* Perform hash tables rehashing if needed, but only if there are no
* other processes saving the DB on disk. Otherwise rehashing is bad
* as will cause a lot of copy-on-write of memory pages. */
- if (!hasForkChild()) {
+ if (!hasActiveChildProcess()) {
/* We use global counters so if we stop the computation at a given
* DB we'll be able to start from the successive in the next
* cron loop iteration. */
@@ -1894,14 +1894,14 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
/* Start a scheduled AOF rewrite if this was requested by the user while
* a BGSAVE was in progress. */
- if (!hasForkChild() &&
+ if (!hasActiveChildProcess() &&
server.aof_rewrite_scheduled)
{
rewriteAppendOnlyFileBackground();
}
/* Check if a background saving or AOF rewrite in progress terminated. */
- if (hasForkChild() || ldbPendingChildren())
+ if (hasActiveChildProcess() || ldbPendingChildren())
{
int statloc;
pid_t pid;
@@ -1975,7 +1975,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
/* Trigger an AOF rewrite if needed. */
if (server.aof_state == AOF_ON &&
- !hasForkChild() &&
+ !hasActiveChildProcess() &&
server.aof_rewrite_perc &&
server.aof_current_size > server.aof_rewrite_min_size)
{
@@ -2033,7 +2033,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
* Note: this code must be after the replicationCron() call above so
* make sure when refactoring this file to keep this order. This is useful
* because we want to give priority to RDB savings for replication. */
- if (!hasForkChild() &&
+ if (!hasActiveChildProcess() &&
server.rdb_bgsave_scheduled &&
(server.unixtime-server.lastbgsave_try > CONFIG_BGSAVE_RETRY_DELAY ||
server.lastbgsave_status == C_OK))
diff --git a/src/server.h b/src/server.h
index c701d6d21..2ab3f2b45 100644
--- a/src/server.h
+++ b/src/server.h
@@ -1818,7 +1818,7 @@ void receiveChildInfo(void);
/* Fork helpers */
int redisFork();
-int hasForkChild();
+int hasActiveChildProcess();
void sendChildCOWInfo(int ptype, char *pname);
/* acl.c -- Authentication related prototypes. */