mirror of
https://github.com/fluencelabs/redis
synced 2025-07-31 16:31:58 +00:00
test adapted to run with diskstore, and a few bugs fixed
This commit is contained in:
@@ -529,7 +529,10 @@ int rewriteAppendOnlyFileBackground(void) {
|
||||
pid_t childpid;
|
||||
|
||||
if (server.bgrewritechildpid != -1) return REDIS_ERR;
|
||||
redisAssert(server.ds_enabled == 0);
|
||||
if (server.ds_enabled != 0) {
|
||||
redisLog(REDIS_WARNING,"BGREWRITEAOF called with diskstore enabled: AOF is not supported when diskstore is enabled. Operation not performed.");
|
||||
return REDIS_ERR;
|
||||
}
|
||||
if ((childpid = fork()) == 0) {
|
||||
/* Child */
|
||||
char tmpfile[256];
|
||||
|
4
src/db.c
4
src/db.c
@@ -201,7 +201,8 @@ int dbDelete(redisDb *db, robj *key) {
|
||||
return dictDelete(db->dict,key->ptr) == DICT_OK;
|
||||
}
|
||||
|
||||
/* Empty the whole database */
|
||||
/* Empty the whole database.
|
||||
* If diskstore is enabled this function will just flush the in-memory cache. */
|
||||
long long emptyDb() {
|
||||
int j;
|
||||
long long removed = 0;
|
||||
@@ -210,6 +211,7 @@ long long emptyDb() {
|
||||
removed += dictSize(server.db[j].dict);
|
||||
dictEmpty(server.db[j].dict);
|
||||
dictEmpty(server.db[j].expires);
|
||||
if (server.ds_enabled) dictEmpty(server.db[j].io_negcache);
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
13
src/debug.c
13
src/debug.c
@@ -177,7 +177,20 @@ void computeDatasetDigest(unsigned char *final) {
|
||||
void debugCommand(redisClient *c) {
|
||||
if (!strcasecmp(c->argv[1]->ptr,"segfault")) {
|
||||
*((char*)-1) = 'x';
|
||||
} else if (!strcasecmp(c->argv[1]->ptr,"flushcache")) {
|
||||
if (!server.ds_enabled) {
|
||||
addReplyError(c, "DEBUG FLUSHCACHE called with diskstore off.");
|
||||
return;
|
||||
} else {
|
||||
emptyDb();
|
||||
addReply(c,shared.ok);
|
||||
return;
|
||||
}
|
||||
} else if (!strcasecmp(c->argv[1]->ptr,"reload")) {
|
||||
if (server.ds_enabled) {
|
||||
addReply(c,shared.ok);
|
||||
return;
|
||||
}
|
||||
if (rdbSave(server.dbfilename) != REDIS_OK) {
|
||||
addReply(c,shared.err);
|
||||
return;
|
||||
|
@@ -456,7 +456,7 @@ void *dsRdbSave_thread(void *arg) {
|
||||
/* Use RENAME to make sure the DB file is changed atomically only
|
||||
* if the generate DB file is ok. */
|
||||
if (rename(tmpfile,filename) == -1) {
|
||||
redisLog(REDIS_WARNING,"Error moving temp DB file on the final destination: %s", strerror(errno));
|
||||
redisLog(REDIS_WARNING,"Error moving temp DB file on the final destination: %s (diskstore)", strerror(errno));
|
||||
unlink(tmpfile);
|
||||
dsRdbSaveSetState(REDIS_BGSAVE_THREAD_DONE_ERR);
|
||||
return NULL;
|
||||
|
@@ -185,8 +185,7 @@ int cacheFreeOneEntry(void) {
|
||||
* are swappable objects */
|
||||
int maxtries = 100;
|
||||
|
||||
if (dictSize(db->dict) == 0) continue;
|
||||
for (i = 0; i < 5; i++) {
|
||||
for (i = 0; i < 5 && dictSize(db->dict); i++) {
|
||||
dictEntry *de;
|
||||
double swappability;
|
||||
robj keyobj;
|
||||
|
Reference in New Issue
Block a user