]> git.saurik.com Git - redis.git/blobdiff - src/config.c
Fix for bug 561 and other related problems
[redis.git] / src / config.c
index 73fd10e435c2843ca96bb5a156cf8e98c0688496..9d30d9859735e9617fc06658421aa665f33fbce4 100644 (file)
@@ -234,7 +234,7 @@ void loadServerConfig(char *filename) {
         } else if (!strcasecmp(argv[0],"auto-aof-rewrite-percentage") &&
                    argc == 2)
         {
-            server.auto_aofrewrite_perc = atoi(argv[2]);
+            server.auto_aofrewrite_perc = atoi(argv[1]);
             if (server.auto_aofrewrite_perc < 0) {
                 err = "Invalid negative percentage for AOF auto rewrite";
                 goto loaderr;
@@ -407,6 +407,12 @@ void configSetCommand(redisClient *c) {
                 }
             }
         }
+    } else if (!strcasecmp(c->argv[2]->ptr,"auto-aof-rewrite-percentage")) {
+        if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll < 0) goto badfmt;
+        server.auto_aofrewrite_perc = ll;
+    } else if (!strcasecmp(c->argv[2]->ptr,"auto-aof-rewrite-min-size")) {
+        if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll < 0) goto badfmt;
+        server.auto_aofrewrite_min_size = ll;
     } else if (!strcasecmp(c->argv[2]->ptr,"save")) {
         int vlen, j;
         sds *v = sdssplitlen(o->ptr,sdslen(o->ptr)," ",1,&vlen);
@@ -593,6 +599,16 @@ void configGetCommand(redisClient *c) {
         sdsfree(buf);
         matches++;
     }
+    if (stringmatch(pattern,"auto-aof-rewrite-percentage",0)) {
+        addReplyBulkCString(c,"auto-aof-rewrite-percentage");
+        addReplyBulkLongLong(c,server.auto_aofrewrite_perc);
+        matches++;
+    }
+    if (stringmatch(pattern,"auto-aof-rewrite-min-size",0)) {
+        addReplyBulkCString(c,"auto-aof-rewrite-min-size");
+        addReplyBulkLongLong(c,server.auto_aofrewrite_min_size);
+        matches++;
+    }
     if (stringmatch(pattern,"slave-serve-stale-data",0)) {
         addReplyBulkCString(c,"slave-serve-stale-data");
         addReplyBulkCString(c,server.repl_serve_stale_data ? "yes" : "no");