dictIterator *di = NULL;
dictEntry *de;
char tmpfile[256];
+ char magic[10];
int j;
long long now = mstime();
FILE *fp;
}
rioInitWithFile(&rdb,fp);
- if (rdbWriteRaw(&rdb,"REDIS0004",9) == -1) goto werr;
+ snprintf(magic,sizeof(magic),"REDIS%04d",REDIS_RDB_VERSION);
+ if (rdbWriteRaw(&rdb,magic,9) == -1) goto werr;
for (j = 0; j < server.dbnum; j++) {
redisDb *db = server.db+j;
/* TBD: include only necessary headers. */
#include "redis.h"
+/* The current RDB version. When the format changes in a way that is no longer
+ * backward compatible this number gets incremented. */
+#define REDIS_RDB_VERSION 4
+
/* Defines related to the dump file format. To store 32 bits lengths for short
* keys requires a lot of space, so we check the most significant 2 bits of
* the first byte to interpreter the length: