]> git.saurik.com Git - redis.git/commitdiff
Merge branch 'check-aof' of git://github.com/pietern/redis
authorantirez <antirez@gmail.com>
Mon, 10 May 2010 13:09:25 +0000 (15:09 +0200)
committerantirez <antirez@gmail.com>
Mon, 10 May 2010 13:09:25 +0000 (15:09 +0200)
TODO
redis.c
redis.conf
staticsymbols.h

diff --git a/TODO b/TODO
index 2c11929399b5c6d41002d3939a1cb861644e9b3b..bdbe79742400ce5739278157d401cc14109db7d0 100644 (file)
--- a/TODO
+++ b/TODO
@@ -15,10 +15,7 @@ Virtual Memory sub-TODO:
 * Check if the page selection algorithm is working well
 * Divide swappability of objects by refcount
 * Use multiple open FDs against the VM file, one for thread.
-* it should be possible to give the vm-max-memory option in megabyte, gigabyte, ..., just using 2GB, 100MB, and so forth.
-* Try to understand what can be moved into I/O threads that currently is instead handled by the main thread. For instance swapping file table scannig to find contiguous page could be a potential candidate (but I'm not convinced it's a good idea, better to improve the algorithm, for instance double the fast forward at every step?).
-* Possibly decrRefCount() against swapped objects can be moved into I/O threads, as it's a slow operation against million elements list, and in general consumes CPU time that can be consumed by other threads (and cores).
-* EXISTS should avoid loading the object if possible without too make the code too specialized.
+* EXISTS should avoid loading the object if possible without making the code too specialized.
 * vm-min-age <seconds> option
 * Make sure objects loaded from the VM are specially encoded when possible.
 * Check what happens performance-wise if instead to create threads again and again the same threads are reused forever. Note: this requires a way to disable this clients in the child, but waiting for empty new jobs queue can be enough.
diff --git a/redis.c b/redis.c
index d8d024e7714feeefd2ac23b29ab5bbc77f75c69e..4c68d69210fbcae7b55d9c0bdc5e760e8d5a3aff 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -370,6 +370,7 @@ struct redisServer {
     pid_t bgsavechildpid;
     pid_t bgrewritechildpid;
     sds bgrewritebuf; /* buffer taken by parent during oppend only rewrite */
+    sds aofbuf;       /* AOF buffer, written before entering the event loop */
     struct saveparam *saveparams;
     int saveparamslen;
     char *logfile;
@@ -557,6 +558,7 @@ static robj *createStringObject(char *ptr, size_t len);
 static robj *dupStringObject(robj *o);
 static void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc);
 static void replicationFeedMonitors(list *monitors, int dictid, robj **argv, int argc);
+static void flushAppendOnlyFile(void);
 static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int argc);
 static int syncWithMaster(void);
 static robj *tryObjectEncoding(robj *o);
@@ -622,6 +624,7 @@ static int listMatchPubsubPattern(void *a, void *b);
 static int compareStringObjects(robj *a, robj *b);
 static void usage();
 static int rewriteAppendOnlyFileBackground(void);
+static int vmSwapObjectBlocking(robj *key, robj *val);
 
 static void authCommand(redisClient *c);
 static void pingCommand(redisClient *c);
