Skip to content

Add basic support for multis in pipelines. - #1

Open
Bernie wants to merge 83 commits into
masterfrom
pipelined_multis
Open

Add basic support for multis in pipelines.#1
Bernie wants to merge 83 commits into
masterfrom
pipelined_multis

Conversation

@Bernie

@Bernie Bernie commented Dec 3, 2025

Copy link
Copy Markdown
Owner

Adds basic support for multis in pipeline.

Basic means basic. No watching, no cross node validation, no timeouts for blocking commands. . . BASIC!

results = redis_cluster.pipelined do |pipe|
  10.times.each do |i|
    pipe.multi do |multi|
      multi.call('INCR", "#{i}")
      multi.call('INCRBY', "#{i}", 2)
    end
  end
end

results should be:

[[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3]]

supercaracal and others added 30 commits December 20, 2025 13:16
…hRing

Ref: rails/rails#57004
Ref: redis-rb/redis-client#292

I'm working on a big cleanup of Rails `RedisCacheStore` and it needs to
support consistent hashing, which I did add in `redis-client` `0.28.0`.

For Rails users to be able to use a redis cluster as a cache store,
`redis-cluster-client` would need to have a shim for the now base
interface:

  - `with`
  - `nodes`
  - `node_for`
  - `nodes_for`
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Fix typos (metdata, hashag, guaranted, transction, fhe, GItHub),
grammar issues (missing verbs, wrong verb forms, uncountable nouns),
and Japanese-English patterns (upper libraries, works multiple keys,
recommend to use, the followings, etc.) across README.md and source comments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…mplementation

- class_diagrams_redis_cluster_client.md:
  - RedisClient::Cluster: add multi() and with()
  - RedisClient::ClusterConfig: replace obsolete per_node_key/update_node/add_node/dup
    with client_config_for_node, resolved?, sentinel?, server_url, and timeout readers
  - RedisClient::Cluster::Command: add exists?()
  - RedisClient::Cluster::Node: remove non-existent self.load_info(), add try_reload!,
    clients, primary_clients, replica_clients
  - Add RedisClient::Cluster::Node::BaseTopology class
  - Add RedisClient::Cluster::Node::RandomReplicaOrPrimary class (was missing)
  - Remove module_RedisClient_Cluster_Node_ReplicaMixin (no longer exists)
  - Update topology class relationships to use inheritance from BaseTopology
  - RedisClient::Cluster::Router: remove non-existent try_send(), add all current
    public methods (handle_redirection, scan_single_key, find_node_key_by_key, etc.)
  - Add RedisClient::Cluster::OptimisticLocking class and its relationships
  - module_RedisClient_Cluster_NodeKey: add build_from_client()

- class_diagrams_redis_client.md:
  - RedisClient: add self.ring, self.now, self.now_ms, server_url, db, host, port,
    path, username, password, idle_timeout, disable_reconnection, measure_round_trip_delay
  - module_RedisClient_Common: add nodes, node_for, nodes_for
  - module_RedisClient_Config_Common: add idle_timeout, protocol, circuit_breaker,
    custom, inherit_socket, driver_info, middlewares_stack, resolved?, server_url,
    build_lib_name
  - RedisClient::SentinelConfig: add resolved?
  - RedisClient::RubyConnection: add measure_round_trip_delay

- sequence_diagrams.md:
  - Update initial topology fetch from CLUSTER NODES to CLUSTER SHARDS
    (with fallback note for older Redis versions)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
supercaracal and others added 18 commits May 4, 2026 10:24
Some managed Redis services (e.g. AWS ElastiCache Serverless) report
`127.0.0.1` in the `ip` field of `CLUSTER SHARDS` while exposing the
real, reachable address only via `endpoint` / `hostname`. Building
node_keys from `ip` then yields an unreachable topology and the
client fails on the next operation that walks all nodes (e.g.
`SCAN`/`delete_matched`) with:

    Connection refused - connect(2) for 127.0.0.1:6379

This regressed in v0.16.0 (redis-rb#479) when topology discovery switched
from `CLUSTER NODES` to `CLUSTER SHARDS`; redis-rb#207 had previously
established hostname precedence for the `CLUSTER NODES` path.

`parse_cluster_shards_reply` now picks the host using:

  1. `endpoint` (server-selected per `cluster-preferred-endpoint-type`)
  2. `hostname` (when `endpoint` is absent or `?`)
  3. `ip` (fallback)

mirroring the precedence used by `parse_node_key` for CLUSTER NODES.

Refs: redis-rb#515
@Bernie
Bernie force-pushed the pipelined_multis branch from 1f6c43e to bdeb1e1 Compare May 15, 2026 13:29
@Bernie
Bernie force-pushed the pipelined_multis branch from 1ebeb38 to 80af0ea Compare May 19, 2026 18:43
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.

4 participants