-
Notifications
You must be signed in to change notification settings - Fork 118
Document server_name, valkey_version, and redis_version INFO fields #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kovan
wants to merge
3
commits into
valkey-io:main
Choose a base branch
from
kovan:docs/info-valkey-fields
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a separate PR for this file. Please keep them separate and skip this file in this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| --- | ||
| title: Redis compatibility | ||
| description: How Valkey maintains compatibility with Redis OSS | ||
| --- | ||
|
|
||
| Valkey is a fork of Redis OSS 7.2.4 and maintains backward compatibility with Redis OSS 7.2 and all earlier open-source Redis versions. | ||
| This page describes how Valkey handles compatibility at the protocol, API, and scripting levels. | ||
|
|
||
| ## Version compatibility | ||
|
|
||
| Valkey 7.2.4 was forked from Redis 7.2.4. | ||
| All commands, data structures, and behaviors present in Redis OSS 7.2.4 work the same way in Valkey. | ||
|
|
||
| Valkey versions 8.0 and later add new features on top of this base. | ||
| These features are Valkey-specific and are not present in Redis OSS. | ||
|
|
||
| Redis Community Edition (CE) 7.4 and later are not open source and are not compatible with Valkey. | ||
| Data files produced by Redis CE 7.4+ cannot be loaded by Valkey. | ||
|
|
||
| For migration steps, refer to [Migration from Redis to Valkey](migration.md). | ||
|
|
||
| ## Protocol compatibility | ||
|
|
||
| Valkey uses the same RESP (REdis Serialization Protocol) wire protocol as Redis, supporting both RESP2 and RESP3. | ||
| Existing Redis client libraries (such as Jedis, redis-py, node-redis, ioredis, and go-redis) connect to Valkey without code changes. | ||
|
|
||
| ## Persistence format compatibility | ||
|
|
||
| Valkey reads and writes the same RDB and AOF file formats as Redis OSS 7.2. | ||
| You can copy an RDB snapshot from Redis OSS to Valkey and load it directly. | ||
| RDB files produced by Redis CE 7.4+ are not compatible. | ||
|
|
||
| ## Configuration compatibility | ||
|
|
||
| Valkey accepts Redis-style configuration files. | ||
| An existing `redis.conf` can be used as-is with `valkey-server`. | ||
| Configuration directives are the same as Redis OSS 7.2, with additional Valkey-specific options for new features. | ||
|
|
||
| ## CLI compatibility | ||
|
|
||
| The `redis-cli` tool works with Valkey servers, and `valkey-cli` works with Redis OSS servers. | ||
| Both tools use the same RESP protocol and command set. | ||
|
|
||
| ## The `redis_version` and `server_name` INFO fields | ||
|
|
||
| To maintain compatibility with existing clients and tools that check the server version, Valkey reports a fixed `redis_version` field in the [INFO](../commands/info.md) server output: | ||
|
|
||
| ``` | ||
| redis_version:7.2.4 | ||
| ``` | ||
|
|
||
| This value does not change across Valkey releases. | ||
| Clients and libraries that rely on `redis_version` to detect feature support continue to work without modification. | ||
|
|
||
| The actual Valkey version is reported in a separate field: | ||
|
|
||
| ``` | ||
| server_name:valkey | ||
| server_version:8.1.1 | ||
| ``` | ||
|
|
||
| Use `server_version` to check the Valkey version. | ||
| Use `redis_version` only for backward compatibility with Redis-era tooling. | ||
|
|
||
| ## Lua scripting compatibility | ||
|
|
||
| Valkey supports both the `redis` and `server` namespaces in Lua scripts and functions. | ||
| The following calls are equivalent: | ||
|
|
||
| ```lua | ||
| -- Redis-style (backward compatible) | ||
| redis.call('SET', 'key', 'value') | ||
| redis.pcall('GET', 'key') | ||
| redis.log(redis.LOG_NOTICE, 'message') | ||
| redis.status_reply('OK') | ||
| redis.error_reply('ERR something') | ||
|
|
||
| -- Valkey-style | ||
| server.call('SET', 'key', 'value') | ||
| server.pcall('GET', 'key') | ||
| server.log(server.LOG_NOTICE, 'message') | ||
| server.status_reply('OK') | ||
| server.error_reply('ERR something') | ||
| ``` | ||
|
|
||
| Existing Lua scripts that use `redis.call()` and `redis.pcall()` work without changes. | ||
| New scripts can use either namespace. | ||
|
|
||
| ## Module API compatibility | ||
|
|
||
| Valkey supports both the `RedisModule_` and `ValkeyModule_` prefixed APIs for modules. | ||
| The header files `redismodule.h` and `valkeymodule.h` are both available. | ||
|
|
||
| Modules written for Redis OSS using the `RedisModule_` API work in Valkey without modification. | ||
| New modules can use either API prefix. | ||
|
|
||
| For example, both of these are valid: | ||
|
|
||
| ```c | ||
| // Redis-style (backward compatible) | ||
| int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { | ||
| if (RedisModule_Init(ctx, "mymodule", 1, REDISMODULE_APIVER_1) == REDISMODULE_ERR) | ||
| return REDISMODULE_ERR; | ||
| return REDISMODULE_OK; | ||
| } | ||
|
|
||
| // Valkey-style | ||
| int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int argc) { | ||
| if (ValkeyModule_Init(ctx, "mymodule", 1, VALKEYMODULE_APIVER_1) == VALKEYMODULE_ERR) | ||
| return VALKEYMODULE_ERR; | ||
| return VALKEYMODULE_OK; | ||
| } | ||
| ``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text looks good, but please reorder them to match the order in INFO. They are in this order:
We kept
redis_versionfirst because of some concerns that some clients or tools might expect it to be first. I don't know if that's true, but the fields should be documented in the same order as they appear in INFO.