mirror of
https://github.com/fluencelabs/redis
synced 2025-04-02 15:51:05 +00:00
fixed a few bugs in DS store, now it's somewhat about able to reply to 'GET foo' with a bogus value.
This commit is contained in:
parent
67b0b41c87
commit
1609a1c42d
@ -142,6 +142,7 @@ int dsSet(redisDb *db, robj *key, robj *val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
robj *dsGet(redisDb *db, robj *key) {
|
robj *dsGet(redisDb *db, robj *key) {
|
||||||
|
return createStringObject("foo",3);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dsDel(redisDb *db, robj *key) {
|
int dsDel(redisDb *db, robj *key) {
|
||||||
|
@ -263,7 +263,6 @@ void vmThreadedIOCompletedJob(aeEventLoop *el, int fd, void *privdata,
|
|||||||
while((retval = read(fd,buf,1)) == 1) {
|
while((retval = read(fd,buf,1)) == 1) {
|
||||||
iojob *j;
|
iojob *j;
|
||||||
listNode *ln;
|
listNode *ln;
|
||||||
struct dictEntry *de;
|
|
||||||
|
|
||||||
redisLog(REDIS_DEBUG,"Processing I/O completed job");
|
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",
|
redisLog(REDIS_DEBUG,"COMPLETED Job type %s, key: %s",
|
||||||
(j->type == REDIS_IOJOB_LOAD) ? "load" : "save",
|
(j->type == REDIS_IOJOB_LOAD) ? "load" : "save",
|
||||||
(unsigned char*)j->key->ptr);
|
(unsigned char*)j->key->ptr);
|
||||||
de = dictFind(j->db->dict,j->key->ptr);
|
|
||||||
redisAssert(de != NULL);
|
|
||||||
if (j->type == REDIS_IOJOB_LOAD) {
|
if (j->type == REDIS_IOJOB_LOAD) {
|
||||||
/* Create the key-value pair in the in-memory database */
|
/* Create the key-value pair in the in-memory database */
|
||||||
dbAdd(j->db,j->key,j->val);
|
dbAdd(j->db,j->key,j->val);
|
||||||
|
incrRefCount(j->val);
|
||||||
/* Handle clients waiting for this key to be loaded. */
|
/* Handle clients waiting for this key to be loaded. */
|
||||||
handleClientsBlockedOnSwappedKey(j->db,j->key);
|
handleClientsBlockedOnSwappedKey(j->db,j->key);
|
||||||
freeIOJob(j);
|
freeIOJob(j);
|
||||||
@ -326,11 +324,9 @@ void *IOThreadEntryPoint(void *arg) {
|
|||||||
lockThreadedIO();
|
lockThreadedIO();
|
||||||
if (listLength(server.io_newjobs) == 0) {
|
if (listLength(server.io_newjobs) == 0) {
|
||||||
/* No new jobs in queue, exit. */
|
/* No new jobs in queue, exit. */
|
||||||
redisLog(REDIS_DEBUG,"Thread %ld exiting, nothing to do",
|
|
||||||
(long) pthread_self());
|
|
||||||
server.io_active_threads--;
|
|
||||||
unlockThreadedIO();
|
unlockThreadedIO();
|
||||||
return NULL;
|
sleep(1);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
ln = listFirst(server.io_newjobs);
|
ln = listFirst(server.io_newjobs);
|
||||||
j = ln->value;
|
j = ln->value;
|
||||||
@ -437,7 +433,7 @@ void dsCreateIOJob(int type, redisDb *db, robj *key, robj *val) {
|
|||||||
j->key = key;
|
j->key = key;
|
||||||
incrRefCount(key);
|
incrRefCount(key);
|
||||||
j->val = val;
|
j->val = val;
|
||||||
incrRefCount(val);
|
if (val) incrRefCount(val);
|
||||||
|
|
||||||
lockThreadedIO();
|
lockThreadedIO();
|
||||||
queueIOJob(j);
|
queueIOJob(j);
|
||||||
|
@ -1050,7 +1050,9 @@ int prepareForShutdown() {
|
|||||||
kill(server.bgsavechildpid,SIGKILL);
|
kill(server.bgsavechildpid,SIGKILL);
|
||||||
rdbRemoveTempFile(server.bgsavechildpid);
|
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 */
|
/* Append only file: fsync() the AOF and exit */
|
||||||
aof_fsync(server.appendfd);
|
aof_fsync(server.appendfd);
|
||||||
} else if (server.saveparamslen > 0) {
|
} else if (server.saveparamslen > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user