Commit 2d9e3eb1 authored by antirez's avatar antirez
Browse files

RDMF: redisAssert -> serverAssert.

parent 14ff5724
...@@ -204,7 +204,7 @@ void aof_background_fsync(int fd) { ...@@ -204,7 +204,7 @@ void aof_background_fsync(int fd) {
/* Called when the user switches from "appendonly yes" to "appendonly no" /* Called when the user switches from "appendonly yes" to "appendonly no"
* at runtime using the CONFIG command. */ * at runtime using the CONFIG command. */
void stopAppendOnly(void) { void stopAppendOnly(void) {
redisAssert(server.aof_state != REDIS_AOF_OFF); serverAssert(server.aof_state != REDIS_AOF_OFF);
flushAppendOnlyFile(1); flushAppendOnlyFile(1);
aof_fsync(server.aof_fd); aof_fsync(server.aof_fd);
close(server.aof_fd); close(server.aof_fd);
...@@ -235,7 +235,7 @@ void stopAppendOnly(void) { ...@@ -235,7 +235,7 @@ void stopAppendOnly(void) {
int startAppendOnly(void) { int startAppendOnly(void) {
server.aof_last_fsync = server.unixtime; server.aof_last_fsync = server.unixtime;
server.aof_fd = open(server.aof_filename,O_WRONLY|O_APPEND|O_CREAT,0644); server.aof_fd = open(server.aof_filename,O_WRONLY|O_APPEND|O_CREAT,0644);
redisAssert(server.aof_state == REDIS_AOF_OFF); serverAssert(server.aof_state == REDIS_AOF_OFF);
if (server.aof_fd == -1) { if (server.aof_fd == -1) {
serverLog(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; return REDIS_ERR;
...@@ -685,9 +685,9 @@ int loadAppendOnlyFile(char *filename) { ...@@ -685,9 +685,9 @@ int loadAppendOnlyFile(char *filename) {
cmd->proc(fakeClient); cmd->proc(fakeClient);
/* The fake client should not have a reply */ /* The fake client should not have a reply */
redisAssert(fakeClient->bufpos == 0 && listLength(fakeClient->reply) == 0); serverAssert(fakeClient->bufpos == 0 && listLength(fakeClient->reply) == 0);
/* The fake client should never get blocked */ /* The fake client should never get blocked */
redisAssert((fakeClient->flags & REDIS_BLOCKED) == 0); serverAssert((fakeClient->flags & REDIS_BLOCKED) == 0);
/* Clean up. Command code may have changed argv/argc so we use the /* Clean up. Command code may have changed argv/argc so we use the
* argv/argc of the client instead of the local variables. */ * argv/argc of the client instead of the local variables. */
...@@ -860,12 +860,12 @@ int rewriteSortedSetObject(rio *r, robj *key, robj *o) { ...@@ -860,12 +860,12 @@ int rewriteSortedSetObject(rio *r, robj *key, robj *o) {
double score; double score;
eptr = ziplistIndex(zl,0); eptr = ziplistIndex(zl,0);
redisAssert(eptr != NULL); serverAssert(eptr != NULL);
sptr = ziplistNext(zl,eptr); sptr = ziplistNext(zl,eptr);
redisAssert(sptr != NULL); serverAssert(sptr != NULL);
while (eptr != NULL) { while (eptr != NULL) {
redisAssert(ziplistGet(eptr,&vstr,&vlen,&vll)); serverAssert(ziplistGet(eptr,&vstr,&vlen,&vll));
score = zzlGetScore(sptr); score = zzlGetScore(sptr);
if (count == 0) { if (count == 0) {
......
...@@ -112,7 +112,7 @@ void processUnblockedClients(void) { ...@@ -112,7 +112,7 @@ void processUnblockedClients(void) {
while (listLength(server.unblocked_clients)) { while (listLength(server.unblocked_clients)) {
ln = listFirst(server.unblocked_clients); ln = listFirst(server.unblocked_clients);
redisAssert(ln != NULL); serverAssert(ln != NULL);
c = ln->value; c = ln->value;
listDelNode(server.unblocked_clients,ln); listDelNode(server.unblocked_clients,ln);
c->flags &= ~REDIS_UNBLOCKED; c->flags &= ~REDIS_UNBLOCKED;
......
...@@ -176,7 +176,7 @@ int clusterLoadConfig(char *filename) { ...@@ -176,7 +176,7 @@ int clusterLoadConfig(char *filename) {
p = strchr(s,','); p = strchr(s,',');
if (p) *p = '\0'; if (p) *p = '\0';
if (!strcasecmp(s,"myself")) { if (!strcasecmp(s,"myself")) {
redisAssert(server.cluster->myself == NULL); serverAssert(server.cluster->myself == NULL);
myself = server.cluster->myself = n; myself = server.cluster->myself = n;
n->flags |= REDIS_NODE_MYSELF; n->flags |= REDIS_NODE_MYSELF;
} else if (!strcasecmp(s,"master")) { } else if (!strcasecmp(s,"master")) {
...@@ -230,7 +230,7 @@ int clusterLoadConfig(char *filename) { ...@@ -230,7 +230,7 @@ int clusterLoadConfig(char *filename) {
clusterNode *cn; clusterNode *cn;
p = strchr(argv[j],'-'); p = strchr(argv[j],'-');
redisAssert(p != NULL); serverAssert(p != NULL);
*p = '\0'; *p = '\0';
direction = p[1]; /* Either '>' or '<' */ direction = p[1]; /* Either '>' or '<' */
slot = atoi(argv[j]+1); slot = atoi(argv[j]+1);
...@@ -833,7 +833,7 @@ void freeClusterNode(clusterNode *n) { ...@@ -833,7 +833,7 @@ void freeClusterNode(clusterNode *n) {
/* Unlink from the set of nodes. */ /* Unlink from the set of nodes. */
nodename = sdsnewlen(n->name, REDIS_CLUSTER_NAMELEN); nodename = sdsnewlen(n->name, REDIS_CLUSTER_NAMELEN);
redisAssert(dictDelete(server.cluster->nodes,nodename) == DICT_OK); serverAssert(dictDelete(server.cluster->nodes,nodename) == DICT_OK);
sdsfree(nodename); sdsfree(nodename);
/* Release link and associated data structures. */ /* Release link and associated data structures. */
...@@ -915,7 +915,7 @@ void clusterRenameNode(clusterNode *node, char *newname) { ...@@ -915,7 +915,7 @@ void clusterRenameNode(clusterNode *node, char *newname) {
node->name, newname); node->name, newname);
retval = dictDelete(server.cluster->nodes, s); retval = dictDelete(server.cluster->nodes, s);
sdsfree(s); sdsfree(s);
redisAssert(retval == DICT_OK); serverAssert(retval == DICT_OK);
memcpy(node->name, newname, REDIS_CLUSTER_NAMELEN); memcpy(node->name, newname, REDIS_CLUSTER_NAMELEN);
clusterAddNode(node); clusterAddNode(node);
} }
...@@ -1183,7 +1183,7 @@ void markNodeAsFailingIfNeeded(clusterNode *node) { ...@@ -1183,7 +1183,7 @@ void markNodeAsFailingIfNeeded(clusterNode *node) {
void clearNodeFailureIfNeeded(clusterNode *node) { void clearNodeFailureIfNeeded(clusterNode *node) {
mstime_t now = mstime(); mstime_t now = mstime();
redisAssert(nodeFailed(node)); serverAssert(nodeFailed(node));
/* For slaves we always clear the FAIL flag if we can contact the /* For slaves we always clear the FAIL flag if we can contact the
* node again. */ * node again. */
...@@ -2571,7 +2571,7 @@ int clusterGetSlaveRank(void) { ...@@ -2571,7 +2571,7 @@ int clusterGetSlaveRank(void) {
int j, rank = 0; int j, rank = 0;
clusterNode *master; clusterNode *master;
redisAssert(nodeIsSlave(myself)); serverAssert(nodeIsSlave(myself));
master = myself->slaveof; master = myself->slaveof;
if (master == NULL) return 0; /* Never called by slaves without master. */ if (master == NULL) return 0; /* Never called by slaves without master. */
...@@ -3360,7 +3360,7 @@ int clusterDelSlot(int slot) { ...@@ -3360,7 +3360,7 @@ int clusterDelSlot(int slot) {
clusterNode *n = server.cluster->slots[slot]; clusterNode *n = server.cluster->slots[slot];
if (!n) return REDIS_ERR; if (!n) return REDIS_ERR;
redisAssert(clusterNodeClearSlotBit(n,slot) == 1); serverAssert(clusterNodeClearSlotBit(n,slot) == 1);
server.cluster->slots[slot] = NULL; server.cluster->slots[slot] = NULL;
return REDIS_OK; return REDIS_OK;
} }
...@@ -3567,8 +3567,8 @@ int verifyClusterConfigWithData(void) { ...@@ -3567,8 +3567,8 @@ int verifyClusterConfigWithData(void) {
/* Set the specified node 'n' as master for this node. /* Set the specified node 'n' as master for this node.
* If this node is currently a master, it is turned into a slave. */ * If this node is currently a master, it is turned into a slave. */
void clusterSetMaster(clusterNode *n) { void clusterSetMaster(clusterNode *n) {
redisAssert(n != myself); serverAssert(n != myself);
redisAssert(myself->numslots == 0); serverAssert(myself->numslots == 0);
if (nodeIsMaster(myself)) { if (nodeIsMaster(myself)) {
myself->flags &= ~REDIS_NODE_MASTER; myself->flags &= ~REDIS_NODE_MASTER;
...@@ -3894,7 +3894,7 @@ void clusterCommand(client *c) { ...@@ -3894,7 +3894,7 @@ void clusterCommand(client *c) {
retval = del ? clusterDelSlot(j) : retval = del ? clusterDelSlot(j) :
clusterAddSlot(myself,j); clusterAddSlot(myself,j);
redisAssertWithInfo(c,NULL,retval == REDIS_OK); serverAssertWithInfo(c,NULL,retval == REDIS_OK);
} }
} }
zfree(slots); zfree(slots);
...@@ -4315,8 +4315,8 @@ void createDumpPayload(rio *payload, robj *o) { ...@@ -4315,8 +4315,8 @@ void createDumpPayload(rio *payload, robj *o) {
/* Serialize the object in a RDB-like format. It consist of an object type /* Serialize the object in a RDB-like format. It consist of an object type
* byte followed by the serialized object. This is understood by RESTORE. */ * byte followed by the serialized object. This is understood by RESTORE. */
rioInitWithBuffer(payload,sdsempty()); rioInitWithBuffer(payload,sdsempty());
redisAssert(rdbSaveObjectType(payload,o)); serverAssert(rdbSaveObjectType(payload,o));
redisAssert(rdbSaveObject(payload,o)); serverAssert(rdbSaveObject(payload,o));
/* Write the footer, this is how it looks like: /* Write the footer, this is how it looks like:
* ----------------+---------------------+---------------+ * ----------------+---------------------+---------------+
...@@ -4610,9 +4610,9 @@ try_again: ...@@ -4610,9 +4610,9 @@ try_again:
/* Send the SELECT command if the current DB is not already selected. */ /* Send the SELECT command if the current DB is not already selected. */
int select = cs->last_dbid != dbid; /* Should we emit SELECT? */ int select = cs->last_dbid != dbid; /* Should we emit SELECT? */
if (select) { if (select) {
redisAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',2)); serverAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',2));
redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"SELECT",6)); serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"SELECT",6));
redisAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,dbid)); serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,dbid));
} }
/* Create RESTORE payload and generate the protocol to call the command. */ /* Create RESTORE payload and generate the protocol to call the command. */
...@@ -4621,28 +4621,28 @@ try_again: ...@@ -4621,28 +4621,28 @@ try_again:
ttl = expireat-mstime(); ttl = expireat-mstime();
if (ttl < 1) ttl = 1; if (ttl < 1) ttl = 1;
} }
redisAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',replace ? 5 : 4)); serverAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',replace ? 5 : 4));
if (server.cluster_enabled) if (server.cluster_enabled)
redisAssertWithInfo(c,NULL, serverAssertWithInfo(c,NULL,
rioWriteBulkString(&cmd,"RESTORE-ASKING",14)); rioWriteBulkString(&cmd,"RESTORE-ASKING",14));
else else
redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"RESTORE",7)); serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"RESTORE",7));
redisAssertWithInfo(c,NULL,sdsEncodedObject(c->argv[3])); serverAssertWithInfo(c,NULL,sdsEncodedObject(c->argv[3]));
redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,c->argv[3]->ptr, serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,c->argv[3]->ptr,
sdslen(c->argv[3]->ptr))); sdslen(c->argv[3]->ptr)));
redisAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,ttl)); serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,ttl));
/* Emit the payload argument, that is the serialized object using /* Emit the payload argument, that is the serialized object using
* the DUMP format. */ * the DUMP format. */
createDumpPayload(&payload,o); createDumpPayload(&payload,o);
redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,payload.io.buffer.ptr, serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,payload.io.buffer.ptr,
sdslen(payload.io.buffer.ptr))); sdslen(payload.io.buffer.ptr)));
sdsfree(payload.io.buffer.ptr); sdsfree(payload.io.buffer.ptr);
/* Add the REPLACE option to the RESTORE command if it was specified /* Add the REPLACE option to the RESTORE command if it was specified
* as a MIGRATE option. */ * as a MIGRATE option. */
if (replace) if (replace)
redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"REPLACE",7)); serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"REPLACE",7));
/* Transfer the query to the other node in 64K chunks. */ /* Transfer the query to the other node in 64K chunks. */
errno = 0; errno = 0;
......
...@@ -474,7 +474,7 @@ void loadServerConfigFromString(char *config) { ...@@ -474,7 +474,7 @@ void loadServerConfigFromString(char *config) {
/* If the target command name is the empty string we just /* If the target command name is the empty string we just
* remove it from the command table. */ * remove it from the command table. */
retval = dictDelete(server.commands, argv[1]); retval = dictDelete(server.commands, argv[1]);
redisAssert(retval == DICT_OK); serverAssert(retval == DICT_OK);
/* Otherwise we re-add the command under a different name. */ /* Otherwise we re-add the command under a different name. */
if (sdslen(argv[2]) != 0) { if (sdslen(argv[2]) != 0) {
...@@ -703,8 +703,8 @@ void configSetCommand(client *c) { ...@@ -703,8 +703,8 @@ void configSetCommand(client *c) {
robj *o; robj *o;
long long ll; long long ll;
int err; int err;
redisAssertWithInfo(c,c->argv[2],sdsEncodedObject(c->argv[2])); serverAssertWithInfo(c,c->argv[2],sdsEncodedObject(c->argv[2]));
redisAssertWithInfo(c,c->argv[3],sdsEncodedObject(c->argv[3])); serverAssertWithInfo(c,c->argv[3],sdsEncodedObject(c->argv[3]));
o = c->argv[3]; o = c->argv[3];
if (0) { /* this starts the config_set macros else-if chain. */ if (0) { /* this starts the config_set macros else-if chain. */
...@@ -1030,7 +1030,7 @@ void configGetCommand(client *c) { ...@@ -1030,7 +1030,7 @@ void configGetCommand(client *c) {
char *pattern = o->ptr; char *pattern = o->ptr;
char buf[128]; char buf[128];
int matches = 0; int matches = 0;
redisAssertWithInfo(c,o,sdsEncodedObject(o)); serverAssertWithInfo(c,o,sdsEncodedObject(o));
/* String values */ /* String values */
config_get_string_field("dbfilename",server.rdb_filename); config_get_string_field("dbfilename",server.rdb_filename);
......
...@@ -119,7 +119,7 @@ void dbAdd(redisDb *db, robj *key, robj *val) { ...@@ -119,7 +119,7 @@ void dbAdd(redisDb *db, robj *key, robj *val) {
sds copy = sdsdup(key->ptr); sds copy = sdsdup(key->ptr);
int retval = dictAdd(db->dict, copy, val); int retval = dictAdd(db->dict, copy, val);
redisAssertWithInfo(NULL,key,retval == REDIS_OK); serverAssertWithInfo(NULL,key,retval == REDIS_OK);
if (val->type == OBJ_LIST) signalListAsReady(db, key); if (val->type == OBJ_LIST) signalListAsReady(db, key);
if (server.cluster_enabled) slotToKeyAdd(key); if (server.cluster_enabled) slotToKeyAdd(key);
} }
...@@ -132,7 +132,7 @@ void dbAdd(redisDb *db, robj *key, robj *val) { ...@@ -132,7 +132,7 @@ void dbAdd(redisDb *db, robj *key, robj *val) {
void dbOverwrite(redisDb *db, robj *key, robj *val) { void dbOverwrite(redisDb *db, robj *key, robj *val) {
dictEntry *de = dictFind(db->dict,key->ptr); dictEntry *de = dictFind(db->dict,key->ptr);
redisAssertWithInfo(NULL,key,de != NULL); serverAssertWithInfo(NULL,key,de != NULL);
dictReplace(db->dict, key->ptr, val); dictReplace(db->dict, key->ptr, val);
} }
...@@ -224,7 +224,7 @@ int dbDelete(redisDb *db, robj *key) { ...@@ -224,7 +224,7 @@ int dbDelete(redisDb *db, robj *key) {
* using an sdscat() call to append some data, or anything else. * using an sdscat() call to append some data, or anything else.
*/ */
robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o) { robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o) {
redisAssert(o->type == OBJ_STRING); serverAssert(o->type == OBJ_STRING);
if (o->refcount != 1 || o->encoding != OBJ_ENCODING_RAW) { if (o->refcount != 1 || o->encoding != OBJ_ENCODING_RAW) {
robj *decoded = getDecodedObject(o); robj *decoded = getDecodedObject(o);
o = createRawStringObject(decoded->ptr, sdslen(decoded->ptr)); o = createRawStringObject(decoded->ptr, sdslen(decoded->ptr));
...@@ -460,7 +460,7 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) { ...@@ -460,7 +460,7 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) {
/* Object must be NULL (to iterate keys names), or the type of the object /* Object must be NULL (to iterate keys names), or the type of the object
* must be Set, Sorted Set, or Hash. */ * must be Set, Sorted Set, or Hash. */
redisAssert(o == NULL || o->type == OBJ_SET || o->type == OBJ_HASH || serverAssert(o == NULL || o->type == OBJ_SET || o->type == OBJ_HASH ||
o->type == OBJ_ZSET); o->type == OBJ_ZSET);
/* Set i to the first option argument. The previous one is the cursor. */ /* Set i to the first option argument. The previous one is the cursor. */
...@@ -579,7 +579,7 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) { ...@@ -579,7 +579,7 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) {
char buf[REDIS_LONGSTR_SIZE]; char buf[REDIS_LONGSTR_SIZE];
int len; int len;
redisAssert(kobj->encoding == OBJ_ENCODING_INT); serverAssert(kobj->encoding == OBJ_ENCODING_INT);
len = ll2string(buf,sizeof(buf),(long)kobj->ptr); len = ll2string(buf,sizeof(buf),(long)kobj->ptr);
if (!stringmatchlen(pat, patlen, buf, len, 0)) filter = 1; if (!stringmatchlen(pat, patlen, buf, len, 0)) filter = 1;
} }
...@@ -799,7 +799,7 @@ void moveCommand(client *c) { ...@@ -799,7 +799,7 @@ void moveCommand(client *c) {
int removeExpire(redisDb *db, robj *key) { int removeExpire(redisDb *db, robj *key) {
/* An expire may only be removed if there is a corresponding entry in the /* An expire may only be removed if there is a corresponding entry in the
* main dict. Otherwise, the key will never be freed. */ * main dict. Otherwise, the key will never be freed. */
redisAssertWithInfo(NULL,key,dictFind(db->dict,key->ptr) != NULL); serverAssertWithInfo(NULL,key,dictFind(db->dict,key->ptr) != NULL);
return dictDelete(db->expires,key->ptr) == DICT_OK; return dictDelete(db->expires,key->ptr) == DICT_OK;
} }
...@@ -808,7 +808,7 @@ void setExpire(redisDb *db, robj *key, long long when) { ...@@ -808,7 +808,7 @@ void setExpire(redisDb *db, robj *key, long long when) {
/* Reuse the sds from the main dict in the expire dict */ /* Reuse the sds from the main dict in the expire dict */
kde = dictFind(db->dict,key->ptr); kde = dictFind(db->dict,key->ptr);
redisAssertWithInfo(NULL,key,kde != NULL); serverAssertWithInfo(NULL,key,kde != NULL);
de = dictReplaceRaw(db->expires,dictGetKey(kde)); de = dictReplaceRaw(db->expires,dictGetKey(kde));
dictSetSignedIntegerVal(de,when); dictSetSignedIntegerVal(de,when);
} }
...@@ -824,7 +824,7 @@ long long getExpire(redisDb *db, robj *key) { ...@@ -824,7 +824,7 @@ long long getExpire(redisDb *db, robj *key) {
/* The entry was found in the expire dict, this means it should also /* The entry was found in the expire dict, this means it should also
* be present in the main dict (safety check). */ * be present in the main dict (safety check). */
redisAssertWithInfo(NULL,key,dictFind(db->dict,key->ptr) != NULL); serverAssertWithInfo(NULL,key,dictFind(db->dict,key->ptr) != NULL);
return dictGetSignedIntegerVal(de); return dictGetSignedIntegerVal(de);
} }
...@@ -924,7 +924,7 @@ void expireGenericCommand(client *c, long long basetime, int unit) { ...@@ -924,7 +924,7 @@ void expireGenericCommand(client *c, long long basetime, int unit) {
if (when <= mstime() && !server.loading && !server.masterhost) { if (when <= mstime() && !server.loading && !server.masterhost) {
robj *aux; robj *aux;
redisAssertWithInfo(c,key,dbDelete(c->db,key)); serverAssertWithInfo(c,key,dbDelete(c->db,key));
server.dirty++; server.dirty++;
/* Replicate/AOF this as an explicit DEL. */ /* Replicate/AOF this as an explicit DEL. */
...@@ -1025,7 +1025,7 @@ int *getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, in ...@@ -1025,7 +1025,7 @@ int *getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, in
if (last < 0) last = argc+last; if (last < 0) last = argc+last;
keys = zmalloc(sizeof(int)*((last - cmd->firstkey)+1)); keys = zmalloc(sizeof(int)*((last - cmd->firstkey)+1));
for (j = cmd->firstkey; j <= last; j += cmd->keystep) { for (j = cmd->firstkey; j <= last; j += cmd->keystep) {
redisAssert(j < argc); serverAssert(j < argc);
keys[i++] = j; keys[i++] = j;
} }
*numkeys = i; *numkeys = i;
......
...@@ -181,12 +181,12 @@ void computeDatasetDigest(unsigned char *final) { ...@@ -181,12 +181,12 @@ void computeDatasetDigest(unsigned char *final) {
double score; double score;
eptr = ziplistIndex(zl,0); eptr = ziplistIndex(zl,0);
redisAssert(eptr != NULL); serverAssert(eptr != NULL);
sptr = ziplistNext(zl,eptr); sptr = ziplistNext(zl,eptr);
redisAssert(sptr != NULL); serverAssert(sptr != NULL);
while (eptr != NULL) { while (eptr != NULL) {
redisAssert(ziplistGet(eptr,&vstr,&vlen,&vll)); serverAssert(ziplistGet(eptr,&vstr,&vlen,&vll));
score = zzlGetScore(sptr); score = zzlGetScore(sptr);
memset(eledigest,0,20); memset(eledigest,0,20);
...@@ -267,7 +267,7 @@ void debugCommand(client *c) { ...@@ -267,7 +267,7 @@ void debugCommand(client *c) {
addReply(c,shared.ok); addReply(c,shared.ok);
} else if (!strcasecmp(c->argv[1]->ptr,"assert")) { } else if (!strcasecmp(c->argv[1]->ptr,"assert")) {
if (c->argc >= 3) c->argv[2] = tryObjectEncoding(c->argv[2]); if (c->argc >= 3) c->argv[2] = tryObjectEncoding(c->argv[2]);
redisAssertWithInfo(c,c->argv[0],1 == 2); serverAssertWithInfo(c,c->argv[0],1 == 2);
} else if (!strcasecmp(c->argv[1]->ptr,"reload")) { } else if (!strcasecmp(c->argv[1]->ptr,"reload")) {
if (rdbSave(server.rdb_filename) != REDIS_OK) { if (rdbSave(server.rdb_filename) != REDIS_OK) {
addReply(c,shared.err); addReply(c,shared.err);
...@@ -470,7 +470,7 @@ void debugCommand(client *c) { ...@@ -470,7 +470,7 @@ void debugCommand(client *c) {
/* =========================== Crash handling ============================== */ /* =========================== Crash handling ============================== */
void _redisAssert(char *estr, char *file, int line) { void _serverAssert(char *estr, char *file, int line) {
bugReportStart(); bugReportStart();
serverLog(REDIS_WARNING,"=== ASSERTION FAILED ==="); serverLog(REDIS_WARNING,"=== ASSERTION FAILED ===");
serverLog(REDIS_WARNING,"==> %s:%d '%s' is not true",file,line,estr); serverLog(REDIS_WARNING,"==> %s:%d '%s' is not true",file,line,estr);
...@@ -483,7 +483,7 @@ void _redisAssert(char *estr, char *file, int line) { ...@@ -483,7 +483,7 @@ void _redisAssert(char *estr, char *file, int line) {
*((char*)-1) = 'x'; *((char*)-1) = 'x';
} }
void _redisAssertPrintClientInfo(client *c) { void _serverAssertPrintClientInfo(client *c) {
int j; int j;
bugReportStart(); bugReportStart();
...@@ -531,16 +531,16 @@ void serverLogObjectDebugInfo(robj *o) { ...@@ -531,16 +531,16 @@ void serverLogObjectDebugInfo(robj *o) {
} }
} }
void _redisAssertPrintObject(robj *o) { void _serverAssertPrintObject(robj *o) {
bugReportStart(); bugReportStart();
serverLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ==="); serverLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ===");
serverLogObjectDebugInfo(o); serverLogObjectDebugInfo(o);
} }
void _redisAssertWithInfo(client *c, robj *o, char *estr, char *file, int line) { void _serverAssertWithInfo(client *c, robj *o, char *estr, char *file, int line) {
if (c) _redisAssertPrintClientInfo(c); if (c) _serverAssertPrintClientInfo(c);
if (o) _redisAssertPrintObject(o); if (o) _serverAssertPrintObject(o);
_redisAssert(estr,file,line); _serverAssert(estr,file,line);
} }
void _redisPanic(char *msg, char *file, int line) { void _redisPanic(char *msg, char *file, int line) {
......
...@@ -877,7 +877,7 @@ promote: /* Promote to dense representation. */ ...@@ -877,7 +877,7 @@ promote: /* Promote to dense representation. */
* is propagated to slaves / AOF, so if there is a sparse -> dense * is propagated to slaves / AOF, so if there is a sparse -> dense
* convertion, it will be performed in all the slaves as well. */ * convertion, it will be performed in all the slaves as well. */
int dense_retval = hllDenseAdd(hdr->registers, ele, elesize); int dense_retval = hllDenseAdd(hdr->registers, ele, elesize);
redisAssert(dense_retval == 1); serverAssert(dense_retval == 1);
return dense_retval; return dense_retval;
} }
...@@ -1108,7 +1108,7 @@ robj *createHLLObject(void) { ...@@ -1108,7 +1108,7 @@ robj *createHLLObject(void) {
p += 2; p += 2;
aux -= xzero; aux -= xzero;
} }
redisAssert((p-(uint8_t*)s) == sparselen); serverAssert((p-(uint8_t*)s) == sparselen);
/* Create the actual object. */ /* Create the actual object. */
o = createObject(OBJ_STRING,s); o = createObject(OBJ_STRING,s);
......
...@@ -244,7 +244,7 @@ void unwatchAllKeys(client *c) { ...@@ -244,7 +244,7 @@ void unwatchAllKeys(client *c) {
* from the list */ * from the list */
wk = listNodeValue(ln); wk = listNodeValue(ln);
clients = dictFetchValue(wk->db->watched_keys, wk->key); clients = dictFetchValue(wk->db->watched_keys, wk->key);
redisAssertWithInfo(c,NULL,clients != NULL); serverAssertWithInfo(c,NULL,clients != NULL);
listDelNode(clients,listSearchKey(clients,c)); listDelNode(clients,listSearchKey(clients,c));
/* Kill the entry at all if this was the only client */ /* Kill the entry at all if this was the only client */
if (listLength(clients) == 0) if (listLength(clients) == 0)
......
...@@ -44,7 +44,7 @@ size_t sdsZmallocSize(sds s) { ...@@ -44,7 +44,7 @@ size_t sdsZmallocSize(sds s) {
/* Return the amount of memory used by the sds string at object->ptr /* Return the amount of memory used by the sds string at object->ptr
* for a string object. */ * for a string object. */
size_t getStringObjectSdsUsedMemory(robj *o) { size_t getStringObjectSdsUsedMemory(robj *o) {
redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);
switch(o->encoding) { switch(o->encoding) {
case OBJ_ENCODING_RAW: return sdsZmallocSize(o->ptr); case OBJ_ENCODING_RAW: return sdsZmallocSize(o->ptr);
case OBJ_ENCODING_EMBSTR: return zmalloc_size(o)-sizeof(robj); case OBJ_ENCODING_EMBSTR: return zmalloc_size(o)-sizeof(robj);
...@@ -186,7 +186,7 @@ int prepareClientToWrite(client *c) { ...@@ -186,7 +186,7 @@ int prepareClientToWrite(client *c) {
robj *dupLastObjectIfNeeded(list *reply) { robj *dupLastObjectIfNeeded(list *reply) {
robj *new, *cur; robj *new, *cur;
listNode *ln; listNode *ln;
redisAssert(listLength(reply) > 0); serverAssert(listLength(reply) > 0);
ln = listLast(reply); ln = listLast(reply);
cur = listNodeValue(ln); cur = listNodeValue(ln);
if (cur->refcount > 1) { if (cur->refcount > 1) {
...@@ -748,7 +748,7 @@ void freeClient(client *c) { ...@@ -748,7 +748,7 @@ void freeClient(client *c) {
/* Remove from the list of clients */ /* Remove from the list of clients */
if (c->fd != -1) { if (c->fd != -1) {
ln = listSearchKey(server.clients,c); ln = listSearchKey(server.clients,c);
redisAssert(ln != NULL); serverAssert(ln != NULL);
listDelNode(server.clients,ln); listDelNode(server.clients,ln);
} }
...@@ -756,7 +756,7 @@ void freeClient(client *c) { ...@@ -756,7 +756,7 @@ void freeClient(client *c) {
* remove it from the list of unblocked clients. */ * remove it from the list of unblocked clients. */
if (c->flags & REDIS_UNBLOCKED) { if (c->flags & REDIS_UNBLOCKED) {
ln = listSearchKey(server.unblocked_clients,c); ln = listSearchKey(server.unblocked_clients,c);
redisAssert(ln != NULL); serverAssert(ln != NULL);
listDelNode(server.unblocked_clients,ln); listDelNode(server.unblocked_clients,ln);
} }
...@@ -769,7 +769,7 @@ void freeClient(client *c) { ...@@ -769,7 +769,7 @@ void freeClient(client *c) {
} }
list *l = (c->flags & REDIS_MONITOR) ? server.monitors : server.slaves; list *l = (c->flags & REDIS_MONITOR) ? server.monitors : server.slaves;
ln = listSearchKey(l,c); ln = listSearchKey(l,c);
redisAssert(ln != NULL); serverAssert(ln != NULL);
listDelNode(l,ln); listDelNode(l,ln);
/* We need to remember the time when we started to have zero /* We need to remember the time when we started to have zero
* attached slaves, as after some time we'll free the replication * attached slaves, as after some time we'll free the replication
...@@ -787,7 +787,7 @@ void freeClient(client *c) { ...@@ -787,7 +787,7 @@ void freeClient(client *c) {
* from the queue. */ * from the queue. */
if (c->flags & REDIS_CLOSE_ASAP) { if (c->flags & REDIS_CLOSE_ASAP) {
ln = listSearchKey(server.clients_to_close,c); ln = listSearchKey(server.clients_to_close,c);
redisAssert(ln != NULL); serverAssert(ln != NULL);
listDelNode(server.clients_to_close,ln); listDelNode(server.clients_to_close,ln);
} }
...@@ -1000,7 +1000,7 @@ int processMultibulkBuffer(client *c) { ...@@ -1000,7 +1000,7 @@ int processMultibulkBuffer(client *c) {
if (c->multibulklen == 0) { if (c->multibulklen == 0) {
/* The client should have been reset */ /* The client should have been reset */
redisAssertWithInfo(c,NULL,c->argc == 0); serverAssertWithInfo(c,NULL,c->argc == 0);
/* Multi bulk length cannot be read without a \r\n */ /* Multi bulk length cannot be read without a \r\n */
newline = strchr(c->querybuf,'\r'); newline = strchr(c->querybuf,'\r');
...@@ -1018,7 +1018,7 @@ int processMultibulkBuffer(client *c) { ...@@ -1018,7 +1018,7 @@ int processMultibulkBuffer(client *c) {
/* We know for sure there is a whole line since newline != NULL, /* We know for sure there is a whole line since newline != NULL,
* so go ahead and find out the multi bulk length. */ * so go ahead and find out the multi bulk length. */
redisAssertWithInfo(c,NULL,c->querybuf[0] == '*'); serverAssertWithInfo(c,NULL,c->querybuf[0] == '*');
ok = string2ll(c->querybuf+1,newline-(c->querybuf+1),&ll); ok = string2ll(c->querybuf+1,newline-(c->querybuf+1),&ll);
if (!ok || ll > 1024*1024) { if (!ok || ll > 1024*1024) {
addReplyError(c,"Protocol error: invalid multibulk length"); addReplyError(c,"Protocol error: invalid multibulk length");
...@@ -1039,7 +1039,7 @@ int processMultibulkBuffer(client *c) { ...@@ -1039,7 +1039,7 @@ int processMultibulkBuffer(client *c) {
c->argv = zmalloc(sizeof(robj*)*c->multibulklen); c->argv = zmalloc(sizeof(robj*)*c->multibulklen);
} }
redisAssertWithInfo(c,NULL,c->multibulklen > 0); serverAssertWithInfo(c,NULL,c->multibulklen > 0);
while(c->multibulklen) { while(c->multibulklen) {
/* Read bulk length if unknown */ /* Read bulk length if unknown */
if (c->bulklen == -1) { if (c->bulklen == -1) {
...@@ -1523,7 +1523,7 @@ void rewriteClientCommandVector(client *c, int argc, ...) { ...@@ -1523,7 +1523,7 @@ void rewriteClientCommandVector(client *c, int argc, ...) {
c->argv = argv; c->argv = argv;
c->argc = argc; c->argc = argc;
c->cmd = lookupCommandOrOriginal(c->argv[0]->ptr); c->cmd = lookupCommandOrOriginal(c->argv[0]->ptr);
redisAssertWithInfo(c,NULL,c->cmd != NULL); serverAssertWithInfo(c,NULL,c->cmd != NULL);
va_end(ap); va_end(ap);
} }
...@@ -1534,7 +1534,7 @@ void replaceClientCommandVector(client *c, int argc, robj **argv) { ...@@ -1534,7 +1534,7 @@ void replaceClientCommandVector(client *c, int argc, robj **argv) {
c->argv = argv; c->argv = argv;
c->argc = argc; c->argc = argc;
c->cmd = lookupCommandOrOriginal(c->argv[0]->ptr); c->cmd = lookupCommandOrOriginal(c->argv[0]->ptr);
redisAssertWithInfo(c,NULL,c->cmd != NULL); serverAssertWithInfo(c,NULL,c->cmd != NULL);
} }
/* Rewrite a single item in the command vector. /* Rewrite a single item in the command vector.
...@@ -1542,7 +1542,7 @@ void replaceClientCommandVector(client *c, int argc, robj **argv) { ...@@ -1542,7 +1542,7 @@ void replaceClientCommandVector(client *c, int argc, robj **argv) {
void rewriteClientCommandArgument(client *c, int i, robj *newval) { void rewriteClientCommandArgument(client *c, int i, robj *newval) {
robj *oldval; robj *oldval;
redisAssertWithInfo(c,NULL,i < c->argc); serverAssertWithInfo(c,NULL,i < c->argc);
oldval = c->argv[i]; oldval = c->argv[i];
c->argv[i] = newval; c->argv[i] = newval;
incrRefCount(newval); incrRefCount(newval);
...@@ -1551,7 +1551,7 @@ void rewriteClientCommandArgument(client *c, int i, robj *newval) { ...@@ -1551,7 +1551,7 @@ void rewriteClientCommandArgument(client *c, int i, robj *newval) {
/* If this is the command name make sure to fix c->cmd. */ /* If this is the command name make sure to fix c->cmd. */
if (i == 0) { if (i == 0) {
c->cmd = lookupCommandOrOriginal(c->argv[0]->ptr); c->cmd = lookupCommandOrOriginal(c->argv[0]->ptr);
redisAssertWithInfo(c,NULL,c->cmd != NULL); serverAssertWithInfo(c,NULL,c->cmd != NULL);
} }
} }
...@@ -1654,7 +1654,7 @@ int checkClientOutputBufferLimits(client *c) { ...@@ -1654,7 +1654,7 @@ int checkClientOutputBufferLimits(client *c) {
* called from contexts where the client can't be freed safely, i.e. from the * called from contexts where the client can't be freed safely, i.e. from the
* lower level functions pushing data inside the client output buffers. */ * lower level functions pushing data inside the client output buffers. */
void asyncCloseClientOnOutputBufferLimitReached(client *c) { void asyncCloseClientOnOutputBufferLimitReached(client *c) {
redisAssert(c->reply_bytes < SIZE_MAX-(1024*64)); serverAssert(c->reply_bytes < SIZE_MAX-(1024*64));
if (c->reply_bytes == 0 || c->flags & REDIS_CLOSE_ASAP) return; if (c->reply_bytes == 0 || c->flags & REDIS_CLOSE_ASAP) return;
if (checkClientOutputBufferLimits(c)) { if (checkClientOutputBufferLimits(c)) {
sds client = catClientInfoString(sdsempty(),c); sds client = catClientInfoString(sdsempty(),c);
......
...@@ -163,7 +163,7 @@ robj *createStringObjectFromLongDouble(long double value, int humanfriendly) { ...@@ -163,7 +163,7 @@ robj *createStringObjectFromLongDouble(long double value, int humanfriendly) {
robj *dupStringObject(robj *o) { robj *dupStringObject(robj *o) {
robj *d; robj *d;
redisAssert(o->type == OBJ_STRING); serverAssert(o->type == OBJ_STRING);
switch(o->encoding) { switch(o->encoding) {
case OBJ_ENCODING_RAW: case OBJ_ENCODING_RAW:
...@@ -348,7 +348,7 @@ int checkType(client *c, robj *o, int type) { ...@@ -348,7 +348,7 @@ int checkType(client *c, robj *o, int type) {
} }
int isObjectRepresentableAsLongLong(robj *o, long long *llval) { int isObjectRepresentableAsLongLong(robj *o, long long *llval) {
redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);
if (o->encoding == OBJ_ENCODING_INT) { if (o->encoding == OBJ_ENCODING_INT) {
if (llval) *llval = (long) o->ptr; if (llval) *llval = (long) o->ptr;
return REDIS_OK; return REDIS_OK;
...@@ -367,7 +367,7 @@ robj *tryObjectEncoding(robj *o) { ...@@ -367,7 +367,7 @@ robj *tryObjectEncoding(robj *o) {
* in this function. Other types use encoded memory efficient * in this function. Other types use encoded memory efficient
* representations but are handled by the commands implementing * representations but are handled by the commands implementing
* the type. */ * the type. */
redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);
/* We try some specialized encoding only for objects that are /* We try some specialized encoding only for objects that are
* RAW or EMBSTR encoded, in other words objects that are still * RAW or EMBSTR encoded, in other words objects that are still
...@@ -469,7 +469,7 @@ robj *getDecodedObject(robj *o) { ...@@ -469,7 +469,7 @@ robj *getDecodedObject(robj *o) {
#define REDIS_COMPARE_COLL (1<<1) #define REDIS_COMPARE_COLL (1<<1)
int compareStringObjectsWithFlags(robj *a, robj *b, int flags) { int compareStringObjectsWithFlags(robj *a, robj *b, int flags) {
redisAssertWithInfo(NULL,a,a->type == OBJ_STRING && b->type == OBJ_STRING); serverAssertWithInfo(NULL,a,a->type == OBJ_STRING && b->type == OBJ_STRING);
char bufa[128], bufb[128], *astr, *bstr; char bufa[128], bufb[128], *astr, *bstr;
size_t alen, blen, minlen; size_t alen, blen, minlen;
...@@ -526,7 +526,7 @@ int equalStringObjects(robj *a, robj *b) { ...@@ -526,7 +526,7 @@ int equalStringObjects(robj *a, robj *b) {
} }
size_t stringObjectLen(robj *o) { size_t stringObjectLen(robj *o) {
redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);
if (sdsEncodedObject(o)) { if (sdsEncodedObject(o)) {
return sdslen(o->ptr); return sdslen(o->ptr);
} else { } else {
...@@ -541,7 +541,7 @@ int getDoubleFromObject(robj *o, double *target) { ...@@ -541,7 +541,7 @@ int getDoubleFromObject(robj *o, double *target) {
if (o == NULL) { if (o == NULL) {
value = 0; value = 0;
} else { } else {
redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);
if (sdsEncodedObject(o)) { if (sdsEncodedObject(o)) {
errno = 0; errno = 0;
value = strtod(o->ptr, &eptr); value = strtod(o->ptr, &eptr);
...@@ -583,7 +583,7 @@ int getLongDoubleFromObject(robj *o, long double *target) { ...@@ -583,7 +583,7 @@ int getLongDoubleFromObject(robj *o, long double *target) {
if (o == NULL) { if (o == NULL) {
value = 0; value = 0;
} else { } else {
redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);
if (sdsEncodedObject(o)) { if (sdsEncodedObject(o)) {
errno = 0; errno = 0;
value = strtold(o->ptr, &eptr); value = strtold(o->ptr, &eptr);
...@@ -621,7 +621,7 @@ int getLongLongFromObject(robj *o, long long *target) { ...@@ -621,7 +621,7 @@ int getLongLongFromObject(robj *o, long long *target) {
if (o == NULL) { if (o == NULL) {
value = 0; value = 0;
} else { } else {
redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);
if (sdsEncodedObject(o)) { if (sdsEncodedObject(o)) {
errno = 0; errno = 0;
value = strtoll(o->ptr, &eptr, 10); value = strtoll(o->ptr, &eptr, 10);
......
...@@ -98,10 +98,10 @@ int pubsubUnsubscribeChannel(client *c, robj *channel, int notify) { ...@@ -98,10 +98,10 @@ int pubsubUnsubscribeChannel(client *c, robj *channel, int notify) {
retval = 1; retval = 1;
/* Remove the client from the channel -> clients list hash table */ /* Remove the client from the channel -> clients list hash table */
de = dictFind(server.pubsub_channels,channel); de = dictFind(server.pubsub_channels,channel);
redisAssertWithInfo(c,NULL,de != NULL); serverAssertWithInfo(c,NULL,de != NULL);
clients = dictGetVal(de); clients = dictGetVal(de);
ln = listSearchKey(clients,c); ln = listSearchKey(clients,c);
redisAssertWithInfo(c,NULL,ln != NULL); serverAssertWithInfo(c,NULL,ln != NULL);
listDelNode(clients,ln); listDelNode(clients,ln);
if (listLength(clients) == 0) { if (listLength(clients) == 0) {
/* Free the list and associated hash entry at all if this was /* Free the list and associated hash entry at all if this was
......
...@@ -357,7 +357,7 @@ ssize_t rdbSaveLongLongAsStringObject(rio *rdb, long long value) { ...@@ -357,7 +357,7 @@ ssize_t rdbSaveLongLongAsStringObject(rio *rdb, long long value) {
} else { } else {
/* Encode as string */ /* Encode as string */
enclen = ll2string((char*)buf,32,value); enclen = ll2string((char*)buf,32,value);
redisAssert(enclen < 32); serverAssert(enclen < 32);
if ((n = rdbSaveLen(rdb,enclen)) == -1) return -1; if ((n = rdbSaveLen(rdb,enclen)) == -1) return -1;
nwritten += n; nwritten += n;
if ((n = rdbWriteRaw(rdb,buf,enclen)) == -1) return -1; if ((n = rdbWriteRaw(rdb,buf,enclen)) == -1) return -1;
...@@ -373,7 +373,7 @@ int rdbSaveStringObject(rio *rdb, robj *obj) { ...@@ -373,7 +373,7 @@ int rdbSaveStringObject(rio *rdb, robj *obj) {
if (obj->encoding == OBJ_ENCODING_INT) { if (obj->encoding == OBJ_ENCODING_INT) {
return rdbSaveLongLongAsStringObject(rdb,(long)obj->ptr); return rdbSaveLongLongAsStringObject(rdb,(long)obj->ptr);
} else { } else {
redisAssertWithInfo(NULL,obj,sdsEncodedObject(obj)); serverAssertWithInfo(NULL,obj,sdsEncodedObject(obj));
return rdbSaveRawString(rdb,obj->ptr,sdslen(obj->ptr)); return rdbSaveRawString(rdb,obj->ptr,sdslen(obj->ptr));
} }
} }
...@@ -666,7 +666,7 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) { ...@@ -666,7 +666,7 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
* we could switch to a faster solution. */ * we could switch to a faster solution. */
size_t rdbSavedObjectLen(robj *o) { size_t rdbSavedObjectLen(robj *o) {
ssize_t len = rdbSaveObject(NULL,o); ssize_t len = rdbSaveObject(NULL,o);
redisAssertWithInfo(NULL,o,len != -1); serverAssertWithInfo(NULL,o,len != -1);
return len; return len;
} }
...@@ -1051,10 +1051,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) { ...@@ -1051,10 +1051,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
/* Load raw strings */ /* Load raw strings */
field = rdbLoadStringObject(rdb); field = rdbLoadStringObject(rdb);
if (field == NULL) return NULL; if (field == NULL) return NULL;
redisAssert(sdsEncodedObject(field)); serverAssert(sdsEncodedObject(field));
value = rdbLoadStringObject(rdb); value = rdbLoadStringObject(rdb);
if (value == NULL) return NULL; if (value == NULL) return NULL;
redisAssert(sdsEncodedObject(value)); serverAssert(sdsEncodedObject(value));
/* Add pair to ziplist */ /* Add pair to ziplist */
o->ptr = ziplistPush(o->ptr, field->ptr, sdslen(field->ptr), ZIPLIST_TAIL); o->ptr = ziplistPush(o->ptr, field->ptr, sdslen(field->ptr), ZIPLIST_TAIL);
...@@ -1094,7 +1094,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) { ...@@ -1094,7 +1094,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
} }
/* All pairs should be read by now */ /* All pairs should be read by now */
redisAssert(len == 0); serverAssert(len == 0);
} else if (rdbtype == REDIS_RDB_TYPE_LIST_QUICKLIST) { } else if (rdbtype == REDIS_RDB_TYPE_LIST_QUICKLIST) {
if ((len = rdbLoadLen(rdb,NULL)) == REDIS_RDB_LENERR) return NULL; if ((len = rdbLoadLen(rdb,NULL)) == REDIS_RDB_LENERR) return NULL;
o = createQuicklistObject(); o = createQuicklistObject();
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
#include <unistd.h> /* for _exit() */ #include <unistd.h> /* for _exit() */
#define assert(_e) ((_e)?(void)0 : (_redisAssert(#_e,__FILE__,__LINE__),_exit(1))) #define assert(_e) ((_e)?(void)0 : (_serverAssert(#_e,__FILE__,__LINE__),_exit(1)))
void _redisAssert(char *estr, char *file, int line); void _serverAssert(char *estr, char *file, int line);
#endif #endif
...@@ -69,7 +69,7 @@ char *replicationGetSlaveName(client *c) { ...@@ -69,7 +69,7 @@ char *replicationGetSlaveName(client *c) {
/* ---------------------------------- MASTER -------------------------------- */ /* ---------------------------------- MASTER -------------------------------- */
void createReplicationBacklog(void) { void createReplicationBacklog(void) {
redisAssert(server.repl_backlog == NULL); serverAssert(server.repl_backlog == NULL);
server.repl_backlog = zmalloc(server.repl_backlog_size); server.repl_backlog = zmalloc(server.repl_backlog_size);
server.repl_backlog_histlen = 0; server.repl_backlog_histlen = 0;
server.repl_backlog_idx = 0; server.repl_backlog_idx = 0;
...@@ -113,7 +113,7 @@ void resizeReplicationBacklog(long long newsize) { ...@@ -113,7 +113,7 @@ void resizeReplicationBacklog(long long newsize) {
} }
void freeReplicationBacklog(void) { void freeReplicationBacklog(void) {
redisAssert(listLength(server.slaves) == 0); serverAssert(listLength(server.slaves) == 0);
zfree(server.repl_backlog); zfree(server.repl_backlog);
server.repl_backlog = NULL; server.repl_backlog = NULL;
} }
...@@ -175,7 +175,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) { ...@@ -175,7 +175,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) {
if (server.repl_backlog == NULL && listLength(slaves) == 0) return; if (server.repl_backlog == NULL && listLength(slaves) == 0) return;
/* We can't have slaves attached and no backlog. */ /* We can't have slaves attached and no backlog. */
redisAssert(!(listLength(slaves) != 0 && server.repl_backlog == NULL)); serverAssert(!(listLength(slaves) != 0 && server.repl_backlog == NULL));
/* Send SELECT command to every slave if needed. */ /* Send SELECT command to every slave if needed. */
if (server.slaveseldb != dictid) { if (server.slaveseldb != dictid) {
...@@ -821,7 +821,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) { ...@@ -821,7 +821,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) {
/* Abort the async download of the bulk dataset while SYNC-ing with master */ /* Abort the async download of the bulk dataset while SYNC-ing with master */
void replicationAbortSyncTransfer(void) { void replicationAbortSyncTransfer(void) {
redisAssert(server.repl_state == REDIS_REPL_TRANSFER); serverAssert(server.repl_state == REDIS_REPL_TRANSFER);
aeDeleteFileEvent(server.el,server.repl_transfer_s,AE_READABLE); aeDeleteFileEvent(server.el,server.repl_transfer_s,AE_READABLE);
close(server.repl_transfer_s); close(server.repl_transfer_s);
...@@ -1411,7 +1411,7 @@ int connectWithMaster(void) { ...@@ -1411,7 +1411,7 @@ int connectWithMaster(void) {
void undoConnectWithMaster(void) { void undoConnectWithMaster(void) {
int fd = server.repl_transfer_s; int fd = server.repl_transfer_s;
redisAssert(server.repl_state == REDIS_REPL_CONNECTING || serverAssert(server.repl_state == REDIS_REPL_CONNECTING ||
server.repl_state == REDIS_REPL_RECEIVE_PONG); server.repl_state == REDIS_REPL_RECEIVE_PONG);
aeDeleteFileEvent(server.el,fd,AE_READABLE|AE_WRITABLE); aeDeleteFileEvent(server.el,fd,AE_READABLE|AE_WRITABLE);
close(fd); close(fd);
...@@ -1603,13 +1603,13 @@ void replicationSendAck(void) { ...@@ -1603,13 +1603,13 @@ void replicationSendAck(void) {
void replicationCacheMaster(client *c) { void replicationCacheMaster(client *c) {
listNode *ln; listNode *ln;
redisAssert(server.master != NULL && server.cached_master == NULL); serverAssert(server.master != NULL && server.cached_master == NULL);
serverLog(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 /* 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. */ * listed by CLIENT LIST or processed in any way by batch operations. */
ln = listSearchKey(server.clients,c); ln = listSearchKey(server.clients,c);
redisAssert(ln != NULL); serverAssert(ln != NULL);
listDelNode(server.clients,ln); listDelNode(server.clients,ln);
/* Save the master. Server.master will be set to null later by /* Save the master. Server.master will be set to null later by
...@@ -1774,14 +1774,14 @@ void replicationScriptCacheAdd(sds sha1) { ...@@ -1774,14 +1774,14 @@ void replicationScriptCacheAdd(sds sha1) {
sds oldest = listNodeValue(ln); sds oldest = listNodeValue(ln);
retval = dictDelete(server.repl_scriptcache_dict,oldest); retval = dictDelete(server.repl_scriptcache_dict,oldest);
redisAssert(retval == DICT_OK); serverAssert(retval == DICT_OK);
listDelNode(server.repl_scriptcache_fifo,ln); listDelNode(server.repl_scriptcache_fifo,ln);
} }
/* Add current. */ /* Add current. */
retval = dictAdd(server.repl_scriptcache_dict,key,NULL); retval = dictAdd(server.repl_scriptcache_dict,key,NULL);
listAddNodeHead(server.repl_scriptcache_fifo,key); listAddNodeHead(server.repl_scriptcache_fifo,key);
redisAssert(retval == DICT_OK); serverAssert(retval == DICT_OK);
} }
/* Returns non-zero if the specified entry exists inside the cache, that is, /* Returns non-zero if the specified entry exists inside the cache, that is,
...@@ -1880,7 +1880,7 @@ void waitCommand(client *c) { ...@@ -1880,7 +1880,7 @@ void waitCommand(client *c) {
* instead. */ * instead. */
void unblockClientWaitingReplicas(client *c) { void unblockClientWaitingReplicas(client *c) {
listNode *ln = listSearchKey(server.clients_waiting_acks,c); listNode *ln = listSearchKey(server.clients_waiting_acks,c);
redisAssert(ln != NULL); serverAssert(ln != NULL);
listDelNode(server.clients_waiting_acks,ln); listDelNode(server.clients_waiting_acks,ln);
} }
......
...@@ -299,7 +299,7 @@ void rioGenericUpdateChecksum(rio *r, const void *buf, size_t len) { ...@@ -299,7 +299,7 @@ void rioGenericUpdateChecksum(rio *r, const void *buf, size_t len) {
* disk I/O concentrated in very little time. When we fsync in an explicit * disk I/O concentrated in very little time. When we fsync in an explicit
* way instead the I/O pressure is more distributed across time. */ * way instead the I/O pressure is more distributed across time. */
void rioSetAutoSync(rio *r, off_t bytes) { void rioSetAutoSync(rio *r, off_t bytes) {
redisAssert(r->read == rioFileIO.read); serverAssert(r->read == rioFileIO.read);
r->io.file.autosync = bytes; r->io.file.autosync = bytes;
} }
......
...@@ -914,7 +914,7 @@ int luaCreateFunction(client *c, lua_State *lua, char *funcname, robj *body) { ...@@ -914,7 +914,7 @@ int luaCreateFunction(client *c, lua_State *lua, char *funcname, robj *body) {
{ {
int retval = dictAdd(server.lua_scripts, int retval = dictAdd(server.lua_scripts,
sdsnewlen(funcname+2,40),body); sdsnewlen(funcname+2,40),body);
redisAssertWithInfo(c,NULL,retval == DICT_OK); serverAssertWithInfo(c,NULL,retval == DICT_OK);
incrRefCount(body); incrRefCount(body);
} }
return REDIS_OK; return REDIS_OK;
...@@ -996,7 +996,7 @@ void evalGenericCommand(client *c, int evalsha) { ...@@ -996,7 +996,7 @@ void evalGenericCommand(client *c, int evalsha) {
} }
/* Now the following is guaranteed to return non nil */ /* Now the following is guaranteed to return non nil */
lua_getglobal(lua, funcname); lua_getglobal(lua, funcname);
redisAssert(!lua_isnil(lua,-1)); serverAssert(!lua_isnil(lua,-1));
} }
/* Populate the argv and keys table accordingly to the arguments that /* Populate the argv and keys table accordingly to the arguments that
...@@ -1081,7 +1081,7 @@ void evalGenericCommand(client *c, int evalsha) { ...@@ -1081,7 +1081,7 @@ void evalGenericCommand(client *c, int evalsha) {
robj *script = dictFetchValue(server.lua_scripts,c->argv[1]->ptr); robj *script = dictFetchValue(server.lua_scripts,c->argv[1]->ptr);
replicationScriptCacheAdd(c->argv[1]->ptr); replicationScriptCacheAdd(c->argv[1]->ptr);
redisAssertWithInfo(c,NULL,script != NULL); serverAssertWithInfo(c,NULL,script != NULL);
rewriteClientCommandArgument(c,0, rewriteClientCommandArgument(c,0,
resetRefCount(createStringObject("EVAL",4))); resetRefCount(createStringObject("EVAL",4)));
rewriteClientCommandArgument(c,1,script); rewriteClientCommandArgument(c,1,script);
......
...@@ -454,7 +454,7 @@ void initSentinel(void) { ...@@ -454,7 +454,7 @@ void initSentinel(void) {
struct redisCommand *cmd = sentinelcmds+j; struct redisCommand *cmd = sentinelcmds+j;
retval = dictAdd(server.commands, sdsnew(cmd->name), cmd); retval = dictAdd(server.commands, sdsnew(cmd->name), cmd);
redisAssert(retval == DICT_OK); serverAssert(retval == DICT_OK);
} }
/* Initialize various data structures. */ /* Initialize various data structures. */
...@@ -705,7 +705,7 @@ void sentinelScheduleScriptExecution(char *path, ...) { ...@@ -705,7 +705,7 @@ void sentinelScheduleScriptExecution(char *path, ...) {
sentinelReleaseScriptJob(sj); sentinelReleaseScriptJob(sj);
break; break;
} }
redisAssert(listLength(sentinel.scripts_queue) <= serverAssert(listLength(sentinel.scripts_queue) <=
SENTINEL_SCRIPT_MAX_QUEUE); SENTINEL_SCRIPT_MAX_QUEUE);
} }
} }
...@@ -973,7 +973,7 @@ void instanceLinkCloseConnection(instanceLink *link, redisAsyncContext *c) { ...@@ -973,7 +973,7 @@ void instanceLinkCloseConnection(instanceLink *link, redisAsyncContext *c) {
* replies for an instance that no longer exists. */ * replies for an instance that no longer exists. */
instanceLink *releaseInstanceLink(instanceLink *link, sentinelRedisInstance *ri) instanceLink *releaseInstanceLink(instanceLink *link, sentinelRedisInstance *ri)
{ {
redisAssert(link->refcount > 0); serverAssert(link->refcount > 0);
link->refcount--; link->refcount--;
if (link->refcount != 0) { if (link->refcount != 0) {
if (ri && ri->link->cc) { if (ri && ri->link->cc) {
...@@ -1016,7 +1016,7 @@ instanceLink *releaseInstanceLink(instanceLink *link, sentinelRedisInstance *ri) ...@@ -1016,7 +1016,7 @@ instanceLink *releaseInstanceLink(instanceLink *link, sentinelRedisInstance *ri)
* different master and sharing was performed. Otherwise REDIS_ERR * different master and sharing was performed. Otherwise REDIS_ERR
* is returned. */ * is returned. */
int sentinelTryConnectionSharing(sentinelRedisInstance *ri) { int sentinelTryConnectionSharing(sentinelRedisInstance *ri) {
redisAssert(ri->flags & SRI_SENTINEL); serverAssert(ri->flags & SRI_SENTINEL);
dictIterator *di; dictIterator *di;
dictEntry *de; dictEntry *de;
...@@ -1052,7 +1052,7 @@ int sentinelTryConnectionSharing(sentinelRedisInstance *ri) { ...@@ -1052,7 +1052,7 @@ int sentinelTryConnectionSharing(sentinelRedisInstance *ri) {
* *
* Return the number of updated Sentinel addresses. */ * Return the number of updated Sentinel addresses. */
int sentinelUpdateSentinelAddressInAllMasters(sentinelRedisInstance *ri) { int sentinelUpdateSentinelAddressInAllMasters(sentinelRedisInstance *ri) {
redisAssert(ri->flags & SRI_SENTINEL); serverAssert(ri->flags & SRI_SENTINEL);
dictIterator *di; dictIterator *di;
dictEntry *de; dictEntry *de;
int reconfigured = 0; int reconfigured = 0;
...@@ -1140,8 +1140,8 @@ sentinelRedisInstance *createSentinelRedisInstance(char *name, int flags, char * ...@@ -1140,8 +1140,8 @@ sentinelRedisInstance *createSentinelRedisInstance(char *name, int flags, char *
dict *table = NULL; dict *table = NULL;
char slavename[REDIS_PEER_ID_LEN], *sdsname; char slavename[REDIS_PEER_ID_LEN], *sdsname;
redisAssert(flags & (SRI_MASTER|SRI_SLAVE|SRI_SENTINEL)); serverAssert(flags & (SRI_MASTER|SRI_SLAVE|SRI_SENTINEL));
redisAssert((flags & SRI_MASTER) || master != NULL); serverAssert((flags & SRI_MASTER) || master != NULL);
/* Check address validity. */ /* Check address validity. */
addr = createSentinelAddr(hostname,port); addr = createSentinelAddr(hostname,port);
...@@ -1262,7 +1262,7 @@ sentinelRedisInstance *sentinelRedisInstanceLookupSlave( ...@@ -1262,7 +1262,7 @@ sentinelRedisInstance *sentinelRedisInstanceLookupSlave(
sentinelRedisInstance *slave; sentinelRedisInstance *slave;
char buf[REDIS_PEER_ID_LEN]; char buf[REDIS_PEER_ID_LEN];
redisAssert(ri->flags & SRI_MASTER); serverAssert(ri->flags & SRI_MASTER);
anetFormatAddr(buf,sizeof(buf),ip,port); anetFormatAddr(buf,sizeof(buf),ip,port);
key = sdsnew(buf); key = sdsnew(buf);
slave = dictFetchValue(ri->slaves,key); slave = dictFetchValue(ri->slaves,key);
...@@ -1320,7 +1320,7 @@ sentinelRedisInstance *getSentinelRedisInstanceByAddrAndRunID(dict *instances, c ...@@ -1320,7 +1320,7 @@ sentinelRedisInstance *getSentinelRedisInstanceByAddrAndRunID(dict *instances, c
dictEntry *de; dictEntry *de;
sentinelRedisInstance *instance = NULL; sentinelRedisInstance *instance = NULL;
redisAssert(ip || runid); /* User must pass at least one search param. */ serverAssert(ip || runid); /* User must pass at least one search param. */
di = dictGetIterator(instances); di = dictGetIterator(instances);
while((de = dictNext(di)) != NULL) { while((de = dictNext(di)) != NULL) {
sentinelRedisInstance *ri = dictGetVal(de); sentinelRedisInstance *ri = dictGetVal(de);
...@@ -1388,7 +1388,7 @@ void sentinelDelFlagsToDictOfRedisInstances(dict *instances, int flags) { ...@@ -1388,7 +1388,7 @@ void sentinelDelFlagsToDictOfRedisInstances(dict *instances, int flags) {
#define SENTINEL_RESET_NO_SENTINELS (1<<0) #define SENTINEL_RESET_NO_SENTINELS (1<<0)
void sentinelResetMaster(sentinelRedisInstance *ri, int flags) { void sentinelResetMaster(sentinelRedisInstance *ri, int flags) {
redisAssert(ri->flags & SRI_MASTER); serverAssert(ri->flags & SRI_MASTER);
dictRelease(ri->slaves); dictRelease(ri->slaves);
ri->slaves = dictCreate(&instancesDictType,NULL); ri->slaves = dictCreate(&instancesDictType,NULL);
if (!(flags & SENTINEL_RESET_NO_SENTINELS)) { if (!(flags & SENTINEL_RESET_NO_SENTINELS)) {
...@@ -3606,7 +3606,7 @@ int sentinelLeaderIncr(dict *counters, char *runid) { ...@@ -3606,7 +3606,7 @@ int sentinelLeaderIncr(dict *counters, char *runid) {
return oldval+1; return oldval+1;
} else { } else {
de = dictAddRaw(counters,runid); de = dictAddRaw(counters,runid);
redisAssert(de != NULL); serverAssert(de != NULL);
dictSetUnsignedIntegerVal(de,1); dictSetUnsignedIntegerVal(de,1);
return 1; return 1;
} }
...@@ -3628,7 +3628,7 @@ char *sentinelGetLeader(sentinelRedisInstance *master, uint64_t epoch) { ...@@ -3628,7 +3628,7 @@ char *sentinelGetLeader(sentinelRedisInstance *master, uint64_t epoch) {
uint64_t leader_epoch; uint64_t leader_epoch;
uint64_t max_votes = 0; uint64_t max_votes = 0;
redisAssert(master->flags & (SRI_O_DOWN|SRI_FAILOVER_IN_PROGRESS)); serverAssert(master->flags & (SRI_O_DOWN|SRI_FAILOVER_IN_PROGRESS));
counters = dictCreate(&leaderVotesDictType,NULL); counters = dictCreate(&leaderVotesDictType,NULL);
voters = dictSize(master->sentinels)+1; /* All the other sentinels and me. */ voters = dictSize(master->sentinels)+1; /* All the other sentinels and me. */
...@@ -3751,7 +3751,7 @@ int sentinelSendSlaveOf(sentinelRedisInstance *ri, char *host, int port) { ...@@ -3751,7 +3751,7 @@ int sentinelSendSlaveOf(sentinelRedisInstance *ri, char *host, int port) {
/* Setup the master state to start a failover. */ /* Setup the master state to start a failover. */
void sentinelStartFailover(sentinelRedisInstance *master) { void sentinelStartFailover(sentinelRedisInstance *master) {
redisAssert(master->flags & SRI_MASTER); serverAssert(master->flags & SRI_MASTER);
master->failover_state = SENTINEL_FAILOVER_STATE_WAIT_START; master->failover_state = SENTINEL_FAILOVER_STATE_WAIT_START;
master->flags |= SRI_FAILOVER_IN_PROGRESS; master->flags |= SRI_FAILOVER_IN_PROGRESS;
...@@ -4137,7 +4137,7 @@ void sentinelFailoverSwitchToPromotedSlave(sentinelRedisInstance *master) { ...@@ -4137,7 +4137,7 @@ void sentinelFailoverSwitchToPromotedSlave(sentinelRedisInstance *master) {
} }
void sentinelFailoverStateMachine(sentinelRedisInstance *ri) { void sentinelFailoverStateMachine(sentinelRedisInstance *ri) {
redisAssert(ri->flags & SRI_MASTER); serverAssert(ri->flags & SRI_MASTER);
if (!(ri->flags & SRI_FAILOVER_IN_PROGRESS)) return; if (!(ri->flags & SRI_FAILOVER_IN_PROGRESS)) return;
...@@ -4166,8 +4166,8 @@ void sentinelFailoverStateMachine(sentinelRedisInstance *ri) { ...@@ -4166,8 +4166,8 @@ void sentinelFailoverStateMachine(sentinelRedisInstance *ri) {
* the slave -> master switch. Otherwise the failover can't be aborted and * the slave -> master switch. Otherwise the failover can't be aborted and
* will reach its end (possibly by timeout). */ * will reach its end (possibly by timeout). */
void sentinelAbortFailover(sentinelRedisInstance *ri) { void sentinelAbortFailover(sentinelRedisInstance *ri) {
redisAssert(ri->flags & SRI_FAILOVER_IN_PROGRESS); serverAssert(ri->flags & SRI_FAILOVER_IN_PROGRESS);
redisAssert(ri->failover_state <= SENTINEL_FAILOVER_STATE_WAIT_PROMOTION); serverAssert(ri->failover_state <= SENTINEL_FAILOVER_STATE_WAIT_PROMOTION);
ri->flags &= ~(SRI_FAILOVER_IN_PROGRESS|SRI_FORCE_FAILOVER); ri->flags &= ~(SRI_FAILOVER_IN_PROGRESS|SRI_FORCE_FAILOVER);
ri->failover_state = SENTINEL_FAILOVER_STATE_NONE; ri->failover_state = SENTINEL_FAILOVER_STATE_NONE;
......
...@@ -1938,7 +1938,7 @@ void populateCommandTable(void) { ...@@ -1938,7 +1938,7 @@ void populateCommandTable(void) {
/* Populate an additional dictionary that will be unaffected /* Populate an additional dictionary that will be unaffected
* by rename-command statements in redis.conf. */ * by rename-command statements in redis.conf. */
retval2 = dictAdd(server.orig_commands, sdsnew(c->name), c); retval2 = dictAdd(server.orig_commands, sdsnew(c->name), c);
redisAssert(retval1 == DICT_OK && retval2 == DICT_OK); serverAssert(retval1 == DICT_OK && retval2 == DICT_OK);
} }
} }
......
...@@ -412,8 +412,8 @@ typedef long long mstime_t; /* millisecond time type. */ ...@@ -412,8 +412,8 @@ typedef long long mstime_t; /* millisecond time type. */
#define run_with_period(_ms_) if ((_ms_ <= 1000/server.hz) || !(server.cronloops%((_ms_)/(1000/server.hz)))) #define run_with_period(_ms_) if ((_ms_ <= 1000/server.hz) || !(server.cronloops%((_ms_)/(1000/server.hz))))
/* We can print the stacktrace, so our assert is defined this way: */ /* We can print the stacktrace, so our assert is defined this way: */
#define redisAssertWithInfo(_c,_o,_e) ((_e)?(void)0 : (_redisAssertWithInfo(_c,_o,#_e,__FILE__,__LINE__),_exit(1))) #define serverAssertWithInfo(_c,_o,_e) ((_e)?(void)0 : (_serverAssertWithInfo(_c,_o,#_e,__FILE__,__LINE__),_exit(1)))
#define redisAssert(_e) ((_e)?(void)0 : (_redisAssert(#_e,__FILE__,__LINE__),_exit(1))) #define serverAssert(_e) ((_e)?(void)0 : (_serverAssert(#_e,__FILE__,__LINE__),_exit(1)))
#define redisPanic(_e) _redisPanic(#_e,__FILE__,__LINE__),_exit(1) #define redisPanic(_e) _redisPanic(#_e,__FILE__,__LINE__),_exit(1)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
...@@ -1581,8 +1581,8 @@ void *realloc(void *ptr, size_t size) __attribute__ ((deprecated)); ...@@ -1581,8 +1581,8 @@ void *realloc(void *ptr, size_t size) __attribute__ ((deprecated));
#endif #endif
/* Debugging stuff */ /* Debugging stuff */
void _redisAssertWithInfo(client *c, robj *o, char *estr, char *file, int line); void _serverAssertWithInfo(client *c, robj *o, char *estr, char *file, int line);
void _redisAssert(char *estr, char *file, int line); void _serverAssert(char *estr, char *file, int line);
void _redisPanic(char *msg, char *file, int line); void _redisPanic(char *msg, char *file, int line);
void bugReportStart(void); void bugReportStart(void);
void serverLogObjectDebugInfo(robj *o); void serverLogObjectDebugInfo(robj *o);
......
...@@ -416,7 +416,7 @@ void sortCommand(client *c) { ...@@ -416,7 +416,7 @@ void sortCommand(client *c) {
} }
while(rangelen--) { while(rangelen--) {
redisAssertWithInfo(c,sortval,ln != NULL); serverAssertWithInfo(c,sortval,ln != NULL);
ele = ln->obj; ele = ln->obj;
vector[j].obj = ele; vector[j].obj = ele;
vector[j].u.score = 0; vector[j].u.score = 0;
...@@ -442,7 +442,7 @@ void sortCommand(client *c) { ...@@ -442,7 +442,7 @@ void sortCommand(client *c) {
} else { } else {
redisPanic("Unknown type"); redisPanic("Unknown type");
} }
redisAssertWithInfo(c,sortval,j == vectorlen); serverAssertWithInfo(c,sortval,j == vectorlen);
/* Now it's time to load the right scores in the sorting vector */ /* Now it's time to load the right scores in the sorting vector */
if (dontsort == 0) { if (dontsort == 0) {
...@@ -475,7 +475,7 @@ void sortCommand(client *c) { ...@@ -475,7 +475,7 @@ void sortCommand(client *c) {
* far. We can just cast it */ * far. We can just cast it */
vector[j].u.score = (long)byval->ptr; vector[j].u.score = (long)byval->ptr;
} else { } else {
redisAssertWithInfo(c,sortval,1 != 1); serverAssertWithInfo(c,sortval,1 != 1);
} }
} }
...@@ -526,7 +526,7 @@ void sortCommand(client *c) { ...@@ -526,7 +526,7 @@ void sortCommand(client *c) {
} }
} else { } else {
/* Always fails */ /* Always fails */
redisAssertWithInfo(c,sortval,sop->type == REDIS_SORT_GET); serverAssertWithInfo(c,sortval,sop->type == REDIS_SORT_GET);
} }
} }
} }
...@@ -557,7 +557,7 @@ void sortCommand(client *c) { ...@@ -557,7 +557,7 @@ void sortCommand(client *c) {
decrRefCount(val); decrRefCount(val);
} else { } else {
/* Always fails */ /* Always fails */
redisAssertWithInfo(c,sortval,sop->type == REDIS_SORT_GET); serverAssertWithInfo(c,sortval,sop->type == REDIS_SORT_GET);
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment