<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Design on Mimus</title><link>https://mimus.pgsty.com/docs/redis/design/</link><description>Recent content in Design on Mimus</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sun, 06 Dec 2026 15:37:05 +0800</lastBuildDate><atom:link href="https://mimus.pgsty.com/docs/redis/design/index.xml" rel="self" type="application/rss+xml"/><item><title>MVP goal (v0.1.0)</title><link>https://mimus.pgsty.com/docs/redis/design/mvp-goal/</link><pubDate>Sun, 08 Nov 2026 00:00:00 +0800</pubDate><guid>https://mimus.pgsty.com/docs/redis/design/mvp-goal/</guid><description>&lt;h2 id="decision"&gt;Decision&#10;&lt;/h2&gt;&#10;&lt;p&gt;On 2026-11-08 the user approved an MVP release candidate (&lt;code&gt;v0.1.0-rcN&lt;/code&gt;) as the current pgredis goal. It replaces the earlier completion condition, which required all delivery stages P0–P6 and the PRD goals G1–G6 together. Those stages stay as the roadmap after the MVP. The first candidate under this goal is &lt;code&gt;v0.1.0-rc1&lt;/code&gt;: local tag on commit &lt;code&gt;2f8ee8d6a&lt;/code&gt;, packages built from &lt;code&gt;11411411d&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;The same rules apply to pgredis, pgetcd and pgsilo.&lt;/p&gt;</description></item><item><title>Status review, 2026-11-08</title><link>https://mimus.pgsty.com/docs/redis/design/review-2026-11-08/</link><pubDate>Sun, 08 Nov 2026 00:00:00 +0800</pubDate><guid>https://mimus.pgsty.com/docs/redis/design/review-2026-11-08/</guid><description>&lt;h2 id="scope"&gt;Scope&#10;&lt;/h2&gt;&#10;&lt;p&gt;This review covers pgredis up to commit &lt;code&gt;c25638e1b&lt;/code&gt; (2026-10-30, the last commit before the review) and the decisions made on 2026-11-08. It replaces no earlier record. The resulting goal is &lt;a href="https://mimus.pgsty.com/docs/redis/design/mvp-goal/"&gt;MVP goal (v0.1.0)&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="state"&gt;State before the review&#10;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Architecture:&lt;/strong&gt; a Go gateway for RESP and sessions, and a PostgreSQL 18 C extension (&lt;code&gt;pg_redis&lt;/code&gt;) that runs every command; PostgreSQL is the only persistent layer.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Commands:&lt;/strong&gt; all classic Redis 7.2.4 data families had an implementation: String, Hash, List, Set, ZSet, Stream, Bitmap, HyperLogLog, Geo, Pub/Sub, transactions and keyspace commands. The 87 commands marked pending were all out of scope: Cluster, Sentinel, Lua/Functions, Redis replication, persistence files, modules and &lt;code&gt;SHUTDOWN&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Size at &lt;code&gt;c25638e1b&lt;/code&gt;:&lt;/strong&gt; about 29,000 hand-written lines of C plus 54 SQL migration scripts (schema &lt;code&gt;0.1&lt;/code&gt; to &lt;code&gt;0.53&lt;/code&gt;); about 11,500 lines of non-test Go. Test code was about five times the product code.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;History:&lt;/strong&gt; schema &lt;code&gt;0.1&lt;/code&gt; to &lt;code&gt;0.50&lt;/code&gt; was built from 2026-10-06 to 2026-10-15. From 2026-10-16 to 2026-10-30 only three schema versions were added. Of 906 commits, about 13% were &lt;code&gt;feat&lt;/code&gt;, &lt;code&gt;fix&lt;/code&gt; or &lt;code&gt;perf&lt;/code&gt;; most of the rest recorded test evidence. No commit was made after 2026-10-30.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Gates:&lt;/strong&gt; no delivery stage was formally closed. The fixed G5 benchmark met its throughput bounds but failed p50 with &lt;code&gt;synchronous_commit=on&lt;/code&gt; (for example &lt;code&gt;SET&lt;/code&gt; p50 6.743 ms and &lt;code&gt;GET&lt;/code&gt; p50 3.559 ms on 2026-10-30). Seven 24-hour runs had started and none completed. The official Redis matrices still had failures and aborted files.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="causes"&gt;Why the work did not finish&#10;&lt;/h2&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;A goal with no intermediate stop.&lt;/strong&gt; Completion required all stages P0–P6 at once, and the goal text stated that a runnable MVP does not count. The first installable stage (P4) was a waypoint, not a stopping point.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Zero-tolerance gates.&lt;/strong&gt; G5 was defined with &lt;code&gt;synchronous_commit=off&lt;/code&gt; in the PRD; that definition passed on 2026-10-29, but the gate had been moved to &lt;code&gt;on&lt;/code&gt;. A 24-hour run failed on one request slower than 3 s or 8 s. The official suites required zero failures, and the 55 cases excluded by the persistence decision were not subtracted.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Change a little, retest everything.&lt;/strong&gt; A dated pass did not count for newer source bytes, so each product change reopened earlier results. Each narrow check was reviewed twice offline, with process, session and volume retirement evidence. Late fixes addressed edge cases such as tracking order across shared redirects.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Test fidelity on hot paths.&lt;/strong&gt; Two features that exist mainly for &lt;code&gt;OBJECT&lt;/code&gt; output made core commands slow:&#10;&lt;ul&gt;&#10;&lt;li&gt;every &lt;code&gt;GET&lt;/code&gt; updated LRU/LFU metadata, so reads also waited for a WAL flush;&lt;/li&gt;&#10;&lt;li&gt;every &lt;code&gt;LPUSH&lt;/code&gt; rewrote and compressed the full list layout, so single-key &lt;code&gt;LPUSH&lt;/code&gt; measured 64.6 req/s with the list growing to 50,000 elements.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;The goal text did not allow these features to be simplified.&lt;/p&gt;</description></item><item><title>MIGRATE connections</title><link>https://mimus.pgsty.com/docs/redis/design/migrate/</link><guid>https://mimus.pgsty.com/docs/redis/design/migrate/</guid><description>&lt;p&gt;&lt;code&gt;MIGRATE&lt;/code&gt; moves or copies keys from a local pgredis database to a target Redis or pgredis server over TCP while holding a PostgreSQL transaction on the source.&lt;/p&gt;&#10;&lt;h2 id="decision"&gt;Connection-stage versus write-stage errors&#10;&lt;/h2&gt;&#10;&lt;p&gt;Redis 7.2.4 classifies &lt;code&gt;MIGRATE&lt;/code&gt; socket failures according to the result of the initial non-blocking &lt;code&gt;connect()&lt;/code&gt; syscall:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Once &lt;code&gt;connect()&lt;/code&gt; succeeds immediately or returns &lt;code&gt;EINPROGRESS&lt;/code&gt;, Redis stops traversing the remaining resolved addresses and waits on that socket. Any later connection refusal or timeout is reported as &lt;code&gt;IOERR error or timeout writing to target instance&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;Standard Go &lt;code&gt;net.Dialer&lt;/code&gt; collapses address iteration and returns only the final &lt;code&gt;errno&lt;/code&gt; or timeout, losing the boundary between &lt;code&gt;connecting to the client&lt;/code&gt; and &lt;code&gt;writing to target instance&lt;/code&gt;.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;To match Redis 7.2.4 error classification, the pgredis &lt;code&gt;MIGRATE&lt;/code&gt; connector walks resolved addresses in order and inspects the initial &lt;code&gt;connect()&lt;/code&gt; result directly:&lt;/p&gt;</description></item><item><title>Persistence and replication scope</title><link>https://mimus.pgsty.com/docs/redis/design/persistence-scope/</link><guid>https://mimus.pgsty.com/docs/redis/design/persistence-scope/</guid><description>&lt;h2 id="decision"&gt;Decision&#10;&lt;/h2&gt;&#10;&lt;p&gt;PostgreSQL WAL, checkpoints, physical/logical backups (&lt;code&gt;pg_basebackup&lt;/code&gt;, &lt;code&gt;pg_dump&lt;/code&gt;/&lt;code&gt;pg_restore&lt;/code&gt;) and PostgreSQL streaming replication are the only durability and high-availability mechanisms in pgredis. Redis-native file persistence (AOF, RDB, &lt;code&gt;SAVE&lt;/code&gt;, &lt;code&gt;BGSAVE&lt;/code&gt;, &lt;code&gt;BGREWRITEAOF&lt;/code&gt;, &lt;code&gt;DEBUG RELOAD&lt;/code&gt;) and Redis replication (&lt;code&gt;REPLICAOF&lt;/code&gt;, &lt;code&gt;SLAVEOF&lt;/code&gt;, &lt;code&gt;SYNC&lt;/code&gt;, &lt;code&gt;PSYNC&lt;/code&gt;) are outside the product scope.&lt;/p&gt;&#10;&lt;h2 id="conflicts"&gt;Upstream test conflicts&#10;&lt;/h2&gt;&#10;&lt;p&gt;An audit of the 39 official Redis 7.2.4 test files (1,914 required test cases) identified 55 cases that invoke Redis-native persistence or replication mechanisms alongside ordinary data assertions:&lt;/p&gt;</description></item><item><title>One semantic core</title><link>https://mimus.pgsty.com/docs/redis/design/semantic-core/</link><guid>https://mimus.pgsty.com/docs/redis/design/semantic-core/</guid><description>&lt;h2 id="decision"&gt;Decision&#10;&lt;/h2&gt;&#10;&lt;p&gt;Implement Redis 7.2.4 command semantics once in the &lt;code&gt;pg_redis&lt;/code&gt; PostgreSQL 18 C extension, and use the &lt;code&gt;pgredis&lt;/code&gt; Go gateway strictly for wire-protocol framing, TLS, authentication, session queues and connection pooling. Both RESP clients and SQL callers (&lt;code&gt;redis.command&lt;/code&gt;, &lt;code&gt;redis.command_bin&lt;/code&gt;) invoke the same C command core, with PostgreSQL tables and WAL as the only persistent store.&lt;/p&gt;&#10;&lt;h2 id="reason"&gt;Rationale&#10;&lt;/h2&gt;&#10;&lt;p&gt;Implementing Redis data semantics in the Go gateway would require duplicating PostgreSQL&amp;rsquo;s transaction isolation, savepoint rollback, MVCC visibility, expiry cleanup and role-permission enforcement across two processes. Putting the semantic core inside the PostgreSQL extension gives SQL table writes and Redis key mutations a single atomic commit boundary.&lt;/p&gt;</description></item></channel></rss>