summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-07-26 15:17:43 +0200
committerantirez <antirez@gmail.com>2015-07-26 15:17:43 +0200
commit424fe9afd9264991cddb502204276a244537c87f (patch)
tree530dcf334ec06bfedb23950ac8899a749e408b3b
parentcef054e86856463d3e79d4a5048507377c85eab7 (diff)
downloadredis-424fe9afd9264991cddb502204276a244537c87f.tar.gz
RDMF: redisLog -> serverLog.
-rw-r--r--src/aof.c86
-rw-r--r--src/bio.c10
-rw-r--r--src/cluster.c140
-rw-r--r--src/config.c12
-rw-r--r--src/debug.c120
-rw-r--r--src/networking.c26
-rw-r--r--src/rdb.c54
-rw-r--r--src/redis-check-rdb.c14
-rw-r--r--src/replication.c162
-rw-r--r--src/scripting.c8
-rw-r--r--src/sentinel.c24
-rw-r--r--src/server.c120
-rw-r--r--src/server.h12
-rw-r--r--src/t_hash.c2
14 files changed, 395 insertions, 395 deletions
diff --git a/src/aof.c b/src/aof.c
index 4a6ad6d5d..7d7870908 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -152,7 +152,7 @@ void aofRewriteBufferAppend(unsigned char *s, unsigned long len) {
if (((numblocks+1) % 10) == 0) {
int level = ((numblocks+1) % 100) == 0 ? REDIS_WARNING :
REDIS_NOTICE;
- redisLog(level,"Background AOF buffer size: %lu MB",
+ serverLog(level,"Background AOF buffer size: %lu MB",
aofRewriteBufferSize()/(1024*1024));
}
}
@@ -216,7 +216,7 @@ void stopAppendOnly(void) {
if (server.aof_child_pid != -1) {
int statloc;
- redisLog(REDIS_NOTICE,"Killing running AOF rewrite child: %ld",
+ serverLog(REDIS_NOTICE,"Killing running AOF rewrite child: %ld",
(long) server.aof_child_pid);
if (kill(server.aof_child_pid,SIGUSR1) != -1)
wait3(&statloc,0,NULL);
@@ -237,12 +237,12 @@ int startAppendOnly(void) {
server.aof_fd = open(server.aof_filename,O_WRONLY|O_APPEND|O_CREAT,0644);
redisAssert(server.aof_state == REDIS_AOF_OFF);
if (server.aof_fd == -1) {
- redisLog(REDIS_WARNING,"Redis needs to enable the AOF but can't open the append only file: %s",strerror(errno));
+ serverLog(REDIS_WARNING,"Redis needs to enable the AOF but can't open the append only file: %s",strerror(errno));
return REDIS_ERR;
}
if (rewriteAppendOnlyFileBackground() == REDIS_ERR) {
close(server.aof_fd);
- redisLog(REDIS_WARNING,"Redis needs to enable the AOF but can't trigger a background AOF rewrite operation. Check the above logs for more info about the error.");
+ serverLog(REDIS_WARNING,"Redis needs to enable the AOF but can't trigger a background AOF rewrite operation. Check the above logs for more info about the error.");
return REDIS_ERR;
}
/* We correctly switched on AOF, now wait for the rewrite to be complete
@@ -298,7 +298,7 @@ void flushAppendOnlyFile(int force) {
/* Otherwise fall trough, and go write since we can't wait
* over two seconds. */
server.aof_delayed_fsync++;
- redisLog(REDIS_NOTICE,"Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.");
+ serverLog(REDIS_NOTICE,"Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.");
}
}
/* We want to perform a single write. This should be guaranteed atomic
@@ -340,13 +340,13 @@ void flushAppendOnlyFile(int force) {
/* Log the AOF write error and record the error code. */
if (nwritten == -1) {
if (can_log) {
- redisLog(REDIS_WARNING,"Error writing to the AOF file: %s",
+ serverLog(REDIS_WARNING,"Error writing to the AOF file: %s",
strerror(errno));
server.aof_last_write_errno = errno;
}
} else {
if (can_log) {
- redisLog(REDIS_WARNING,"Short write while writing to "
+ serverLog(REDIS_WARNING,"Short write while writing to "
"the AOF file: (nwritten=%lld, "
"expected=%lld)",
(long long)nwritten,
@@ -355,7 +355,7 @@ void flushAppendOnlyFile(int force) {
if (ftruncate(server.aof_fd, server.aof_current_size) == -1) {
if (can_log) {
- redisLog(REDIS_WARNING, "Could not remove short write "
+ serverLog(REDIS_WARNING, "Could not remove short write "
"from the append-only file. Redis may refuse "
"to load the AOF the next time it starts. "
"ftruncate: %s", strerror(errno));
@@ -374,7 +374,7 @@ void flushAppendOnlyFile(int force) {
* reply for the client is already in the output buffers, and we
* have the contract with the user that on acknowledged write data
* is synced on disk. */
- redisLog(REDIS_WARNING,"Can't recover from AOF write error when the AOF fsync policy is 'always'. Exiting...");
+ serverLog(REDIS_WARNING,"Can't recover from AOF write error when the AOF fsync policy is 'always'. Exiting...");
exit(1);
} else {
/* Recover from failed write leaving data into the buffer. However
@@ -394,7 +394,7 @@ void flushAppendOnlyFile(int force) {
/* Successful write(2). If AOF was in error state, restore the
* OK state and log the event. */
if (server.aof_last_write_status == REDIS_ERR) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"AOF write error looks solved, Redis can write again.");
server.aof_last_write_status = REDIS_OK;
}
@@ -611,7 +611,7 @@ int loadAppendOnlyFile(char *filename) {
}
if (fp == NULL) {
- redisLog(REDIS_WARNING,"Fatal error: can't open the append log file for reading: %s",strerror(errno));
+ serverLog(REDIS_WARNING,"Fatal error: can't open the append log file for reading: %s",strerror(errno));
exit(1);
}
@@ -677,7 +677,7 @@ int loadAppendOnlyFile(char *filename) {
/* Command lookup */
cmd = lookupCommand(argv[0]->ptr);
if (!cmd) {
- redisLog(REDIS_WARNING,"Unknown command '%s' reading the append only file", (char*)argv[0]->ptr);
+ serverLog(REDIS_WARNING,"Unknown command '%s' reading the append only file", (char*)argv[0]->ptr);
exit(1);
}
@@ -710,40 +710,40 @@ loaded_ok: /* DB loaded, cleanup and return REDIS_OK to the caller. */
readerr: /* Read error. If feof(fp) is true, fall through to unexpected EOF. */
if (!feof(fp)) {
- redisLog(REDIS_WARNING,"Unrecoverable error reading the append only file: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Unrecoverable error reading the append only file: %s", strerror(errno));
exit(1);
}
uxeof: /* Unexpected AOF end of file. */
if (server.aof_load_truncated) {
- redisLog(REDIS_WARNING,"!!! Warning: short read while loading the AOF file !!!");
- redisLog(REDIS_WARNING,"!!! Truncating the AOF at offset %llu !!!",
+ serverLog(REDIS_WARNING,"!!! Warning: short read while loading the AOF file !!!");
+ serverLog(REDIS_WARNING,"!!! Truncating the AOF at offset %llu !!!",
(unsigned long long) valid_up_to);
if (valid_up_to == -1 || truncate(filename,valid_up_to) == -1) {
if (valid_up_to == -1) {
- redisLog(REDIS_WARNING,"Last valid command offset is invalid");
+ serverLog(REDIS_WARNING,"Last valid command offset is invalid");
} else {
- redisLog(REDIS_WARNING,"Error truncating the AOF file: %s",
+ serverLog(REDIS_WARNING,"Error truncating the AOF file: %s",
strerror(errno));
}
} else {
/* Make sure the AOF file descriptor points to the end of the
* file after the truncate call. */
if (server.aof_fd != -1 && lseek(server.aof_fd,0,SEEK_END) == -1) {
- redisLog(REDIS_WARNING,"Can't seek the end of the AOF file: %s",
+ serverLog(REDIS_WARNING,"Can't seek the end of the AOF file: %s",
strerror(errno));
} else {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"AOF loaded anyway because aof-load-truncated is enabled");
goto loaded_ok;
}
}
}
- redisLog(REDIS_WARNING,"Unexpected end of file reading the append only file. You can: 1) Make a backup of your AOF file, then use ./redis-check-aof --fix <filename>. 2) Alternatively you can set the 'aof-load-truncated' configuration option to yes and restart the server.");
+ serverLog(REDIS_WARNING,"Unexpected end of file reading the append only file. You can: 1) Make a backup of your AOF file, then use ./redis-check-aof --fix <filename>. 2) Alternatively you can set the 'aof-load-truncated' configuration option to yes and restart the server.");
exit(1);
fmterr: /* Format error. */
- redisLog(REDIS_WARNING,"Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>");
+ serverLog(REDIS_WARNING,"Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>");
exit(1);
}
@@ -1011,7 +1011,7 @@ int rewriteAppendOnlyFile(char *filename) {
snprintf(tmpfile,256,"temp-rewriteaof-%d.aof", (int) getpid());
fp = fopen(tmpfile,"w");
if (!fp) {
- redisLog(REDIS_WARNING, "Opening the temp file for AOF rewrite in rewriteAppendOnlyFile(): %s", strerror(errno));
+ serverLog(REDIS_WARNING, "Opening the temp file for AOF rewrite in rewriteAppendOnlyFile(): %s", strerror(errno));
return REDIS_ERR;
}
@@ -1118,13 +1118,13 @@ int rewriteAppendOnlyFile(char *filename) {
* the child will eventually get terminated. */
if (syncRead(server.aof_pipe_read_ack_from_parent,&byte,1,5000) != 1 ||
byte != '!') goto werr;
- redisLog(REDIS_NOTICE,"Parent agreed to stop sending diffs. Finalizing AOF...");
+ serverLog(REDIS_NOTICE,"Parent agreed to stop sending diffs. Finalizing AOF...");
/* Read the final diff if any. */
aofReadDiffFromParent();
/* Write the received diff to the file. */
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Concatenating %.2f MB of AOF diff received from parent.",
(double) sdslen(server.aof_child_diff) / (1024*1024));
if (rioWrite(&aof,server.aof_child_diff,sdslen(server.aof_child_diff)) == 0)
@@ -1138,15 +1138,15 @@ int rewriteAppendOnlyFile(char *filename) {
/* Use RENAME to make sure the DB file is changed atomically only
* if the generate DB file is ok. */
if (rename(tmpfile,filename) == -1) {
- redisLog(REDIS_WARNING,"Error moving temp append only file on the final destination: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Error moving temp append only file on the final destination: %s", strerror(errno));
unlink(tmpfile);
return REDIS_ERR;
}
- redisLog(REDIS_NOTICE,"SYNC append only file rewrite performed");
+ serverLog(REDIS_NOTICE,"SYNC append only file rewrite performed");
return REDIS_OK;
werr:
- redisLog(REDIS_WARNING,"Write error writing append only file on disk: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Write error writing append only file on disk: %s", strerror(errno));
fclose(fp);
unlink(tmpfile);
if (di) dictReleaseIterator(di);
@@ -1167,14 +1167,14 @@ void aofChildPipeReadable(aeEventLoop *el, int fd, void *privdata, int mask) {
REDIS_NOTUSED(mask);
if (read(fd,&byte,1) == 1 && byte == '!') {
- redisLog(REDIS_NOTICE,"AOF rewrite child asks to stop sending diffs.");
+ serverLog(REDIS_NOTICE,"AOF rewrite child asks to stop sending diffs.");
server.aof_stop_sending_diff = 1;
if (write(server.aof_pipe_write_ack_to_child,"!",1) != 1) {
/* If we can't send the ack, inform the user, but don't try again
* since in the other side the children will use a timeout if the
* kernel can't buffer our write, or, the children was
* terminated. */
- redisLog(REDIS_WARNING,"Can't send ACK to AOF child: %s",
+ serverLog(REDIS_WARNING,"Can't send ACK to AOF child: %s",
strerror(errno));
}
}
@@ -1210,7 +1210,7 @@ int aofCreatePipes(void) {
return REDIS_OK;
error:
- redisLog(REDIS_WARNING,"Error opening /setting AOF rewrite IPC pipes: %s",
+ serverLog(REDIS_WARNING,"Error opening /setting AOF rewrite IPC pipes: %s",
strerror(errno));
for (j = 0; j < 6; j++) if(fds[j] != -1) close(fds[j]);
return REDIS_ERR;
@@ -1261,7 +1261,7 @@ int rewriteAppendOnlyFileBackground(void) {
size_t private_dirty = zmalloc_get_private_dirty();
if (private_dirty) {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"AOF rewrite: %zu MB of memory used by copy-on-write",
private_dirty/(1024*1024));
}
@@ -1275,12 +1275,12 @@ int rewriteAppendOnlyFileBackground(void) {
server.stat_fork_rate = (double) zmalloc_used_memory() * 1000000 / server.stat_fork_time / (1024*1024*1024); /* GB per second. */
latencyAddSampleIfNeeded("fork",server.stat_fork_time/1000);
if (childpid == -1) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Can't rewrite append only file in background: fork: %s",
strerror(errno));
return REDIS_ERR;
}
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Background append only file rewriting started by pid %d",childpid);
server.aof_rewrite_scheduled = 0;
server.aof_rewrite_time_start = time(NULL);
@@ -1327,7 +1327,7 @@ void aofUpdateCurrentSize(void) {
latencyStartMonitor(latency);
if (redis_fstat(server.aof_fd,&sb) == -1) {
- redisLog(REDIS_WARNING,"Unable to obtain the AOF file length. stat: %s",
+ serverLog(REDIS_WARNING,"Unable to obtain the AOF file length. stat: %s",
strerror(errno));
} else {
server.aof_current_size = sb.st_size;
@@ -1345,7 +1345,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
long long now = ustime();
mstime_t latency;
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Background AOF rewrite terminated with success");
/* Flush the differences accumulated by the parent to the
@@ -1355,13 +1355,13 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
(int)server.aof_child_pid);
newfd = open(tmpfile,O_WRONLY|O_APPEND);
if (newfd == -1) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Unable to open the temporary AOF produced by the child: %s", strerror(errno));
goto cleanup;
}
if (aofRewriteBufferWrite(newfd) == -1) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Error trying to flush the parent diff to the rewritten AOF: %s", strerror(errno));
close(newfd);
goto cleanup;
@@ -1369,7 +1369,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
latencyEndMonitor(latency);
latencyAddSampleIfNeeded("aof-rewrite-diff-write",latency);
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Residual parent diff successfully flushed to the rewritten AOF (%.2f MB)", (double) aofRewriteBufferSize() / (1024*1024));
/* The only remaining thing to do is to rename the temporary file to
@@ -1415,7 +1415,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
* it exists, because we reference it with "oldfd". */
latencyStartMonitor(latency);
if (rename(tmpfile,server.aof_filename) == -1) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Error trying to rename the temporary AOF file: %s", strerror(errno));
close(newfd);
if (oldfd != -1) close(oldfd);
@@ -1448,7 +1448,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
server.aof_lastbgrewrite_status = REDIS_OK;
- redisLog(REDIS_NOTICE, "Background AOF rewrite finished successfully");
+ serverLog(REDIS_NOTICE, "Background AOF rewrite finished successfully");
/* Change state from WAIT_REWRITE to ON if needed */
if (server.aof_state == REDIS_AOF_WAIT_REWRITE)
server.aof_state = REDIS_AOF_ON;
@@ -1456,17 +1456,17 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
/* Asynchronously close the overwritten AOF. */
if (oldfd != -1) bioCreateBackgroundJob(REDIS_BIO_CLOSE_FILE,(void*)(long)oldfd,NULL,NULL);
- redisLog(REDIS_VERBOSE,
+ serverLog(REDIS_VERBOSE,
"Background AOF rewrite signal handler took %lldus", ustime()-now);
} else if (!bysignal && exitcode != 0) {
server.aof_lastbgrewrite_status = REDIS_ERR;
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Background AOF rewrite terminated with error");
} else {
server.aof_lastbgrewrite_status = REDIS_ERR;
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Background AOF rewrite terminated by signal %d", bysignal);
}
diff --git a/src/bio.c b/src/bio.c
index a9bccff18..e76c8f1e6 100644
--- a/src/bio.c
+++ b/src/bio.c
@@ -116,7 +116,7 @@ void bioInit(void) {
for (j = 0; j < REDIS_BIO_NUM_OPS; j++) {
void *arg = (void*)(unsigned long) j;
if (pthread_create(&thread,&attr,bioProcessBackgroundJobs,arg) != 0) {
- redisLog(REDIS_WARNING,"Fatal: Can't initialize Background Jobs.");
+ serverLog(REDIS_WARNING,"Fatal: Can't initialize Background Jobs.");
exit(1);
}
bio_threads[j] = thread;
@@ -144,7 +144,7 @@ void *bioProcessBackgroundJobs(void *arg) {
/* Check that the type is within the right interval. */
if (type >= REDIS_BIO_NUM_OPS) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Warning: bio thread started with wrong type %lu",type);
return NULL;
}
@@ -160,7 +160,7 @@ void *bioProcessBackgroundJobs(void *arg) {
sigemptyset(&sigset);
sigaddset(&sigset, SIGALRM);
if (pthread_sigmask(SIG_BLOCK, &sigset, NULL))
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Warning: can't mask SIGALRM in bio.c thread: %s", strerror(errno));
while(1) {
@@ -215,11 +215,11 @@ void bioKillThreads(void) {
for (j = 0; j < REDIS_BIO_NUM_OPS; j++) {
if (pthread_cancel(bio_threads[j]) == 0) {
if ((err = pthread_join(bio_threads[j],NULL)) != 0) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Bio thread for job type #%d can be joined: %s",
j, strerror(err));
} else {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Bio thread for job type #%d terminated",j);
}
}
diff --git a/src/cluster.c b/src/cluster.c
index f7f3da8a3..8fd5c9328 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -97,7 +97,7 @@ int clusterLoadConfig(char *filename) {
if (errno == ENOENT) {
return REDIS_ERR;
} else {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Loading the cluster node config from %s: %s",
filename, strerror(errno));
exit(1);
@@ -146,7 +146,7 @@ int clusterLoadConfig(char *filename) {
server.cluster->lastVoteEpoch =
strtoull(argv[j+1],NULL,10);
} else {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Skipping unknown cluster config variable '%s'",
argv[j]);
}
@@ -264,7 +264,7 @@ int clusterLoadConfig(char *filename) {
zfree(line);
fclose(fp);
- redisLog(REDIS_NOTICE,"Node configuration loaded, I'm %.40s", myself->name);
+ serverLog(REDIS_NOTICE,"Node configuration loaded, I'm %.40s", myself->name);
/* Something that should never happen: currentEpoch smaller than
* the max epoch found in the nodes configuration. However we handle this
@@ -275,7 +275,7 @@ int clusterLoadConfig(char *filename) {
return REDIS_OK;
fmterr:
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Unrecoverable error: corrupted cluster config file.");
zfree(line);
if (fp) fclose(fp);
@@ -343,7 +343,7 @@ err:
void clusterSaveConfigOrDie(int do_fsync) {
if (clusterSaveConfig(do_fsync) == -1) {
- redisLog(REDIS_WARNING,"Fatal: can't update cluster config file.");
+ serverLog(REDIS_WARNING,"Fatal: can't update cluster config file.");
exit(1);
}
}
@@ -368,7 +368,7 @@ int clusterLockConfig(char *filename) {
* processes. */
int fd = open(filename,O_WRONLY|O_CREAT,0644);
if (fd == -1) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Can't open %s in order to acquire a lock: %s",
filename, strerror(errno));
return REDIS_ERR;
@@ -376,13 +376,13 @@ int clusterLockConfig(char *filename) {
if (flock(fd,LOCK_EX|LOCK_NB) == -1) {
if (errno == EWOULDBLOCK) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Sorry, the cluster configuration file %s is already used "
"by a different Redis Cluster node. Please make sure that "
"different nodes use different cluster configuration "
"files.", filename);
} else {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Impossible to lock %s: %s", filename, strerror(errno));
}
close(fd);
@@ -429,7 +429,7 @@ void clusterInit(void) {
* by the createClusterNode() function. */
myself = server.cluster->myself =
createClusterNode(NULL,REDIS_NODE_MYSELF|REDIS_NODE_MASTER);
- redisLog(REDIS_NOTICE,"No cluster configuration found, I'm %.40s",
+ serverLog(REDIS_NOTICE,"No cluster configuration found, I'm %.40s",
myself->name);
clusterAddNode(myself);
saveconf = 1;
@@ -443,7 +443,7 @@ void clusterInit(void) {
* The other handshake port check is triggered too late to stop
* us from trying to use a too-high cluster port number. */
if (server.port > (65535-REDIS_CLUSTER_PORT_INCR)) {
- redisLog(REDIS_WARNING, "Redis port number too high. "
+ serverLog(REDIS_WARNING, "Redis port number too high. "
"Cluster communication port is 10,000 port "
"numbers higher than your Redis port. "
"Your Redis port number must be "
@@ -522,7 +522,7 @@ void clusterReset(int hard) {
server.cluster->currentEpoch = 0;
server.cluster->lastVoteEpoch = 0;
myself->configEpoch = 0;
- redisLog(REDIS_WARNING, "configEpoch set to 0 via CLUSTER RESET HARD");
+ serverLog(REDIS_WARNING, "configEpoch set to 0 via CLUSTER RESET HARD");
/* To change the Node ID we need to remove the old name from the
* nodes table, change the ID, and re-add back with new name. */
@@ -587,7 +587,7 @@ void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
cfd = anetTcpAccept(server.neterr, fd, cip, sizeof(cip), &cport);
if (cfd == ANET_ERR) {
if (errno != EWOULDBLOCK)
- redisLog(REDIS_VERBOSE,
+ serverLog(REDIS_VERBOSE,
"Error accepting cluster node: %s", server.neterr);
return;
}
@@ -595,7 +595,7 @@ void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
anetEnableTcpNoDelay(NULL,cfd);
/* Use non-blocking I/O for cluster messages. */
- redisLog(REDIS_VERBOSE,"Accepted cluster node %s:%d", cip, cport);
+ serverLog(REDIS_VERBOSE,"Accepted cluster node %s:%d", cip, cport);
/* Create a link object we use to handle the connection.
* It gets passed to the readable handler when data is available.
* Initiallly the link->node pointer is set to NULL as we don't know
@@ -911,7 +911,7 @@ void clusterRenameNode(clusterNode *node, char *newname) {
int retval;
sds s = sdsnewlen(node->name, REDIS_CLUSTER_NAMELEN);
- redisLog(REDIS_DEBUG,"Renaming node %.40s into %.40s",
+ serverLog(REDIS_DEBUG,"Renaming node %.40s into %.40s",
node->name, newname);
retval = dictDelete(server.cluster->nodes, s);
sdsfree(s);
@@ -980,7 +980,7 @@ int clusterBumpConfigEpochWithoutConsensus(void) {
myself->configEpoch = server.cluster->currentEpoch;
clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG|
CLUSTER_TODO_FSYNC_CONFIG);
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"New configEpoch set to %llu",
(unsigned long long) myself->configEpoch);
return REDIS_OK;
@@ -1045,7 +1045,7 @@ void clusterHandleConfigEpochCollision(clusterNode *sender) {
server.cluster->currentEpoch++;
myself->configEpoch = server.cluster->currentEpoch;
clusterSaveConfigOrDie(1);
- redisLog(REDIS_VERBOSE,
+ serverLog(REDIS_VERBOSE,
"WARNING: configEpoch collision with node %.40s."
" configEpoch set to %llu",
sender->name,
@@ -1163,7 +1163,7 @@ void markNodeAsFailingIfNeeded(clusterNode *node) {
if (nodeIsMaster(myself)) failures++;
if (failures < needed_quorum) return; /* No weak agreement from masters. */
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Marking node %.40s as failing (quorum reached).", node->name);
/* Mark the node as failing. */
@@ -1188,7 +1188,7 @@ void clearNodeFailureIfNeeded(clusterNode *node) {
/* For slaves we always clear the FAIL flag if we can contact the
* node again. */
if (nodeIsSlave(node) || node->numslots == 0) {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Clear FAIL state for node %.40s: %s is reachable again.",
node->name,
nodeIsSlave(node) ? "slave" : "master without slots");
@@ -1204,7 +1204,7 @@ void clearNodeFailureIfNeeded(clusterNode *node) {
(now - node->fail_time) >
(server.cluster_node_timeout * REDIS_CLUSTER_FAIL_UNDO_TIME_MULT))
{
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Clear FAIL state for node %.40s: is reachable again and nobody is serving its slots after some time.",
node->name);
node->flags &= ~REDIS_NODE_FAIL;
@@ -1304,7 +1304,7 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {
sds ci;
ci = representRedisNodeFlags(sdsempty(), flags);
- redisLog(REDIS_DEBUG,"GOSSIP %.40s %s:%d %s",
+ serverLog(REDIS_DEBUG,"GOSSIP %.40s %s:%d %s",
g->nodename,
g->ip,
ntohs(g->port),
@@ -1319,14 +1319,14 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {
if (sender && nodeIsMaster(sender) && node != myself) {
if (flags & (REDIS_NODE_FAIL|REDIS_NODE_PFAIL)) {
if (clusterNodeAddFailureReport(node,sender)) {
- redisLog(REDIS_VERBOSE,
+ serverLog(REDIS_VERBOSE,
"Node %.40s reported node %.40s as not reachable.",
sender->name, node->name);
}
markNodeAsFailingIfNeeded(node);
} else {
if (clusterNodeDelFailureReport(node,sender)) {
- redisLog(REDIS_VERBOSE,
+ serverLog(REDIS_VERBOSE,
"Node %.40s reported node %.40s is back online.",
sender->name, node->name);
}
@@ -1397,7 +1397,7 @@ int nodeUpdateAddressIfNeeded(clusterNode *node, clusterLink *link, int port) {
node->port = port;
if (node->link) freeClusterLink(node->link);
node->flags &= ~REDIS_NODE_NOADDR;
- redisLog(REDIS_WARNING,"Address updated for node %.40s, now %s:%d",
+ serverLog(REDIS_WARNING,"Address updated for node %.40s, now %s:%d",
node->name, node->ip, node->port);
/* Check if this is our master and we have to change the
@@ -1453,7 +1453,7 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc
curmaster = nodeIsMaster(myself) ? myself : myself->slaveof;
if (sender == myself) {
- redisLog(REDIS_WARNING,"Discarding UPDATE message about myself.");
+ serverLog(REDIS_WARNING,"Discarding UPDATE message about myself.");
return;
}
@@ -1504,7 +1504,7 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc
* 2) We are a slave and our master is left without slots. We need
* to replicate to the new slots owner. */
if (newmaster && curmaster->numslots == 0) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Configuration change detected. Reconfiguring myself "
"as a replica of %.40s", sender->name);
clusterSetMaster(sender);
@@ -1542,7 +1542,7 @@ int clusterProcessPacket(clusterLink *link) {
clusterNode *sender;
server.cluster->stats_bus_messages_received++;
- redisLog(REDIS_DEBUG,"--- Processing packet of type %d, %lu bytes",
+ serverLog(REDIS_DEBUG,"--- Processing packet of type %d, %lu bytes",
type, (unsigned long) totlen);
/* Perform sanity checks */
@@ -1612,7 +1612,7 @@ int clusterProcessPacket(clusterLink *link) {
server.cluster->mf_master_offset == 0)
{
server.cluster->mf_master_offset = sender->repl_offset;
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Received replication offset for paused "
"master manual failover: %lld",
server.cluster->mf_master_offset);
@@ -1621,7 +1621,7 @@ int clusterProcessPacket(clusterLink *link) {
/* Initial processing of PING and MEET requests replying with a PONG. */
if (type == CLUSTERMSG_TYPE_PING || type == CLUSTERMSG_TYPE_MEET) {
- redisLog(REDIS_DEBUG,"Ping packet received: %p", (void*)link->node);
+ serverLog(REDIS_DEBUG,"Ping packet received: %p", (void*)link->node);
/* We use incoming MEET messages in order to set the address
* for 'myself', since only other cluster nodes will send us
@@ -1641,7 +1641,7 @@ int clusterProcessPacket(clusterLink *link) {
strcmp(ip,myself->ip))
{
memcpy(myself->ip,ip,REDIS_IP_STR_LEN);
- redisLog(REDIS_WARNING,"IP address for this node updated to %s",
+ serverLog(REDIS_WARNING,"IP address for this node updated to %s",
myself->ip);
clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG);
}
@@ -1675,7 +1675,7 @@ int clusterProcessPacket(clusterLink *link) {
if (type == CLUSTERMSG_TYPE_PING || type == CLUSTERMSG_TYPE_PONG ||
type == CLUSTERMSG_TYPE_MEET)
{
- redisLog(REDIS_DEBUG,"%s packet received: %p",
+ serverLog(REDIS_DEBUG,"%s packet received: %p",
type == CLUSTERMSG_TYPE_PING ? "ping" : "pong",
(void*)link->node);
if (link->node) {
@@ -1683,7 +1683,7 @@ int clusterProcessPacket(clusterLink *link) {
/* If we already have this node, try to change the
* IP/port of the node with the new one. */
if (sender) {
- redisLog(REDIS_VERBOSE,
+ serverLog(REDIS_VERBOSE,
"Handshake: we already know node %.40s, "
"updating the address if needed.", sender->name);
if (nodeUpdateAddressIfNeeded(sender,link,ntohs(hdr->port)))
@@ -1700,7 +1700,7 @@ int clusterProcessPacket(clusterLink *link) {
/* First thing to do is replacing the random name with the
* right node name if this was a handshake stage. */
clusterRenameNode(link->node, hdr->sender);
- redisLog(REDIS_DEBUG,"Handshake with node %.40s completed.",
+ serverLog(REDIS_DEBUG,"Handshake with node %.40s completed.",
link->node->name);
link->node->flags &= ~REDIS_NODE_HANDSHAKE;
link->node->flags |= flags&(REDIS_NODE_MASTER|REDIS_NODE_SLAVE);
@@ -1711,7 +1711,7 @@ int clusterProcessPacket(clusterLink *link) {
/* If the reply has a non matching node ID we
* disconnect this node and set it as not having an associated
* address. */
- redisLog(REDIS_DEBUG,"PONG contains mismatching sender ID");
+ serverLog(REDIS_DEBUG,"PONG contains mismatching sender ID");
link->node->flags |= REDIS_NODE_NOADDR;
link->node->ip[0] = '\0';
link->node->port = 0;
@@ -1842,7 +1842,7 @@ int clusterProcessPacket(clusterLink *link) {
if (server.cluster->slots[j]->configEpoch >
senderConfigEpoch)
{
- redisLog(REDIS_VERBOSE,
+ serverLog(REDIS_VERBOSE,
"Node %.40s has old slots configuration, sending "
"an UPDATE message about %.40s",
sender->name, server.cluster->slots[j]->name);
@@ -1877,7 +1877,7 @@ int clusterProcessPacket(clusterLink *link) {
if (failing &&
!(failing->flags & (REDIS_NODE_FAIL|REDIS_NODE_MYSELF)))
{
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"FAIL message received from %.40s about %.40s",
hdr->sender, hdr->data.fail.about.nodename);
failing->flags |= REDIS_NODE_FAIL;
@@ -1887,7 +1887,7 @@ int clusterProcessPacket(clusterLink *link) {
CLUSTER_TODO_UPDATE_STATE);
}
} else {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Ignoring FAIL message from unknown node %.40s about %.40s",
hdr->sender, hdr->data.fail.about.nodename);
}
@@ -1937,7 +1937,7 @@ int clusterProcessPacket(clusterLink *link) {
server.cluster->mf_end = mstime() + REDIS_CLUSTER_MF_TIMEOUT;
server.cluster->mf_slave = sender;
pauseClients(mstime()+(REDIS_CLUSTER_MF_TIMEOUT*2));
- redisLog(REDIS_WARNING,"Manual failover requested by slave %.40s.",
+ serverLog(REDIS_WARNING,"Manual failover requested by slave %.40s.",
sender->name);
} else if (type == CLUSTERMSG_TYPE_UPDATE) {
clusterNode *n; /* The node the update is about. */
@@ -1962,7 +1962,7 @@ int clusterProcessPacket(clusterLink *link) {
clusterUpdateSlotsConfigWith(n,reportedConfigEpoch,
hdr->data.update.nodecfg.slots);
} else {
- redisLog(REDIS_WARNING,"Received unknown packet type: %d", type);
+ serverLog(REDIS_WARNING,"Received unknown packet type: %d", type);
}
return 1;
}
@@ -1988,7 +1988,7 @@ void clusterWriteHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
nwritten = write(fd, link->sndbuf, sdslen(link->sndbuf));
if (nwritten <= 0) {
- redisLog(REDIS_DEBUG,"I/O error writing to node link: %s",
+ serverLog(REDIS_DEBUG,"I/O error writing to node link: %s",
strerror(errno));
handleLinkIOError(link);
return;
@@ -2025,7 +2025,7 @@ void clusterReadHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
if (memcmp(hdr->sig,"RCmb",4) != 0 ||
ntohl(hdr->totlen) < CLUSTERMSG_MIN_LEN)
{
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Bad message length or signature received "
"from Cluster bus.");
handleLinkIOError(link);
@@ -2041,7 +2041,7 @@ void clusterReadHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
if (nread <= 0) {
/* I/O error... */
- redisLog(REDIS_DEBUG,"I/O error reading from node link: %s",
+ serverLog(REDIS_DEBUG,"I/O error reading from node link: %s",
(nread == 0) ? "connection closed" : strerror(errno));
handleLinkIOError(link);
return;
@@ -2471,7 +2471,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
* our currentEpoch was updated as a side effect of receiving this
* request, if the request epoch was greater. */
if (requestCurrentEpoch < server.cluster->currentEpoch) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Failover auth denied to %.40s: reqEpoch (%llu) < curEpoch(%llu)",
node->name,
(unsigned long long) requestCurrentEpoch,
@@ -2481,7 +2481,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
/* I already voted for this epoch? Return ASAP. */
if (server.cluster->lastVoteEpoch == server.cluster->currentEpoch) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Failover auth denied to %.40s: already voted for epoch %llu",
node->name,
(unsigned long long) server.cluster->currentEpoch);
@@ -2495,15 +2495,15 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
(!nodeFailed(master) && !force_ack))
{
if (nodeIsMaster(node)) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Failover auth denied to %.40s: it is a master node",
node->name);
} else if (master == NULL) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Failover auth denied to %.40s: I don't know its master",
node->name);
} else if (!nodeFailed(master)) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Failover auth denied to %.40s: its master is up",
node->name);
}
@@ -2515,7 +2515,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
* of the algorithm but makes the base case more linear. */
if (mstime() - node->slaveof->voted_time < server.cluster_node_timeout * 2)
{
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Failover auth denied to %.40s: "
"can't vote about this master before %lld milliseconds",
node->name,
@@ -2537,7 +2537,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
/* If we reached this point we found a slot that in our current slots
* is served by a master with a greater configEpoch than the one claimed
* by the slave requesting our vote. Refuse to vote for this slave. */
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Failover auth denied to %.40s: "
"slot %d epoch (%llu) > reqEpoch (%llu)",
node->name, j,
@@ -2550,7 +2550,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
clusterSendFailoverAuth(node);
server.cluster->lastVoteEpoch = server.cluster->currentEpoch;
node->slaveof->voted_time = mstime();
- redisLog(REDIS_WARNING, "Failover auth granted to %.40s for epoch %llu",
+ serverLog(REDIS_WARNING, "Failover auth granted to %.40s for epoch %llu",
node->name, (unsigned long long) server.cluster->currentEpoch);
}
@@ -2641,7 +2641,7 @@ void clusterLogCantFailover(int reason) {
break;
}
lastlog_time = time(NULL);
- redisLog(REDIS_WARNING,"Currently unable to failover: %s", msg);
+ serverLog(REDIS_WARNING,"Currently unable to failover: %s", msg);
}
/* This function implements the final part of automatic and manual failovers,
@@ -2774,7 +2774,7 @@ void clusterHandleSlaveFailover(void) {
server.cluster->failover_auth_time = mstime();
server.cluster->failover_auth_rank = 0;
}
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Start of election delayed for %lld milliseconds "
"(rank #%d, offset %lld).",
server.cluster->failover_auth_time - mstime(),
@@ -2801,7 +2801,7 @@ void clusterHandleSlaveFailover(void) {
(newrank - server.cluster->failover_auth_rank) * 1000;
server.cluster->failover_auth_time += added_delay;
server.cluster->failover_auth_rank = newrank;
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Slave rank updated to #%d, added %lld milliseconds of delay.",
newrank, added_delay);
}
@@ -2823,7 +2823,7 @@ void clusterHandleSlaveFailover(void) {
if (server.cluster->failover_auth_sent == 0) {
server.cluster->currentEpoch++;
server.cluster->failover_auth_epoch = server.cluster->currentEpoch;
- redisLog(REDIS_WARNING,"Starting a failover election for epoch %llu.",
+ serverLog(REDIS_WARNING,"Starting a failover election for epoch %llu.",
(unsigned long long) server.cluster->currentEpoch);
clusterRequestFailoverAuth();
server.cluster->failover_auth_sent = 1;
@@ -2837,13 +2837,13 @@ void clusterHandleSlaveFailover(void) {
if (server.cluster->failover_auth_count >= needed_quorum) {
/* We have the quorum, we can finally failover the master. */
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Failover election won: I'm the new master.");
/* Update my configEpoch to the epoch of the election. */
if (myself->configEpoch < server.cluster->failover_auth_epoch) {
myself->configEpoch = server.cluster->failover_auth_epoch;
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"configEpoch set to %llu after successful failover",
(unsigned long long) myself->configEpoch);
}
@@ -2941,7 +2941,7 @@ void clusterHandleSlaveMigration(int max_slaves) {
/* Step 4: perform the migration if there is a target, and if I'm the
* candidate. */
if (target && candidate == myself) {
- redisLog(REDIS_WARNING,"Migrating to orphaned master %.40s",
+ serverLog(REDIS_WARNING,"Migrating to orphaned master %.40s",
target->name);
clusterSetMaster(target);
}
@@ -2995,7 +2995,7 @@ void resetManualFailover(void) {
/* If a manual failover timed out, abort it. */
void manualFailoverCheckTimeout(void) {
if (server.cluster->mf_end && server.cluster->mf_end < mstime()) {
- redisLog(REDIS_WARNING,"Manual failover timed out.");
+ serverLog(REDIS_WARNING,"Manual failover timed out.");
resetManualFailover();
}
}
@@ -3016,7 +3016,7 @@ void clusterHandleManualFailover(void) {
/* Our replication offset matches the master replication offset
* announced after clients were paused. We can start the failover. */
server.cluster->mf_can_start = 1;
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"All master replication stream processed, "
"manual failover can start.");
}
@@ -3076,7 +3076,7 @@ void clusterCron(void) {
* so we claim we actually sent a ping now (that will
* be really sent as soon as the link is obtained). */
if (node->ping_sent == 0) node->ping_sent = mstime();
- redisLog(REDIS_DEBUG, "Unable to connect to "
+ serverLog(REDIS_DEBUG, "Unable to connect to "
"Cluster Node [%s]:%d -> %s", node->ip,
node->port+REDIS_CLUSTER_PORT_INCR,
server.neterr);
@@ -3109,7 +3109,7 @@ void clusterCron(void) {
* normal PING packets. */
node->flags &= ~REDIS_NODE_MEET;
- redisLog(REDIS_DEBUG,"Connecting with Node %.40s at %s:%d",
+ serverLog(REDIS_DEBUG,"Connecting with Node %.40s at %s:%d",
node->name, node->ip, node->port+REDIS_CLUSTER_PORT_INCR);
}
}
@@ -3136,7 +3136,7 @@ void clusterCron(void) {
}
}
if (min_pong_node) {
- redisLog(REDIS_DEBUG,"Pinging node %.40s", min_pong_node->name);
+ serverLog(REDIS_DEBUG,"Pinging node %.40s", min_pong_node->name);
clusterSendPing(min_pong_node->link, CLUSTERMSG_TYPE_PING);
}
}
@@ -3225,7 +3225,7 @@ void clusterCron(void) {
/* Timeout reached. Set the node as possibly failing if it is
* not already in this state. */
if (!(node->flags & (REDIS_NODE_PFAIL|REDIS_NODE_FAIL))) {
- redisLog(REDIS_DEBUG,"*** NODE %.40s possibly failing",
+ serverLog(REDIS_DEBUG,"*** NODE %.40s possibly failing",
node->name);
node->flags |= REDIS_NODE_PFAIL;
update_state = 1;
@@ -3488,7 +3488,7 @@ void clusterUpdateState(void) {
}
/* Change the state and log the event. */
- redisLog(REDIS_WARNING,"Cluster state changed: %s",
+ serverLog(REDIS_WARNING,"Cluster state changed: %s",
new_state == REDIS_CLUSTER_OK ? "ok" : "fail");
server.cluster->state = new_state;
}
@@ -3546,11 +3546,11 @@ int verifyClusterConfigWithData(void) {
update_config++;
/* Case A: slot is unassigned. Take responsibility for it. */
if (server.cluster->slots[j] == NULL) {
- redisLog(REDIS_WARNING, "I have keys for unassigned slot %d. "
+ serverLog(REDIS_WARNING, "I have keys for unassigned slot %d. "
"Taking responsibility for it.",j);
clusterAddSlot(myself,j);
} else {
- redisLog(REDIS_WARNING, "I have keys for slot %d, but the slot is "
+ serverLog(REDIS_WARNING, "I have keys for slot %d, but the slot is "
"assigned to another node. "
"Setting it to importing state.",j);
server.cluster->importing_slots_from[j] = server.cluster->slots[j];
@@ -3978,7 +3978,7 @@ void clusterCommand(redisClient *c) {
* configEpoch collision resolution will fix it assigning
* a different epoch to each node. */
if (clusterBumpConfigEpochWithoutConsensus() == REDIS_OK) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"configEpoch updated after importing slot %d", slot);
}
server.cluster->importing_slots_from[slot] = NULL;
@@ -4220,17 +4220,17 @@ void clusterCommand(redisClient *c) {
* generates a new configuration epoch for this node without
* consensus, claims the master's slots, and broadcast the new
* configuration. */
- redisLog(REDIS_WARNING,"Taking over the master (user request).");
+ serverLog(REDIS_WARNING,"Taking over the master (user request).");
clusterBumpConfigEpochWithoutConsensus();
clusterFailoverReplaceYourMaster();
} else if (force) {
/* If this is a forced failover, we don't need to talk with our
* master to agree about the offset. We just failover taking over
* it without coordination. */
- redisLog(REDIS_WARNING,"Forced failover user request accepted.");
+ serverLog(REDIS_WARNING,"Forced failover user request accepted.");
server.cluster->mf_can_start = 1;
} else {
- redisLog(REDIS_WARNING,"Manual failover user request accepted.");
+ serverLog(REDIS_WARNING,"Manual failover user request accepted.");
clusterSendMFStart(myself->slaveof);
}
addReply(c,shared.ok);
@@ -4257,7 +4257,7 @@ void clusterCommand(redisClient *c) {
addReplyError(c,"Node config epoch is already non-zero");
} else {
myself->configEpoch = epoch;
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"configEpoch set to %llu via CLUSTER SET-CONFIG-EPOCH",
(unsigned long long) myself->configEpoch);
diff --git a/src/config.c b/src/config.c
index a6ea1ce7d..0659ee2fc 100644
--- a/src/config.c
+++ b/src/config.c
@@ -236,7 +236,7 @@ void loadServerConfigFromString(char *config) {
}
} else if (!strcasecmp(argv[0],"dir") && argc == 2) {
if (chdir(argv[1]) == -1) {
- redisLog(REDIS_WARNING,"Can't chdir to '%s': %s",
+ serverLog(REDIS_WARNING,"Can't chdir to '%s': %s",
argv[1], strerror(errno));
exit(1);
}
@@ -647,7 +647,7 @@ void loadServerConfig(char *filename, char *options) {
fp = stdin;
} else {
if ((fp = fopen(filename,"r")) == NULL) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Fatal error, can't open config file '%s'", filename);
exit(1);
}
@@ -954,7 +954,7 @@ void configSetCommand(redisClient *c) {
} config_set_memory_field("maxmemory",server.maxmemory) {
if (server.maxmemory) {
if (server.maxmemory < zmalloc_used_memory()) {
- redisLog(REDIS_WARNING,"WARNING: the new maxmemory value set via CONFIG SET is smaller than the current memory usage. This will result in keys eviction and/or inability to accept new write commands depending on the maxmemory-policy.");
+ serverLog(REDIS_WARNING,"WARNING: the new maxmemory value set via CONFIG SET is smaller than the current memory usage. This will result in keys eviction and/or inability to accept new write commands depending on the maxmemory-policy.");
}
freeMemoryIfNeeded();
}
@@ -1657,7 +1657,7 @@ void rewriteConfigRemoveOrphaned(struct rewriteConfigState *state) {
/* Don't blank lines about options the rewrite process
* don't understand. */
if (dictFind(state->rewritten,option) == NULL) {
- redisLog(REDIS_DEBUG,"Not rewritten option: %s", option);
+ serverLog(REDIS_DEBUG,"Not rewritten option: %s", option);
continue;
}
@@ -1862,10 +1862,10 @@ void configCommand(redisClient *c) {
return;
}
if (rewriteConfig(server.configfile) == -1) {
- redisLog(REDIS_WARNING,"CONFIG REWRITE failed: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"CONFIG REWRITE failed: %s", strerror(errno));
addReplyErrorFormat(c,"Rewriting config file: %s", strerror(errno));
} else {
- redisLog(REDIS_WARNING,"CONFIG REWRITE executed with success.");
+ serverLog(REDIS_WARNING,"CONFIG REWRITE executed with success.");
addReply(c,shared.ok);
}
} else {
diff --git a/src/debug.c b/src/debug.c
index fffefe6ad..9c9118eb2 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -278,7 +278,7 @@ void debugCommand(redisClient *c) {
addReplyError(c,"Error trying to load the RDB dump");
return;
}
- redisLog(REDIS_WARNING,"DB reloaded by DEBUG RELOAD");
+ serverLog(REDIS_WARNING,"DB reloaded by DEBUG RELOAD");
addReply(c,shared.ok);
} else if (!strcasecmp(c->argv[1]->ptr,"loadaof")) {
emptyDb(NULL);
@@ -287,7 +287,7 @@ void debugCommand(redisClient *c) {
return;
}
server.dirty = 0; /* Prevent AOF / replication */
- redisLog(REDIS_WARNING,"Append Only File loaded by DEBUG LOADAOF");
+ serverLog(REDIS_WARNING,"Append Only File loaded by DEBUG LOADAOF");
addReply(c,shared.ok);
} else if (!strcasecmp(c->argv[1]->ptr,"object") && c->argc == 3) {
dictEntry *de;
@@ -472,13 +472,13 @@ void debugCommand(redisClient *c) {
void _redisAssert(char *estr, char *file, int line) {
bugReportStart();
- redisLog(REDIS_WARNING,"=== ASSERTION FAILED ===");
- redisLog(REDIS_WARNING,"==> %s:%d '%s' is not true",file,line,estr);
+ serverLog(REDIS_WARNING,"=== ASSERTION FAILED ===");
+ serverLog(REDIS_WARNING,"==> %s:%d '%s' is not true",file,line,estr);
#ifdef HAVE_BACKTRACE
server.assert_failed = estr;
server.assert_file = file;
server.assert_line = line;
- redisLog(REDIS_WARNING,"(forcing SIGSEGV to print the bug report.)");
+ serverLog(REDIS_WARNING,"(forcing SIGSEGV to print the bug report.)");
#endif
*((char*)-1) = 'x';
}
@@ -487,10 +487,10 @@ void _redisAssertPrintClientInfo(redisClient *c) {
int j;
bugReportStart();
- redisLog(REDIS_WARNING,"=== ASSERTION FAILED CLIENT CONTEXT ===");
- redisLog(REDIS_WARNING,"client->flags = %d", c->flags);
- redisLog(REDIS_WARNING,"client->fd = %d", c->fd);
- redisLog(REDIS_WARNING,"client->argc = %d", c->argc);
+ serverLog(REDIS_WARNING,"=== ASSERTION FAILED CLIENT CONTEXT ===");
+ serverLog(REDIS_WARNING,"client->flags = %d", c->flags);
+ serverLog(REDIS_WARNING,"client->fd = %d", c->fd);
+ serverLog(REDIS_WARNING,"client->argc = %d", c->argc);
for (j=0; j < c->argc; j++) {
char buf[128];
char *arg;
@@ -502,39 +502,39 @@ void _redisAssertPrintClientInfo(redisClient *c) {
c->argv[j]->type, c->argv[j]->encoding);
arg = buf;
}
- redisLog(REDIS_WARNING,"client->argv[%d] = \"%s\" (refcount: %d)",
+ serverLog(REDIS_WARNING,"client->argv[%d] = \"%s\" (refcount: %d)",
j, arg, c->argv[j]->refcount);
}
}
-void redisLogObjectDebugInfo(robj *o) {
- redisLog(REDIS_WARNING,"Object type: %d", o->type);
- redisLog(REDIS_WARNING,"Object encoding: %d", o->encoding);
- redisLog(REDIS_WARNING,"Object refcount: %d", o->refcount);
+void serverLogObjectDebugInfo(robj *o) {
+ serverLog(REDIS_WARNING,"Object type: %d", o->type);
+ serverLog(REDIS_WARNING,"Object encoding: %d", o->encoding);
+ serverLog(REDIS_WARNING,"Object refcount: %d", o->refcount);
if (o->type == REDIS_STRING && sdsEncodedObject(o)) {
- redisLog(REDIS_WARNING,"Object raw string len: %zu", sdslen(o->ptr));
+ serverLog(REDIS_WARNING,"Object raw string len: %zu", sdslen(o->ptr));
if (sdslen(o->ptr) < 4096) {
sds repr = sdscatrepr(sdsempty(),o->ptr,sdslen(o->ptr));
- redisLog(REDIS_WARNING,"Object raw string content: %s", repr);
+ serverLog(REDIS_WARNING,"Object raw string content: %s", repr);
sdsfree(repr);
}
} else if (o->type == REDIS_LIST) {
- redisLog(REDIS_WARNING,"List length: %d", (int) listTypeLength(o));
+ serverLog(REDIS_WARNING,"List length: %d", (int) listTypeLength(o));
} else if (o->type == REDIS_SET) {
- redisLog(REDIS_WARNING,"Set size: %d", (int) setTypeSize(o));
+ serverLog(REDIS_WARNING,"Set size: %d", (int) setTypeSize(o));
} else if (o->type == REDIS_HASH) {
- redisLog(REDIS_WARNING,"Hash size: %d", (int) hashTypeLength(o));
+ serverLog(REDIS_WARNING,"Hash size: %d", (int) hashTypeLength(o));
} else if (o->type == REDIS_ZSET) {
- redisLog(REDIS_WARNING,"Sorted set size: %d", (int) zsetLength(o));
+ serverLog(REDIS_WARNING,"Sorted set size: %d", (int) zsetLength(o));
if (o->encoding == REDIS_ENCODING_SKIPLIST)
- redisLog(REDIS_WARNING,"Skiplist level: %d", (int) ((zset*)o->ptr)->zsl->level);
+ serverLog(REDIS_WARNING,"Skiplist level: %d", (int) ((zset*)o->ptr)->zsl->level);
}
}
void _redisAssertPrintObject(robj *o) {
bugReportStart();
- redisLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ===");
- redisLogObjectDebugInfo(o);
+ serverLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ===");
+ serverLogObjectDebugInfo(o);
}
void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int line) {
@@ -545,19 +545,19 @@ void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int l
void _redisPanic(char *msg, char *file, int line) {
bugReportStart();
- redisLog(REDIS_WARNING,"------------------------------------------------");
- redisLog(REDIS_WARNING,"!!! Software Failure. Press left mouse button to continue");
- redisLog(REDIS_WARNING,"Guru Meditation: %s #%s:%d",msg,file,line);
+ serverLog(REDIS_WARNING,"------------------------------------------------");
+ serverLog(REDIS_WARNING,"!!! Software Failure. Press left mouse button to continue");
+ serverLog(REDIS_WARNING,"Guru Meditation: %s #%s:%d",msg,file,line);
#ifdef HAVE_BACKTRACE
- redisLog(REDIS_WARNING,"(forcing SIGSEGV in order to print the stack trace)");
+ serverLog(REDIS_WARNING,"(forcing SIGSEGV in order to print the stack trace)");
#endif
- redisLog(REDIS_WARNING,"------------------------------------------------");
+ serverLog(REDIS_WARNING,"------------------------------------------------");
*((char*)-1) = 'x';
}
void bugReportStart(void) {
if (server.bug_report_start == 0) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"\n\n=== REDIS BUG REPORT START: Cut & paste starting from here ===");
server.bug_report_start = 1;
}
@@ -602,20 +602,20 @@ void logStackContent(void **sp) {
unsigned long val = (unsigned long) sp[i];
if (sizeof(long) == 4)
- redisLog(REDIS_WARNING, "(%08lx) -> %08lx", addr, val);
+ serverLog(REDIS_WARNING, "(%08lx) -> %08lx", addr, val);
else
- redisLog(REDIS_WARNING, "(%016lx) -> %016lx", addr, val);
+ serverLog(REDIS_WARNING, "(%016lx) -> %016lx", addr, val);
}
}
void logRegisters(ucontext_t *uc) {
- redisLog(REDIS_WARNING, "--- REGISTERS");
+ serverLog(REDIS_WARNING, "--- REGISTERS");
/* OSX */
#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)
/* OSX AMD64 */
#if defined(_STRUCT_X86_THREAD_STATE64) && !defined(__i386__)
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"\n"
"RAX:%016lx RBX:%016lx\nRCX:%016lx RDX:%016lx\n"
"RDI:%016lx RSI:%016lx\nRBP:%016lx RSP:%016lx\n"
@@ -647,7 +647,7 @@ void logRegisters(ucontext_t *uc) {
logStackContent((void**)uc->uc_mcontext->__ss.__rsp);
#else
/* OSX x86 */
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"\n"
"EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n"
"EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx\n"
@@ -676,7 +676,7 @@ void logRegisters(ucontext_t *uc) {
#elif defined(__linux__)
/* Linux x86 */
#if defined(__i386__)
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"\n"
"EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n"
"EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx\n"
@@ -702,7 +702,7 @@ void logRegisters(ucontext_t *uc) {
logStackContent((void**)uc->uc_mcontext.gregs[7]);
#elif defined(__X86_64__) || defined(__x86_64__)
/* Linux AMD64 */
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"\n"
"RAX:%016lx RBX:%016lx\nRCX:%016lx RDX:%016lx\n"
"RDI:%016lx RSI:%016lx\nRBP:%016lx RSP:%016lx\n"
@@ -732,7 +732,7 @@ void logRegisters(ucontext_t *uc) {
logStackContent((void**)uc->uc_mcontext.gregs[15]);
#endif
#else
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
" Dumping of registers not supported for this OS/arch");
#endif
}
@@ -774,15 +774,15 @@ void logCurrentClient(void) {
sds client;
int j;
- redisLog(REDIS_WARNING, "--- CURRENT CLIENT INFO");
+ serverLog(REDIS_WARNING, "--- CURRENT CLIENT INFO");
client = catClientInfoString(sdsempty(),cc);
- redisLog(REDIS_WARNING,"client: %s", client);
+ serverLog(REDIS_WARNING,"client: %s", client);
sdsfree(client);
for (j = 0; j < cc->argc; j++) {
robj *decoded;
decoded = getDecodedObject(cc->argv[j]);
- redisLog(REDIS_WARNING,"argv[%d]: '%s'", j, (char*)decoded->ptr);
+ serverLog(REDIS_WARNING,"argv[%d]: '%s'", j, (char*)decoded->ptr);
decrRefCount(decoded);
}
/* Check if the first argument, usually a key, is found inside the
@@ -795,8 +795,8 @@ void logCurrentClient(void) {
de = dictFind(cc->db->dict, key->ptr);
if (de) {
val = dictGetVal(de);
- redisLog(REDIS_WARNING,"key '%s' found in DB containing the following object:", (char*)key->ptr);
- redisLogObjectDebugInfo(val);
+ serverLog(REDIS_WARNING,"key '%s' found in DB containing the following object:", (char*)key->ptr);
+ serverLogObjectDebugInfo(val);
}
decrRefCount(key);
}
@@ -892,25 +892,25 @@ void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
REDIS_NOTUSED(info);
bugReportStart();
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
" Redis %s crashed by signal: %d", REDIS_VERSION, sig);
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
" Failed assertion: %s (%s:%d)", server.assert_failed,
server.assert_file, server.assert_line);
/* Log the stack trace */
- redisLog(REDIS_WARNING, "--- STACK TRACE");
+ serverLog(REDIS_WARNING, "--- STACK TRACE");
logStackTrace(uc);
/* Log INFO and CLIENT LIST */
- redisLog(REDIS_WARNING, "--- INFO OUTPUT");
+ serverLog(REDIS_WARNING, "--- INFO OUTPUT");
infostring = genRedisInfoString("all");
infostring = sdscatprintf(infostring, "hash_init_value: %u\n",
dictGetHashFunctionSeed());
- redisLogRaw(REDIS_WARNING, infostring);
- redisLog(REDIS_WARNING, "--- CLIENT LIST OUTPUT");
+ serverLogRaw(REDIS_WARNING, infostring);
+ serverLog(REDIS_WARNING, "--- CLIENT LIST OUTPUT");
clients = getAllClientsInfoString();
- redisLogRaw(REDIS_WARNING, clients);
+ serverLogRaw(REDIS_WARNING, clients);
sdsfree(infostring);
sdsfree(clients);
@@ -922,18 +922,18 @@ void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
#if defined(HAVE_PROC_MAPS)
/* Test memory */
- redisLog(REDIS_WARNING, "--- FAST MEMORY TEST");
+ serverLog(REDIS_WARNING, "--- FAST MEMORY TEST");
bioKillThreads();
if (memtest_test_linux_anonymous_maps()) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"!!! MEMORY ERROR DETECTED! Check your memory ASAP !!!");
} else {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Fast memory test PASSED, however your memory can still be broken. Please run a memory test for several hours if possible.");
}
#endif
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"\n=== REDIS BUG REPORT END. Make sure to include from START to END. ===\n\n"
" Please report the crash by opening an issue on github:\n\n"
" http://github.com/antirez/redis/issues\n\n"
@@ -954,12 +954,12 @@ void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
/* ==================== Logging functions for debugging ===================== */
-void redisLogHexDump(int level, char *descr, void *value, size_t len) {
+void serverLogHexDump(int level, char *descr, void *value, size_t len) {
char buf[65], *b;
unsigned char *v = value;
char charset[] = "0123456789abcdef";
- redisLog(level,"%s (hexdump):", descr);
+ serverLog(level,"%s (hexdump):", descr);
b = buf;
while(len) {
b[0] = charset[(*v)>>4];
@@ -969,11 +969,11 @@ void redisLogHexDump(int level, char *descr, void *value, size_t len) {
len--;
v++;
if (b-buf == 64 || len == 0) {
- redisLogRaw(level|REDIS_LOG_RAW,buf);
+ serverLogRaw(level|REDIS_LOG_RAW,buf);
b = buf;
}
}
- redisLogRaw(level|REDIS_LOG_RAW,"\n");
+ serverLogRaw(level|REDIS_LOG_RAW,"\n");
}
/* =========================== Software Watchdog ============================ */
@@ -986,13 +986,13 @@ void watchdogSignalHandler(int sig, siginfo_t *info, void *secret) {
REDIS_NOTUSED(info);
REDIS_NOTUSED(sig);
- redisLogFromHandler(REDIS_WARNING,"\n--- WATCHDOG TIMER EXPIRED ---");
+ serverLogFromHandler(REDIS_WARNING,"\n--- WATCHDOG TIMER EXPIRED ---");
#ifdef HAVE_BACKTRACE
logStackTrace(uc);
#else
- redisLogFromHandler(REDIS_WARNING,"Sorry: no support for backtrace().");
+ serverLogFromHandler(REDIS_WARNING,"Sorry: no support for backtrace().");
#endif
- redisLogFromHandler(REDIS_WARNING,"--------\n");
+ serverLogFromHandler(REDIS_WARNING,"--------\n");
}
/* Schedule a SIGALRM delivery after the specified period in milliseconds.
diff --git a/src/networking.c b/src/networking.c
index 0df37c0fa..ec9aef2bc 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -592,7 +592,7 @@ void copyClientOutputBuffer(redisClient *dst, redisClient *src) {
static void acceptCommonHandler(int fd, int flags) {
redisClient *c;
if ((c = createClient(fd)) == NULL) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Error registering fd event for the new client: %s (fd=%d)",
strerror(errno),fd);
close(fd); /* May be already closed, just ignore errors */
@@ -628,11 +628,11 @@ void acceptTcpHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
cfd = anetTcpAccept(server.neterr, fd, cip, sizeof(cip), &cport);
if (cfd == ANET_ERR) {
if (errno != EWOULDBLOCK)
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Accepting client connection: %s", server.neterr);
return;
}
- redisLog(REDIS_VERBOSE,"Accepted %s:%d", cip, cport);
+ serverLog(REDIS_VERBOSE,"Accepted %s:%d", cip, cport);
acceptCommonHandler(cfd,0);
}
}
@@ -647,11 +647,11 @@ void acceptUnixHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
cfd = anetUnixAccept(server.neterr, fd);
if (cfd == ANET_ERR) {
if (errno != EWOULDBLOCK)
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Accepting client connection: %s", server.neterr);
return;
}
- redisLog(REDIS_VERBOSE,"Accepted connection to %s", server.unixsocket);
+ serverLog(REDIS_VERBOSE,"Accepted connection to %s", server.unixsocket);
acceptCommonHandler(cfd,REDIS_UNIX_SOCKET);
}
}
@@ -700,7 +700,7 @@ void freeClient(redisClient *c) {
* Note that before doing this we make sure that the client is not in
* some unexpected state, by checking its flags. */
if (server.master && c->flags & REDIS_MASTER) {
- redisLog(REDIS_WARNING,"Connection with master lost.");
+ serverLog(REDIS_WARNING,"Connection with master lost.");
if (!(c->flags & (REDIS_CLOSE_AFTER_REPLY|
REDIS_CLOSE_ASAP|
REDIS_BLOCKED|
@@ -713,7 +713,7 @@ void freeClient(redisClient *c) {
/* Log link disconnection with slave */
if ((c->flags & REDIS_SLAVE) && !(c->flags & REDIS_MONITOR)) {
- redisLog(REDIS_WARNING,"Connection with slave %s lost.",
+ serverLog(REDIS_WARNING,"Connection with slave %s lost.",
replicationGetSlaveName(c));
}
@@ -883,7 +883,7 @@ void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) {
if (errno == EAGAIN) {
nwritten = 0;
} else {
- redisLog(REDIS_VERBOSE,
+ serverLog(REDIS_VERBOSE,
"Error writing to client: %s", strerror(errno));
freeClient(c);
return;
@@ -985,7 +985,7 @@ int processInlineBuffer(redisClient *c) {
static void setProtocolError(redisClient *c, int pos) {
if (server.verbosity <= REDIS_VERBOSE) {
sds client = catClientInfoString(sdsempty(),c);
- redisLog(REDIS_VERBOSE,
+ serverLog(REDIS_VERBOSE,
"Protocol error from client: %s", client);
sdsfree(client);
}
@@ -1205,12 +1205,12 @@ void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) {
if (errno == EAGAIN) {
return;
} else {
- redisLog(REDIS_VERBOSE, "Reading from client: %s",strerror(errno));
+ serverLog(REDIS_VERBOSE, "Reading from client: %s",strerror(errno));
freeClient(c);
return;
}
} else if (nread == 0) {
- redisLog(REDIS_VERBOSE, "Client closed connection");
+ serverLog(REDIS_VERBOSE, "Client closed connection");
freeClient(c);
return;
}
@@ -1223,7 +1223,7 @@ void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) {
sds ci = catClientInfoString(sdsempty(),c), bytes = sdsempty();
bytes = sdscatrepr(bytes,c->querybuf,64);
- redisLog(REDIS_WARNING,"Closing client that reached max query buffer length: %s (qbuf initial bytes: %s)", ci, bytes);
+ serverLog(REDIS_WARNING,"Closing client that reached max query buffer length: %s (qbuf initial bytes: %s)", ci, bytes);
sdsfree(ci);
sdsfree(bytes);
freeClient(c);
@@ -1660,7 +1660,7 @@ void asyncCloseClientOnOutputBufferLimitReached(redisClient *c) {
sds client = catClientInfoString(sdsempty(),c);
freeClientAsync(c);
- redisLog(REDIS_WARNING,"Client %s scheduled to be closed ASAP for overcoming of output buffer limits.", client);
+ serverLog(REDIS_WARNING,"Client %s scheduled to be closed ASAP for overcoming of output buffer limits.", client);
sdsfree(client);
}
}
diff --git a/src/rdb.c b/src/rdb.c
index bbc791046..8e652cde5 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -47,7 +47,7 @@
#define rdbExitReportCorruptRDB(reason) rdbCheckThenExit(reason, __LINE__);
void rdbCheckThenExit(char *reason, int where) {
- redisLog(REDIS_WARNING, "Corrupt RDB detected at rdb.c:%d (%s). "
+ serverLog(REDIS_WARNING, "Corrupt RDB detected at rdb.c:%d (%s). "
"Running 'redis-check-rdb %s'",
where, reason, server.rdb_filename);
redis_check_rdb(server.rdb_filename);
@@ -839,7 +839,7 @@ int rdbSave(char *filename) {
snprintf(tmpfile,256,"temp-%d.rdb", (int) getpid());
fp = fopen(tmpfile,"w");
if (!fp) {
- redisLog(REDIS_WARNING, "Failed opening .rdb for saving: %s",
+ serverLog(REDIS_WARNING, "Failed opening .rdb for saving: %s",
strerror(errno));
return REDIS_ERR;
}
@@ -858,18 +858,18 @@ int rdbSave(char *filename) {
/* Use RENAME to make sure the DB file is changed atomically only
* if the generate DB file is ok. */
if (rename(tmpfile,filename) == -1) {
- redisLog(REDIS_WARNING,"Error moving temp DB file on the final destination: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Error moving temp DB file on the final destination: %s", strerror(errno));
unlink(tmpfile);
return REDIS_ERR;
}
- redisLog(REDIS_NOTICE,"DB saved on disk");
+ serverLog(REDIS_NOTICE,"DB saved on disk");
server.dirty = 0;
server.lastsave = time(NULL);
server.lastbgsave_status = REDIS_OK;
return REDIS_OK;
werr:
- redisLog(REDIS_WARNING,"Write error saving DB on disk: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Write error saving DB on disk: %s", strerror(errno));
fclose(fp);
unlink(tmpfile);
return REDIS_ERR;
@@ -896,7 +896,7 @@ int rdbSaveBackground(char *filename) {
size_t private_dirty = zmalloc_get_private_dirty();
if (private_dirty) {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"RDB: %zu MB of memory used by copy-on-write",
private_dirty/(1024*1024));
}
@@ -909,11 +909,11 @@ int rdbSaveBackground(char *filename) {
latencyAddSampleIfNeeded("fork",server.stat_fork_time/1000);
if (childpid == -1) {
server.lastbgsave_status = REDIS_ERR;
- redisLog(REDIS_WARNING,"Can't save in background: fork: %s",
+ serverLog(REDIS_WARNING,"Can't save in background: fork: %s",
strerror(errno));
return REDIS_ERR;
}
- redisLog(REDIS_NOTICE,"Background saving started by pid %d",childpid);
+ serverLog(REDIS_NOTICE,"Background saving started by pid %d",childpid);
server.rdb_save_time_start = time(NULL);
server.rdb_child_pid = childpid;
server.rdb_child_type = REDIS_RDB_CHILD_TYPE_DISK;
@@ -1250,14 +1250,14 @@ int rdbLoad(char *filename) {
buf[9] = '\0';
if (memcmp(buf,"REDIS",5) != 0) {
fclose(fp);
- redisLog(REDIS_WARNING,"Wrong signature trying to load DB from file");
+ serverLog(REDIS_WARNING,"Wrong signature trying to load DB from file");
errno = EINVAL;
return REDIS_ERR;
}
rdbver = atoi(buf+5);
if (rdbver < 1 || rdbver > REDIS_RDB_VERSION) {
fclose(fp);
- redisLog(REDIS_WARNING,"Can't handle RDB format version %d",rdbver);
+ serverLog(REDIS_WARNING,"Can't handle RDB format version %d",rdbver);
errno = EINVAL;
return REDIS_ERR;
}
@@ -1295,7 +1295,7 @@ int rdbLoad(char *filename) {
if ((dbid = rdbLoadLen(&rdb,NULL)) == REDIS_RDB_LENERR)
goto eoferr;
if (dbid >= (unsigned)server.dbnum) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"FATAL: Data file was created with a Redis "
"server configured to handle more than %d "
"databases. Exiting\n", server.dbnum);
@@ -1328,13 +1328,13 @@ int rdbLoad(char *filename) {
/* All the fields with a name staring with '%' are considered
* information fields and are logged at startup with a log
* level of NOTICE. */
- redisLog(REDIS_NOTICE,"RDB '%s': %s",
+ serverLog(REDIS_NOTICE,"RDB '%s': %s",
(char*)auxkey->ptr,
(char*)auxval->ptr);
} else {
/* We ignore fields we don't understand, as by AUX field
* contract. */
- redisLog(REDIS_DEBUG,"Unrecognized RDB AUX field: '%s'",
+ serverLog(REDIS_DEBUG,"Unrecognized RDB AUX field: '%s'",
(char*)auxkey->ptr);
}
@@ -1372,9 +1372,9 @@ int rdbLoad(char *filename) {
if (rioRead(&rdb,&cksum,8) == 0) goto eoferr;
memrev64ifbe(&cksum);
if (cksum == 0) {
- redisLog(REDIS_WARNING,"RDB file was saved with checksum disabled: no check performed.");
+ serverLog(REDIS_WARNING,"RDB file was saved with checksum disabled: no check performed.");
} else if (cksum != expected) {
- redisLog(REDIS_WARNING,"Wrong RDB checksum. Aborting now.");
+ serverLog(REDIS_WARNING,"Wrong RDB checksum. Aborting now.");
rdbExitReportCorruptRDB("RDB CRC error");
}
}
@@ -1384,7 +1384,7 @@ int rdbLoad(char *filename) {
return REDIS_OK;
eoferr: /* unexpected end of file is handled here with a fatal exit */
- redisLog(REDIS_WARNING,"Short read or OOM loading DB. Unrecoverable error, aborting now.");
+ serverLog(REDIS_WARNING,"Short read or OOM loading DB. Unrecoverable error, aborting now.");
rdbExitReportCorruptRDB("Unexpected EOF reading RDB file");
return REDIS_ERR; /* Just to avoid warning */
}
@@ -1393,18 +1393,18 @@ eoferr: /* unexpected end of file is handled here with a fatal exit */
* This function covers the case of actual BGSAVEs. */
void backgroundSaveDoneHandlerDisk(int exitcode, int bysignal) {
if (!bysignal && exitcode == 0) {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Background saving terminated with success");
server.dirty = server.dirty - server.dirty_before_bgsave;
server.lastsave = time(NULL);
server.lastbgsave_status = REDIS_OK;
} else if (!bysignal && exitcode != 0) {
- redisLog(REDIS_WARNING, "Background saving error");
+ serverLog(REDIS_WARNING, "Background saving error");
server.lastbgsave_status = REDIS_ERR;
} else {
mstime_t latency;
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Background saving terminated by signal %d", bysignal);
latencyStartMonitor(latency);
rdbRemoveTempFile(server.rdb_child_pid);
@@ -1431,12 +1431,12 @@ void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) {
uint64_t *ok_slaves;
if (!bysignal && exitcode == 0) {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Background RDB transfer terminated with success");
} else if (!bysignal && exitcode != 0) {
- redisLog(REDIS_WARNING, "Background transfer error");
+ serverLog(REDIS_WARNING, "Background transfer error");
} else {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Background transfer terminated by signal %d", bysignal);
}
server.rdb_child_pid = -1;
@@ -1498,14 +1498,14 @@ void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) {
}
}
if (j == ok_slaves[0] || errorcode != 0) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Closing slave %s: child->slave RDB transfer failed: %s",
replicationGetSlaveName(slave),
(errorcode == 0) ? "RDB transfer child aborted"
: strerror(errorcode));
freeClient(slave);
} else {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Slave %s correctly received the streamed RDB file.",
replicationGetSlaveName(slave));
/* Restore the socket as non-blocking. */
@@ -1601,7 +1601,7 @@ int rdbSaveToSlavesSockets(void) {
size_t private_dirty = zmalloc_get_private_dirty();
if (private_dirty) {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"RDB: %zu MB of memory used by copy-on-write",
private_dirty/(1024*1024));
}
@@ -1654,14 +1654,14 @@ int rdbSaveToSlavesSockets(void) {
server.stat_fork_rate = (double) zmalloc_used_memory() * 1000000 / server.stat_fork_time / (1024*1024*1024); /* GB per second. */
latencyAddSampleIfNeeded("fork",server.stat_fork_time/1000);
if (childpid == -1) {
- redisLog(REDIS_WARNING,"Can't save in background: fork: %s",
+ serverLog(REDIS_WARNING,"Can't save in background: fork: %s",
strerror(errno));
zfree(fds);
close(pipefds[0]);
close(pipefds[1]);
return REDIS_ERR;
}
- redisLog(REDIS_NOTICE,"Background RDB transfer started by pid %d",childpid);
+ serverLog(REDIS_NOTICE,"Background RDB transfer started by pid %d",childpid);
server.rdb_save_time_start = time(NULL);
server.rdb_child_pid = childpid;
server.rdb_child_type = REDIS_RDB_CHILD_TYPE_SOCKET;
diff --git a/src/redis-check-rdb.c b/src/redis-check-rdb.c
index da73bd38b..459aec86e 100644
--- a/src/redis-check-rdb.c
+++ b/src/redis-check-rdb.c
@@ -41,7 +41,7 @@
#include "crc64.h"
#define ERROR(...) { \
- redisLog(REDIS_WARNING, __VA_ARGS__); \
+ serverLog(REDIS_WARNING, __VA_ARGS__); \
exit(1); \
}
@@ -491,7 +491,7 @@ static void printCentered(int indent, int width, char* body) {
memset(head, '=', indent);
memset(tail, '=', width - 2 - indent - strlen(body));
- redisLog(REDIS_WARNING, "%s %s %s", head, body, tail);
+ serverLog(REDIS_WARNING, "%s %s %s", head, body, tail);
}
static void printValid(uint64_t ops, uint64_t bytes) {
@@ -538,7 +538,7 @@ static void printErrorStack(entry *e) {
/* display error stack */
for (i = 0; i < errors.level; i++) {
- redisLog(REDIS_WARNING, "0x%08lx - %s",
+ serverLog(REDIS_WARNING, "0x%08lx - %s",
(unsigned long) errors.offset[i], errors.error[i]);
}
}
@@ -551,7 +551,7 @@ void process(void) {
/* Exclude the final checksum for RDB >= 5. Will be checked at the end. */
if (dump_version >= 5) {
if (positions[0].size < 8) {
- redisLog(REDIS_WARNING, "RDB version >= 5 but no room for checksum.");
+ serverLog(REDIS_WARNING, "RDB version >= 5 but no room for checksum.");
exit(1);
}
positions[0].size -= 8;
@@ -636,13 +636,13 @@ void process(void) {
if (crc != crc2) {
SHIFT_ERROR(positions[0].offset, "RDB CRC64 does not match.");
} else {
- redisLog(REDIS_WARNING, "CRC64 checksum is OK");
+ serverLog(REDIS_WARNING, "CRC64 checksum is OK");
}
}
/* print summary on errors */
if (num_errors) {
- redisLog(REDIS_WARNING, "Total unprocessable opcodes: %llu",
+ serverLog(REDIS_WARNING, "Total unprocessable opcodes: %llu",
(unsigned long long) num_errors);
}
}
@@ -704,7 +704,7 @@ int redis_check_rdb_main(char **argv, int argc) {
fprintf(stderr, "Usage: %s <rdb-file-name>\n", argv[0]);
exit(1);
}
- redisLog(REDIS_WARNING, "Checking RDB file %s", argv[1]);
+ serverLog(REDIS_WARNING, "Checking RDB file %s", argv[1]);
exit(redis_check_rdb(argv[1]));
return 0;
}
diff --git a/src/replication.c b/src/replication.c
index 0d35ccd3d..5f366f189 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -302,32 +302,32 @@ void replicationFeedMonitors(redisClient *c, list *monitors, int dictid, robj **
long long addReplyReplicationBacklog(redisClient *c, long long offset) {
long long j, skip, len;
- redisLog(REDIS_DEBUG, "[PSYNC] Slave request offset: %lld", offset);
+ serverLog(REDIS_DEBUG, "[PSYNC] Slave request offset: %lld", offset);
if (server.repl_backlog_histlen == 0) {
- redisLog(REDIS_DEBUG, "[PSYNC] Backlog history len is zero");
+ serverLog(REDIS_DEBUG, "[PSYNC] Backlog history len is zero");
return 0;
}
- redisLog(REDIS_DEBUG, "[PSYNC] Backlog size: %lld",
+ serverLog(REDIS_DEBUG, "[PSYNC] Backlog size: %lld",
server.repl_backlog_size);
- redisLog(REDIS_DEBUG, "[PSYNC] First byte: %lld",
+ serverLog(REDIS_DEBUG, "[PSYNC] First byte: %lld",
server.repl_backlog_off);
- redisLog(REDIS_DEBUG, "[PSYNC] History len: %lld",
+ serverLog(REDIS_DEBUG, "[PSYNC] History len: %lld",
server.repl_backlog_histlen);
- redisLog(REDIS_DEBUG, "[PSYNC] Current index: %lld",
+ serverLog(REDIS_DEBUG, "[PSYNC] Current index: %lld",
server.repl_backlog_idx);
/* Compute the amount of bytes we need to discard. */
skip = offset - server.repl_backlog_off;
- redisLog(REDIS_DEBUG, "[PSYNC] Skipping: %lld", skip);
+ serverLog(REDIS_DEBUG, "[PSYNC] Skipping: %lld", skip);
/* Point j to the oldest byte, that is actaully our
* server.repl_backlog_off byte. */
j = (server.repl_backlog_idx +
(server.repl_backlog_size-server.repl_backlog_histlen)) %
server.repl_backlog_size;
- redisLog(REDIS_DEBUG, "[PSYNC] Index of first byte: %lld", j);
+ serverLog(REDIS_DEBUG, "[PSYNC] Index of first byte: %lld", j);
/* Discard the amount of data to seek to the specified 'offset'. */
j = (j + skip) % server.repl_backlog_size;
@@ -335,13 +335,13 @@ long long addReplyReplicationBacklog(redisClient *c, long long offset) {
/* Feed slave with data. Since it is a circular buffer we have to
* split the reply in two parts if we are cross-boundary. */
len = server.repl_backlog_histlen - skip;
- redisLog(REDIS_DEBUG, "[PSYNC] Reply total length: %lld", len);
+ serverLog(REDIS_DEBUG, "[PSYNC] Reply total length: %lld", len);
while(len) {
long long thislen =
((server.repl_backlog_size - j) < len) ?
(server.repl_backlog_size - j) : len;
- redisLog(REDIS_DEBUG, "[PSYNC] addReply() length: %lld", thislen);
+ serverLog(REDIS_DEBUG, "[PSYNC] addReply() length: %lld", thislen);
addReplySds(c,sdsnewlen(server.repl_backlog + j, thislen));
len -= thislen;
j = 0;
@@ -366,11 +366,11 @@ int masterTryPartialResynchronization(redisClient *c) {
if (strcasecmp(master_runid, server.runid)) {
/* Run id "?" is used by slaves that want to force a full resync. */
if (master_runid[0] != '?') {
- redisLog(REDIS_NOTICE,"Partial resynchronization not accepted: "
+ serverLog(REDIS_NOTICE,"Partial resynchronization not accepted: "
"Runid mismatch (Client asked for runid '%s', my runid is '%s')",
master_runid, server.runid);
} else {
- redisLog(REDIS_NOTICE,"Full resync requested by slave %s",
+ serverLog(REDIS_NOTICE,"Full resync requested by slave %s",
replicationGetSlaveName(c));
}
goto need_full_resync;
@@ -383,10 +383,10 @@ int masterTryPartialResynchronization(redisClient *c) {
psync_offset < server.repl_backlog_off ||
psync_offset > (server.repl_backlog_off + server.repl_backlog_histlen))
{
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Unable to partial resync with slave %s for lack of backlog (Slave request was: %lld).", replicationGetSlaveName(c), psync_offset);
if (psync_offset > server.master_repl_offset) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Warning: slave %s tried to PSYNC with an offset that is greater than the master replication offset.", replicationGetSlaveName(c));
}
goto need_full_resync;
@@ -410,7 +410,7 @@ int masterTryPartialResynchronization(redisClient *c) {
return REDIS_OK;
}
psync_len = addReplyReplicationBacklog(c,psync_offset);
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Partial resynchronization request from %s accepted. Sending %lld bytes of backlog starting from offset %lld.",
replicationGetSlaveName(c),
psync_len, psync_offset);
@@ -445,7 +445,7 @@ need_full_resync:
int startBgsaveForReplication(void) {
int retval;
- redisLog(REDIS_NOTICE,"Starting BGSAVE for SYNC with target: %s",
+ serverLog(REDIS_NOTICE,"Starting BGSAVE for SYNC with target: %s",
server.repl_diskless_sync ? "slaves sockets" : "disk");
if (server.repl_diskless_sync)
@@ -480,7 +480,7 @@ void syncCommand(redisClient *c) {
return;
}
- redisLog(REDIS_NOTICE,"Slave %s asks for synchronization",
+ serverLog(REDIS_NOTICE,"Slave %s asks for synchronization",
replicationGetSlaveName(c));
/* Try a partial resynchronization if this is a PSYNC command.
@@ -537,12 +537,12 @@ void syncCommand(redisClient *c) {
* another slave. Set the right state, and copy the buffer. */
copyClientOutputBuffer(c,slave);
c->replstate = REDIS_REPL_WAIT_BGSAVE_END;
- redisLog(REDIS_NOTICE,"Waiting for end of BGSAVE for SYNC");
+ serverLog(REDIS_NOTICE,"Waiting for end of BGSAVE for SYNC");
} else {
/* No way, we need to wait for the next BGSAVE in order to
* register differences. */
c->replstate = REDIS_REPL_WAIT_BGSAVE_START;
- redisLog(REDIS_NOTICE,"Waiting for next BGSAVE for SYNC");
+ serverLog(REDIS_NOTICE,"Waiting for next BGSAVE for SYNC");
}
} else if (server.rdb_child_pid != -1 &&
server.rdb_child_type == REDIS_RDB_CHILD_TYPE_SOCKET)
@@ -551,7 +551,7 @@ void syncCommand(redisClient *c) {
* children sockets. We need to wait for the next BGSAVE
* in order to synchronize. */
c->replstate = REDIS_REPL_WAIT_BGSAVE_START;
- redisLog(REDIS_NOTICE,"Waiting for next BGSAVE for SYNC");
+ serverLog(REDIS_NOTICE,"Waiting for next BGSAVE for SYNC");
} else {
if (server.repl_diskless_sync) {
/* Diskless replication RDB child is created inside
@@ -559,11 +559,11 @@ void syncCommand(redisClient *c) {
* few seconds to wait for more slaves to arrive. */
c->replstate = REDIS_REPL_WAIT_BGSAVE_START;
if (server.repl_diskless_sync_delay)
- redisLog(REDIS_NOTICE,"Delay next BGSAVE for SYNC");
+ serverLog(REDIS_NOTICE,"Delay next BGSAVE for SYNC");
} else {
/* Ok we don't have a BGSAVE in progress, let's start one. */
if (startBgsaveForReplication() != REDIS_OK) {
- redisLog(REDIS_NOTICE,"Replication failed, can't BGSAVE");
+ serverLog(REDIS_NOTICE,"Replication failed, can't BGSAVE");
addReplyError(c,"Unable to perform background save");
return;
}
@@ -664,12 +664,12 @@ void putSlaveOnline(redisClient *slave) {
slave->repl_ack_time = server.unixtime; /* Prevent false timeout. */
if (aeCreateFileEvent(server.el, slave->fd, AE_WRITABLE,
sendReplyToClient, slave) == AE_ERR) {
- redisLog(REDIS_WARNING,"Unable to register writable event for slave bulk transfer: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Unable to register writable event for slave bulk transfer: %s", strerror(errno));
freeClient(slave);
return;
}
refreshGoodSlavesCount();
- redisLog(REDIS_NOTICE,"Synchronization with slave %s succeeded",
+ serverLog(REDIS_NOTICE,"Synchronization with slave %s succeeded",
replicationGetSlaveName(slave));
}
@@ -686,7 +686,7 @@ void sendBulkToSlave(aeEventLoop *el, int fd, void *privdata, int mask) {
if (slave->replpreamble) {
nwritten = write(fd,slave->replpreamble,sdslen(slave->replpreamble));
if (nwritten == -1) {
- redisLog(REDIS_VERBOSE,"Write error sending RDB preamble to slave: %s",
+ serverLog(REDIS_VERBOSE,"Write error sending RDB preamble to slave: %s",
strerror(errno));
freeClient(slave);
return;
@@ -706,14 +706,14 @@ void sendBulkToSlave(aeEventLoop *el, int fd, void *privdata, int mask) {
lseek(slave->repldbfd,slave->repldboff,SEEK_SET);
buflen = read(slave->repldbfd,buf,REDIS_IOBUF_LEN);
if (buflen <= 0) {
- redisLog(REDIS_WARNING,"Read error sending DB to slave: %s",
+ serverLog(REDIS_WARNING,"Read error sending DB to slave: %s",
(buflen == 0) ? "premature EOF" : strerror(errno));
freeClient(slave);
return;
}
if ((nwritten = write(fd,buf,buflen)) == -1) {
if (errno != EAGAIN) {
- redisLog(REDIS_WARNING,"Write error sending DB to slave: %s",
+ serverLog(REDIS_WARNING,"Write error sending DB to slave: %s",
strerror(errno));
freeClient(slave);
}
@@ -764,7 +764,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) {
* diskless replication, our work is trivial, we can just put
* the slave online. */
if (type == REDIS_RDB_CHILD_TYPE_SOCKET) {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Streamed RDB transfer with slave %s succeeded (socket). Waiting for REPLCONF ACK from slave to enable streaming",
replicationGetSlaveName(slave));
/* Note: we wait for a REPLCONF ACK message from slave in
@@ -778,13 +778,13 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) {
} else {
if (bgsaveerr != REDIS_OK) {
freeClient(slave);
- redisLog(REDIS_WARNING,"SYNC failed. BGSAVE child returned an error");
+ serverLog(REDIS_WARNING,"SYNC failed. BGSAVE child returned an error");
continue;
}
if ((slave->repldbfd = open(server.rdb_filename,O_RDONLY)) == -1 ||
redis_fstat(slave->repldbfd,&buf) == -1) {
freeClient(slave);
- redisLog(REDIS_WARNING,"SYNC failed. Can't open/stat DB after BGSAVE: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"SYNC failed. Can't open/stat DB after BGSAVE: %s", strerror(errno));
continue;
}
slave->repldboff = 0;
@@ -806,7 +806,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) {
listIter li;
listRewind(server.slaves,&li);
- redisLog(REDIS_WARNING,"SYNC failed. BGSAVE failed");
+ serverLog(REDIS_WARNING,"SYNC failed. BGSAVE failed");
while((ln = listNext(&li))) {
redisClient *slave = ln->value;
@@ -893,14 +893,14 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
* from the master reply. */
if (server.repl_transfer_size == -1) {
if (syncReadLine(fd,buf,1024,server.repl_syncio_timeout*1000) == -1) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"I/O error reading bulk count from MASTER: %s",
strerror(errno));
goto error;
}
if (buf[0] == '-') {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"MASTER aborted replication with an error: %s",
buf+1);
goto error;
@@ -911,7 +911,7 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
server.repl_transfer_lastio = server.unixtime;
return;
} else if (buf[0] != '$') {
- redisLog(REDIS_WARNING,"Bad protocol from MASTER, the first byte is not '$' (we received '%s'), are you sure the host and port are right?", buf);
+ serverLog(REDIS_WARNING,"Bad protocol from MASTER, the first byte is not '$' (we received '%s'), are you sure the host and port are right?", buf);
goto error;
}
@@ -932,12 +932,12 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
/* Set any repl_transfer_size to avoid entering this code path
* at the next call. */
server.repl_transfer_size = 0;
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"MASTER <-> SLAVE sync: receiving streamed RDB from master");
} else {
usemark = 0;
server.repl_transfer_size = strtol(buf+1,NULL,10);
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"MASTER <-> SLAVE sync: receiving %lld bytes from master",
(long long) server.repl_transfer_size);
}
@@ -954,7 +954,7 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
nread = read(fd,buf,readlen);
if (nread <= 0) {
- redisLog(REDIS_WARNING,"I/O error trying to sync with MASTER: %s",
+ serverLog(REDIS_WARNING,"I/O error trying to sync with MASTER: %s",
(nread == -1) ? strerror(errno) : "connection lost");
replicationAbortSyncTransfer();
return;
@@ -979,7 +979,7 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
server.repl_transfer_lastio = server.unixtime;
if (write(server.repl_transfer_fd,buf,nread) != nread) {
- redisLog(REDIS_WARNING,"Write error or short write writing to the DB dump file needed for MASTER <-> SLAVE synchronization: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Write error or short write writing to the DB dump file needed for MASTER <-> SLAVE synchronization: %s", strerror(errno));
goto error;
}
server.repl_transfer_read += nread;
@@ -989,7 +989,7 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
if (ftruncate(server.repl_transfer_fd,
server.repl_transfer_read - REDIS_RUN_ID_SIZE) == -1)
{
- redisLog(REDIS_WARNING,"Error truncating the RDB file received from the master for SYNC: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Error truncating the RDB file received from the master for SYNC: %s", strerror(errno));
goto error;
}
}
@@ -1015,11 +1015,11 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
if (eof_reached) {
if (rename(server.repl_transfer_tmpfile,server.rdb_filename) == -1) {
- redisLog(REDIS_WARNING,"Failed trying to rename the temp DB into dump.rdb in MASTER <-> SLAVE synchronization: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Failed trying to rename the temp DB into dump.rdb in MASTER <-> SLAVE synchronization: %s", strerror(errno));
replicationAbortSyncTransfer();
return;
}
- redisLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Flushing old data");
+ serverLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Flushing old data");
signalFlushedDb(-1);
emptyDb(replicationEmptyDbCallback);
/* Before loading the DB into memory we need to delete the readable
@@ -1027,9 +1027,9 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
* rdbLoad() will call the event loop to process events from time to
* time for non blocking loading. */
aeDeleteFileEvent(server.el,server.repl_transfer_s,AE_READABLE);
- redisLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Loading DB in memory");
+ serverLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Loading DB in memory");
if (rdbLoad(server.rdb_filename) != REDIS_OK) {
- redisLog(REDIS_WARNING,"Failed trying to load the MASTER synchronization DB from disk");
+ serverLog(REDIS_WARNING,"Failed trying to load the MASTER synchronization DB from disk");
replicationAbortSyncTransfer();
return;
}
@@ -1037,7 +1037,7 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
zfree(server.repl_transfer_tmpfile);
close(server.repl_transfer_fd);
replicationCreateMasterClient(server.repl_transfer_s);
- redisLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Finished with success");
+ serverLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Finished with success");
/* 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. */
@@ -1046,11 +1046,11 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
stopAppendOnly();
while (retry-- && startAppendOnly() == REDIS_ERR) {
- redisLog(REDIS_WARNING,"Failed enabling the AOF after successful master synchronization! Trying it again in one second.");
+ serverLog(REDIS_WARNING,"Failed enabling the AOF after successful master synchronization! Trying it again in one second.");
sleep(1);
}
if (!retry) {
- redisLog(REDIS_WARNING,"FATAL: this slave instance finished the synchronization with its master, but the AOF can't be turned on. Exiting now.");
+ serverLog(REDIS_WARNING,"FATAL: this slave instance finished the synchronization with its master, but the AOF can't be turned on. Exiting now.");
exit(1);
}
}
@@ -1145,9 +1145,9 @@ int slaveTryPartialResynchronization(int fd) {
if (server.cached_master) {
psync_runid = server.cached_master->replrunid;
snprintf(psync_offset,sizeof(psync_offset),"%lld", server.cached_master->reploff+1);
- redisLog(REDIS_NOTICE,"Trying a partial resynchronization (request %s:%s).", psync_runid, psync_offset);
+ serverLog(REDIS_NOTICE,"Trying a partial resynchronization (request %s:%s).", psync_runid, psync_offset);
} else {
- redisLog(REDIS_NOTICE,"Partial resynchronization not possible (no cached master)");
+ serverLog(REDIS_NOTICE,"Partial resynchronization not possible (no cached master)");
psync_runid = "?";
memcpy(psync_offset,"-1",3);
}
@@ -1167,7 +1167,7 @@ int slaveTryPartialResynchronization(int fd) {
if (offset) offset++;
}
if (!runid || !offset || (offset-runid-1) != REDIS_RUN_ID_SIZE) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Master replied with wrong +FULLRESYNC syntax.");
/* This is an unexpected condition, actually the +FULLRESYNC
* reply means that the master supports PSYNC, but the reply
@@ -1178,7 +1178,7 @@ int slaveTryPartialResynchronization(int fd) {
memcpy(server.repl_master_runid, runid, offset-runid-1);
server.repl_master_runid[REDIS_RUN_ID_SIZE] = '\0';
server.repl_master_initial_offset = strtoll(offset,NULL,10);
- redisLog(REDIS_NOTICE,"Full resync from master: %s:%lld",
+ serverLog(REDIS_NOTICE,"Full resync from master: %s:%lld",
server.repl_master_runid,
server.repl_master_initial_offset);
}
@@ -1190,7 +1190,7 @@ int slaveTryPartialResynchronization(int fd) {
if (!strncmp(reply,"+CONTINUE",9)) {
/* Partial resync was accepted, set the replication state accordingly */
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Successful partial resynchronization with master.");
sdsfree(reply);
replicationResurrectCachedMaster(fd);
@@ -1203,10 +1203,10 @@ int slaveTryPartialResynchronization(int fd) {
if (strncmp(reply,"-ERR",4)) {
/* If it's not an error, log the unexpected event. */
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Unexpected reply to PSYNC from master: %s", reply);
} else {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Master does not support PSYNC or is in "
"error state (reply: %s)", reply);
}
@@ -1236,7 +1236,7 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
sockerr = errno;
if (sockerr) {
aeDeleteFileEvent(server.el,fd,AE_READABLE|AE_WRITABLE);
- redisLog(REDIS_WARNING,"Error condition on socket for SYNC: %s",
+ serverLog(REDIS_WARNING,"Error condition on socket for SYNC: %s",
strerror(sockerr));
goto error;
}
@@ -1246,7 +1246,7 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
* replication process where we have long timeouts in the order of
* seconds (in the meantime the slave would block). */
if (server.repl_state == REDIS_REPL_CONNECTING) {
- redisLog(REDIS_NOTICE,"Non blocking connect for SYNC fired the event.");
+ serverLog(REDIS_NOTICE,"Non blocking connect for SYNC fired the event.");
/* Delete the writable event so that the readable event remains
* registered and we can wait for the PONG reply. */
aeDeleteFileEvent(server.el,fd,AE_WRITABLE);
@@ -1270,7 +1270,7 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
if (syncReadLine(fd,buf,sizeof(buf),
server.repl_syncio_timeout*1000) == -1)
{
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"I/O error reading PING reply from master: %s",
strerror(errno));
goto error;
@@ -1285,10 +1285,10 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
strncmp(buf,"-NOAUTH",7) != 0 &&
strncmp(buf,"-ERR operation not permitted",28) != 0)
{
- redisLog(REDIS_WARNING,"Error reply to PING from master: '%s'",buf);
+ serverLog(REDIS_WARNING,"Error reply to PING from master: '%s'",buf);
goto error;
} else {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Master replied to PING, replication can continue...");
}
}
@@ -1297,7 +1297,7 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
if(server.masterauth) {
err = sendSynchronousCommand(fd,"AUTH",server.masterauth,NULL);
if (err[0] == '-') {
- redisLog(REDIS_WARNING,"Unable to AUTH to MASTER: %s",err);
+ serverLog(REDIS_WARNING,"Unable to AUTH to MASTER: %s",err);
sdsfree(err);
goto error;
}
@@ -1314,7 +1314,7 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
/* Ignore the error if any, not all the Redis versions support
* REPLCONF listening-port. */
if (err[0] == '-') {
- redisLog(REDIS_NOTICE,"(Non critical) Master does not understand REPLCONF listening-port: %s", err);
+ serverLog(REDIS_NOTICE,"(Non critical) Master does not understand REPLCONF listening-port: %s", err);
}
sdsfree(err);
}
@@ -1326,7 +1326,7 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
* reconnection attempt. */
psync_result = slaveTryPartialResynchronization(fd);
if (psync_result == PSYNC_CONTINUE) {
- redisLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Master accepted a Partial Resynchronization.");
+ serverLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Master accepted a Partial Resynchronization.");
return;
}
@@ -1334,9 +1334,9 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
* and the server.repl_master_runid and repl_master_initial_offset are
* already populated. */
if (psync_result == PSYNC_NOT_SUPPORTED) {
- redisLog(REDIS_NOTICE,"Retrying with SYNC...");
+ serverLog(REDIS_NOTICE,"Retrying with SYNC...");
if (syncWrite(fd,"SYNC\r\n",6,server.repl_syncio_timeout*1000) == -1) {
- redisLog(REDIS_WARNING,"I/O error writing to MASTER: %s",
+ serverLog(REDIS_WARNING,"I/O error writing to MASTER: %s",
strerror(errno));
goto error;
}
@@ -1351,7 +1351,7 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
sleep(1);
}
if (dfd == -1) {
- redisLog(REDIS_WARNING,"Opening the temp file needed for MASTER <-> SLAVE synchronization: %s",strerror(errno));
+ serverLog(REDIS_WARNING,"Opening the temp file needed for MASTER <-> SLAVE synchronization: %s",strerror(errno));
goto error;
}
@@ -1359,7 +1359,7 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
if (aeCreateFileEvent(server.el,fd, AE_READABLE,readSyncBulkPayload,NULL)
== AE_ERR)
{
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Can't create readable event for SYNC: %s (fd=%d)",
strerror(errno),fd);
goto error;
@@ -1387,7 +1387,7 @@ int connectWithMaster(void) {
fd = anetTcpNonBlockBestEffortBindConnect(NULL,
server.masterhost,server.masterport,REDIS_BIND_ADDR);
if (fd == -1) {
- redisLog(REDIS_WARNING,"Unable to connect to MASTER: %s",
+ serverLog(REDIS_WARNING,"Unable to connect to MASTER: %s",
strerror(errno));
return REDIS_ERR;
}
@@ -1396,7 +1396,7 @@ int connectWithMaster(void) {
AE_ERR)
{
close(fd);
- redisLog(REDIS_WARNING,"Can't create readable event for SYNC");
+ serverLog(REDIS_WARNING,"Can't create readable event for SYNC");
return REDIS_ERR;
}
@@ -1491,7 +1491,7 @@ void slaveofCommand(redisClient *c) {
!strcasecmp(c->argv[2]->ptr,"one")) {
if (server.masterhost) {
replicationUnsetMaster();
- redisLog(REDIS_NOTICE,"MASTER MODE enabled (user request)");
+ serverLog(REDIS_NOTICE,"MASTER MODE enabled (user request)");
}
} else {
long port;
@@ -1502,14 +1502,14 @@ void slaveofCommand(redisClient *c) {
/* Check if we are already attached to the specified slave */
if (server.masterhost && !strcasecmp(server.masterhost,c->argv[1]->ptr)
&& server.masterport == port) {
- redisLog(REDIS_NOTICE,"SLAVE OF would result into synchronization with the master we are already connected with. No operation performed.");
+ serverLog(REDIS_NOTICE,"SLAVE OF would result into synchronization with the master we are already connected with. No operation performed.");
addReplySds(c,sdsnew("+OK Already connected to specified master\r\n"));
return;
}
/* There was no previous master or the user specified a different one,
* we can continue. */
replicationSetMaster(c->argv[1]->ptr, port);
- redisLog(REDIS_NOTICE,"SLAVE OF %s:%d enabled (user request)",
+ serverLog(REDIS_NOTICE,"SLAVE OF %s:%d enabled (user request)",
server.masterhost, server.masterport);
}
addReply(c,shared.ok);
@@ -1604,7 +1604,7 @@ void replicationCacheMaster(redisClient *c) {
listNode *ln;
redisAssert(server.master != NULL && server.cached_master == NULL);
- redisLog(REDIS_NOTICE,"Caching the disconnected master state.");
+ serverLog(REDIS_NOTICE,"Caching the disconnected master state.");
/* Remove from the list of clients, we don't want this client to be
* listed by CLIENT LIST or processed in any way by batch operations. */
@@ -1642,7 +1642,7 @@ void replicationCacheMaster(redisClient *c) {
void replicationDiscardCachedMaster(void) {
if (server.cached_master == NULL) return;
- redisLog(REDIS_NOTICE,"Discarding previously cached master state.");
+ serverLog(REDIS_NOTICE,"Discarding previously cached master state.");
server.cached_master->flags &= ~REDIS_MASTER;
freeClient(server.cached_master);
server.cached_master = NULL;
@@ -1667,7 +1667,7 @@ void replicationResurrectCachedMaster(int newfd) {
listAddNodeTail(server.clients,server.master);
if (aeCreateFileEvent(server.el, newfd, AE_READABLE,
readQueryFromClient, server.master)) {
- redisLog(REDIS_WARNING,"Error resurrecting the cached master, impossible to add the readable handler: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Error resurrecting the cached master, impossible to add the readable handler: %s", strerror(errno));
freeClientAsync(server.master); /* Close ASAP. */
}
@@ -1676,7 +1676,7 @@ void replicationResurrectCachedMaster(int newfd) {
if (server.master->bufpos || listLength(server.master->reply)) {
if (aeCreateFileEvent(server.el, newfd, AE_WRITABLE,
sendReplyToClient, server.master)) {
- redisLog(REDIS_WARNING,"Error resurrecting the cached master, impossible to add the writable handler: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"Error resurrecting the cached master, impossible to add the writable handler: %s", strerror(errno));
freeClientAsync(server.master); /* Close ASAP. */
}
}
@@ -1949,7 +1949,7 @@ void replicationCron(void) {
server.repl_state == REDIS_REPL_RECEIVE_PONG) &&
(time(NULL)-server.repl_transfer_lastio) > server.repl_timeout)
{
- redisLog(REDIS_WARNING,"Timeout connecting to the MASTER...");
+ serverLog(REDIS_WARNING,"Timeout connecting to the MASTER...");
undoConnectWithMaster();
}
@@ -1957,7 +1957,7 @@ void replicationCron(void) {
if (server.masterhost && server.repl_state == REDIS_REPL_TRANSFER &&
(time(NULL)-server.repl_transfer_lastio) > server.repl_timeout)
{
- redisLog(REDIS_WARNING,"Timeout receiving bulk data from MASTER... If the problem persists try to set the 'repl-timeout' parameter in redis.conf to a larger value.");
+ serverLog(REDIS_WARNING,"Timeout receiving bulk data from MASTER... If the problem persists try to set the 'repl-timeout' parameter in redis.conf to a larger value.");
replicationAbortSyncTransfer();
}
@@ -1965,16 +1965,16 @@ void replicationCron(void) {
if (server.masterhost && server.repl_state == REDIS_REPL_CONNECTED &&
(time(NULL)-server.master->lastinteraction) > server.repl_timeout)
{
- redisLog(REDIS_WARNING,"MASTER timeout: no data nor PING received...");
+ serverLog(REDIS_WARNING,"MASTER timeout: no data nor PING received...");
freeClient(server.master);
}
/* Check if we should connect to a MASTER */
if (server.repl_state == REDIS_REPL_CONNECT) {
- redisLog(REDIS_NOTICE,"Connecting to MASTER %s:%d",
+ serverLog(REDIS_NOTICE,"Connecting to MASTER %s:%d",
server.masterhost, server.masterport);
if (connectWithMaster() == REDIS_OK) {
- redisLog(REDIS_NOTICE,"MASTER <-> SLAVE sync started");
+ serverLog(REDIS_NOTICE,"MASTER <-> SLAVE sync started");
}
}
@@ -2031,7 +2031,7 @@ void replicationCron(void) {
if (slave->flags & REDIS_PRE_PSYNC) continue;
if ((server.unixtime - slave->repl_ack_time) > server.repl_timeout)
{
- redisLog(REDIS_WARNING, "Disconnecting timedout slave: %s",
+ serverLog(REDIS_WARNING, "Disconnecting timedout slave: %s",
replicationGetSlaveName(slave));
freeClient(slave);
}
@@ -2047,7 +2047,7 @@ void replicationCron(void) {
if (idle > server.repl_backlog_time_limit) {
freeReplicationBacklog();
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Replication backlog freed after %d seconds "
"without connected slaves.",
(int) server.repl_backlog_time_limit);
diff --git a/src/scripting.c b/src/scripting.c
index 6c1963793..79547aa4d 100644
--- a/src/scripting.c
+++ b/src/scripting.c
@@ -224,7 +224,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
char *recursion_warning =
"luaRedisGenericCommand() recursive call detected. "
"Are you doing funny stuff with Lua debug hooks?";
- redisLog(REDIS_WARNING,"%s",recursion_warning);
+ serverLog(REDIS_WARNING,"%s",recursion_warning);
luaPushError(lua,recursion_warning);
return 1;
}
@@ -532,7 +532,7 @@ int luaLogCommand(lua_State *lua) {
log = sdscatlen(log,s,len);
}
}
- redisLogRaw(level,log);
+ serverLogRaw(level,log);
sdsfree(log);
return 0;
}
@@ -544,7 +544,7 @@ void luaMaskCountHook(lua_State *lua, lua_Debug *ar) {
elapsed = mstime() - server.lua_time_start;
if (elapsed >= server.lua_time_limit && server.lua_timedout == 0) {
- redisLog(REDIS_WARNING,"Lua slow script detected: still in execution after %lld milliseconds. You can try killing the script using the SCRIPT KILL command.",elapsed);
+ serverLog(REDIS_WARNING,"Lua slow script detected: still in execution after %lld milliseconds. You can try killing the script using the SCRIPT KILL command.",elapsed);
server.lua_timedout = 1;
/* Once the script timeouts we reenter the event loop to permit others
* to call SCRIPT KILL or SHUTDOWN NOSAVE if needed. For this reason
@@ -555,7 +555,7 @@ void luaMaskCountHook(lua_State *lua, lua_Debug *ar) {
}
if (server.lua_timedout) processEventsWhileBlocked();
if (server.lua_kill) {
- redisLog(REDIS_WARNING,"Lua script killed by user with SCRIPT KILL.");
+ serverLog(REDIS_WARNING,"Lua script killed by user with SCRIPT KILL.");
lua_pushstring(lua,"Script killed by user with SCRIPT KILL...");
lua_error(lua);
}
diff --git a/src/sentinel.c b/src/sentinel.c
index 5fa8258cd..bd315ccd5 100644
--- a/src/sentinel.c
+++ b/src/sentinel.c
@@ -477,11 +477,11 @@ void sentinelIsRunning(void) {
int j;
if (server.configfile == NULL) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Sentinel started without a config file. Exiting...");
exit(1);
} else if (access(server.configfile,W_OK) == -1) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Sentinel config file %s is not writable: %s. Exiting...",
server.configfile,strerror(errno));
exit(1);
@@ -500,7 +500,7 @@ void sentinelIsRunning(void) {
}
/* Log its ID to make debugging of issues simpler. */
- redisLog(REDIS_WARNING,"Sentinel ID is %s", sentinel.myid);
+ serverLog(REDIS_WARNING,"Sentinel ID is %s", sentinel.myid);
/* We want to generate a +monitor event for every configured master
* at startup. */
@@ -614,7 +614,7 @@ void sentinelEvent(int level, char *type, sentinelRedisInstance *ri,
/* Log the message if the log level allows it to be logged. */
if (level >= server.verbosity)
- redisLog(level,"%s %s",type,msg);
+ serverLog(level,"%s %s",type,msg);
/* Publish the message via Pub/Sub if it's not a debugging one. */
if (level != REDIS_DEBUG) {
@@ -808,7 +808,7 @@ void sentinelCollectTerminatedScripts(void) {
ln = sentinelGetScriptListNodeByPid(pid);
if (ln == NULL) {
- redisLog(REDIS_WARNING,"wait3() returned a pid (%ld) we can't find in our scripts execution queue!", (long)pid);
+ serverLog(REDIS_WARNING,"wait3() returned a pid (%ld) we can't find in our scripts execution queue!", (long)pid);
continue;
}
sj = ln->value;
@@ -1852,7 +1852,7 @@ void sentinelFlushConfig(void) {
werr:
if (fd != -1) close(fd);
- redisLog(REDIS_WARNING,"WARNING: Sentinel was not able to save the new configuration on disk!!!: %s", strerror(errno));
+ serverLog(REDIS_WARNING,"WARNING: Sentinel was not able to save the new configuration on disk!!!: %s", strerror(errno));
}
/* ====================== hiredis connection handling ======================= */
@@ -2967,7 +2967,7 @@ void sentinelCommand(redisClient *c) {
addReplySds(c,sdsnew("-NOGOODSLAVE No suitable slave to promote\r\n"));
return;
}
- redisLog(REDIS_WARNING,"Executing user requested FAILOVER of '%s'",
+ serverLog(REDIS_WARNING,"Executing user requested FAILOVER of '%s'",
ri->name);
sentinelStartFailover(ri);
ri->flags |= SRI_FORCE_FAILOVER;
@@ -3136,13 +3136,13 @@ void sentinelCommand(redisClient *c) {
if (!strcasecmp(c->argv[j]->ptr,"crash-after-election")) {
sentinel.simfailure_flags |=
SENTINEL_SIMFAILURE_CRASH_AFTER_ELECTION;
- redisLog(REDIS_WARNING,"Failure simulation: this Sentinel "
+ serverLog(REDIS_WARNING,"Failure simulation: this Sentinel "
"will crash after being successfully elected as failover "
"leader");
} else if (!strcasecmp(c->argv[j]->ptr,"crash-after-promotion")) {
sentinel.simfailure_flags |=
SENTINEL_SIMFAILURE_CRASH_AFTER_PROMOTION;
- redisLog(REDIS_WARNING,"Failure simulation: this Sentinel "
+ serverLog(REDIS_WARNING,"Failure simulation: this Sentinel "
"will crash after promoting the selected slave to master");
} else if (!strcasecmp(c->argv[j]->ptr,"help")) {
addReplyMultiBulkLen(c,2);
@@ -3490,7 +3490,7 @@ void sentinelReceiveIsMasterDownReply(redisAsyncContext *c, void *reply, void *p
* replied with a vote. */
sdsfree(ri->leader);
if ((long long)ri->leader_epoch != r->element[2]->integer)
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"%s voted for %s %llu", ri->name,
r->element[1]->str,
(unsigned long long) r->element[2]->integer);
@@ -3552,7 +3552,7 @@ void sentinelAskMasterStateToOtherSentinels(sentinelRedisInstance *master, int f
/* Crash because of user request via SENTINEL simulate-failure command. */
void sentinelSimFailureCrash(void) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Sentinel CRASH because of SENTINEL simulate-failure");
exit(99);
}
@@ -3793,7 +3793,7 @@ int sentinelStartFailoverIfNeeded(sentinelRedisInstance *master) {
ctime_r(&clock,ctimebuf);
ctimebuf[24] = '\0'; /* Remove newline. */
master->failover_delay_logged = master->failover_start_time;
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Next failover delay: I will not start a failover before %s",
ctimebuf);
}
diff --git a/src/server.c b/src/server.c
index 3459a0119..b666e8d63 100644
--- a/src/server.c
+++ b/src/server.c
@@ -300,8 +300,8 @@ struct evictionPoolEntry *evictionPoolAlloc(void);
/*============================ Utility functions ============================ */
/* Low level logging. To use only for very big messages, otherwise
- * redisLog() is to prefer. */
-void redisLogRaw(int level, const char *msg) {
+ * serverLog() is to prefer. */
+void serverLogRaw(int level, const char *msg) {
const int syslogLevelMap[] = { LOG_DEBUG, LOG_INFO, LOG_NOTICE, LOG_WARNING };
const char *c = ".-*#";
FILE *fp;
@@ -342,10 +342,10 @@ void redisLogRaw(int level, const char *msg) {
if (server.syslog_enabled) syslog(syslogLevelMap[level], "%s", msg);
}
-/* Like redisLogRaw() but with printf-alike support. This is the function that
+/* Like serverLogRaw() but with printf-alike support. This is the function that
* is used across the code. The raw version is only used in order to dump
* the INFO output on crash. */
-void redisLog(int level, const char *fmt, ...) {
+void serverLog(int level, const char *fmt, ...) {
va_list ap;
char msg[REDIS_MAX_LOGMSG_LEN];
@@ -355,7 +355,7 @@ void redisLog(int level, const char *fmt, ...) {
vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap);
- redisLogRaw(level,msg);
+ serverLogRaw(level,msg);
}
/* Log a fixed message without printf-alike capabilities, in a way that is
@@ -363,8 +363,8 @@ void redisLog(int level, const char *fmt, ...) {
*
* We actually use this only for signals that are not fatal from the point
* of view of Redis. Signals that are going to kill the server anyway and
- * where we need printf-alike features are served by redisLog(). */
-void redisLogFromHandler(int level, const char *msg) {
+ * where we need printf-alike features are served by serverLog(). */
+void serverLogFromHandler(int level, const char *msg) {
int fd;
int log_to_stdout = server.logfile[0] == '\0';
char buf[64];
@@ -925,7 +925,7 @@ int clientsCronHandleTimeout(redisClient *c, mstime_t now_ms) {
!(c->flags & REDIS_PUBSUB) && /* no timeout for Pub/Sub clients */
(now - c->lastinteraction > server.maxidletime))
{
- redisLog(REDIS_VERBOSE,"Closing idle client");
+ serverLog(REDIS_VERBOSE,"Closing idle client");
freeClient(c);
return 1;
} else if (c->flags & REDIS_BLOCKED) {
@@ -1126,7 +1126,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
* not ok doing so inside the signal handler. */
if (server.shutdown_asap) {
if (prepareForShutdown(0) == REDIS_OK) exit(0);
- redisLog(REDIS_WARNING,"SIGTERM received but errors trying to shut down the server, check the logs for more information");
+ serverLog(REDIS_WARNING,"SIGTERM received but errors trying to shut down the server, check the logs for more information");
server.shutdown_asap = 0;
}
@@ -1139,7 +1139,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
used = dictSize(server.db[j].dict);
vkeys = dictSize(server.db[j].expires);
if (used || vkeys) {
- redisLog(REDIS_VERBOSE,"DB %d: %lld keys (%lld volatile) in %lld slots HT.",j,used,vkeys,size);
+ serverLog(REDIS_VERBOSE,"DB %d: %lld keys (%lld volatile) in %lld slots HT.",j,used,vkeys,size);
/* dictPrintStats(server.dict); */
}
}
@@ -1148,7 +1148,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
/* Show information about connected clients */
if (!server.sentinel_mode) {
run_with_period(5000) {
- redisLog(REDIS_VERBOSE,
+ serverLog(REDIS_VERBOSE,
"%lu clients connected (%lu slaves), %zu bytes in use",
listLength(server.clients)-listLength(server.slaves),
listLength(server.slaves),
@@ -1186,7 +1186,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
} else if (pid == server.aof_child_pid) {
backgroundRewriteDoneHandler(exitcode,bysignal);
} else {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Warning, detected child with unmatched pid: %ld",
(long)pid);
}
@@ -1208,7 +1208,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
REDIS_BGSAVE_RETRY_DELAY ||
server.lastbgsave_status == REDIS_OK))
{
- redisLog(REDIS_NOTICE,"%d changes in %d seconds. Saving...",
+ serverLog(REDIS_NOTICE,"%d changes in %d seconds. Saving...",
sp->changes, (int)sp->seconds);
rdbSaveBackground(server.rdb_filename);
break;
@@ -1225,7 +1225,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
server.aof_rewrite_base_size : 1;
long long growth = (server.aof_current_size*100/base) - 100;
if (growth >= server.aof_rewrite_perc) {
- redisLog(REDIS_NOTICE,"Starting automatic rewriting of AOF on %lld%% growth",growth);
+ serverLog(REDIS_NOTICE,"Starting automatic rewriting of AOF on %lld%% growth",growth);
rewriteAppendOnlyFileBackground();
}
}
@@ -1583,7 +1583,7 @@ void adjustOpenFilesLimit(void) {
struct rlimit limit;
if (getrlimit(RLIMIT_NOFILE,&limit) == -1) {
- redisLog(REDIS_WARNING,"Unable to obtain the current NOFILE limit (%s), assuming 1024 and setting the max clients configuration accordingly.",
+ serverLog(REDIS_WARNING,"Unable to obtain the current NOFILE limit (%s), assuming 1024 and setting the max clients configuration accordingly.",
strerror(errno));
server.maxclients = 1024-REDIS_MIN_RESERVED_FDS;
} else {
@@ -1620,7 +1620,7 @@ void adjustOpenFilesLimit(void) {
int old_maxclients = server.maxclients;
server.maxclients = bestlimit-REDIS_MIN_RESERVED_FDS;
if (server.maxclients < 1) {
- redisLog(REDIS_WARNING,"Your current 'ulimit -n' "
+ serverLog(REDIS_WARNING,"Your current 'ulimit -n' "
"of %llu is not enough for Redis to start. "
"Please increase your open file limit to at least "
"%llu. Exiting.",
@@ -1628,20 +1628,20 @@ void adjustOpenFilesLimit(void) {
(unsigned long long) maxfiles);
exit(1);
}
- redisLog(REDIS_WARNING,"You requested maxclients of %d "
+ serverLog(REDIS_WARNING,"You requested maxclients of %d "
"requiring at least %llu max file descriptors.",
old_maxclients,
(unsigned long long) maxfiles);
- redisLog(REDIS_WARNING,"Redis can't set maximum open files "
+ serverLog(REDIS_WARNING,"Redis can't set maximum open files "
"to %llu because of OS error: %s.",
(unsigned long long) maxfiles, strerror(setrlimit_error));
- redisLog(REDIS_WARNING,"Current maximum open files is %llu. "
+ serverLog(REDIS_WARNING,"Current maximum open files is %llu. "
"maxclients has been reduced to %d to compensate for "
"low ulimit. "
"If you need higher maxclients increase 'ulimit -n'.",
(unsigned long long) bestlimit, server.maxclients);
} else {
- redisLog(REDIS_NOTICE,"Increased maximum number of open files "
+ serverLog(REDIS_NOTICE,"Increased maximum number of open files "
"to %llu (it was originally set to %llu).",
(unsigned long long) maxfiles,
(unsigned long long) oldlimit);
@@ -1660,7 +1660,7 @@ void checkTcpBacklogSettings(void) {
if (fgets(buf,sizeof(buf),fp) != NULL) {
int somaxconn = atoi(buf);
if (somaxconn > 0 && somaxconn < server.tcp_backlog) {
- redisLog(REDIS_WARNING,"WARNING: The TCP backlog setting of %d cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of %d.", server.tcp_backlog, somaxconn);
+ serverLog(REDIS_WARNING,"WARNING: The TCP backlog setting of %d cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of %d.", server.tcp_backlog, somaxconn);
}
}
fclose(fp);
@@ -1721,7 +1721,7 @@ int listenToPort(int port, int *fds, int *count) {
server.tcp_backlog);
}
if (fds[*count] == ANET_ERR) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Creating Server TCP listening socket %s:%d: %s",
server.bindaddr[j] ? server.bindaddr[j] : "*",
port, server.neterr);
@@ -1805,7 +1805,7 @@ void initServer(void) {
server.sofd = anetUnixServer(server.neterr,server.unixsocket,
server.unixsocketperm, server.tcp_backlog);
if (server.sofd == ANET_ERR) {
- redisLog(REDIS_WARNING, "Opening Unix socket: %s", server.neterr);
+ serverLog(REDIS_WARNING, "Opening Unix socket: %s", server.neterr);
exit(1);
}
anetNonBlock(NULL,server.sofd);
@@ -1813,7 +1813,7 @@ void initServer(void) {
/* Abort if there are no listening sockets at all. */
if (server.ipfd_count == 0 && server.sofd < 0) {
- redisLog(REDIS_WARNING, "Configured to not listen anywhere, exiting.");
+ serverLog(REDIS_WARNING, "Configured to not listen anywhere, exiting.");
exit(1);
}
@@ -1879,7 +1879,7 @@ void initServer(void) {
server.aof_fd = open(server.aof_filename,
O_WRONLY|O_APPEND|O_CREAT,0644);
if (server.aof_fd == -1) {
- redisLog(REDIS_WARNING, "Can't open the append-only file: %s",
+ serverLog(REDIS_WARNING, "Can't open the append-only file: %s",
strerror(errno));
exit(1);
}
@@ -1890,7 +1890,7 @@ void initServer(void) {
* at 3 GB using maxmemory with 'noeviction' policy'. This avoids
* useless crashes of the Redis instance for out of memory. */
if (server.arch_bits == 32 && server.maxmemory == 0) {
- redisLog(REDIS_WARNING,"Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.");
+ serverLog(REDIS_WARNING,"Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.");
server.maxmemory = 3072LL*(1024*1024); /* 3 GB */
server.maxmemory_policy = REDIS_MAXMEMORY_NO_EVICTION;
}
@@ -2372,7 +2372,7 @@ void closeListeningSockets(int unlink_unix_socket) {
if (server.cluster_enabled)
for (j = 0; j < server.cfd_count; j++) close(server.cfd[j]);
if (unlink_unix_socket && server.unixsocket) {
- redisLog(REDIS_NOTICE,"Removing the unix socket file.");
+ serverLog(REDIS_NOTICE,"Removing the unix socket file.");
unlink(server.unixsocket); /* don't care if this fails */
}
}
@@ -2381,12 +2381,12 @@ int prepareForShutdown(int flags) {
int save = flags & REDIS_SHUTDOWN_SAVE;
int nosave = flags & REDIS_SHUTDOWN_NOSAVE;
- redisLog(REDIS_WARNING,"User requested shutdown...");
+ serverLog(REDIS_WARNING,"User requested shutdown...");
/* Kill the saving child if there is a background saving in progress.
We want to avoid race conditions, for instance our saving child may
overwrite the synchronous saving did by SHUTDOWN. */
if (server.rdb_child_pid != -1) {
- redisLog(REDIS_WARNING,"There is a child saving an .rdb. Killing it!");
+ serverLog(REDIS_WARNING,"There is a child saving an .rdb. Killing it!");
kill(server.rdb_child_pid,SIGUSR1);
rdbRemoveTempFile(server.rdb_child_pid);
}
@@ -2397,19 +2397,19 @@ int prepareForShutdown(int flags) {
/* If we have AOF enabled but haven't written the AOF yet, don't
* shutdown or else the dataset will be lost. */
if (server.aof_state == REDIS_AOF_WAIT_REWRITE) {
- redisLog(REDIS_WARNING, "Writing initial AOF, can't exit.");
+ serverLog(REDIS_WARNING, "Writing initial AOF, can't exit.");
return REDIS_ERR;
}
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"There is a child rewriting the AOF. Killing it!");
kill(server.aof_child_pid,SIGUSR1);
}
/* Append only file: fsync() the AOF and exit */
- redisLog(REDIS_NOTICE,"Calling fsync() on the AOF file.");
+ serverLog(REDIS_NOTICE,"Calling fsync() on the AOF file.");
aof_fsync(server.aof_fd);
}
if ((server.saveparamslen > 0 && !nosave) || save) {
- redisLog(REDIS_NOTICE,"Saving the final RDB snapshot before exiting.");
+ serverLog(REDIS_NOTICE,"Saving the final RDB snapshot before exiting.");
/* Snapshotting. Perform a SYNC SAVE and exit */
if (rdbSave(server.rdb_filename) != REDIS_OK) {
/* Ooops.. error saving! The best we can do is to continue
@@ -2417,17 +2417,17 @@ int prepareForShutdown(int flags) {
* in the next cron() Redis will be notified that the background
* saving aborted, handling special stuff like slaves pending for
* synchronization... */
- redisLog(REDIS_WARNING,"Error trying to save the DB, can't exit.");
+ serverLog(REDIS_WARNING,"Error trying to save the DB, can't exit.");
return REDIS_ERR;
}
}
if (server.daemonize || server.pidfile) {
- redisLog(REDIS_NOTICE,"Removing the pid file.");
+ serverLog(REDIS_NOTICE,"Removing the pid file.");
unlink(server.pidfile);
}
/* Close the listening sockets. Apparently this allows faster restarts. */
closeListeningSockets(1);
- redisLog(REDIS_WARNING,"%s is now ready to exit, bye bye...",
+ serverLog(REDIS_WARNING,"%s is now ready to exit, bye bye...",
server.sentinel_mode ? "Sentinel" : "Redis");
return REDIS_OK;
}
@@ -3444,10 +3444,10 @@ int linuxOvercommitMemoryValue(void) {
void linuxMemoryWarnings(void) {
if (linuxOvercommitMemoryValue() == 0) {
- redisLog(REDIS_WARNING,"WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.");
+ serverLog(REDIS_WARNING,"WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.");
}
if (THPIsEnabled()) {
- redisLog(REDIS_WARNING,"WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.");
+ serverLog(REDIS_WARNING,"WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.");
}
}
#endif /* __linux__ */
@@ -3520,7 +3520,7 @@ void redisAsciiArt(void) {
else mode = "standalone";
if (server.syslog_enabled) {
- redisLog(REDIS_NOTICE,
+ serverLog(REDIS_NOTICE,
"Redis %s (%s/%d) %s bit, %s mode, port %d, pid %ld ready to start.",
REDIS_VERSION,
redisGitSHA1(),
@@ -3538,7 +3538,7 @@ void redisAsciiArt(void) {
mode, server.port,
(long) getpid()
);
- redisLogRaw(REDIS_NOTICE|REDIS_LOG_RAW,buf);
+ serverLogRaw(REDIS_NOTICE|REDIS_LOG_RAW,buf);
}
zfree(buf);
}
@@ -3562,14 +3562,14 @@ static void sigShutdownHandler(int sig) {
* the user really wanting to quit ASAP without waiting to persist
* on disk. */
if (server.shutdown_asap && sig == SIGINT) {
- redisLogFromHandler(REDIS_WARNING, "You insist... exiting now.");
+ serverLogFromHandler(REDIS_WARNING, "You insist... exiting now.");
rdbRemoveTempFile(getpid());
exit(1); /* Exit with an error since this was not a clean shutdown. */
} else if (server.loading) {
exit(0);
}
- redisLogFromHandler(REDIS_WARNING, msg);
+ serverLogFromHandler(REDIS_WARNING, msg);
server.shutdown_asap = 1;
}
@@ -3614,20 +3614,20 @@ void loadDataFromDisk(void) {
long long start = ustime();
if (server.aof_state == REDIS_AOF_ON) {
if (loadAppendOnlyFile(server.aof_filename) == REDIS_OK)
- redisLog(REDIS_NOTICE,"DB loaded from append only file: %.3f seconds",(float)(ustime()-start)/1000000);
+ serverLog(REDIS_NOTICE,"DB loaded from append only file: %.3f seconds",(float)(ustime()-start)/1000000);
} else {
if (rdbLoad(server.rdb_filename) == REDIS_OK) {
- redisLog(REDIS_NOTICE,"DB loaded from disk: %.3f seconds",
+ serverLog(REDIS_NOTICE,"DB loaded from disk: %.3f seconds",
(float)(ustime()-start)/1000000);
} else if (errno != ENOENT) {
- redisLog(REDIS_WARNING,"Fatal error loading the DB: %s. Exiting.",strerror(errno));
+ serverLog(REDIS_WARNING,"Fatal error loading the DB: %s. Exiting.",strerror(errno));
exit(1);
}
}
}
void redisOutOfMemoryHandler(size_t allocation_size) {
- redisLog(REDIS_WARNING,"Out Of Memory allocating %zu bytes!",
+ serverLog(REDIS_WARNING,"Out Of Memory allocating %zu bytes!",
allocation_size);
redisPanic("Redis aborting for OUT OF MEMORY");
}
@@ -3656,12 +3656,12 @@ int redisSupervisedUpstart(void) {
const char *upstart_job = getenv("UPSTART_JOB");
if (!upstart_job) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"upstart supervision requested, but UPSTART_JOB not found");
return 0;
}
- redisLog(REDIS_NOTICE, "supervised by upstart, will stop to signal readyness");
+ serverLog(REDIS_NOTICE, "supervised by upstart, will stop to signal readyness");
raise(SIGSTOP);
unsetenv("UPSTART_JOB");
return 1;
@@ -3676,7 +3676,7 @@ int redisSupervisedSystemd(void) {
int sendto_flags = 0;
if (!notify_socket) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"systemd supervision requested, but NOTIFY_SOCKET not found");
return 0;
}
@@ -3685,9 +3685,9 @@ int redisSupervisedSystemd(void) {
return 0;
}
- redisLog(REDIS_NOTICE, "supervised by systemd, will signal readyness");
+ serverLog(REDIS_NOTICE, "supervised by systemd, will signal readyness");
if ((fd = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Can't connect to systemd socket %s", notify_socket);
return 0;
}
@@ -3716,7 +3716,7 @@ int redisSupervisedSystemd(void) {
sendto_flags |= MSG_NOSIGNAL;
#endif
if (sendmsg(fd, &hdr, sendto_flags) < 0) {
- redisLog(REDIS_WARNING, "Can't send notification to systemd");
+ serverLog(REDIS_WARNING, "Can't send notification to systemd");
close(fd);
return 0;
}
@@ -3847,9 +3847,9 @@ int main(int argc, char **argv) {
j++;
}
if (server.sentinel_mode && configfile && *configfile == '-') {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Sentinel config from STDIN not allowed.");
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"Sentinel needs config file on disk to save state. Exiting...");
exit(1);
}
@@ -3858,7 +3858,7 @@ int main(int argc, char **argv) {
loadServerConfig(configfile,options);
sdsfree(options);
} else {
- redisLog(REDIS_WARNING, "Warning: no config file specified, using the default config. In order to specify a config file use %s /path/to/%s.conf", argv[0], server.sentinel_mode ? "sentinel" : "redis");
+ serverLog(REDIS_WARNING, "Warning: no config file specified, using the default config. In order to specify a config file use %s /path/to/%s.conf", argv[0], server.sentinel_mode ? "sentinel" : "redis");
}
server.supervised = redisIsSupervised(server.supervised_mode);
@@ -3872,7 +3872,7 @@ int main(int argc, char **argv) {
if (!server.sentinel_mode) {
/* Things not needed when running in Sentinel mode. */
- redisLog(REDIS_WARNING,"Server started, Redis version " REDIS_VERSION);
+ serverLog(REDIS_WARNING,"Server started, Redis version " REDIS_VERSION);
#ifdef __linux__
linuxMemoryWarnings();
#endif
@@ -3880,23 +3880,23 @@ int main(int argc, char **argv) {
loadDataFromDisk();
if (server.cluster_enabled) {
if (verifyClusterConfigWithData() == REDIS_ERR) {
- redisLog(REDIS_WARNING,
+ serverLog(REDIS_WARNING,
"You can't have keys in a DB different than DB 0 when in "
"Cluster mode. Exiting.");
exit(1);
}
}
if (server.ipfd_count > 0)
- redisLog(REDIS_NOTICE,"The server is now ready to accept connections on port %d", server.port);
+ serverLog(REDIS_NOTICE,"The server is now ready to accept connections on port %d", server.port);
if (server.sofd > 0)
- redisLog(REDIS_NOTICE,"The server is now ready to accept connections at %s", server.unixsocket);
+ serverLog(REDIS_NOTICE,"The server is now ready to accept connections at %s", server.unixsocket);
} else {
sentinelIsRunning();
}
/* Warning the user about suspicious maxmemory setting. */
if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
- redisLog(REDIS_WARNING,"WARNING: You specified a maxmemory value that is less than 1MB (current value is %llu bytes). Are you sure this is what you really want?", server.maxmemory);
+ serverLog(REDIS_WARNING,"WARNING: You specified a maxmemory value that is less than 1MB (current value is %llu bytes). Are you sure this is what you really want?", server.maxmemory);
}
aeSetBeforeSleepProc(server.el,beforeSleep);
diff --git a/src/server.h b/src/server.h
index 7149bb4f5..2e926b989 100644
--- a/src/server.h
+++ b/src/server.h
@@ -1258,13 +1258,13 @@ void forceCommandPropagation(redisClient *c, int flags);
void preventCommandPropagation(redisClient *c);
int prepareForShutdown();
#ifdef __GNUC__
-void redisLog(int level, const char *fmt, ...)
+void serverLog(int level, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
#else
-void redisLog(int level, const char *fmt, ...);
+void serverLog(int level, const char *fmt, ...);
#endif
-void redisLogRaw(int level, const char *msg);
-void redisLogFromHandler(int level, const char *msg);
+void serverLogRaw(int level, const char *msg);
+void serverLogFromHandler(int level, const char *msg);
void usage(void);
void updateDictResizePolicy(void);
int htNeedsResize(dict *dict);
@@ -1585,13 +1585,13 @@ void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int l
void _redisAssert(char *estr, char *file, int line);
void _redisPanic(char *msg, char *file, int line);
void bugReportStart(void);
-void redisLogObjectDebugInfo(robj *o);
+void serverLogObjectDebugInfo(robj *o);
void sigsegvHandler(int sig, siginfo_t *info, void *secret);
sds genRedisInfoString(char *section);
void enableWatchdog(int period);
void disableWatchdog(void);
void watchdogScheduleSignal(int period);
-void redisLogHexDump(int level, char *descr, void *value, size_t len);
+void serverLogHexDump(int level, char *descr, void *value, size_t len);
#define redisDebug(fmt, ...) \
printf("DEBUG %s:%d > " fmt "\n", __FILE__, __LINE__, __VA_ARGS__)
diff --git a/src/t_hash.c b/src/t_hash.c
index ddfcf31a8..8754f3182 100644
--- a/src/t_hash.c
+++ b/src/t_hash.c
@@ -452,7 +452,7 @@ void hashTypeConvertZiplist(robj *o, int enc) {
value = tryObjectEncoding(value);
ret = dictAdd(dict, field, value);
if (ret != DICT_OK) {
- redisLogHexDump(REDIS_WARNING,"ziplist with dup elements dump",
+ serverLogHexDump(REDIS_WARNING,"ziplist with dup elements dump",
o->ptr,ziplistBlobLen(o->ptr));
redisAssert(ret == DICT_OK);
}