Skip to content

feat: Add read_from and client_az options to the Redis GLIDE client - #7093

Open
NopeCharon wants to merge 1 commit into
feast-dev:masterfrom
NopeCharon:feat/redis-glide-read-from
Open

NopeCharon wants to merge 1 commit into
feast-dev:masterfrom
NopeCharon:feat/redis-glide-read-from

Conversation

@NopeCharon

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The GLIDE client from #6870 always reads from the primary: the Feast config has no way to pass GLIDE's read strategy through, so clusters with replicas can't spread online reads across them.

This adds two RedisOnlineStoreConfig options that map directly onto GLIDE's own settings:

  • read_from: primary (default), prefer_replica, az_affinity, az_affinity_replicas_and_primary or all_nodes, translated to glide_sync.ReadFrom.
  • client_az: the client's availability zone, used by the az_affinity strategies.
online_store:
  type: redis
  redis_type: redis_cluster
  connection_string: "redis1:6379,redis2:6379"
  client: glide
  read_from: az_affinity
  client_az: us-east-1a

I used dedicated options rather than connection_string parameters, as the issue suggests. The reason is that connection_string parameters are also passed as kwargs to redis-py, which still handles writes and async reads, and redis-py would reject them.

The config is validated at load time, so a setting is never silently ignored:

  • read_from and client_az require client: glide, since redis-py doesn't use them.
  • A read_from other than primary requires redis_type: redis_cluster. A standalone GLIDE client sends every batch to the primary whatever read_from is, so the batched HMGET read would ignore the strategy. GLIDE's standalone BatchOptions has no routing option. I checked this against a real primary + replica: with PREFER_REPLICA, single hmget calls went to the replica but exec(Batch(...)) still went to the primary.
  • The az_affinity strategies require client_az. GLIDE also enforces this, but only when the client is created.

Docs: docs/reference/online-stores/redis.md gets a "Reading from replicas" section and two new rows in the configuration reference table.

Which issue(s) this PR fixes:

Fixes #7086

Checks

  • I've made sure the tests are passing.
  • My commits are signed off (git commit -s)
  • My PR title follows conventional commits format

Testing Strategy

  • Unit tests
  • Integration tests
  • Manual tests
  • Testing is not required for this change

Unit tests (tests/unit/infra/online_store/test_redis.py) cover the default, the three validation rules, and the mapping of every read_from value onto glide_sync.ReadFrom and client_az.

Manual test: I ran RedisOnlineStore.online_write_batch + online_read with client: glide against a Valkey 8 cluster with one primary (availability-zone zone-a) and one replica (zone-b). For each config I counted HMGET calls per node from INFO commandstats over one read of 3 entities:

config primary replica
default (primary) 3 0
prefer_replica 0 3
all_nodes 2 1
az_affinity, client_az: zone-b 0 3
az_affinity, client_az: zone-a (no replica in zone, falls back to other replicas) 0 3
az_affinity_replicas_and_primary, client_az: zone-a 3 0

All reads returned the written values.

Misc

The GLIDE client added in feast-dev#6870 always read from the primary, because
the Feast config had no way to pass GLIDE's read strategy through.
Clusters with replicas could not spread online reads across them.

Add two RedisOnlineStoreConfig options that map onto GLIDE's own
settings:

* read_from: primary (default), prefer_replica, az_affinity,
  az_affinity_replicas_and_primary or all_nodes, translated to
  glide_sync.ReadFrom.
* client_az: the client's availability zone, used by the az_affinity
  strategies.

The config is validated at load time so a setting can never be silently
ignored:

* read_from and client_az require client: glide, since redis-py does not
  use them.
* A read_from other than primary requires redis_type: redis_cluster. A
  standalone GLIDE client sends every batch to the primary, so the
  batched HMGET read would ignore the strategy.
* The az_affinity strategies require client_az, which GLIDE also
  enforces when building the client config.

Verified against a Valkey 8 cluster with one primary and one replica:
prefer_replica and az_affinity send the batched online_read to the
replica, all_nodes spreads it over both nodes, and the default keeps
reading from the primary.

Fixes feast-dev#7086

Signed-off-by: NopeCharon <[email protected]>
@NopeCharon
NopeCharon requested a review from a team as a code owner October 30, 2026 04:28
@codecov-commenter

codecov-commenter commented Oct 30, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.01%. Comparing base (1e5e90c) to head (d3def03).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7093      +/-   ##
==========================================
+ Coverage   50.97%   51.01%   +0.03%     
==========================================
  Files         455      455              
  Lines       56994    57014      +20     
  Branches     8321     8324       +3     
==========================================
+ Hits        29055    29083      +28     
+ Misses      25954    25946       -8     
  Partials     1985     1985              
Flag Coverage Δ
go-feature-server 30.58% <ø> (+0.20%) ⬆️
python-unit 52.47% <100.00%> (+0.01%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/infra/online_stores/redis.py 69.91% <100.00%> (+1.39%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e5e90c...d3def03. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Glide Client should support reading from replicas

2 participants