]> git.saurik.com Git - redis.git/commitdiff
fixed a few bugs in DS store, now it's somewhat about able to reply to 'GET foo'...
authorantirez <antirez@gmail.com>
Thu, 30 Dec 2010 14:55:24 +0000 (15:55 +0100)
committerantirez <antirez@gmail.com>
Thu, 30 Dec 2010 14:55:24 +0000 (15:55 +0100)
src/diskstore.c
src/dscache.c
src/redis.c

index 043adc4b0875338930a9d469c246af647c107ad2..ae23b8ed981c65d3066bdde7670c247bf1017423 100644 (file)
@@ -142,6 +142,7 @@ int dsSet(redisDb *db, robj *key, robj *val) {
 }
 
 robj *dsGet(redisDb *db, robj *key) {
+    return createStringObject("foo",3);
 }
 
 int dsDel(redisDb *db, robj *key) {
index 7273f7ffd6decf7fa58cc39daf966e24beb4b4e0..d24ec77cd3478dd8dd9f55793be39f283c2118eb 100644 (file)
@@ -263,7 +263,6 @@ void vmThreadedIOCompletedJob(aeEventLoop *el, int fd, void *privdata,
     while((retval = read(fd,buf,1)) == 1) {
         iojob *j;
         listNode *ln;
-        struct dictEntry *de;
 
         redisLog(REDIS_DEBUG,"Processing I/O completed job");
 
@@ -284,11 +283,10 @@ void vmThreadedIOCompletedJob(aeEventLoop *el, int fd, void *privdata,
         redisLog(REDIS_DEBUG,"COMPLETED Job type %s, key: %s",
             (j->type == REDIS_IOJOB_LOAD) ? "load" : "save",
             (unsigned char*)j->key->ptr);
-        de = dictFind(j->db->dict,j->key->ptr);
-        redisAssert(de != NULL);
         if (j->type == REDIS_IOJOB_LOAD) {
             /* Create the key-value pair in the in-memory database */
             dbAdd(j->db,j->key,j->val);
+            incrRefCount(j->val);
             /* Handle clients waiting for this key to be loaded. */
             handleClientsBlockedOnSwappedKey(j->db,j->key);
             freeIOJob(j);
@@ -326,11 +324,9 @@ void *IOThreadEntryPoint(void *arg) {
         lockThreadedIO();
         if (listLength(server.io_newjobs) == 0) {
             /* No new jobs in queue, exit. */
-            redisLog(REDIS_DEBUG,"Thread %ld exiting, nothing to do",
-                (long) pthread_self());
-            server.io_active_threads--;
             unlockThreadedIO();
-            return NULL;
+            sleep(1);
+            continue;
         }
         ln = listFirst(server.io_newjobs);
         j = ln->value;
@@ -437,7 +433,7 @@ void dsCreateIOJob(int type, redisDb *db, robj *key, robj *val) {
     j->key = key;
     incrRefCount(key);
     j->val = val;
-    incrRefCount(val);
+    if (val) incrRefCount(val);
 
     lockThreadedIO();
     queueIOJob(j);
index 2ca37a3b92a10c0bcf3a2a68775f90f55dbf7721..36b7c853ec8c493c8a7c6cde146761714bf66bba 100644 (file)
@@ -1050,7 +1050,9 @@ int prepareForShutdown() {
         kill(server.bgsavechildpid,SIGKILL);
         rdbRemoveTempFile(server.bgsavechildpid);
     }
-    if (server.appendonly) {
+    if (server.ds_enabled) {
+        /* FIXME: flush all objects on disk */
+    } else if (server.appendonly) {
         /* Append only file: fsync() the AOF and exit */
         aof_fsync(server.appendfd);
     } else if (server.saveparamslen > 0) {