From f14422909fdfe8c8adf6db716628d017a48d6ed7 Mon Sep 17 00:00:00 2001 From: Matt Jibson Date: Mon, 13 Nov 2023 17:52:12 +0000 Subject: [PATCH] doc: add read holds design doc --- doc/developer/design/20231102_read_holds.md | 154 ++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 doc/developer/design/20231102_read_holds.md diff --git a/doc/developer/design/20231102_read_holds.md b/doc/developer/design/20231102_read_holds.md new file mode 100644 index 000000000000..71ee2045b805 --- /dev/null +++ b/doc/developer/design/20231102_read_holds.md @@ -0,0 +1,154 @@ +# Read Holds + +- Durable Subscribes epic: [17541](https://github.com/MaterializeInc/materialize/issues/17541) +- Configurable compaction windows: [16701](https://github.com/MaterializeInc/materialize/issues/16701) + +## The Problem + +Users are not able to use `SUBSCRIBE` without data loss. +When materialize restarts or a client connection fails for some reason, +users are not able to restart the `SUBSCRIBE` `AS OF` their most recently observed timestamp because the read frontier has usually progressed past that time. +This happens because the compaction window is 1 second for all user objects. + +## Success Criteria + +`SUBSCRIBE` must be usable without data loss across server restarts or client reconnections. + +## Out of Scope + + + +## Solution Proposal + +Add a new `HOLD` object that acquires controller read holds on listed objects at a specific timestamp. +The `HOLD` must be manually advanced to newer timestamps by users which will release the previous and acquire a new read hold to the specified timestamp. +If the timestamp falls behind a configurable window, the `HOLD` is marked in an error state and the read holds are released. + +The `HOLD` can be created by: + +``` +CREATE HOLD +ON [, ...] +[AT