Update versioning fields for compatibility (#47)
New info information to be used to determine the valkey versioning info. Internally, introduce new define values for "SERVER_VERSION" which is different from the Redis compatibility version, "REDIS_VERSION". Add two new info fields: `server_version`: The Valkey server version `server_name`: Indicates that the server is valkey. Add one new RDB field: `server_ver`, which indicates the valkey version that produced the server. Add 3 new LUA globals: `SERVER_VERSION_NUM`, `SERVER_VERSION`, and `SERVER_NAME`. Which reflect the valkey version instead of the Redis compatibility version. Also clean up various places where Redis and configuration was being used that is no longer necessary. --------- Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
This commit is contained in:
parent
55de74e0dc
commit
39d0f457a2
@ -413,7 +413,7 @@ sds escapeJsonString(sds s, const char *p, size_t len) {
|
||||
}
|
||||
|
||||
sds cliVersion(void) {
|
||||
sds version = sdscatprintf(sdsempty(), "%s", REDIS_VERSION);
|
||||
sds version = sdscatprintf(sdsempty(), "%s", SERVER_VERSION);
|
||||
|
||||
/* Add git commit and working tree status when available. */
|
||||
if (strtoll(serverGitSHA1(),NULL,16)) {
|
||||
|
@ -634,8 +634,7 @@ void loadServerConfigFromString(char *config) {
|
||||
|
||||
loaderr:
|
||||
if (argv) sdsfreesplitres(argv,argc);
|
||||
fprintf(stderr, "\n*** FATAL CONFIG FILE ERROR (Redis %s) ***\n",
|
||||
REDIS_VERSION);
|
||||
fprintf(stderr, "\n*** FATAL CONFIG FILE ERROR (Version %s) ***\n", SERVER_VERSION);
|
||||
if (i < totlines) {
|
||||
fprintf(stderr, "Reading the configuration file, at line %d\n", linenum);
|
||||
fprintf(stderr, ">>> '%s'\n", lines[i]);
|
||||
|
@ -2252,7 +2252,7 @@ static void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
|
||||
|
||||
bugReportStart();
|
||||
serverLog(LL_WARNING,
|
||||
"Redis %s crashed by signal: %d, si_code: %d", REDIS_VERSION, sig, info->si_code);
|
||||
SERVER_NAME " %s crashed by signal: %d, si_code: %d", SERVER_VERSION, sig, info->si_code);
|
||||
if (sig == SIGSEGV || sig == SIGBUS) {
|
||||
serverLog(LL_WARNING,
|
||||
"Accessing address: %p", (void*)info->si_addr);
|
||||
|
@ -44,7 +44,7 @@ void lolwut6Command(client *c);
|
||||
* This is what unstable versions of Redis will display. */
|
||||
void lolwutUnstableCommand(client *c) {
|
||||
sds rendered = sdsnew("Redis ver. ");
|
||||
rendered = sdscat(rendered,REDIS_VERSION);
|
||||
rendered = sdscat(rendered,SERVER_VERSION);
|
||||
rendered = sdscatlen(rendered,"\n",1);
|
||||
addReplyVerbatim(c,rendered,sdslen(rendered),"txt");
|
||||
sdsfree(rendered);
|
||||
@ -52,7 +52,7 @@ void lolwutUnstableCommand(client *c) {
|
||||
|
||||
/* LOLWUT [VERSION <version>] [... version specific arguments ...] */
|
||||
void lolwutCommand(client *c) {
|
||||
char *v = REDIS_VERSION;
|
||||
char *v = SERVER_VERSION;
|
||||
char verstr[64];
|
||||
|
||||
if (c->argc >= 3 && !strcasecmp(c->argv[1]->ptr,"version")) {
|
||||
|
@ -169,7 +169,7 @@ void lolwut5Command(client *c) {
|
||||
sds rendered = renderCanvas(canvas);
|
||||
rendered = sdscat(rendered,
|
||||
"\nGeorg Nees - schotter, plotter on paper, 1968. Redis ver. ");
|
||||
rendered = sdscat(rendered,REDIS_VERSION);
|
||||
rendered = sdscat(rendered,SERVER_VERSION);
|
||||
rendered = sdscatlen(rendered,"\n",1);
|
||||
addReplyVerbatim(c,rendered,sdslen(rendered),"txt");
|
||||
sdsfree(rendered);
|
||||
|
@ -193,7 +193,7 @@ void lolwut6Command(client *c) {
|
||||
rendered = sdscat(rendered,
|
||||
"\nDedicated to the 8 bit game developers of past and present.\n"
|
||||
"Original 8 bit image from Plaguemon by hikikomori. Redis ver. ");
|
||||
rendered = sdscat(rendered,REDIS_VERSION);
|
||||
rendered = sdscat(rendered,SERVER_VERSION);
|
||||
rendered = sdscatlen(rendered,"\n",1);
|
||||
addReplyVerbatim(c,rendered,sdslen(rendered),"txt");
|
||||
sdsfree(rendered);
|
||||
|
@ -12,5 +12,5 @@ echo "#define REDIS_GIT_SHA1 \"$GIT_SHA1\"" > release.h
|
||||
echo "#define REDIS_GIT_DIRTY \"$GIT_DIRTY\"" >> release.h
|
||||
echo "#define REDIS_BUILD_ID \"$BUILD_ID\"" >> release.h
|
||||
echo "#include \"version.h\"" >> release.h
|
||||
echo "#define REDIS_BUILD_ID_RAW REDIS_VERSION REDIS_BUILD_ID REDIS_GIT_DIRTY REDIS_GIT_SHA1" >> release.h
|
||||
echo "#define REDIS_BUILD_ID_RAW SERVER_NAME SERVER_VERSION REDIS_BUILD_ID REDIS_GIT_DIRTY REDIS_GIT_SHA1" >> release.h
|
||||
touch release.c # Force recompile of release.c
|
||||
|
@ -13295,7 +13295,7 @@ int RM_GetKeyspaceNotificationFlagsAll(void) {
|
||||
* Example for 6.0.7 the return value will be 0x00060007.
|
||||
*/
|
||||
int RM_GetServerVersion(void) {
|
||||
return REDIS_VERSION_NUM;
|
||||
return SERVER_VERSION_NUM;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3650,7 +3650,7 @@ void helloCommand(client *c) {
|
||||
addReplyBulkCString(c,"redis");
|
||||
|
||||
addReplyBulkCString(c,"version");
|
||||
addReplyBulkCString(c,REDIS_VERSION);
|
||||
addReplyBulkCString(c,SERVER_VERSION);
|
||||
|
||||
addReplyBulkCString(c,"proto");
|
||||
addReplyLongLong(c,c->resp);
|
||||
|
@ -1195,6 +1195,8 @@ int rdbSaveInfoAuxFields(rio *rdb, int rdbflags, rdbSaveInfo *rsi) {
|
||||
int aof_base = (rdbflags & RDBFLAGS_AOF_PREAMBLE) != 0;
|
||||
|
||||
/* Add a few fields about the state when the RDB was created. */
|
||||
if (rdbSaveAuxFieldStrStr(rdb,"server-ver",SERVER_VERSION) == -1) return -1;
|
||||
/* Print Redis version for backwards compatibility with redis. */
|
||||
if (rdbSaveAuxFieldStrStr(rdb,"redis-ver",REDIS_VERSION) == -1) return -1;
|
||||
if (rdbSaveAuxFieldStrInt(rdb,"redis-bits",redis_bits) == -1) return -1;
|
||||
if (rdbSaveAuxFieldStrInt(rdb,"ctime",time(NULL)) == -1) return -1;
|
||||
@ -3162,7 +3164,10 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin
|
||||
} else if (!strcasecmp(auxkey->ptr,"lua")) {
|
||||
/* Won't load the script back in memory anymore. */
|
||||
} else if (!strcasecmp(auxkey->ptr,"redis-ver")) {
|
||||
serverLog(LL_NOTICE,"Loading RDB produced by version %s",
|
||||
serverLog(LL_NOTICE,"Loading RDB produced by Redis version %s",
|
||||
(char*)auxval->ptr);
|
||||
} else if (!strcasecmp(auxkey->ptr,"server-ver")) {
|
||||
serverLog(LL_NOTICE,"Loading RDB produced by server version %s",
|
||||
(char*)auxval->ptr);
|
||||
} else if (!strcasecmp(auxkey->ptr,"ctime")) {
|
||||
time_t age = time(NULL)-strtol(auxval->ptr,NULL,10);
|
||||
|
@ -1383,6 +1383,7 @@ void luaSetTableProtectionRecursively(lua_State *lua) {
|
||||
}
|
||||
|
||||
void luaRegisterVersion(lua_State* lua) {
|
||||
/* For legacy compatibility reasons include Redis versions. */
|
||||
lua_pushstring(lua,"REDIS_VERSION_NUM");
|
||||
lua_pushnumber(lua,REDIS_VERSION_NUM);
|
||||
lua_settable(lua,-3);
|
||||
@ -1390,6 +1391,19 @@ void luaRegisterVersion(lua_State* lua) {
|
||||
lua_pushstring(lua,"REDIS_VERSION");
|
||||
lua_pushstring(lua,REDIS_VERSION);
|
||||
lua_settable(lua,-3);
|
||||
|
||||
/* Now push the Valkey version information. */
|
||||
lua_pushstring(lua,"SERVER_VERSION_NUM");
|
||||
lua_pushnumber(lua,SERVER_VERSION_NUM);
|
||||
lua_settable(lua,-3);
|
||||
|
||||
lua_pushstring(lua,"SERVER_VERSION");
|
||||
lua_pushstring(lua,SERVER_VERSION);
|
||||
lua_settable(lua,-3);
|
||||
|
||||
lua_pushstring(lua,"SERVER_NAME");
|
||||
lua_pushstring(lua,SERVER_NAME);
|
||||
lua_settable(lua,-3);
|
||||
}
|
||||
|
||||
void luaRegisterLogFunction(lua_State* lua) {
|
||||
|
@ -1846,8 +1846,7 @@ void loadSentinelConfigFromQueue(void) {
|
||||
return;
|
||||
|
||||
loaderr:
|
||||
fprintf(stderr, "\n*** FATAL CONFIG FILE ERROR (Redis %s) ***\n",
|
||||
REDIS_VERSION);
|
||||
fprintf(stderr, "\n*** FATAL CONFIG FILE ERROR (Version %s) ***\n", SERVER_VERSION);
|
||||
fprintf(stderr, "Reading the configuration file, at line %d\n", linenum);
|
||||
fprintf(stderr, ">>> '%s'\n", line);
|
||||
fprintf(stderr, "%s\n", err);
|
||||
|
11
src/server.c
11
src/server.c
@ -5585,6 +5585,8 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) {
|
||||
|
||||
info = sdscatfmt(info, "# Server\r\n" FMTARGS(
|
||||
"redis_version:%s\r\n", REDIS_VERSION,
|
||||
"server_name:%s\r\n", SERVER_NAME,
|
||||
"server_version:%s\r\n", SERVER_VERSION,
|
||||
"redis_git_sha1:%s\r\n", serverGitSHA1(),
|
||||
"redis_git_dirty:%i\r\n", strtol(serverGitDirty(),NULL,10) > 0,
|
||||
"redis_build_id:%s\r\n", serverBuildIdString(),
|
||||
@ -6265,7 +6267,7 @@ void daemonize(void) {
|
||||
sds getVersion(void) {
|
||||
sds version = sdscatprintf(sdsempty(),
|
||||
"v=%s sha=%s:%d malloc=%s bits=%d build=%llx",
|
||||
REDIS_VERSION,
|
||||
SERVER_VERSION,
|
||||
serverGitSHA1(),
|
||||
atoi(serverGitDirty()) > 0,
|
||||
ZMALLOC_LIB,
|
||||
@ -6319,7 +6321,7 @@ void redisAsciiArt(void) {
|
||||
);
|
||||
} else {
|
||||
snprintf(buf,1024*16,ascii_logo,
|
||||
REDIS_VERSION,
|
||||
SERVER_VERSION,
|
||||
serverGitSHA1(),
|
||||
strtol(serverGitDirty(),NULL,10) > 0,
|
||||
(sizeof(long) == 8) ? "64" : "32",
|
||||
@ -7153,9 +7155,8 @@ int main(int argc, char **argv) {
|
||||
if (background) daemonize();
|
||||
|
||||
serverLog(LL_NOTICE, "oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo");
|
||||
serverLog(LL_NOTICE,
|
||||
"Redis version=%s, bits=%d, commit=%s, modified=%d, pid=%d, just started",
|
||||
REDIS_VERSION,
|
||||
serverLog(LL_NOTICE, SERVER_NAME " version=%s, bits=%d, commit=%s, modified=%d, pid=%d, just started",
|
||||
SERVER_VERSION,
|
||||
(sizeof(long) == 8) ? 64 : 32,
|
||||
serverGitSHA1(),
|
||||
strtol(serverGitDirty(),NULL,10) > 0,
|
||||
|
@ -1,2 +1,8 @@
|
||||
#define REDIS_VERSION "255.255.255"
|
||||
#define REDIS_VERSION_NUM 0x00ffffff
|
||||
#define SERVER_NAME "valkey"
|
||||
#define SERVER_VERSION "255.255.255"
|
||||
#define SERVER_VERSION_NUM 0x00ffffff
|
||||
|
||||
/* Redis compatibility version, should never
|
||||
* exceed 7.2.x. */
|
||||
#define REDIS_VERSION "7.2.4"
|
||||
#define REDIS_VERSION_NUM 0x00070204
|
||||
|
@ -21,8 +21,7 @@ start_server {overrides {save {900 1}} tags {"modules"}} {
|
||||
}
|
||||
|
||||
test {test redis version} {
|
||||
set version [s redis_version]
|
||||
assert_equal $version [r test.redisversion]
|
||||
assert_equal [s server_version] [r test.redisversion]
|
||||
}
|
||||
|
||||
test {test long double conversions} {
|
||||
|
Loading…
Reference in New Issue
Block a user