Architecture
Tidemark is one process next to one Kafka cluster. It reads where every partition and every group stands, writes that down as a manifest beside the backup, and copies no data. This chapter is for the operator who runs it: the parts, one round in detail, what happens when something fails, and what Tidemark needs on the cluster. The why behind the round is in Concepts.
The parts and where they run
One Tidemark deployment watches one Kafka cluster: one pod, one replica, configured by environment variables. Beside it runs the backup tool, Kannika, which copies the records. Both write into storage outside the cluster, because a backup that needs the cluster to answer is no backup once the cluster is gone.
The object storage is S3, a store with an S3 API, or Azure Blob Storage. The dashed arrow is optional: Tidemark reads Kannika’s index only with a coverage provider configured.
Everything Tidemark writes goes into its own prefix, tidemark/<cluster>/, beside the backup data and never inside it.
The round loop
Every TIDEMARK_CADENCE_SECONDS (10 by default) the round loop takes a cut: where every partition of the cluster stands, where every consumer group stands, and how wide that instant really was.
The result is one manifest.
The cadence sets how many restore points there are, not how old the newest usable one is; that depends on how far the backup has come.
The canary and its two topics
A cut is only safe if it is narrower than the time the fastest application on the cluster needs to turn a cause into an effect.
Tidemark measures that time itself, with a canary: it writes a record into tidemark.canary.in, consumes it, produces it on into _tidemark.canary.out and consumes it again, the way an application would.
The fastest of these chains in the round’s window is the _chain floor, the yardstick every partition is judged against.
Tidemark does not create the two topics, and the broker must not auto-create them either, since that would give them one partition. Without them Tidemark starts, logs the command that creates them, and grades every manifest wide until both exist. They are excluded from the cut and from the backup; a restore recreates them empty. Installation has their layout.
The manifest store
Manifests go to S3 (or a store with an S3 API), to Azure Blob Storage, or to a directory on disk for a laptop. Exactly one is configured; two at once refuse the start. Keys sort by time, so the newest manifest is the last key of a listing, and there is no "latest" pointer that could race. Tidemark deletes nothing: a lifecycle rule on the store expires manifests after the backup’s own retention.
A manifest is self-contained. Choosing a restore point needs the file and nothing else, because the case it exists for is the case in which no Tidemark is running.
Coverage
A manifest is a restore point only once the backup has reached it on every partition in the cut.
Whether it has is the backup tool’s knowledge, so it comes from a provider per backup tool.
With TIDEMARK_COVERAGE_PROVIDER=kannika Tidemark reads Kannika’s segment index every 30 seconds and publishes the recovery point: the age of the newest written manifest the backup covers.
The slowest partition decides it, never the average.
Where Kannika’s archive ends just below a cut, Tidemark reads that gap on the cluster itself and writes the verdict beside the manifest, under tidemark/<cluster>/coverage/, so that a restore after a total loss judges it the same way.
The default provider, none, leaves the join to a dashboard.
The page and the HTTP endpoints
One port (TIDEMARK_HTTP_PORT, 8080) serves everything:
| Endpoint | What it answers |
|---|---|
|
200 while the process answers. For the liveness probe. |
|
200 once Tidemark can produce manifests: the cluster has answered and the consumer offsets view has caught up. 503 with the reason before that. For the readiness probe. |
|
200 when a round was published and a manifest confirmed in the store within the last three cadences; 503 with the reason otherwise. For monitoring and for people. |
|
Prometheus text format: manifest age per class, cut width and margin, canary floors, store buffer, recovery point. |
|
The page that reads manifests, with |
Readiness routes nothing: the Service keeps the pod while it is not ready, so the page and /metrics stay reachable exactly when they are wanted, during a slow start.
The page is also a single file that opens from disk without any server and reads a manifest you upload.
Restore mode
TIDEMARK_MODE=restore is the same binary with a different job, run against the target of a restore.
It runs no rounds, no canary and no views, and writes no manifests; the store is only read.
On the cluster it writes one topic, its state topic (_tidemark.restore by default): a log of every decision the restore takes, with who and when.
With TIDEMARK_RESTORE_EXECUTE=true it also executes the commands the page generates, on request and where its principal has the rights: creating topics, altering configs, creating ACLs, setting a group’s offsets.
Each execution is recorded in the state topic.
Without it, every command stays a command for a human to run.
The steps themselves are in During the disaster.
One round in detail
A round runs six steps, always in this order:
-
Consumer groups. Tidemark does not poll hundreds of group coordinators. It consumes
__consumer_offsetscontinuously and keeps the newest offset of every group; the round takes a snapshot of that view. The groups are read first, so a group can stand at the cut or before it, never beyond it. -
Transactions. From its view of
__transaction_state, and by asking every partition which producers it has, before and after the cut. That is how a manifest knows whether the cut fell through a transaction. -
Last stable offsets. One
ListOffsetsrequest withread_committedper partition leader, all sent at the same instant,t_send. Each partition’s interval is the time fromt_senduntil its answer came back. The cut sits on the last stable offset because the backup readsread_committedand cannot reach past it. -
High watermarks and log start, right behind the cut, so the distance to an open transaction is readable.
-
Judge the cut. Every partition whose interval is below the chain floor is clean; the rest are wide. Before judging, the round waits two seconds for transactions that committed while it was out to become visible.
-
Write the manifest, clean or wide. The round hands it to the store writer, which writes on a thread of its own.
The cadence counts from the start of a round, and a slow store never delays the next one.
When something fails
The rule behind every case below: every round that completes produces a manifest, and its health is in the data. Tidemark does not discard a round because it came out wide. Under sustained degradation every round would fail, and the service would fall silent exactly when the backup is about to matter. A wide manifest is not wrong, only wider, and it says by how much.
A broker answers late
Each round has a deadline, taken from a ladder: 200 ms, 500 ms, 1 s, 2 s, 5 s.
If a partition has not answered by the deadline, the whole round is dropped and taken again at once on the next rung.
It is never patched: a round with one partition asked again 400 ms later would look complete and be incoherent.
Every manifest therefore has exactly one t_send and one deadline.
After a round completes, the next one starts at the shortest rung that would have held it, so the ladder comes back down as the cluster recovers. A slow but successful broker produces wide intervals on its own partitions only; the rest of the manifest stays clean. Health is per partition for this reason: somebody restoring one topic cares whether that topic was clean.
A partition does not answer at all
Once the last rung fails too, the round writes a manifest anyway and names every partition it did not get, with the reason: no leader, no answer, or not authorised. Such a manifest is never clean. During a partition reassignment some partition is in flight at every moment; producing nothing would mean no restore points for hours. For the partitions it does contain, the manifest is as good as any.
The store is down
Writing to the store happens on its own thread, and every store call ends within ten seconds.
Rounds go on into a buffer in memory that holds 512 manifests, about 85 minutes at a 10-second cadence; tidemark_store_buffer_depth climbs and tidemark_store_failing_seconds counts.
When the store answers again the buffer drains.
A full buffer drops its oldest manifest, logs it and counts it on tidemark_store_dropped_total.
The age metrics move only on a confirmed write. A manifest in the buffer does not count, because if Kafka is gone Tidemark is most likely gone with it, and the buffer too. At start the store does not have to answer either: rounds begin and wait in the buffer.
The cluster does not exist yet
After a total loss Tidemark and the new cluster come up together, and the cluster may not answer yet, or its bootstrap name may not even resolve.
Tidemark waits for it with no upper bound, retrying after 1 s and doubling up to every 15 s.
Meanwhile /live is 200, /ready and /health are 503 with what it waits for and since when, and nothing is written.
The log says so once and reminds after 1, 3, 7 and 15 minutes, then every ten.
A restart would start the same wait again, so the probes do not cause one.
Only the cluster being away is waited out. A rejected credential, a missing permission or a bad setting ends the start with that error. So does a manifest prefix that belongs to an earlier incarnation of the cluster, typically the source of a restore: a new cluster needs a prefix of its own, under another cluster name or in another bucket, or its manifests would sit on top of the old cluster’s.
Health, in two places
The service’s health is on the endpoints: /health is 503 when no round was published, or no manifest confirmed in the store, for three cadences.
Once the cluster and the store have answered, neither probe follows them: a restart during an outage would lose the buffer and start the views over.
A manifest’s health is in the manifest, on three axes:
| clean |
every partition’s interval below the chain floor |
| complete |
no partition missing |
| atomic |
no transaction split by the cut, and every partition could be asked about its producers |
tidemark_manifest_age_seconds{class="clean"} is the age of the newest written manifest that is clean and atomic; class="any" counts every manifest.
The gap between the two shows how degraded the cluster is right now.
Anything automated picks from the clean class only; a degraded manifest is for a human who chooses it with its numbers in view.
What Tidemark reads and writes on the cluster
In normal mode Tidemark reads almost everything and writes only to its two canary topics. Its consumers assign partitions themselves; they never join a group and never commit. That shapes the rights its principal needs:
- Every topic in the cut:
Read,DescribeConfigs -
A topic it may not describe is in no manifest. Without
Readno manifest is atomic; withoutDescribeConfigsthe manifest has no topic configuration. - The two canary topics:
Read,Write -
Without them no probe lands, no floor is measured, and every partition is wide.
__consumer_offsets:Read,Create-
Without them the service does not start.
__transaction_state:Read,Create-
Without
Readit runs without the transaction view and no manifest is atomic; withoutCreateit does not start on a fresh cluster. - The cluster:
Describe -
Without it the manifest carries no ACLs, and the group view cannot trust its group list.
- Consumer groups and transactional ids:
Describe -
Without it the views read their topics from the beginning at start, which can take minutes.
Restore mode needs less, on the target cluster: Read, Write, Describe and DescribeConfigs on its state topic, read rights on the restored topics, groups and cluster for its checks, and read access to the store.
With execution switched on, each action needs its own right, and whatever is not granted stays a command on the page, with the reason.
Installation has the complete ACL setup, including a Strimzi KafkaUser for both modes.
Tidemark and Kannika
Kannika copies data; Tidemark copies none. Tidemark decides where a restore has to stop and checks that it did.
| Kannika | Tidemark | |
|---|---|---|
During backup |
Consumes every partition |
Takes a round every few seconds and writes manifests into its own prefix. With the provider, reads Kannika’s index, read only, and publishes the recovery point. |
Choosing a restore point |
— |
In restore mode, lists the manifests and reads Kannika’s index to find the newest manifest the backup covers. |
Restoring the data |
Writes every partition back into the target up to the cut, and marks each record with its original offset. |
Generates Kannika’s |
Restoring the groups |
— |
Translates each group’s offset through the original-offset headers and generates the reset, or sets it on request. |
After the restore |
Backs up the new cluster. |
A normal Tidemark runs on the new cluster, with a new prefix. |
Restore mode never talks to Kannika directly: it generates what Kannika needs and reads what Kannika wrote. That keeps the backup tool replaceable behind a provider, and it keeps a restore possible with nothing but the manifest file and the backup tool, when Tidemark itself is not running. During the disaster walks through the steps.