Repository navigation
Conversation
Redis Cluster serves only database 0 and rejects SELECT, and go-redis builds cluster clients without a DB field, so redis.db alongside cluster_addresses is silently ignored: the server uses database 0 with no diagnostic. Cluster mode otherwise works on master; this came up while reproducing the setup confusion in livekit#2129. The warning is emitted from getConfig after InitLoggerFromConfig, since log output from inside NewConfig is discarded (the package logger is a no-op until then). A warning rather than a startup error keeps existing deployments with a leftover db value starting on upgrade. config-sample.yaml documents the restriction. Refs livekit#2129
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a startup warning for
redis.dbset alongsideredis.cluster_addresses, where it cannot take effect.Redis Cluster serves only database 0 and rejects
SELECT, and go-redis builds cluster clients without a DB field, so the value is dropped and the server connects to database 0. Users in #2129 moved from single-node Redis to a cluster and assumed the setting carried over; nothing told them it could not.What I checked while looking at that report: the parse error from the 1.2.4 upgrade (
field cluster_addresses not found in type config.RedisConfig) came from that tag not having the field yet, so it is unrelated to the current code. On master, cluster mode works: with a real 3-node Redis Cluster (no auth), a room created through one server instance lists and deletes through the other, and pub/sub over the cluster works. The gap left was the droppeddbvalue, which this change surfaces:A warning instead of a startup error keeps deployments with a leftover
dbvalue starting after an upgrade; they were already running against database 0.Changes
pkg/config/config.go:RedisConfigWarning()reports the conflict.cmd/server/main.go: emits the warning fromgetConfig, afterInitLoggerFromConfig. Output from insideNewConfigis discarded, since the package logger is not initialized until then.config-sample.yaml: documents the restriction in the cluster block.pkg/config/config_test.go:TestRedisConfigWarningcovers single-node with db (no warning), cluster with db 0 (no warning), and cluster with a non-zero db (warns).Testing
go build ./cmd/... ./pkg/...clean;go test ./pkg/config/passes.cluster_addressesanddb: 3logs the warning at startup.TestRedisConfigWarning/cluster_with_non-zero_dbfail; the restored file hash matches.Refs #2129