Middle · Redis with Go
Pipeline is not a transaction
What does Redis pipelining guarantee?
Try explaining this aloud before opening the answer. State your assumptions and trace a boundary case.
Reveal a strong answer
A pipeline batches command transmission and responses to reduce network round trips. It does not by itself provide transaction isolation or all-or-nothing behavior. Bound batch size to avoid large retained commands and replies.
MULTI/EXEC has separate transaction semantics; execution-time errors do not roll back earlier successful commands. WATCH supports optimistic checks but requires retry handling and a consistent connection workflow.
Lua can express an atomic server-side decision, but long scripts block other work on that server. In Cluster, multi-key operations must respect hash-slot constraints. Choose from the actual invariant and network cost.
Common trap
“Pipeline failed, so nothing ran” is unsafe after a partial network failure.
Try it
A pipeline sends100 increments and the connection breaks before replies. Can you safely replay all100?
Worked solution
Not without knowing which increments ran or making them idempotent. Some or all may already be applied. Use stable operation IDs or a reconciliation strategy for critical counters, and distinguish best-effort telemetry from money or quota authority.
Change the constraint
When does a Lua script reduce races but still leave a retry ambiguity after a lost response?
How did you do?
Self-assessment, not a compiler pass or interview score. Explain the reasoning unaided before marking understood.
Not marked. Progress stays on this browser, separate from course completion.
Primary references
Checked 2026-10-20. Use documentation for your pinned runtime, driver and tool version.