MOD-16600 Serialize legacy topology replacement (#116) [8.8 backport] - #120
MOD-16600 Serialize legacy topology replacement (#116) [8.8 backport]#120gabsow wants to merge 1 commit into
Conversation
… backport] Clean cherry-pick of 25fe7a3 onto a37b672, the LibMR commit pinned by RedisTimeSeries 8.8.x (and 8.6/8.4). No conflicts; brings its own regression coverage (tests/mr_test_module). Why the 8.8 line needs it: the assertion RedisGears#116 prevents is still reproducing on the RE8.8 nightly. Build 100.0.20-7660 (2026-08-05), released TS 80802, shard redis-119: 21:22:23.033 <timeseries> cluster topology changed (x5 in 4ms) 21:22:23.037 <timeseries> Got cluster set command (long form) 21:22:23.037 === REDIS BUG REPORT START 21:22:23.037 # ==> /workspace/deps/LibMR/src/mr.c:939 'false' is not true Long-form CLUSTERSET -> MR_SetClusterData -> MR_ClusterFree() transiently reports a one-shard topology -> a concurrent execution takes ExecutionFlag_Local -> its StepType_InternalCommand reaches the worker path -> assert. Holding the Redis lock across the free/rebuild stops that state being observable. master carries this since 2026-07-26, but RTS 8.8/8.6/8.4 all pin a37b672, which predates it, so MOD-16600 cannot be verified on the RE8.8 nightly until this lands and RTS bumps deps/LibMR. Note this does not fix the whole MOD-16600 scenario: the same packages still show the MOD-15896 Enterprise/OSS misdetection (Detected redis oss (cluster-enabled=yes) on ASM shards -> 1309 rejected timeseries.HELLO, 722 "not connected", 97 "max idle" on one shard), which is a separate defect.
|
Competing alternative opened as #121 — please treat these two as either/or, not both. Tom's point was that a maintenance branch shouldn't be needed, and checking it out he's right: the only reason RTS 8.8 can't build against master is that #121 restores If #121 lands, this PR should be closed and the |
|
Closing — the premise is gone. A maintenance branch was only needed because RTS 8.8 couldn't build against master, and that turned out to be one argument at the consumer's call site: pass I also checked the other commits 8.8 would inherit by moving to master, since that was the real risk in this decision:
Deleting the |
What
Clean cherry-pick of
25fe7a3("MOD-16600 Serialize legacy topology replacement", #116) ontoa37b672— the LibMR commit pinned by RedisTimeSeries 8.8.x, 8.6 and 8.4. No conflicts, and it brings its own regression coverage (tests/mr_test_module).Base branch
8.8is new: it is justa37b672, i.e. exactly what RTS 8.8 pins today, so this PR's diff is only #116. Happy to rename it (rts-8.8,8.8-maintenance, …) or drop it if the team would rather carry 8.8 backports differently — I created it because a reviewable PR needs a base and RTS pins a bare commit.Why 8.8 needs it
The assertion #116 prevents is still reproducing on the RE8.8 nightly. Build
100.0.20-7660(2026-08-05), released TS80802, shardredis-119:Long-form
CLUSTERSET→MR_SetClusterData→MR_ClusterFree()transiently reports a one-shard topology → a concurrent execution takesExecutionFlag_Local→ itsStepType_InternalCommandreaches the worker path → assert. Holding the Redis lock across the free/rebuild stops that state ever being observable.master has carried this since 2026-07-26, but RTS 8.8 / 8.6 / 8.4 all pin
a37b672, which predates it. So MOD-16600 currently sits in Awaiting Verification against a lane that structurally cannot verify it — the RE8.8 nightly has never run the fix.What this does not fix
The same support packages still show the MOD-15896 Enterprise/OSS misdetection:
Detected redis oss (cluster-enabled=yes)on the ASM shards (×14 and ×24 in the two packages, versus ×180 correctenterprise (cluster-enabled=no)on the non-cluster DBs). On one shard that produced 1309 rejectedtimeseries.HELLO, 722message was not sent because status is not connected, and 97execution max idle reached.That is a separate defect and it is unfixed on every line. So this backport should stop the crash but is not expected to make the ASM scale-under-traffic scenario pass on its own — same caveat recorded on MOD-16600 when #116 was opened.
Verification
git cherry-pickof25fe7a3ontoa37b672applies with no conflicts; the resulting diff is byte-identical to MOD-16600 Serialize legacy topology replacement #116's (src/cluster.c21 lines, plus its tests).deps/LibMRto this commit.Follow-up
RTS-side pin bumps on
8.8(and 8.6 / 8.4 if wanted) are the second half; I'll open those once this has a merge commit to point at.Note
Medium Risk
Changes synchronization around cluster topology updates on a path tied to production crashes; scope is limited to lock placement and test coverage, not new topology logic.
Overview
Fixes a race where long-form
CLUSTERSETandREFRESHCLUSTERcould leaveclusterCtxin a transient one-shard state (MR_ClusterFree()setsclusterSizeto 1) while the main thread still starts executions. Concurrent internal-command work could then be classified as local and hit an assertion inmr.c.Production change (
cluster.c):MR_ClusterRefreshFromCommandandMR_ClusterSetFromCommandnow takeRedisModule_ThreadSafeContextLockfor the fullMR_RefreshClusterData/MR_SetClusterDatasequence (including the legacy free-then-rebuild path). Narrow locks aroundcluster slots/GetClusterNodeInfoinside refresh were removed so locking is owned at the event-loop handler level.Tests: The
lmrtestmodule gainslmrtest.internalcommandand a registered internal command so executions exercise the same routing path as production. New multi-shard tests overlap heavyCLUSTERSETor repeatedREFRESHCLUSTERwith internal commands to catch the bug without test-only delays in core code.Reviewed by Cursor Bugbot for commit 2de069c. Bugbot is set up for automated code reviews on this repo. Configure here.