@@ -1528,6 +1531,7 @@ static int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientD
 static void beforeSleep(struct aeEventLoop *eventLoop) {
     REDIS_NOTUSED(eventLoop);
 
+    /* Awake clients that got all the swapped keys they requested */
     if (server.vm_enabled && listLength(server.io_ready_clients)) {
         listIter li;
         listNode *ln;
@@ -1552,6 +1556,8 @@ static void beforeSleep(struct aeEventLoop *eventLoop) {
                 processInputBuffer(c);
         }
     }
+    /* Write the AOF buffer on disk */
+    flushAppendOnlyFile();
 }
 
 static void createSharedObjects(void) {
@@ -1712,6 +1718,7 @@ static void initServer() {
     server.bgsavechildpid = -1;
     server.bgrewritechildpid = -1;
     server.bgrewritebuf = sdsempty();
+    server.aofbuf = sdsempty();
     server.lastsave = time(NULL);
     server.dirty = 0;
     server.stat_numcommands = 0;
@@ -3940,13 +3947,13 @@ static robj *rdbLoadObject(int type, FILE *fp) {
 
 static int rdbLoad(char *filename) {
     FILE *fp;
-    robj *keyobj = NULL;
     uint32_t dbid;
     int type, retval, rdbver;
+    int swap_all_values = 0;
     dict *d = server.db[0].dict;
     redisDb *db = server.db+0;
     char buf[1024];
-    time_t expiretime = -1, now = time(NULL);
+    time_t expiretime, now = time(NULL);
     long long loadedkeys = 0;
 
     fp = fopen(filename,"r");
@@ -3965,8 +3972,9 @@ static int rdbLoad(char *filename) {
         return REDIS_ERR;
     }
     while(1) {
-        robj *o;
+        robj *key, *val;
 
+        expiretime = -1;
         /* Read type. */
         if ((type = rdbLoadType(fp)) == -1) goto eoferr;
         if (type == REDIS_EXPIRETIME) {
@@ -3988,36 +3996,62 @@ static int rdbLoad(char *filename) {
             continue;
         }
         /* Read key */
-        if ((keyobj = rdbLoadStringObject(fp)) == NULL) goto eoferr;
+        if ((key = rdbLoadStringObject(fp)) == NULL) goto eoferr;
         /* Read value */
-        if ((o = rdbLoadObject(type,fp)) == NULL) goto eoferr;
+        if ((val = rdbLoadObject(type,fp)) == NULL) goto eoferr;
         /* Add the new object in the hash table */
-        retval = dictAdd(d,keyobj,o);
+        retval = dictAdd(d,key,val);
         if (retval == DICT_ERR) {
-            redisLog(REDIS_WARNING,"Loading DB, duplicated key (%s) found! Unrecoverable error, exiting now.", keyobj->ptr);
+            redisLog(REDIS_WARNING,"Loading DB, duplicated key (%s) found! Unrecoverable error, exiting now.", key->ptr);
             exit(1);
         }
+        loadedkeys++;
         /* Set the expire time if needed */
         if (expiretime != -1) {
-            setExpire(db,keyobj,expiretime);
+            setExpire(db,key,expiretime);
             /* Delete this key if already expired */
-            if (expiretime < now) deleteKey(db,keyobj);
-            expiretime = -1;
+            if (expiretime < now) {
+                deleteKey(db,key);
+                continue; /* don't try to swap this out */
+            }
         }
-        keyobj = o = NULL;
+
         /* Handle swapping while loading big datasets when VM is on */
-        loadedkeys++;
-        if (server.vm_enabled && (loadedkeys % 5000) == 0) {
+
+        /* If we detecter we are hopeless about fitting something in memory
+         * we just swap every new key on disk. Directly...
+         * Note that's important to check for this condition before resorting
+         * to random sampling, otherwise we may try to swap already
+         * swapped keys. */
+        if (swap_all_values) {
+            dictEntry *de = dictFind(d,key);
+
+            /* de may be NULL since the key already expired */
+            if (de) {
+                key = dictGetEntryKey(de);
+                val = dictGetEntryVal(de);
+
+                if (vmSwapObjectBlocking(key,val) == REDIS_OK) {
+                    dictGetEntryVal(de) = NULL;
+                }
+            }
+            continue;
+        }
+
+        /* If we have still some hope of having some value fitting memory
+         * then we try random sampling. */
+        if (!swap_all_values && server.vm_enabled && (loadedkeys % 5000) == 0) {
             while (zmalloc_used_memory() > server.vm_max_memory) {
                 if (vmSwapOneObjectBlocking() == REDIS_ERR) break;
             }
+            if (zmalloc_used_memory() > server.vm_max_memory)
+                swap_all_values = 1; /* We are already using too much mem */
         }
     }
     fclose(fp);
     return REDIS_OK;
 
 eoferr: /* unexpected end of file is handled here with a fatal exit */
-    if (keyobj) decrRefCount(keyobj);
     redisLog(REDIS_WARNING,"Short read or OOM loading DB. Unrecoverable error, aborting now.");
     exit(1);
     return REDIS_ERR; /* Just to avoid warning */
@@ -4479,7 +4513,6 @@ static void shutdownCommand(redisClient *c) {
                 unlink(server.pidfile);
             redisLog(REDIS_WARNING,"%zu bytes used at exit",zmalloc_used_memory());
             redisLog(REDIS_WARNING,"Server exit now, bye bye...");
-            if (server.vm_enabled) unlink(server.vm_swap_file);
             exit(0);
         } else {
             /* Ooops.. error saving! The best we can do is to continue
@@ -8007,11 +8040,55 @@ static void freeMemoryIfNeeded(void) {
 
 /* ============================== Append Only file ========================== */
 
+/* Write the append only file buffer on disk.
+ *
+ * Since we are required to write the AOF before replying to the client,
+ * and the only way the client socket can get a write is entering when the
+ * the event loop, we accumulate all the AOF writes in a memory
+ * buffer and write it on disk using this function just before entering
+ * the event loop again. */
+static void flushAppendOnlyFile(void) {
+    time_t now;
+    ssize_t nwritten;
+
+    if (sdslen(server.aofbuf) == 0) return;
+
+    /* We want to perform a single write. This should be guaranteed atomic
+     * at least if the filesystem we are writing is a real physical one.
+     * While this will save us against the server being killed I don't think
+     * there is much to do about the whole server stopping for power problems
+     * or alike */
+     nwritten = write(server.appendfd,server.aofbuf,sdslen(server.aofbuf));
+     if (nwritten != (signed)sdslen(server.aofbuf)) {
+        /* Ooops, we are in troubles. The best thing to do for now is
+         * aborting instead of giving the illusion that everything is
+         * working as expected. */
+         if (nwritten == -1) {
+            redisLog(REDIS_WARNING,"Exiting on error writing to the append-only file: %s",strerror(errno));
+         } else {
+            redisLog(REDIS_WARNING,"Exiting on short write while writing to the append-only file: %s",strerror(errno));
+         }
+         exit(1);
+    }
+    sdsfree(server.aofbuf);
+    server.aofbuf = sdsempty();
+
+    /* Fsync if needed */
+    now = time(NULL);
+    if (server.appendfsync == APPENDFSYNC_ALWAYS ||
+        (server.appendfsync == APPENDFSYNC_EVERYSEC &&
+         now-server.lastfsync > 1))
+    {
+        /* aof_fsync is defined as fdatasync() for Linux in order to avoid
+         * flushing metadata. */
+        aof_fsync(server.appendfd); /* Let's try to get this data on the disk */
+        server.lastfsync = now;
+    }
+}
+
 static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int argc) {
     sds buf = sdsempty();
     int j;
-    ssize_t nwritten;
-    time_t now;
     robj *tmpargv[3];
 
     /* The DB this command was targetting is not the same as the last command
@@ -8057,23 +8134,11 @@ static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv
             decrRefCount(argv[j]);
     }
 
-    /* We want to perform a single write. This should be guaranteed atomic
-     * at least if the filesystem we are writing is a real physical one.
-     * While this will save us against the server being killed I don't think
-     * there is much to do about the whole server stopping for power problems
-     * or alike */
-     nwritten = write(server.appendfd,buf,sdslen(buf));
-     if (nwritten != (signed)sdslen(buf)) {
-        /* Ooops, we are in troubles. The best thing to do for now is
-         * to simply exit instead to give the illusion that everything is
-         * working as expected. */
-         if (nwritten == -1) {
-            redisLog(REDIS_WARNING,"Exiting on error writing to the append-only file: %s",strerror(errno));
-         } else {
-            redisLog(REDIS_WARNING,"Exiting on short write while writing to the append-only file: %s",strerror(errno));
-         }
-         exit(1);
-    }
+    /* Append to the AOF buffer. This will be flushed on disk just before
+     * of re-entering the event loop, so before the client will get a
+     * positive reply about the operation performed. */
+    server.aofbuf = sdscatlen(server.aofbuf,buf,sdslen(buf));
+
     /* If a background append only file rewriting is in progress we want to
      * accumulate the differences between the child DB and the current one
      * in a buffer, so that when the child process will do its work we
@@ -8082,16 +8147,6 @@ static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv
         server.bgrewritebuf = sdscatlen(server.bgrewritebuf,buf,sdslen(buf));
 
     sdsfree(buf);
-    now = time(NULL);
-    if (server.appendfsync == APPENDFSYNC_ALWAYS ||
-        (server.appendfsync == APPENDFSYNC_EVERYSEC &&
-         now-server.lastfsync > 1))
-    {
-        /* aof_fsync is defined as fdatasync() for Linux in order to avoid
-         * flushing metadata. */
-        aof_fsync(server.appendfd); /* Let's try to get this data on the disk */
-        server.lastfsync = now;
-    }
 }
 
 /* In Redis commands are always executed in the context of a client, so in
@@ -8556,42 +8611,38 @@ static void aofRemoveTempFile(pid_t childpid) {
 
 /* =================== Virtual Memory - Blocking Side  ====================== */
 
-/* substitute the first occurrence of '%p' with the process pid in the
- * swap file name. */
-static void expandVmSwapFilename(void) {
-    char *p = strstr(server.vm_swap_file,"%p");
-    sds new;
-
-    if (!p) return;
-    new = sdsempty();
-    *p = '\0';
-    new = sdscat(new,server.vm_swap_file);
-    new = sdscatprintf(new,"%ld",(long) getpid());
-    new = sdscat(new,p+2);
-    zfree(server.vm_swap_file);
-    server.vm_swap_file = new;
-}
-
 static void vmInit(void) {
     off_t totsize;
     int pipefds[2];
     size_t stacksize;
+    struct flock fl;
 
     if (server.vm_max_threads != 0)
         zmalloc_enable_thread_safeness(); /* we need thread safe zmalloc() */
 
-    expandVmSwapFilename();
     redisLog(REDIS_NOTICE,"Using '%s' as swap file",server.vm_swap_file);
+    /* Try to open the old swap file, otherwise create it */
     if ((server.vm_fp = fopen(server.vm_swap_file,"r+b")) == NULL) {
         server.vm_fp = fopen(server.vm_swap_file,"w+b");
     }
     if (server.vm_fp == NULL) {
         redisLog(REDIS_WARNING,
-            "Impossible to open the swap file: %s. Exiting.",
+            "Can't open the swap file: %s. Exiting.",
             strerror(errno));
         exit(1);
     }
     server.vm_fd = fileno(server.vm_fp);
+    /* Lock the swap file for writing, this is useful in order to avoid
+     * another instance to use the same swap file for a config error. */
+    fl.l_type = F_WRLCK;
+    fl.l_whence = SEEK_SET;
+    fl.l_start = fl.l_len = 0;
+    if (fcntl(server.vm_fd,F_SETLK,&fl) == -1) {
+        redisLog(REDIS_WARNING,
+            "Can't lock the swap file at '%s': %s. Make sure it is not used by another Redis instance.", server.vm_swap_file, strerror(errno));
+        exit(1);
+    }
+    /* Initialize */
     server.vm_next_page = 0;
     server.vm_near_pages = 0;
     server.vm_stats_used_pages = 0;
@@ -10056,6 +10107,25 @@ static void debugCommand(redisClient *c) {
         } else {
             addReply(c,shared.err);
         }
+    } else if (!strcasecmp(c->argv[1]->ptr,"populate") && c->argc == 3) {
+        long keys, j;
+        robj *key, *val;
+        char buf[128];
+
+        if (getLongFromObjectOrReply(c, c->argv[2], &keys, NULL) != REDIS_OK)
+            return;
+        for (j = 0; j < keys; j++) {
+            snprintf(buf,sizeof(buf),"key:%lu",j);
+            key = createStringObject(buf,strlen(buf));
+            if (lookupKeyRead(c->db,key) != NULL) {
+                decrRefCount(key);
+                continue;
+            }
+            snprintf(buf,sizeof(buf),"value:%lu",j);
+            val = createStringObject(buf,strlen(buf));
+            dictAdd(c->db->dict,key,val);
+        }
+        addReply(c,shared.ok);
     } else {
         addReplySds(c,sdsnew(
             "-ERR Syntax error, try DEBUG [SEGFAULT|OBJECT <key>|SWAPIN <key>|SWAPOUT <key>|RELOAD]\r\n"));
index 377d947a52d40b841525f14e2cf1d41dca006d60..c946a80e86d0fa21e75324b6dc2aa5519b35d990 100644 (file)
@@ -206,20 +206,16 @@ vm-enabled no
 
 # This is the path of the Redis swap file. As you can guess, swap files
 # can't be shared by different Redis instances, so make sure to use a swap
-# file for every redis process you are running.
+# file for every redis process you are running. Redis will complain if the
+# swap file is already in use.
 #
-# The swap file name may contain "%p" that is substituted with the PID of
-# the Redis process, so the default name /tmp/redis-%p.vm will work even
-# with multiple instances as Redis will use, for example, redis-811.vm
-# for one instance and redis-593.vm for another one.
-#
-# Useless to say, the best kind of disk for a Redis swap file (that's accessed
-# at random) is a Solid State Disk (SSD).
+# The best kind of storage for the Redis swap file (that's accessed at random) 
+# is a Solid State Disk (SSD).
 #
 # *** WARNING *** if you are using a shared hosting the default of putting
 # the swap file under /tmp is not secure. Create a dir with access granted
 # only to Redis user and configure Redis to create the swap file there.
-vm-swap-file /tmp/redis-%p.vm
+vm-swap-file /tmp/redis.swap
 
 # vm-max-memory configures the VM to use at max the specified amount of
 # RAM. Everything that deos not fit will be swapped on disk *if* possible, that
index ab4ada7d43bcb39d592bc0be91dcce93939b4db1..aff7b3a37d057823d1bb13dcc8f6ccf9bbb908cb 100644 (file)
@@ -1,6 +1,7 @@
 static struct redisFunctionSym symsTable[] = {
 {"IOThreadEntryPoint",(unsigned long)IOThreadEntryPoint},
 {"_redisAssert",(unsigned long)_redisAssert},
+{"_redisPanic",(unsigned long)_redisPanic},
 {"acceptHandler",(unsigned long)acceptHandler},
 {"addReply",(unsigned long)addReply},
 {"addReplyBulk",(unsigned long)addReplyBulk},
@@ -41,6 +42,7 @@ static struct redisFunctionSym symsTable[] = {
 {"createSharedObjects",(unsigned long)createSharedObjects},
 {"createSortOperation",(unsigned long)createSortOperation},
 {"createStringObject",(unsigned long)createStringObject},
+{"createStringObjectFromLongLong",(unsigned long)createStringObjectFromLongLong},
 {"createZsetObject",(unsigned long)createZsetObject},
 {"daemonize",(unsigned long)daemonize},
 {"dbsizeCommand",(unsigned long)dbsizeCommand},
@@ -63,14 +65,15 @@ static struct redisFunctionSym symsTable[] = {
 {"dupStringObject",(unsigned long)dupStringObject},
 {"echoCommand",(unsigned long)echoCommand},
 {"execCommand",(unsigned long)execCommand},
+{"execCommandReplicateMulti",(unsigned long)execCommandReplicateMulti},
 {"existsCommand",(unsigned long)existsCommand},
-{"expandVmSwapFilename",(unsigned long)expandVmSwapFilename},
 {"expireCommand",(unsigned long)expireCommand},
 {"expireGenericCommand",(unsigned long)expireGenericCommand},
 {"expireIfNeeded",(unsigned long)expireIfNeeded},
 {"expireatCommand",(unsigned long)expireatCommand},
 {"feedAppendOnlyFile",(unsigned long)feedAppendOnlyFile},
 {"findFuncName",(unsigned long)findFuncName},
+{"flushAppendOnlyFile",(unsigned long)flushAppendOnlyFile},
 {"flushallCommand",(unsigned long)flushallCommand},
 {"flushdbCommand",(unsigned long)flushdbCommand},
 {"freeClient",(unsigned long)freeClient},
@@ -94,13 +97,29 @@ static struct redisFunctionSym symsTable[] = {
 {"genericZrangebyscoreCommand",(unsigned long)genericZrangebyscoreCommand},
 {"getCommand",(unsigned long)getCommand},
 {"getDecodedObject",(unsigned long)getDecodedObject},
+{"getDoubleFromObject",(unsigned long)getDoubleFromObject},
+{"getDoubleFromObjectOrReply",(unsigned long)getDoubleFromObjectOrReply},
 {"getExpire",(unsigned long)getExpire},
 {"getGenericCommand",(unsigned long)getGenericCommand},
+{"getLongFromObjectOrReply",(unsigned long)getLongFromObjectOrReply},
+{"getLongLongFromObject",(unsigned long)getLongLongFromObject},
+{"getLongLongFromObjectOrReply",(unsigned long)getLongLongFromObjectOrReply},
 {"getMcontextEip",(unsigned long)getMcontextEip},
 {"getsetCommand",(unsigned long)getsetCommand},
 {"glueReplyBuffersIfNeeded",(unsigned long)glueReplyBuffersIfNeeded},
 {"handleClientsBlockedOnSwappedKey",(unsigned long)handleClientsBlockedOnSwappedKey},
 {"handleClientsWaitingListPush",(unsigned long)handleClientsWaitingListPush},
+{"hashCurrent",(unsigned long)hashCurrent},
+{"hashDelete",(unsigned long)hashDelete},
+{"hashExists",(unsigned long)hashExists},
+{"hashGet",(unsigned long)hashGet},
+{"hashInitIterator",(unsigned long)hashInitIterator},
+{"hashLookupWriteOrCreate",(unsigned long)hashLookupWriteOrCreate},
+{"hashNext",(unsigned long)hashNext},
+{"hashReleaseIterator",(unsigned long)hashReleaseIterator},
+{"hashSet",(unsigned long)hashSet},
+{"hashTryConversion",(unsigned long)hashTryConversion},
+{"hashTryObjectEncoding",(unsigned long)hashTryObjectEncoding},
 {"hdelCommand",(unsigned long)hdelCommand},
 {"hexistsCommand",(unsigned long)hexistsCommand},
 {"hgetCommand",(unsigned long)hgetCommand},
@@ -108,13 +127,17 @@ static struct redisFunctionSym symsTable[] = {
 {"hincrbyCommand",(unsigned long)hincrbyCommand},
 {"hkeysCommand",(unsigned long)hkeysCommand},
 {"hlenCommand",(unsigned long)hlenCommand},
+{"hmgetCommand",(unsigned long)hmgetCommand},
+{"hmsetCommand",(unsigned long)hmsetCommand},
 {"hsetCommand",(unsigned long)hsetCommand},
+{"hsetnxCommand",(unsigned long)hsetnxCommand},
 {"htNeedsResize",(unsigned long)htNeedsResize},
 {"hvalsCommand",(unsigned long)hvalsCommand},
 {"incrCommand",(unsigned long)incrCommand},
 {"incrDecrCommand",(unsigned long)incrDecrCommand},
 {"incrRefCount",(unsigned long)incrRefCount},
 {"incrbyCommand",(unsigned long)incrbyCommand},
+{"incrementallyRehash",(unsigned long)incrementallyRehash},
 {"infoCommand",(unsigned long)infoCommand},
 {"initClientMultiState",(unsigned long)initClientMultiState},
 {"initServer",(unsigned long)initServer},
@@ -197,6 +220,7 @@ static struct redisFunctionSym symsTable[] = {
 {"renameCommand",(unsigned long)renameCommand},
 {"renameGenericCommand",(unsigned long)renameGenericCommand},
 {"renamenxCommand",(unsigned long)renamenxCommand},
+{"replicationFeedMonitors",(unsigned long)replicationFeedMonitors},
 {"replicationFeedSlaves",(unsigned long)replicationFeedSlaves},
 {"resetClient",(unsigned long)resetClient},
 {"resetServerSaveParams",(unsigned long)resetServerSaveParams},
@@ -211,6 +235,7 @@ static struct redisFunctionSym symsTable[] = {
 {"sdiffCommand",(unsigned long)sdiffCommand},
 {"sdiffstoreCommand",(unsigned long)sdiffstoreCommand},
 {"sdsDictKeyCompare",(unsigned long)sdsDictKeyCompare},
+{"sdscatrepr",(unsigned long)sdscatrepr},
 {"segvHandler",(unsigned long)segvHandler},
 {"selectCommand",(unsigned long)selectCommand},
 {"selectDb",(unsigned long)selectDb},
@@ -221,6 +246,7 @@ static struct redisFunctionSym symsTable[] = {
 {"setCommand",(unsigned long)setCommand},
 {"setExpire",(unsigned long)setExpire},
 {"setGenericCommand",(unsigned long)setGenericCommand},
+{"setexCommand",(unsigned long)setexCommand},
 {"setnxCommand",(unsigned long)setnxCommand},
 {"setupSigSegvAction",(unsigned long)setupSigSegvAction},
 {"shutdownCommand",(unsigned long)shutdownCommand},