Repository navigation
Remove ValkeyRdbVisitor and add Valkey 9 handshake support - #112
Conversation
- Remove ValkeyRdbVisitor; flavor-specific version parsing is now handled by Flavor.getVersionDigits() and Flavor.validateRdbVersion() - Add versionDigits field to Flavor enum to encode per-flavor version string length (4 for Redis, 3 for Valkey) - DefaultRdbVisitor.applyVersion() delegates to Flavor for digit count and version validation - DefaultRdbVisitor is now the single RDB visitor for all flavors - Add Valkey 9 Docker setup instructions to CONTRIBUTING.md
- Introduce `sendSlaveRdbVersion` to handle `REPLCONF rdb-version` for Valkey servers. - Update `Flavor` enum to support Valkey-specific RDB versioning. - Note Valkey 9 changes and added setup instructions to CONTRIBUTING.md.
…values with `versionDigits()`.
|
Sorry, I noticed that FlavorSupport was introduced upstream — should we bring ValkeyRdbVisitor back? |
|
I’m also a bit conflicted about whether we should introduce a The advantage is that it would give us better extensibility as the differences grow over time. However, the downside is the added complexity, since we would need to introduce additional classes like I’d like to hear your thoughts on this. |
|
Thanks for asking for my thoughts. I expect Valkey and Redis to continue diverging over time. As those differences become clearer, it may make more sense to introduce dedicated Valkey visitor classes with a better-informed design. For now, keeping the implementation flavor-driven seems like a reasonable approach. That said, I also think it would be perfectly valid to separate Redis and Valkey more explicitly in a future 4.0 release, even if that means sacrificing some backward compatibility. In the meantime, managing the divergence through Flavor could still be helpful as a way to centralize the growing differences. I don’t have a strong preference either way, so I’ll defer to your judgment as the author of redis-replicator. |
|
After some consideration, I think it would be better to introduce ValkeyRdbVisitor in version 4.0, where we can properly handle the required changes. So I’ve merged this part of the code as a preparation for that. |
|
One more adjustment is needed here. We shouldn’t hardcode the version like this: @Override
public String slaveRdbVersion() {
return "9.0.0";
}Instead, we should first retrieve the server version via the This makes the behavior more flexible and avoids hardcoding assumptions about the server version. |
|
All changes have been applied. Please sync with the latest commits. |
I completely agree.
I see. Thanks for the update. I’ll pull the latest changes and base my next PRs on them. |
Summary
ValkeyRdbVisitorand consolidated Valkey RDB parsing intoDefaultRdbVisitor. Magic string, version digit count, and version validation are now driven by Flavor.REPLCONF versionnegotiation for Valkey: when the flavor is VALKEY, the replicator now sendsREPLCONF version 9.0.0during handshake, as required by Valkey 9.Flavor.getSlaveRdbVersion()to keep version knowledge co-located with the flavor definition.CONTRIBUTING.mdwith Valkey 9 test setup instructions, including a note that--repl-diskless-sync nomust be set explicitly (Valkey 9 changed the default to yes), with a TODO to support diskless replication in the future.Tests performed
CONTRIBUTING.md