mirror of
https://github.com/floci-io/floci.git
synced 2026-12-02 09:47:56 -05:00
CreateReplicationGroup answered a second cache on port 6379 with InvalidParameterValue: Port 6379 is already in use by another replication group. AWS has no such rule. Port belongs to a cache's own endpoint, and 6379 is the Redis default, so nearly every ElastiCache cluster uses it and they coexist: AWS gives each cache a DNS name of its own and the port never has to tell them apart. Floci puts every cache's proxy on one host, where a TCP port is exclusive and the port IS the only thing that tells them apart. Any module standing up two Redis clusters, and any suite running one per test in parallel, failed at the second create. A pinned port that is free and inside the proxy range is still honored. One that is taken, or outside the range, now yields a port from the range rather than a rejection, and that port is what the cache's endpoint reports. The port a cache reports is always the port it is actually on. That is the whole design, and it rules out the tempting alternative of reporting the pinned port while listening elsewhere: the endpoint would then name a DIFFERENT cache's listener, and a client following it reads the wrong cache's data with no error at all. Measured, on a build that did exactly that: two no-auth caches pinned to 6379, write through each, then read through the second's advertised endpoint and get the FIRST cache's value, from the host and from inside a container both. #4094 removed that same failure from the restore path last week, where "the old endpoint then reached an unrelated cache instead of failing cleanly". What a caller gives up is the pinned port when Floci cannot serve it, which terraform surfaces as a replacement-forcing diff on the next plan. A visible difference, against a silent wrong answer: the create still succeeds, which is what unblocks the modules. The out-of-range rejection goes for the same reason. That range bounds what this emulator may listen on and never bounded what AWS accepts. The only rejection left is AWS's own, 1150 to 65535, as RdsService already applies. Tests: the two that pinned the old rejections now pin the substitution, and ElastiCachePortSharingIntegrationTest asserts at the DATA plane, writing through each cache's own advertised endpoint and reading its own value back. A control-plane-only test passes against the wrong-endpoint design too, which is how that design survived review. ElastiCache surface: 214 tests, 0 failures. Refs: floci-j55a