Permalink
Browse files

Warn the user that will try to enable VM that VM sucks. But still all…

…ows him to enable VM with a special option.
  • Loading branch information...
1 parent b590ced commit a7982fed9eba68f6e7f3256e5a30c8b510b1b79f @antirez committed Jun 6, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/config.c
View
@@ -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]);
@@ -301,6 +306,7 @@ void loadServerConfig(char *filename) {
sdsfree(line);
}
if (fp != stdin) fclose(fp);
+ if (server.vm_enabled && !really_use_vm) goto vm_warning;
return;
loaderr:
@@ -309,6 +315,15 @@ void loadServerConfig(char *filename) {
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);
}
/*-----------------------------------------------------------------------------

0 comments on commit a7982fe

Please sign in to comment.