summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-06-06 18:41:54 +0200
committerantirez <antirez@gmail.com>2011-07-15 18:11:00 +0200
commite8108591e441b331093f6ea9759d403ca071a811 (patch)
tree263f4b17a30a5755fe4e111be64a28dfe949d84c
parenteed4ec46646a614c2aa9c2916776728c1c02ff85 (diff)
downloadredis-e8108591e441b331093f6ea9759d403ca071a811.tar.gz
Warn the user that will try to enable VM that VM sucks. But still allows him to enable VM with a special option.
-rw-r--r--src/config.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 44c0e21d5..a5d5ce2c5 100644
--- a/src/config.c
+++ b/src/config.c
@@ -30,6 +30,7 @@ void loadServerConfig(char *filename) {
char buf[REDIS_CONFIGLINE_MAX+1], *err = NULL;
int linenum = 0;
sds line = NULL;
+ int really_use_vm = 0;
if (filename[0] == '-' && filename[1] == '\0')
fp = stdin;
@@ -243,6 +244,10 @@ void loadServerConfig(char *filename) {
if ((server.vm_enabled = yesnotoi(argv[1])) == -1) {
err = "argument must be 'yes' or 'no'"; goto loaderr;
}
+ } else if (!strcasecmp(argv[0],"really-use-vm") && argc == 2) {
+ if ((really_use_vm = yesnotoi(argv[1])) == -1) {
+ err = "argument must be 'yes' or 'no'"; goto loaderr;
+ }
} else if (!strcasecmp(argv[0],"vm-swap-file") && argc == 2) {
zfree(server.vm_swap_file);
server.vm_swap_file = zstrdup(argv[1]);
@@ -303,6 +308,7 @@ void loadServerConfig(char *filename) {
sdsfree(line);
}
if (fp != stdin) fclose(fp);
+ if (server.vm_enabled && !really_use_vm) goto vm_warning;
return;
loaderr:
@@ -311,6 +317,15 @@ loaderr:
fprintf(stderr, ">>> '%s'\n", line);
fprintf(stderr, "%s\n", err);
exit(1);
+
+vm_warning:
+ fprintf(stderr, "\nARE YOU SURE YOU WANT TO USE VM?\n\n");
+ fprintf(stderr, "Redis Virtual Memory is going to be deprecated soon,\n");
+ fprintf(stderr, "we think you should NOT use it, but use Redis only if\n");
+ fprintf(stderr, "your data is suitable for an in-memory database.\n");
+ fprintf(stderr, "If you *really* want VM add this in the config file:\n");
+ fprintf(stderr, "\n really-use-vm yes\n\n");
+ exit(1);
}
/*-----------------------------------------------------------------------------