test: apply Redis server flags via compose command, not REDIS_ARGS - #659
test: apply Redis server flags via compose command, not REDIS_ARGS#659nkanu17 wants to merge 1 commit into
Conversation
tests/docker-compose.yml declared --save '', --appendonly no, and
--search-workers through the REDIS_ARGS environment variable. REDIS_ARGS
is a redis-stack image convention; the official docker.io/library/redis
image used by the test harness never reads it, so none of those flags
were ever applied. A container started from the old file reported
search-workers 14 on redis:latest (8.10.0) instead of 0, and a probe
with REDIS_ARGS=--maxmemory 123mb left maxmemory at 0, confirming the
variable was ignored outright.
Pass the flags as real server arguments through a compose command entry
so the configuration the file declares is actually applied. The
${REDIS_SEARCH_WORKERS:-0} parameterization is preserved. Verified on
redis:latest (8.10.0), redis:8.4 and redis:8.2: search-workers is 0,
CONFIG GET save returns an empty string, appendonly is no, and
REDIS_SEARCH_WORKERS=4 overrides to 4.
Fixes #658
There was a problem hiding this comment.
Pull request overview
Updates the test Docker Compose configuration for Redis so that Redis server flags are actually applied when using the official docker.io/library/redis image (which ignores the REDIS_ARGS environment variable). This aligns the test container’s runtime configuration with what the compose file declares, especially for --search-workers.
Changes:
- Replace
REDIS_ARGSenvironment-based flag passing with a real Composecommand:argv list. - Preserve
${REDIS_SEARCH_WORKERS:-0}parameterization while ensuring--save ""and--appendonly noare applied. - Rewrite the inline comment to accurately document the mechanism and avoid asserting an unproven CI flakiness root cause.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Closing as a duplicate of #653, which already contains this fix and predates it by over a week. The functional change is identical: same exec-form My verification is recorded on #653 rather than duplicated here: Issue #658 is likewise a duplicate of a problem already diagnosed in #653 and can be closed with it. |
Fixes #658
Problem
tests/docker-compose.ymlpassed Redis server flags through theREDIS_ARGSenvironment variable.REDIS_ARGSis a redis-stack image convention: its entrypoint reads the variable and appends it to the server command line. The officialdocker.io/library/redisimage that this compose file uses never reads it, so--save '',--appendonly no, and--search-workerswere all silently discarded.The practical effect was that the
--search-workers 0pin, added to keep newer Redis images on the same query execution model as the pinned ones, had never taken effect on any image.This is test infrastructure only. No shipped
redisvlcode is affected, so no released version carries a defect from this.Fix
The flags are now passed as real server arguments via a compose
command:entry, with the${REDIS_SEARCH_WORKERS:-0}parameterization preserved. The accompanying comment was rewritten to explain the actual mechanism (the official image ignoresREDIS_ARGS) and no longer asserts the FT.SEARCH nil-field race as established fact, for the reason in the next section.Exec (list) form turned out to express
--save ''correctly, so no shell-form fallback was needed.docker inspect -f '{{json .Args}}'confirms the argv reaching the server:Verification
Containers were started from this compose file and inspected directly. On
redis:latest(8.10.0):The same three checks pass on
redis:8.4(8.4.5) andredis:8.2(8.2.8), wheresearch-workers 0is already the default so the pin is a no-op, and both containers start normally.--search-workersis accepted on all three images, so no version gating is needed.Parameterization still works:
REDIS_SEARCH_WORKERS=4yieldsCONFIG GET search-workers -> 4on bothredis:latestandredis:8.4, withsaveandappendonlyunchanged.Integration tests exercising the testcontainers
DockerComposefixture that drives this file:tests/integration/test_search_index.py: 46 passedtests/integration/test_hybrid.py: 12 passed, 2 skippedWhy this matters: it fixes the flaky redis:latest jobs
The comment being replaced attributed flaky
redis:latestruns to the Redis 8.8 change that enables a multithreaded RediSearch worker pool. That attribution is correct, and becauseREDIS_ARGSwas ignored,search-workershas been at the image default on everyredis:latestCI job, so the intended mitigation was never in effect.Reproduced with 8 concurrent threads each creating an index, loading 3 documents, and querying immediately expecting all 3, 60 iterations per thread (480 total), against
redis:latest(8.10.0):search-workers 14(image default), 1 CPUsearch-workers 14(image default), unconstrained CPUsearch-workers 0The partial-result distribution matches the observed CI failures: zero documents (
test_hybrid.pyreturning 0 of 7) and 1 or 2 of 3 (test_unf_noindex_integration).The writes are not lost. Across 30 shortfall events, all 3 hashes were already in the keyspace every time, and the index caught up in every case within 0.8 to 2.6 ms (median 1.6 ms). So
FT.SEARCHbriefly loses read-your-writes consistency under concurrent write and query load, andsearch-workers 0eliminates it.A single-threaded probe against an idle server shows no shortfall at all, which is why an earlier attempt of mine failed to reproduce this. Concurrency is required to surface it.
This is server behavior and also affects library users who load and then immediately query under concurrency. That is tracked separately for documentation and is not addressed by this PR.