Skip to content

Add MR_ClusterRefreshTopology for event-driven OSS topology refresh#100

Draft
gabsow wants to merge 1 commit into
RedisGears:masterfrom
gabsow:feature/cluster-topology-auto-refresh
Draft

Add MR_ClusterRefreshTopology for event-driven OSS topology refresh#100
gabsow wants to merge 1 commit into
RedisGears:masterfrom
gabsow:feature/cluster-topology-auto-refresh

Conversation

@gabsow

@gabsow gabsow commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds MR_ClusterRefreshTopology() so a consumer module can refresh the LibMR cluster view in response to a Redis server event, instead of requiring an operator to call a manual refresh command (e.g. TIMESERIES.REFRESHCLUSTER) on every primary after each reshard.

What it does

  • MR_ClusterRefreshTopology() schedules the existing MR_RefreshClusterData() on the LibMR event loop (the thread-safe place to mutate topology), with no blocked client to reply to — the difference from the command-driven MR_ClusterRefresh.
  • It is gated by clusterCtx.isOss, so it is a no-op outside OSS cluster mode (under Enterprise the DMC drives topology via CLUSTERSET), mirroring the OSS-only registration of REFRESHCLUSTER. Safe to call unconditionally from an event callback.
  • Declared in cluster.h next to the other MR_Cluster* entry points.

The local redismodule.h copy is updated with the RedisModuleEvent_ClusterTopologyChange definitions (id 20) so LibMR consumers compile against the new event; this mirrors redis/redis#15350 and will be reconciled by the normal header sync.

Used by the RedisTimeSeries consumer PR (auto-refresh on cluster topology change). Verified end-to-end on a 3-node OSS cluster: topology auto-refreshes on formation and reshard with no manual command.

Depends on / mirrors: redis/redis#15350
Relates-to: MOD-9152, RED-148990

Draft — gated on the core event being finalized.

🤖 Generated with Claude Code

Expose MR_ClusterRefreshTopology(): schedules MR_RefreshClusterData on the
event loop (no blocked client), gated by clusterCtx.isOss so it is a no-op
outside OSS cluster mode. Lets a module refresh the LibMR cluster view from a
Redis server-event callback instead of requiring a manual REFRESHCLUSTER.

Also vendors the RedisModuleEvent_ClusterTopologyChange definitions (event id
20, subevents, info struct) into the local redismodule.h so consumers can
subscribe; this mirrors redis/redis#15350 and will be reconciled by the normal
redismodule.h sync.

Relates-to: MOD-9152, RED-148990

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant