diff --git a/src/aof.c b/src/aof.c index aeee446be..0c23818d1 100644 --- a/src/aof.c +++ b/src/aof.c @@ -204,7 +204,7 @@ void aof_background_fsync(int fd) { /* Called when the user switches from "appendonly yes" to "appendonly no" * at runtime using the CONFIG command. */ void stopAppendOnly(void) { - redisAssert(server.aof_state != REDIS_AOF_OFF); + serverAssert(server.aof_state != REDIS_AOF_OFF); flushAppendOnlyFile(1); aof_fsync(server.aof_fd); close(server.aof_fd); @@ -235,7 +235,7 @@ void stopAppendOnly(void) { int startAppendOnly(void) { server.aof_last_fsync = server.unixtime; 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) { serverLog(REDIS_WARNING,"Redis needs to enable the AOF but can't open the append only file: %s",strerror(errno)); return REDIS_ERR; @@ -685,9 +685,9 @@ int loadAppendOnlyFile(char *filename) { cmd->proc(fakeClient); /* 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 */ - 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 * argv/argc of the client instead of the local variables. */ @@ -860,12 +860,12 @@ int rewriteSortedSetObject(rio *r, robj *key, robj *o) { double score; eptr = ziplistIndex(zl,0); - redisAssert(eptr != NULL); + serverAssert(eptr != NULL); sptr = ziplistNext(zl,eptr); - redisAssert(sptr != NULL); + serverAssert(sptr != NULL); while (eptr != NULL) { - redisAssert(ziplistGet(eptr,&vstr,&vlen,&vll)); + serverAssert(ziplistGet(eptr,&vstr,&vlen,&vll)); score = zzlGetScore(sptr); if (count == 0) { diff --git a/src/blocked.c b/src/blocked.c index d084521a3..2480bf2a7 100644 --- a/src/blocked.c +++ b/src/blocked.c @@ -112,7 +112,7 @@ void processUnblockedClients(void) { while (listLength(server.unblocked_clients)) { ln = listFirst(server.unblocked_clients); - redisAssert(ln != NULL); + serverAssert(ln != NULL); c = ln->value; listDelNode(server.unblocked_clients,ln); c->flags &= ~REDIS_UNBLOCKED; diff --git a/src/cluster.c b/src/cluster.c index ff7c80c2a..bce082ac0 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -176,7 +176,7 @@ int clusterLoadConfig(char *filename) { p = strchr(s,','); if (p) *p = '\0'; if (!strcasecmp(s,"myself")) { - redisAssert(server.cluster->myself == NULL); + serverAssert(server.cluster->myself == NULL); myself = server.cluster->myself = n; n->flags |= REDIS_NODE_MYSELF; } else if (!strcasecmp(s,"master")) { @@ -230,7 +230,7 @@ int clusterLoadConfig(char *filename) { clusterNode *cn; p = strchr(argv[j],'-'); - redisAssert(p != NULL); + serverAssert(p != NULL); *p = '\0'; direction = p[1]; /* Either '>' or '<' */ slot = atoi(argv[j]+1); @@ -833,7 +833,7 @@ void freeClusterNode(clusterNode *n) { /* Unlink from the set of nodes. */ 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); /* Release link and associated data structures. */ @@ -915,7 +915,7 @@ void clusterRenameNode(clusterNode *node, char *newname) { node->name, newname); retval = dictDelete(server.cluster->nodes, s); sdsfree(s); - redisAssert(retval == DICT_OK); + serverAssert(retval == DICT_OK); memcpy(node->name, newname, REDIS_CLUSTER_NAMELEN); clusterAddNode(node); } @@ -1183,7 +1183,7 @@ void markNodeAsFailingIfNeeded(clusterNode *node) { void clearNodeFailureIfNeeded(clusterNode *node) { mstime_t now = mstime(); - redisAssert(nodeFailed(node)); + serverAssert(nodeFailed(node)); /* For slaves we always clear the FAIL flag if we can contact the * node again. */ @@ -2571,7 +2571,7 @@ int clusterGetSlaveRank(void) { int j, rank = 0; clusterNode *master; - redisAssert(nodeIsSlave(myself)); + serverAssert(nodeIsSlave(myself)); master = myself->slaveof; if (master == NULL) return 0; /* Never called by slaves without master. */ @@ -3360,7 +3360,7 @@ int clusterDelSlot(int slot) { clusterNode *n = server.cluster->slots[slot]; if (!n) return REDIS_ERR; - redisAssert(clusterNodeClearSlotBit(n,slot) == 1); + serverAssert(clusterNodeClearSlotBit(n,slot) == 1); server.cluster->slots[slot] = NULL; return REDIS_OK; } @@ -3567,8 +3567,8 @@ int verifyClusterConfigWithData(void) { /* Set the specified node 'n' as master for this node. * If this node is currently a master, it is turned into a slave. */ void clusterSetMaster(clusterNode *n) { - redisAssert(n != myself); - redisAssert(myself->numslots == 0); + serverAssert(n != myself); + serverAssert(myself->numslots == 0); if (nodeIsMaster(myself)) { myself->flags &= ~REDIS_NODE_MASTER; @@ -3894,7 +3894,7 @@ void clusterCommand(client *c) { retval = del ? clusterDelSlot(j) : clusterAddSlot(myself,j); - redisAssertWithInfo(c,NULL,retval == REDIS_OK); + serverAssertWithInfo(c,NULL,retval == REDIS_OK); } } zfree(slots); @@ -4315,8 +4315,8 @@ void createDumpPayload(rio *payload, robj *o) { /* 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. */ rioInitWithBuffer(payload,sdsempty()); - redisAssert(rdbSaveObjectType(payload,o)); - redisAssert(rdbSaveObject(payload,o)); + serverAssert(rdbSaveObjectType(payload,o)); + serverAssert(rdbSaveObject(payload,o)); /* Write the footer, this is how it looks like: * ----------------+---------------------+---------------+ @@ -4610,9 +4610,9 @@ try_again: /* Send the SELECT command if the current DB is not already selected. */ int select = cs->last_dbid != dbid; /* Should we emit SELECT? */ if (select) { - redisAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',2)); - redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"SELECT",6)); - redisAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,dbid)); + serverAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',2)); + serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"SELECT",6)); + serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,dbid)); } /* Create RESTORE payload and generate the protocol to call the command. */ @@ -4621,28 +4621,28 @@ try_again: ttl = expireat-mstime(); 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) - redisAssertWithInfo(c,NULL, + serverAssertWithInfo(c,NULL, rioWriteBulkString(&cmd,"RESTORE-ASKING",14)); else - redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"RESTORE",7)); - redisAssertWithInfo(c,NULL,sdsEncodedObject(c->argv[3])); - redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,c->argv[3]->ptr, + serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"RESTORE",7)); + serverAssertWithInfo(c,NULL,sdsEncodedObject(c->argv[3])); + serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,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 * the DUMP format. */ 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))); sdsfree(payload.io.buffer.ptr); /* Add the REPLACE option to the RESTORE command if it was specified * as a MIGRATE option. */ 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. */ errno = 0; diff --git a/src/config.c b/src/config.c index 465f8ccb1..b33db70bf 100644 --- a/src/config.c +++ b/src/config.c @@ -474,7 +474,7 @@ void loadServerConfigFromString(char *config) { /* If the target command name is the empty string we just * remove it from the command table. */ retval = dictDelete(server.commands, argv[1]); - redisAssert(retval == DICT_OK); + serverAssert(retval == DICT_OK); /* Otherwise we re-add the command under a different name. */ if (sdslen(argv[2]) != 0) { @@ -703,8 +703,8 @@ void configSetCommand(client *c) { robj *o; long long ll; int err; - redisAssertWithInfo(c,c->argv[2],sdsEncodedObject(c->argv[2])); - redisAssertWithInfo(c,c->argv[3],sdsEncodedObject(c->argv[3])); + serverAssertWithInfo(c,c->argv[2],sdsEncodedObject(c->argv[2])); + serverAssertWithInfo(c,c->argv[3],sdsEncodedObject(c->argv[3])); o = c->argv[3]; if (0) { /* this starts the config_set macros else-if chain. */ @@ -1030,7 +1030,7 @@ void configGetCommand(client *c) { char *pattern = o->ptr; char buf[128]; int matches = 0; - redisAssertWithInfo(c,o,sdsEncodedObject(o)); + serverAssertWithInfo(c,o,sdsEncodedObject(o)); /* String values */ config_get_string_field("dbfilename",server.rdb_filename); diff --git a/src/db.c b/src/db.c index 55b725f78..72c4c3b4e 100644 --- a/src/db.c +++ b/src/db.c @@ -119,7 +119,7 @@ void dbAdd(redisDb *db, robj *key, robj *val) { sds copy = sdsdup(key->ptr); 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 (server.cluster_enabled) slotToKeyAdd(key); } @@ -132,7 +132,7 @@ void dbAdd(redisDb *db, robj *key, robj *val) { void dbOverwrite(redisDb *db, robj *key, robj *val) { dictEntry *de = dictFind(db->dict,key->ptr); - redisAssertWithInfo(NULL,key,de != NULL); + serverAssertWithInfo(NULL,key,de != NULL); dictReplace(db->dict, key->ptr, val); } @@ -224,7 +224,7 @@ int dbDelete(redisDb *db, robj *key) { * using an sdscat() call to append some data, or anything else. */ 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) { robj *decoded = getDecodedObject(o); o = createRawStringObject(decoded->ptr, sdslen(decoded->ptr)); @@ -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 * 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); /* 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) { char buf[REDIS_LONGSTR_SIZE]; int len; - redisAssert(kobj->encoding == OBJ_ENCODING_INT); + serverAssert(kobj->encoding == OBJ_ENCODING_INT); len = ll2string(buf,sizeof(buf),(long)kobj->ptr); if (!stringmatchlen(pat, patlen, buf, len, 0)) filter = 1; } @@ -799,7 +799,7 @@ void moveCommand(client *c) { int removeExpire(redisDb *db, robj *key) { /* An expire may only be removed if there is a corresponding entry in the * 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; } @@ -808,7 +808,7 @@ void setExpire(redisDb *db, robj *key, long long when) { /* Reuse the sds from the main dict in the expire dict */ kde = dictFind(db->dict,key->ptr); - redisAssertWithInfo(NULL,key,kde != NULL); + serverAssertWithInfo(NULL,key,kde != NULL); de = dictReplaceRaw(db->expires,dictGetKey(kde)); dictSetSignedIntegerVal(de,when); } @@ -824,7 +824,7 @@ long long getExpire(redisDb *db, robj *key) { /* The entry was found in the expire dict, this means it should also * 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); } @@ -924,7 +924,7 @@ void expireGenericCommand(client *c, long long basetime, int unit) { if (when <= mstime() && !server.loading && !server.masterhost) { robj *aux; - redisAssertWithInfo(c,key,dbDelete(c->db,key)); + serverAssertWithInfo(c,key,dbDelete(c->db,key)); server.dirty++; /* Replicate/AOF this as an explicit DEL. */ @@ -1025,7 +1025,7 @@ int *getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, in if (last < 0) last = argc+last; keys = zmalloc(sizeof(int)*((last - cmd->firstkey)+1)); for (j = cmd->firstkey; j <= last; j += cmd->keystep) { - redisAssert(j < argc); + serverAssert(j < argc); keys[i++] = j; } *numkeys = i; diff --git a/src/debug.c b/src/debug.c index dc77d2c78..7a45816ad 100644 --- a/src/debug.c +++ b/src/debug.c @@ -181,12 +181,12 @@ void computeDatasetDigest(unsigned char *final) { double score; eptr = ziplistIndex(zl,0); - redisAssert(eptr != NULL); + serverAssert(eptr != NULL); sptr = ziplistNext(zl,eptr); - redisAssert(sptr != NULL); + serverAssert(sptr != NULL); while (eptr != NULL) { - redisAssert(ziplistGet(eptr,&vstr,&vlen,&vll)); + serverAssert(ziplistGet(eptr,&vstr,&vlen,&vll)); score = zzlGetScore(sptr); memset(eledigest,0,20); @@ -267,7 +267,7 @@ void debugCommand(client *c) { addReply(c,shared.ok); } else if (!strcasecmp(c->argv[1]->ptr,"assert")) { 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")) { if (rdbSave(server.rdb_filename) != REDIS_OK) { addReply(c,shared.err); @@ -470,7 +470,7 @@ void debugCommand(client *c) { /* =========================== Crash handling ============================== */ -void _redisAssert(char *estr, char *file, int line) { +void _serverAssert(char *estr, char *file, int line) { bugReportStart(); serverLog(REDIS_WARNING,"=== ASSERTION FAILED ==="); serverLog(REDIS_WARNING,"==> %s:%d '%s' is not true",file,line,estr); @@ -483,7 +483,7 @@ void _redisAssert(char *estr, char *file, int line) { *((char*)-1) = 'x'; } -void _redisAssertPrintClientInfo(client *c) { +void _serverAssertPrintClientInfo(client *c) { int j; bugReportStart(); @@ -531,16 +531,16 @@ void serverLogObjectDebugInfo(robj *o) { } } -void _redisAssertPrintObject(robj *o) { +void _serverAssertPrintObject(robj *o) { bugReportStart(); serverLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ==="); serverLogObjectDebugInfo(o); } -void _redisAssertWithInfo(client *c, robj *o, char *estr, char *file, int line) { - if (c) _redisAssertPrintClientInfo(c); - if (o) _redisAssertPrintObject(o); - _redisAssert(estr,file,line); +void _serverAssertWithInfo(client *c, robj *o, char *estr, char *file, int line) { + if (c) _serverAssertPrintClientInfo(c); + if (o) _serverAssertPrintObject(o); + _serverAssert(estr,file,line); } void _redisPanic(char *msg, char *file, int line) { diff --git a/src/hyperloglog.c b/src/hyperloglog.c index fb56e5538..8e18f5261 100644 --- a/src/hyperloglog.c +++ b/src/hyperloglog.c @@ -877,7 +877,7 @@ promote: /* Promote to dense representation. */ * is propagated to slaves / AOF, so if there is a sparse -> dense * convertion, it will be performed in all the slaves as well. */ int dense_retval = hllDenseAdd(hdr->registers, ele, elesize); - redisAssert(dense_retval == 1); + serverAssert(dense_retval == 1); return dense_retval; } @@ -1108,7 +1108,7 @@ robj *createHLLObject(void) { p += 2; aux -= xzero; } - redisAssert((p-(uint8_t*)s) == sparselen); + serverAssert((p-(uint8_t*)s) == sparselen); /* Create the actual object. */ o = createObject(OBJ_STRING,s); diff --git a/src/multi.c b/src/multi.c index aff394023..c9d1f9c3b 100644 --- a/src/multi.c +++ b/src/multi.c @@ -244,7 +244,7 @@ void unwatchAllKeys(client *c) { * from the list */ wk = listNodeValue(ln); clients = dictFetchValue(wk->db->watched_keys, wk->key); - redisAssertWithInfo(c,NULL,clients != NULL); + serverAssertWithInfo(c,NULL,clients != NULL); listDelNode(clients,listSearchKey(clients,c)); /* Kill the entry at all if this was the only client */ if (listLength(clients) == 0) diff --git a/src/networking.c b/src/networking.c index 545441be2..9c17763d3 100644 --- a/src/networking.c +++ b/src/networking.c @@ -44,7 +44,7 @@ size_t sdsZmallocSize(sds s) { /* Return the amount of memory used by the sds string at object->ptr * for a string object. */ size_t getStringObjectSdsUsedMemory(robj *o) { - redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); + serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); switch(o->encoding) { case OBJ_ENCODING_RAW: return sdsZmallocSize(o->ptr); case OBJ_ENCODING_EMBSTR: return zmalloc_size(o)-sizeof(robj); @@ -186,7 +186,7 @@ int prepareClientToWrite(client *c) { robj *dupLastObjectIfNeeded(list *reply) { robj *new, *cur; listNode *ln; - redisAssert(listLength(reply) > 0); + serverAssert(listLength(reply) > 0); ln = listLast(reply); cur = listNodeValue(ln); if (cur->refcount > 1) { @@ -748,7 +748,7 @@ void freeClient(client *c) { /* Remove from the list of clients */ if (c->fd != -1) { ln = listSearchKey(server.clients,c); - redisAssert(ln != NULL); + serverAssert(ln != NULL); listDelNode(server.clients,ln); } @@ -756,7 +756,7 @@ void freeClient(client *c) { * remove it from the list of unblocked clients. */ if (c->flags & REDIS_UNBLOCKED) { ln = listSearchKey(server.unblocked_clients,c); - redisAssert(ln != NULL); + serverAssert(ln != NULL); listDelNode(server.unblocked_clients,ln); } @@ -769,7 +769,7 @@ void freeClient(client *c) { } list *l = (c->flags & REDIS_MONITOR) ? server.monitors : server.slaves; ln = listSearchKey(l,c); - redisAssert(ln != NULL); + serverAssert(ln != NULL); listDelNode(l,ln); /* We need to remember the time when we started to have zero * attached slaves, as after some time we'll free the replication @@ -787,7 +787,7 @@ void freeClient(client *c) { * from the queue. */ if (c->flags & REDIS_CLOSE_ASAP) { ln = listSearchKey(server.clients_to_close,c); - redisAssert(ln != NULL); + serverAssert(ln != NULL); listDelNode(server.clients_to_close,ln); } @@ -1000,7 +1000,7 @@ int processMultibulkBuffer(client *c) { if (c->multibulklen == 0) { /* 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 */ newline = strchr(c->querybuf,'\r'); @@ -1018,7 +1018,7 @@ int processMultibulkBuffer(client *c) { /* We know for sure there is a whole line since newline != NULL, * 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); if (!ok || ll > 1024*1024) { addReplyError(c,"Protocol error: invalid multibulk length"); @@ -1039,7 +1039,7 @@ int processMultibulkBuffer(client *c) { c->argv = zmalloc(sizeof(robj*)*c->multibulklen); } - redisAssertWithInfo(c,NULL,c->multibulklen > 0); + serverAssertWithInfo(c,NULL,c->multibulklen > 0); while(c->multibulklen) { /* Read bulk length if unknown */ if (c->bulklen == -1) { @@ -1523,7 +1523,7 @@ void rewriteClientCommandVector(client *c, int argc, ...) { c->argv = argv; c->argc = argc; c->cmd = lookupCommandOrOriginal(c->argv[0]->ptr); - redisAssertWithInfo(c,NULL,c->cmd != NULL); + serverAssertWithInfo(c,NULL,c->cmd != NULL); va_end(ap); } @@ -1534,7 +1534,7 @@ void replaceClientCommandVector(client *c, int argc, robj **argv) { c->argv = argv; c->argc = argc; 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. @@ -1542,7 +1542,7 @@ void replaceClientCommandVector(client *c, int argc, robj **argv) { void rewriteClientCommandArgument(client *c, int i, robj *newval) { robj *oldval; - redisAssertWithInfo(c,NULL,i < c->argc); + serverAssertWithInfo(c,NULL,i < c->argc); oldval = c->argv[i]; c->argv[i] = newval; incrRefCount(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 (i == 0) { 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) { * 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. */ 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 (checkClientOutputBufferLimits(c)) { sds client = catClientInfoString(sdsempty(),c); diff --git a/src/object.c b/src/object.c index d84f388c2..a9d959b4c 100644 --- a/src/object.c +++ b/src/object.c @@ -163,7 +163,7 @@ robj *createStringObjectFromLongDouble(long double value, int humanfriendly) { robj *dupStringObject(robj *o) { robj *d; - redisAssert(o->type == OBJ_STRING); + serverAssert(o->type == OBJ_STRING); switch(o->encoding) { case OBJ_ENCODING_RAW: @@ -348,7 +348,7 @@ int checkType(client *c, robj *o, int type) { } 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 (llval) *llval = (long) o->ptr; return REDIS_OK; @@ -367,7 +367,7 @@ robj *tryObjectEncoding(robj *o) { * in this function. Other types use encoded memory efficient * representations but are handled by the commands implementing * 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 * RAW or EMBSTR encoded, in other words objects that are still @@ -469,7 +469,7 @@ robj *getDecodedObject(robj *o) { #define REDIS_COMPARE_COLL (1<<1) 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; size_t alen, blen, minlen; @@ -526,7 +526,7 @@ int equalStringObjects(robj *a, robj *b) { } size_t stringObjectLen(robj *o) { - redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); + serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); if (sdsEncodedObject(o)) { return sdslen(o->ptr); } else { @@ -541,7 +541,7 @@ int getDoubleFromObject(robj *o, double *target) { if (o == NULL) { value = 0; } else { - redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); + serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); if (sdsEncodedObject(o)) { errno = 0; value = strtod(o->ptr, &eptr); @@ -583,7 +583,7 @@ int getLongDoubleFromObject(robj *o, long double *target) { if (o == NULL) { value = 0; } else { - redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); + serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); if (sdsEncodedObject(o)) { errno = 0; value = strtold(o->ptr, &eptr); @@ -621,7 +621,7 @@ int getLongLongFromObject(robj *o, long long *target) { if (o == NULL) { value = 0; } else { - redisAssertWithInfo(NULL,o,o->type == OBJ_STRING); + serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); if (sdsEncodedObject(o)) { errno = 0; value = strtoll(o->ptr, &eptr, 10); diff --git a/src/pubsub.c b/src/pubsub.c index edb08b04b..c07a692a9 100644 --- a/src/pubsub.c +++ b/src/pubsub.c @@ -98,10 +98,10 @@ int pubsubUnsubscribeChannel(client *c, robj *channel, int notify) { retval = 1; /* Remove the client from the channel -> clients list hash table */ de = dictFind(server.pubsub_channels,channel); - redisAssertWithInfo(c,NULL,de != NULL); + serverAssertWithInfo(c,NULL,de != NULL); clients = dictGetVal(de); ln = listSearchKey(clients,c); - redisAssertWithInfo(c,NULL,ln != NULL); + serverAssertWithInfo(c,NULL,ln != NULL); listDelNode(clients,ln); if (listLength(clients) == 0) { /* Free the list and associated hash entry at all if this was diff --git a/src/rdb.c b/src/rdb.c index 6bf03384b..69c69d744 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -357,7 +357,7 @@ ssize_t rdbSaveLongLongAsStringObject(rio *rdb, long long value) { } else { /* Encode as string */ enclen = ll2string((char*)buf,32,value); - redisAssert(enclen < 32); + serverAssert(enclen < 32); if ((n = rdbSaveLen(rdb,enclen)) == -1) return -1; nwritten += n; if ((n = rdbWriteRaw(rdb,buf,enclen)) == -1) return -1; @@ -373,7 +373,7 @@ int rdbSaveStringObject(rio *rdb, robj *obj) { if (obj->encoding == OBJ_ENCODING_INT) { return rdbSaveLongLongAsStringObject(rdb,(long)obj->ptr); } else { - redisAssertWithInfo(NULL,obj,sdsEncodedObject(obj)); + serverAssertWithInfo(NULL,obj,sdsEncodedObject(obj)); return rdbSaveRawString(rdb,obj->ptr,sdslen(obj->ptr)); } } @@ -666,7 +666,7 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) { * we could switch to a faster solution. */ size_t rdbSavedObjectLen(robj *o) { ssize_t len = rdbSaveObject(NULL,o); - redisAssertWithInfo(NULL,o,len != -1); + serverAssertWithInfo(NULL,o,len != -1); return len; } @@ -1051,10 +1051,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) { /* Load raw strings */ field = rdbLoadStringObject(rdb); if (field == NULL) return NULL; - redisAssert(sdsEncodedObject(field)); + serverAssert(sdsEncodedObject(field)); value = rdbLoadStringObject(rdb); if (value == NULL) return NULL; - redisAssert(sdsEncodedObject(value)); + serverAssert(sdsEncodedObject(value)); /* Add pair to ziplist */ o->ptr = ziplistPush(o->ptr, field->ptr, sdslen(field->ptr), ZIPLIST_TAIL); @@ -1094,7 +1094,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) { } /* All pairs should be read by now */ - redisAssert(len == 0); + serverAssert(len == 0); } else if (rdbtype == REDIS_RDB_TYPE_LIST_QUICKLIST) { if ((len = rdbLoadLen(rdb,NULL)) == REDIS_RDB_LENERR) return NULL; o = createQuicklistObject(); diff --git a/src/redisassert.h b/src/redisassert.h index e5825c0f5..34e95268a 100644 --- a/src/redisassert.h +++ b/src/redisassert.h @@ -40,8 +40,8 @@ #include /* 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 diff --git a/src/replication.c b/src/replication.c index f42285e2e..fdd4ddfa0 100644 --- a/src/replication.c +++ b/src/replication.c @@ -69,7 +69,7 @@ char *replicationGetSlaveName(client *c) { /* ---------------------------------- MASTER -------------------------------- */ void createReplicationBacklog(void) { - redisAssert(server.repl_backlog == NULL); + serverAssert(server.repl_backlog == NULL); server.repl_backlog = zmalloc(server.repl_backlog_size); server.repl_backlog_histlen = 0; server.repl_backlog_idx = 0; @@ -113,7 +113,7 @@ void resizeReplicationBacklog(long long newsize) { } void freeReplicationBacklog(void) { - redisAssert(listLength(server.slaves) == 0); + serverAssert(listLength(server.slaves) == 0); zfree(server.repl_backlog); server.repl_backlog = NULL; } @@ -175,7 +175,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) { if (server.repl_backlog == NULL && listLength(slaves) == 0) return; /* 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. */ if (server.slaveseldb != dictid) { @@ -821,7 +821,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) { /* Abort the async download of the bulk dataset while SYNC-ing with master */ 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); close(server.repl_transfer_s); @@ -1411,7 +1411,7 @@ int connectWithMaster(void) { void undoConnectWithMaster(void) { 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); aeDeleteFileEvent(server.el,fd,AE_READABLE|AE_WRITABLE); close(fd); @@ -1603,13 +1603,13 @@ void replicationSendAck(void) { void replicationCacheMaster(client *c) { 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."); /* 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. */ ln = listSearchKey(server.clients,c); - redisAssert(ln != NULL); + serverAssert(ln != NULL); listDelNode(server.clients,ln); /* Save the master. Server.master will be set to null later by @@ -1774,14 +1774,14 @@ void replicationScriptCacheAdd(sds sha1) { sds oldest = listNodeValue(ln); retval = dictDelete(server.repl_scriptcache_dict,oldest); - redisAssert(retval == DICT_OK); + serverAssert(retval == DICT_OK); listDelNode(server.repl_scriptcache_fifo,ln); } /* Add current. */ retval = dictAdd(server.repl_scriptcache_dict,key,NULL); 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, @@ -1880,7 +1880,7 @@ void waitCommand(client *c) { * instead. */ void unblockClientWaitingReplicas(client *c) { listNode *ln = listSearchKey(server.clients_waiting_acks,c); - redisAssert(ln != NULL); + serverAssert(ln != NULL); listDelNode(server.clients_waiting_acks,ln); } diff --git a/src/rio.c b/src/rio.c index 1cc6225f7..329c887a4 100644 --- a/src/rio.c +++ b/src/rio.c @@ -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 * way instead the I/O pressure is more distributed across time. */ void rioSetAutoSync(rio *r, off_t bytes) { - redisAssert(r->read == rioFileIO.read); + serverAssert(r->read == rioFileIO.read); r->io.file.autosync = bytes; } diff --git a/src/scripting.c b/src/scripting.c index 9271ea6d0..9364d8b19 100644 --- a/src/scripting.c +++ b/src/scripting.c @@ -914,7 +914,7 @@ int luaCreateFunction(client *c, lua_State *lua, char *funcname, robj *body) { { int retval = dictAdd(server.lua_scripts, sdsnewlen(funcname+2,40),body); - redisAssertWithInfo(c,NULL,retval == DICT_OK); + serverAssertWithInfo(c,NULL,retval == DICT_OK); incrRefCount(body); } return REDIS_OK; @@ -996,7 +996,7 @@ void evalGenericCommand(client *c, int evalsha) { } /* Now the following is guaranteed to return non nil */ 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 @@ -1081,7 +1081,7 @@ void evalGenericCommand(client *c, int evalsha) { robj *script = dictFetchValue(server.lua_scripts,c->argv[1]->ptr); replicationScriptCacheAdd(c->argv[1]->ptr); - redisAssertWithInfo(c,NULL,script != NULL); + serverAssertWithInfo(c,NULL,script != NULL); rewriteClientCommandArgument(c,0, resetRefCount(createStringObject("EVAL",4))); rewriteClientCommandArgument(c,1,script); diff --git a/src/sentinel.c b/src/sentinel.c index 42e8eab1f..6de90f997 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -454,7 +454,7 @@ void initSentinel(void) { struct redisCommand *cmd = sentinelcmds+j; retval = dictAdd(server.commands, sdsnew(cmd->name), cmd); - redisAssert(retval == DICT_OK); + serverAssert(retval == DICT_OK); } /* Initialize various data structures. */ @@ -705,7 +705,7 @@ void sentinelScheduleScriptExecution(char *path, ...) { sentinelReleaseScriptJob(sj); break; } - redisAssert(listLength(sentinel.scripts_queue) <= + serverAssert(listLength(sentinel.scripts_queue) <= SENTINEL_SCRIPT_MAX_QUEUE); } } @@ -973,7 +973,7 @@ void instanceLinkCloseConnection(instanceLink *link, redisAsyncContext *c) { * replies for an instance that no longer exists. */ instanceLink *releaseInstanceLink(instanceLink *link, sentinelRedisInstance *ri) { - redisAssert(link->refcount > 0); + serverAssert(link->refcount > 0); link->refcount--; if (link->refcount != 0) { if (ri && ri->link->cc) { @@ -1016,7 +1016,7 @@ instanceLink *releaseInstanceLink(instanceLink *link, sentinelRedisInstance *ri) * different master and sharing was performed. Otherwise REDIS_ERR * is returned. */ int sentinelTryConnectionSharing(sentinelRedisInstance *ri) { - redisAssert(ri->flags & SRI_SENTINEL); + serverAssert(ri->flags & SRI_SENTINEL); dictIterator *di; dictEntry *de; @@ -1052,7 +1052,7 @@ int sentinelTryConnectionSharing(sentinelRedisInstance *ri) { * * Return the number of updated Sentinel addresses. */ int sentinelUpdateSentinelAddressInAllMasters(sentinelRedisInstance *ri) { - redisAssert(ri->flags & SRI_SENTINEL); + serverAssert(ri->flags & SRI_SENTINEL); dictIterator *di; dictEntry *de; int reconfigured = 0; @@ -1140,8 +1140,8 @@ sentinelRedisInstance *createSentinelRedisInstance(char *name, int flags, char * dict *table = NULL; char slavename[REDIS_PEER_ID_LEN], *sdsname; - redisAssert(flags & (SRI_MASTER|SRI_SLAVE|SRI_SENTINEL)); - redisAssert((flags & SRI_MASTER) || master != NULL); + serverAssert(flags & (SRI_MASTER|SRI_SLAVE|SRI_SENTINEL)); + serverAssert((flags & SRI_MASTER) || master != NULL); /* Check address validity. */ addr = createSentinelAddr(hostname,port); @@ -1262,7 +1262,7 @@ sentinelRedisInstance *sentinelRedisInstanceLookupSlave( sentinelRedisInstance *slave; char buf[REDIS_PEER_ID_LEN]; - redisAssert(ri->flags & SRI_MASTER); + serverAssert(ri->flags & SRI_MASTER); anetFormatAddr(buf,sizeof(buf),ip,port); key = sdsnew(buf); slave = dictFetchValue(ri->slaves,key); @@ -1320,7 +1320,7 @@ sentinelRedisInstance *getSentinelRedisInstanceByAddrAndRunID(dict *instances, c dictEntry *de; 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); while((de = dictNext(di)) != NULL) { sentinelRedisInstance *ri = dictGetVal(de); @@ -1388,7 +1388,7 @@ void sentinelDelFlagsToDictOfRedisInstances(dict *instances, int flags) { #define SENTINEL_RESET_NO_SENTINELS (1<<0) void sentinelResetMaster(sentinelRedisInstance *ri, int flags) { - redisAssert(ri->flags & SRI_MASTER); + serverAssert(ri->flags & SRI_MASTER); dictRelease(ri->slaves); ri->slaves = dictCreate(&instancesDictType,NULL); if (!(flags & SENTINEL_RESET_NO_SENTINELS)) { @@ -3606,7 +3606,7 @@ int sentinelLeaderIncr(dict *counters, char *runid) { return oldval+1; } else { de = dictAddRaw(counters,runid); - redisAssert(de != NULL); + serverAssert(de != NULL); dictSetUnsignedIntegerVal(de,1); return 1; } @@ -3628,7 +3628,7 @@ char *sentinelGetLeader(sentinelRedisInstance *master, uint64_t epoch) { uint64_t leader_epoch; 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); voters = dictSize(master->sentinels)+1; /* All the other sentinels and me. */ @@ -3751,7 +3751,7 @@ int sentinelSendSlaveOf(sentinelRedisInstance *ri, char *host, int port) { /* Setup the master state to start a failover. */ void sentinelStartFailover(sentinelRedisInstance *master) { - redisAssert(master->flags & SRI_MASTER); + serverAssert(master->flags & SRI_MASTER); master->failover_state = SENTINEL_FAILOVER_STATE_WAIT_START; master->flags |= SRI_FAILOVER_IN_PROGRESS; @@ -4137,7 +4137,7 @@ void sentinelFailoverSwitchToPromotedSlave(sentinelRedisInstance *master) { } void sentinelFailoverStateMachine(sentinelRedisInstance *ri) { - redisAssert(ri->flags & SRI_MASTER); + serverAssert(ri->flags & SRI_MASTER); if (!(ri->flags & SRI_FAILOVER_IN_PROGRESS)) return; @@ -4166,8 +4166,8 @@ void sentinelFailoverStateMachine(sentinelRedisInstance *ri) { * the slave -> master switch. Otherwise the failover can't be aborted and * will reach its end (possibly by timeout). */ void sentinelAbortFailover(sentinelRedisInstance *ri) { - redisAssert(ri->flags & SRI_FAILOVER_IN_PROGRESS); - redisAssert(ri->failover_state <= SENTINEL_FAILOVER_STATE_WAIT_PROMOTION); + serverAssert(ri->flags & SRI_FAILOVER_IN_PROGRESS); + serverAssert(ri->failover_state <= SENTINEL_FAILOVER_STATE_WAIT_PROMOTION); ri->flags &= ~(SRI_FAILOVER_IN_PROGRESS|SRI_FORCE_FAILOVER); ri->failover_state = SENTINEL_FAILOVER_STATE_NONE; diff --git a/src/server.c b/src/server.c index cc7d1a19b..4a2483f66 100644 --- a/src/server.c +++ b/src/server.c @@ -1938,7 +1938,7 @@ void populateCommandTable(void) { /* Populate an additional dictionary that will be unaffected * by rename-command statements in redis.conf. */ retval2 = dictAdd(server.orig_commands, sdsnew(c->name), c); - redisAssert(retval1 == DICT_OK && retval2 == DICT_OK); + serverAssert(retval1 == DICT_OK && retval2 == DICT_OK); } } diff --git a/src/server.h b/src/server.h index 7bed5be57..6677d8419 100644 --- a/src/server.h +++ b/src/server.h @@ -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)))) /* 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 redisAssert(_e) ((_e)?(void)0 : (_redisAssert(#_e,__FILE__,__LINE__),_exit(1))) +#define serverAssertWithInfo(_c,_o,_e) ((_e)?(void)0 : (_serverAssertWithInfo(_c,_o,#_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) /*----------------------------------------------------------------------------- @@ -1581,8 +1581,8 @@ void *realloc(void *ptr, size_t size) __attribute__ ((deprecated)); #endif /* Debugging stuff */ -void _redisAssertWithInfo(client *c, robj *o, char *estr, char *file, int line); -void _redisAssert(char *estr, char *file, int line); +void _serverAssertWithInfo(client *c, robj *o, char *estr, char *file, int line); +void _serverAssert(char *estr, char *file, int line); void _redisPanic(char *msg, char *file, int line); void bugReportStart(void); void serverLogObjectDebugInfo(robj *o); diff --git a/src/sort.c b/src/sort.c index 6662913c6..a3b0b750c 100644 --- a/src/sort.c +++ b/src/sort.c @@ -416,7 +416,7 @@ void sortCommand(client *c) { } while(rangelen--) { - redisAssertWithInfo(c,sortval,ln != NULL); + serverAssertWithInfo(c,sortval,ln != NULL); ele = ln->obj; vector[j].obj = ele; vector[j].u.score = 0; @@ -442,7 +442,7 @@ void sortCommand(client *c) { } else { 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 */ if (dontsort == 0) { @@ -475,7 +475,7 @@ void sortCommand(client *c) { * far. We can just cast it */ vector[j].u.score = (long)byval->ptr; } else { - redisAssertWithInfo(c,sortval,1 != 1); + serverAssertWithInfo(c,sortval,1 != 1); } } @@ -526,7 +526,7 @@ void sortCommand(client *c) { } } else { /* 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) { decrRefCount(val); } else { /* Always fails */ - redisAssertWithInfo(c,sortval,sop->type == REDIS_SORT_GET); + serverAssertWithInfo(c,sortval,sop->type == REDIS_SORT_GET); } } } diff --git a/src/t_hash.c b/src/t_hash.c index b097b3201..e94238f5e 100644 --- a/src/t_hash.c +++ b/src/t_hash.c @@ -70,7 +70,7 @@ int hashTypeGetFromZiplist(robj *o, robj *field, unsigned char *zl, *fptr = NULL, *vptr = NULL; int ret; - redisAssert(o->encoding == OBJ_ENCODING_ZIPLIST); + serverAssert(o->encoding == OBJ_ENCODING_ZIPLIST); field = getDecodedObject(field); @@ -81,7 +81,7 @@ int hashTypeGetFromZiplist(robj *o, robj *field, if (fptr != NULL) { /* Grab pointer to the value (fptr points to the field) */ vptr = ziplistNext(zl, fptr); - redisAssert(vptr != NULL); + serverAssert(vptr != NULL); } } @@ -89,7 +89,7 @@ int hashTypeGetFromZiplist(robj *o, robj *field, if (vptr != NULL) { ret = ziplistGet(vptr, vstr, vlen, vll); - redisAssert(ret); + serverAssert(ret); return 0; } @@ -101,7 +101,7 @@ int hashTypeGetFromZiplist(robj *o, robj *field, int hashTypeGetFromHashTable(robj *o, robj *field, robj **value) { dictEntry *de; - redisAssert(o->encoding == OBJ_ENCODING_HT); + serverAssert(o->encoding == OBJ_ENCODING_HT); de = dictFind(o->ptr, field); if (de == NULL) return -1; @@ -205,7 +205,7 @@ int hashTypeSet(robj *o, robj *field, robj *value) { if (fptr != NULL) { /* Grab pointer to the value (fptr points to the field) */ vptr = ziplistNext(zl, fptr); - redisAssert(vptr != NULL); + serverAssert(vptr != NULL); update = 1; /* Delete value */ @@ -333,18 +333,18 @@ int hashTypeNext(hashTypeIterator *hi) { if (fptr == NULL) { /* Initialize cursor */ - redisAssert(vptr == NULL); + serverAssert(vptr == NULL); fptr = ziplistIndex(zl, 0); } else { /* Advance cursor */ - redisAssert(vptr != NULL); + serverAssert(vptr != NULL); fptr = ziplistNext(zl, vptr); } if (fptr == NULL) return REDIS_ERR; /* Grab pointer to the value (fptr points to the field) */ vptr = ziplistNext(zl, fptr); - redisAssert(vptr != NULL); + serverAssert(vptr != NULL); /* fptr, vptr now point to the first or next pair */ hi->fptr = fptr; @@ -366,21 +366,21 @@ void hashTypeCurrentFromZiplist(hashTypeIterator *hi, int what, { int ret; - redisAssert(hi->encoding == OBJ_ENCODING_ZIPLIST); + serverAssert(hi->encoding == OBJ_ENCODING_ZIPLIST); if (what & OBJ_HASH_KEY) { ret = ziplistGet(hi->fptr, vstr, vlen, vll); - redisAssert(ret); + serverAssert(ret); } else { ret = ziplistGet(hi->vptr, vstr, vlen, vll); - redisAssert(ret); + serverAssert(ret); } } /* Get the field or value at iterator cursor, for an iterator on a hash value * encoded as a ziplist. Prototype is similar to `hashTypeGetFromHashTable`. */ void hashTypeCurrentFromHashTable(hashTypeIterator *hi, int what, robj **dst) { - redisAssert(hi->encoding == OBJ_ENCODING_HT); + serverAssert(hi->encoding == OBJ_ENCODING_HT); if (what & OBJ_HASH_KEY) { *dst = dictGetKey(hi->de); @@ -430,7 +430,7 @@ robj *hashTypeLookupWriteOrCreate(client *c, robj *key) { } void hashTypeConvertZiplist(robj *o, int enc) { - redisAssert(o->encoding == OBJ_ENCODING_ZIPLIST); + serverAssert(o->encoding == OBJ_ENCODING_ZIPLIST); if (enc == OBJ_ENCODING_ZIPLIST) { /* Nothing to do... */ @@ -454,7 +454,7 @@ void hashTypeConvertZiplist(robj *o, int enc) { if (ret != DICT_OK) { serverLogHexDump(REDIS_WARNING,"ziplist with dup elements dump", o->ptr,ziplistBlobLen(o->ptr)); - redisAssert(ret == DICT_OK); + serverAssert(ret == DICT_OK); } } @@ -768,7 +768,7 @@ void genericHgetallCommand(client *c, int flags) { } hashTypeReleaseIterator(hi); - redisAssert(count == length); + serverAssert(count == length); } void hkeysCommand(client *c) { diff --git a/src/t_list.c b/src/t_list.c index b01df6698..0d5ca8fe9 100644 --- a/src/t_list.c +++ b/src/t_list.c @@ -111,7 +111,7 @@ void listTypeReleaseIterator(listTypeIterator *li) { * entry is in fact an entry, 0 otherwise. */ int listTypeNext(listTypeIterator *li, listTypeEntry *entry) { /* Protect from converting when iterating */ - redisAssert(li->subject->encoding == li->encoding); + serverAssert(li->subject->encoding == li->encoding); entry->li = li; if (li->encoding == OBJ_ENCODING_QUICKLIST) { @@ -159,7 +159,7 @@ void listTypeInsert(listTypeEntry *entry, robj *value, int where) { /* Compare the given object with the entry at the current position. */ int listTypeEqual(listTypeEntry *entry, robj *o) { if (entry->li->encoding == OBJ_ENCODING_QUICKLIST) { - redisAssertWithInfo(NULL,o,sdsEncodedObject(o)); + serverAssertWithInfo(NULL,o,sdsEncodedObject(o)); return quicklistCompare(entry->entry.zi,o->ptr,sdslen(o->ptr)); } else { redisPanic("Unknown list encoding"); @@ -177,8 +177,8 @@ void listTypeDelete(listTypeIterator *iter, listTypeEntry *entry) { /* Create a quicklist from a single ziplist */ void listTypeConvert(robj *subject, int enc) { - redisAssertWithInfo(NULL,subject,subject->type==OBJ_LIST); - redisAssertWithInfo(NULL,subject,subject->encoding==OBJ_ENCODING_ZIPLIST); + serverAssertWithInfo(NULL,subject,subject->type==OBJ_LIST); + serverAssertWithInfo(NULL,subject,subject->encoding==OBJ_ENCODING_ZIPLIST); if (enc == OBJ_ENCODING_QUICKLIST) { size_t zlen = server.list_max_ziplist_size; @@ -632,7 +632,7 @@ void blockForKeys(client *c, robj **keys, int numkeys, mstime_t timeout, robj *t l = listCreate(); retval = dictAdd(c->db->blocking_keys,keys[j],l); incrRefCount(keys[j]); - redisAssertWithInfo(c,keys[j],retval == DICT_OK); + serverAssertWithInfo(c,keys[j],retval == DICT_OK); } else { l = dictGetVal(de); } @@ -648,7 +648,7 @@ void unblockClientWaitingData(client *c) { dictIterator *di; list *l; - redisAssertWithInfo(c,NULL,dictSize(c->bpop.keys) != 0); + serverAssertWithInfo(c,NULL,dictSize(c->bpop.keys) != 0); di = dictGetIterator(c->bpop.keys); /* The client may wait for multiple keys, so unblock it for every key. */ while((de = dictNext(di)) != NULL) { @@ -656,7 +656,7 @@ void unblockClientWaitingData(client *c) { /* Remove this client from the list of clients waiting for this key. */ l = dictFetchValue(c->db->blocking_keys,key); - redisAssertWithInfo(c,key,l != NULL); + serverAssertWithInfo(c,key,l != NULL); listDelNode(l,listSearchKey(l,c)); /* If the list is empty we need to remove it to avoid wasting memory */ if (listLength(l) == 0) @@ -699,7 +699,7 @@ void signalListAsReady(redisDb *db, robj *key) { * to avoid adding it multiple times into a list with a simple O(1) * check. */ incrRefCount(key); - redisAssert(dictAdd(db->ready_keys,key,NULL) == DICT_OK); + serverAssert(dictAdd(db->ready_keys,key,NULL) == DICT_OK); } /* This is a helper function for handleClientsBlockedOnLists(). It's work @@ -882,7 +882,7 @@ void blockingPopGenericCommand(client *c, int where) { /* Non empty list, this is like a non normal [LR]POP. */ char *event = (where == REDIS_HEAD) ? "lpop" : "rpop"; robj *value = listTypePop(o,where); - redisAssert(value != NULL); + serverAssert(value != NULL); addReplyMultiBulkLen(c,2); addReplyBulk(c,c->argv[j]); @@ -950,7 +950,7 @@ void brpoplpushCommand(client *c) { } else { /* The list exists and has elements, so * the regular rpoplpushCommand is executed. */ - redisAssertWithInfo(c,key,listTypeLength(key) > 0); + serverAssertWithInfo(c,key,listTypeLength(key) > 0); rpoplpushCommand(c); } } diff --git a/src/t_set.c b/src/t_set.c index f71f5de48..4d8dd165b 100644 --- a/src/t_set.c +++ b/src/t_set.c @@ -74,7 +74,7 @@ int setTypeAdd(robj *subject, robj *value) { /* The set *was* an intset and this value is not integer * encodable, so dictAdd should always work. */ - redisAssertWithInfo(NULL,value, + serverAssertWithInfo(NULL,value, dictAdd(subject->ptr,value,NULL) == DICT_OK); incrRefCount(value); return 1; @@ -241,7 +241,7 @@ unsigned long setTypeSize(robj *subject) { * set. */ void setTypeConvert(robj *setobj, int enc) { setTypeIterator *si; - redisAssertWithInfo(NULL,setobj,setobj->type == OBJ_SET && + serverAssertWithInfo(NULL,setobj,setobj->type == OBJ_SET && setobj->encoding == OBJ_ENCODING_INTSET); if (enc == OBJ_ENCODING_HT) { @@ -256,7 +256,7 @@ void setTypeConvert(robj *setobj, int enc) { si = setTypeInitIterator(setobj); while (setTypeNext(si,&element,&intele) != -1) { element = createStringObjectFromLongLong(intele); - redisAssertWithInfo(NULL,element, + serverAssertWithInfo(NULL,element, dictAdd(d,element,NULL) == DICT_OK); } setTypeReleaseIterator(si); @@ -696,10 +696,10 @@ void srandmemberWithCountCommand(client *c) { } else { retval = dictAdd(d,dupStringObject(ele),NULL); } - redisAssert(retval == DICT_OK); + serverAssert(retval == DICT_OK); } setTypeReleaseIterator(si); - redisAssert(dictSize(d) == size); + serverAssert(dictSize(d) == size); /* Remove random elements to reach the right count. */ while(size > count) { diff --git a/src/t_zset.c b/src/t_zset.c index 9bad44264..63d19036a 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -112,7 +112,7 @@ zskiplistNode *zslInsert(zskiplist *zsl, double score, robj *obj) { unsigned int rank[ZSKIPLIST_MAXLEVEL]; int i, level; - redisAssert(!isnan(score)); + serverAssert(!isnan(score)); x = zsl->header; for (i = zsl->level-1; i >= 0; i--) { /* store rank that is crossed to reach the insert position */ @@ -253,7 +253,7 @@ zskiplistNode *zslFirstInRange(zskiplist *zsl, zrangespec *range) { /* This is an inner range, so the next node cannot be NULL. */ x = x->level[0].forward; - redisAssert(x != NULL); + serverAssert(x != NULL); /* Check if score <= max. */ if (!zslValueLteMax(x->score,range)) return NULL; @@ -278,7 +278,7 @@ zskiplistNode *zslLastInRange(zskiplist *zsl, zrangespec *range) { } /* This is an inner range, so this node cannot be NULL. */ - redisAssert(x != NULL); + serverAssert(x != NULL); /* Check if score >= min. */ if (!zslValueGteMin(x->score,range)) return NULL; @@ -596,7 +596,7 @@ zskiplistNode *zslFirstInLexRange(zskiplist *zsl, zlexrangespec *range) { /* This is an inner range, so the next node cannot be NULL. */ x = x->level[0].forward; - redisAssert(x != NULL); + serverAssert(x != NULL); /* Check if score <= max. */ if (!zslLexValueLteMax(x->obj,range)) return NULL; @@ -621,7 +621,7 @@ zskiplistNode *zslLastInLexRange(zskiplist *zsl, zlexrangespec *range) { } /* This is an inner range, so this node cannot be NULL. */ - redisAssert(x != NULL); + serverAssert(x != NULL); /* Check if score >= min. */ if (!zslLexValueGteMin(x->obj,range)) return NULL; @@ -639,8 +639,8 @@ double zzlGetScore(unsigned char *sptr) { char buf[128]; double score; - redisAssert(sptr != NULL); - redisAssert(ziplistGet(sptr,&vstr,&vlen,&vlong)); + serverAssert(sptr != NULL); + serverAssert(ziplistGet(sptr,&vstr,&vlen,&vlong)); if (vstr) { memcpy(buf,vstr,vlen); @@ -661,8 +661,8 @@ robj *ziplistGetObject(unsigned char *sptr) { unsigned int vlen; long long vlong; - redisAssert(sptr != NULL); - redisAssert(ziplistGet(sptr,&vstr,&vlen,&vlong)); + serverAssert(sptr != NULL); + serverAssert(ziplistGet(sptr,&vstr,&vlen,&vlong)); if (vstr) { return createStringObject((char*)vstr,vlen); @@ -679,7 +679,7 @@ int zzlCompareElements(unsigned char *eptr, unsigned char *cstr, unsigned int cl unsigned char vbuf[32]; int minlen, cmp; - redisAssert(ziplistGet(eptr,&vstr,&vlen,&vlong)); + serverAssert(ziplistGet(eptr,&vstr,&vlen,&vlong)); if (vstr == NULL) { /* Store string representation of long long in buf. */ vlen = ll2string((char*)vbuf,sizeof(vbuf),vlong); @@ -700,12 +700,12 @@ unsigned int zzlLength(unsigned char *zl) { * NULL when there is no next entry. */ void zzlNext(unsigned char *zl, unsigned char **eptr, unsigned char **sptr) { unsigned char *_eptr, *_sptr; - redisAssert(*eptr != NULL && *sptr != NULL); + serverAssert(*eptr != NULL && *sptr != NULL); _eptr = ziplistNext(zl,*sptr); if (_eptr != NULL) { _sptr = ziplistNext(zl,_eptr); - redisAssert(_sptr != NULL); + serverAssert(_sptr != NULL); } else { /* No next entry. */ _sptr = NULL; @@ -719,12 +719,12 @@ void zzlNext(unsigned char *zl, unsigned char **eptr, unsigned char **sptr) { * set to NULL when there is no next entry. */ void zzlPrev(unsigned char *zl, unsigned char **eptr, unsigned char **sptr) { unsigned char *_eptr, *_sptr; - redisAssert(*eptr != NULL && *sptr != NULL); + serverAssert(*eptr != NULL && *sptr != NULL); _sptr = ziplistPrev(zl,*eptr); if (_sptr != NULL) { _eptr = ziplistPrev(zl,_sptr); - redisAssert(_eptr != NULL); + serverAssert(_eptr != NULL); } else { /* No previous entry. */ _eptr = NULL; @@ -752,7 +752,7 @@ int zzlIsInRange(unsigned char *zl, zrangespec *range) { return 0; p = ziplistIndex(zl,1); /* First score. */ - redisAssert(p != NULL); + serverAssert(p != NULL); score = zzlGetScore(p); if (!zslValueLteMax(score,range)) return 0; @@ -771,7 +771,7 @@ unsigned char *zzlFirstInRange(unsigned char *zl, zrangespec *range) { while (eptr != NULL) { sptr = ziplistNext(zl,eptr); - redisAssert(sptr != NULL); + serverAssert(sptr != NULL); score = zzlGetScore(sptr); if (zslValueGteMin(score,range)) { @@ -799,7 +799,7 @@ unsigned char *zzlLastInRange(unsigned char *zl, zrangespec *range) { while (eptr != NULL) { sptr = ziplistNext(zl,eptr); - redisAssert(sptr != NULL); + serverAssert(sptr != NULL); score = zzlGetScore(sptr); if (zslValueLteMax(score,range)) { @@ -813,7 +813,7 @@ unsigned char *zzlLastInRange(unsigned char *zl, zrangespec *range) { * When this returns NULL, we know there also is no element. */ sptr = ziplistPrev(zl,eptr); if (sptr != NULL) - redisAssert((eptr = ziplistPrev(zl,sptr)) != NULL); + serverAssert((eptr = ziplistPrev(zl,sptr)) != NULL); else eptr = NULL; } @@ -852,7 +852,7 @@ int zzlIsInLexRange(unsigned char *zl, zlexrangespec *range) { return 0; p = ziplistIndex(zl,0); /* First element. */ - redisAssert(p != NULL); + serverAssert(p != NULL); if (!zzlLexValueLteMax(p,range)) return 0; @@ -877,7 +877,7 @@ unsigned char *zzlFirstInLexRange(unsigned char *zl, zlexrangespec *range) { /* Move to next element. */ sptr = ziplistNext(zl,eptr); /* This element score. Skip it. */ - redisAssert(sptr != NULL); + serverAssert(sptr != NULL); eptr = ziplistNext(zl,sptr); /* Next element. */ } @@ -904,7 +904,7 @@ unsigned char *zzlLastInLexRange(unsigned char *zl, zlexrangespec *range) { * When this returns NULL, we know there also is no element. */ sptr = ziplistPrev(zl,eptr); if (sptr != NULL) - redisAssert((eptr = ziplistPrev(zl,sptr)) != NULL); + serverAssert((eptr = ziplistPrev(zl,sptr)) != NULL); else eptr = NULL; } @@ -918,7 +918,7 @@ unsigned char *zzlFind(unsigned char *zl, robj *ele, double *score) { ele = getDecodedObject(ele); while (eptr != NULL) { sptr = ziplistNext(zl,eptr); - redisAssertWithInfo(NULL,ele,sptr != NULL); + serverAssertWithInfo(NULL,ele,sptr != NULL); if (ziplistCompare(eptr,ele->ptr,sdslen(ele->ptr))) { /* Matching element, pull out score. */ @@ -952,7 +952,7 @@ unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, robj *ele, do int scorelen; size_t offset; - redisAssertWithInfo(NULL,ele,sdsEncodedObject(ele)); + serverAssertWithInfo(NULL,ele,sdsEncodedObject(ele)); scorelen = d2string(scorebuf,sizeof(scorebuf),score); if (eptr == NULL) { zl = ziplistPush(zl,ele->ptr,sdslen(ele->ptr),ZIPLIST_TAIL); @@ -964,7 +964,7 @@ unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, robj *ele, do eptr = zl+offset; /* Insert score after the element. */ - redisAssertWithInfo(NULL,ele,(sptr = ziplistNext(zl,eptr)) != NULL); + serverAssertWithInfo(NULL,ele,(sptr = ziplistNext(zl,eptr)) != NULL); zl = ziplistInsert(zl,sptr,(unsigned char*)scorebuf,scorelen); } @@ -980,7 +980,7 @@ unsigned char *zzlInsert(unsigned char *zl, robj *ele, double score) { ele = getDecodedObject(ele); while (eptr != NULL) { sptr = ziplistNext(zl,eptr); - redisAssertWithInfo(NULL,ele,sptr != NULL); + serverAssertWithInfo(NULL,ele,sptr != NULL); s = zzlGetScore(sptr); if (s > score) { @@ -1112,13 +1112,13 @@ void zsetConvert(robj *zobj, int encoding) { zs->zsl = zslCreate(); eptr = ziplistIndex(zl,0); - redisAssertWithInfo(NULL,zobj,eptr != NULL); + serverAssertWithInfo(NULL,zobj,eptr != NULL); sptr = ziplistNext(zl,eptr); - redisAssertWithInfo(NULL,zobj,sptr != NULL); + serverAssertWithInfo(NULL,zobj,sptr != NULL); while (eptr != NULL) { score = zzlGetScore(sptr); - redisAssertWithInfo(NULL,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong)); + serverAssertWithInfo(NULL,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong)); if (vstr == NULL) ele = createStringObjectFromLongLong(vlong); else @@ -1126,7 +1126,7 @@ void zsetConvert(robj *zobj, int encoding) { /* Has incremented refcount since it was just created. */ node = zslInsert(zs->zsl,score,ele); - redisAssertWithInfo(NULL,zobj,dictAdd(zs->dict,ele,&node->score) == DICT_OK); + serverAssertWithInfo(NULL,zobj,dictAdd(zs->dict,ele,&node->score) == DICT_OK); incrRefCount(ele); /* Added to dictionary. */ zzlNext(zl,&eptr,&sptr); } @@ -1347,7 +1347,7 @@ void zaddGenericCommand(client *c, int flags) { * delete the key object from the skiplist, since the * dictionary still has a reference to it. */ if (score != curscore) { - redisAssertWithInfo(c,curobj,zslDelete(zs->zsl,curscore,curobj)); + serverAssertWithInfo(c,curobj,zslDelete(zs->zsl,curscore,curobj)); znode = zslInsert(zs->zsl,score,curobj); incrRefCount(curobj); /* Re-inserted in skiplist. */ dictGetVal(de) = &znode->score; /* Update score ptr. */ @@ -1358,7 +1358,7 @@ void zaddGenericCommand(client *c, int flags) { } else if (!xx) { znode = zslInsert(zs->zsl,score,ele); incrRefCount(ele); /* Inserted in skiplist. */ - redisAssertWithInfo(c,NULL,dictAdd(zs->dict,ele,&znode->score) == DICT_OK); + serverAssertWithInfo(c,NULL,dictAdd(zs->dict,ele,&znode->score) == DICT_OK); incrRefCount(ele); /* Added to dictionary. */ server.dirty++; added++; @@ -1430,7 +1430,7 @@ void zremCommand(client *c) { /* Delete from the skiplist */ score = *(double*)dictGetVal(de); - redisAssertWithInfo(c,c->argv[j],zslDelete(zs->zsl,score,c->argv[j])); + serverAssertWithInfo(c,c->argv[j],zslDelete(zs->zsl,score,c->argv[j])); /* Delete from the hash table */ dictDelete(zs->dict,c->argv[j]); @@ -1654,7 +1654,7 @@ void zuiInitIterator(zsetopsrc *op) { it->zl.eptr = ziplistIndex(it->zl.zl,0); if (it->zl.eptr != NULL) { it->zl.sptr = ziplistNext(it->zl.zl,it->zl.eptr); - redisAssert(it->zl.sptr != NULL); + serverAssert(it->zl.sptr != NULL); } } else if (op->encoding == OBJ_ENCODING_SKIPLIST) { it->sl.zs = op->subject->ptr; @@ -1762,7 +1762,7 @@ int zuiNext(zsetopsrc *op, zsetopval *val) { /* No need to check both, but better be explicit. */ if (it->zl.eptr == NULL || it->zl.sptr == NULL) return 0; - redisAssert(ziplistGet(it->zl.eptr,&val->estr,&val->elen,&val->ell)); + serverAssert(ziplistGet(it->zl.eptr,&val->estr,&val->elen,&val->ell)); val->score = zzlGetScore(it->zl.sptr); /* Move to next element. */ @@ -2223,12 +2223,12 @@ void zrangeGenericCommand(client *c, int reverse) { else eptr = ziplistIndex(zl,2*start); - redisAssertWithInfo(c,zobj,eptr != NULL); + serverAssertWithInfo(c,zobj,eptr != NULL); sptr = ziplistNext(zl,eptr); while (rangelen--) { - redisAssertWithInfo(c,zobj,eptr != NULL && sptr != NULL); - redisAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong)); + serverAssertWithInfo(c,zobj,eptr != NULL && sptr != NULL); + serverAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong)); if (vstr == NULL) addReplyBulkLongLong(c,vlong); else @@ -2261,7 +2261,7 @@ void zrangeGenericCommand(client *c, int reverse) { } while(rangelen--) { - redisAssertWithInfo(c,zobj,ln != NULL); + serverAssertWithInfo(c,zobj,ln != NULL); ele = ln->obj; addReplyBulk(c,ele); if (withscores) @@ -2353,7 +2353,7 @@ void genericZrangebyscoreCommand(client *c, int reverse) { } /* Get score pointer for the first element. */ - redisAssertWithInfo(c,zobj,eptr != NULL); + serverAssertWithInfo(c,zobj,eptr != NULL); sptr = ziplistNext(zl,eptr); /* We don't know in advance how many matching elements there are in the @@ -2382,7 +2382,7 @@ void genericZrangebyscoreCommand(client *c, int reverse) { } /* We know the element exists, so ziplistGet should always succeed */ - redisAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong)); + serverAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong)); rangelen++; if (vstr == NULL) { @@ -2509,7 +2509,7 @@ void zcountCommand(client *c) { /* First element is in range */ sptr = ziplistNext(zl,eptr); score = zzlGetScore(sptr); - redisAssertWithInfo(c,zobj,zslValueLteMax(score,&range)); + serverAssertWithInfo(c,zobj,zslValueLteMax(score,&range)); /* Iterate over elements in range */ while (eptr) { @@ -2589,7 +2589,7 @@ void zlexcountCommand(client *c) { /* First element is in range */ sptr = ziplistNext(zl,eptr); - redisAssertWithInfo(c,zobj,zzlLexValueLteMax(eptr,&range)); + serverAssertWithInfo(c,zobj,zzlLexValueLteMax(eptr,&range)); /* Iterate over elements in range */ while (eptr) { @@ -2705,7 +2705,7 @@ void genericZrangebylexCommand(client *c, int reverse) { } /* Get score pointer for the first element. */ - redisAssertWithInfo(c,zobj,eptr != NULL); + serverAssertWithInfo(c,zobj,eptr != NULL); sptr = ziplistNext(zl,eptr); /* We don't know in advance how many matching elements there are in the @@ -2733,7 +2733,7 @@ void genericZrangebylexCommand(client *c, int reverse) { /* We know the element exists, so ziplistGet should always * succeed. */ - redisAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong)); + serverAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong)); rangelen++; if (vstr == NULL) { @@ -2853,16 +2853,16 @@ void zrankGenericCommand(client *c, int reverse) { checkType(c,zobj,OBJ_ZSET)) return; llen = zsetLength(zobj); - redisAssertWithInfo(c,ele,sdsEncodedObject(ele)); + serverAssertWithInfo(c,ele,sdsEncodedObject(ele)); if (zobj->encoding == OBJ_ENCODING_ZIPLIST) { unsigned char *zl = zobj->ptr; unsigned char *eptr, *sptr; eptr = ziplistIndex(zl,0); - redisAssertWithInfo(c,zobj,eptr != NULL); + serverAssertWithInfo(c,zobj,eptr != NULL); sptr = ziplistNext(zl,eptr); - redisAssertWithInfo(c,zobj,sptr != NULL); + serverAssertWithInfo(c,zobj,sptr != NULL); rank = 1; while(eptr != NULL) { @@ -2891,7 +2891,7 @@ void zrankGenericCommand(client *c, int reverse) { if (de != NULL) { score = *(double*)dictGetVal(de); rank = zslGetRank(zsl,score,ele); - redisAssertWithInfo(c,ele,rank); /* Existing elements always have a rank. */ + serverAssertWithInfo(c,ele,rank); /* Existing elements always have a rank. */ if (reverse) addReplyLongLong(c,llen-rank); else