What an ack actually promises

This page exists because the roadmap asked for one “that does not overstate it”. Every claim below names the test that holds it, and the limits are stated as plainly as the guarantees.


The two modes

IngestCandles and IngestTicks take a Durability:

Mode

Returns when

Promise

DurabilityAcked (zero value)

the server sends INGEST_ACK

the batch is in the write-ahead log and the log has been fsynced

DurabilityFireAndForget

the bytes are written to the socket

nothing

Acked is the zero value deliberately: the safe meaning is the one you get by not choosing.

What “acked” means, exactly

The ack is a durability receipt, not an acknowledgement of receipt. It is sent after the batch’s WAL record is flushed and synced, so a machine losing power immediately after still has the data — TestServer_AckedCandleIngestIsInWALBeforeAck, and TestCrash_KillDashNine for the recovery half.

This was not always true. Until 2026-09-04 the ack was sent from a buffer, and “acked” meant “accepted”, which is a materially weaker promise. If you are reading older material about this system, distrust it.

What fire-and-forget means, exactly

It means exactly what it says. The call returns once the bytes reach the socket. There is no response frame, so:

  • A batch the server refuses — one overflowing the WAL’s record size, one whose timestamps fall outside the stream’s admissible window — is dropped and you are never told.

  • Nothing is retried, because there is no answer to classify.

Use it when throughput matters more than certainty, and pair it with a periodic acked batch as a barrier if you need a checkpoint: frames on one connection are processed in order, so an ack proves every preceding batch was handled.

Backpressure: the one retryable failure

A server that cannot absorb a write answers ErrorCodeOverloaded with a backoff hint. The SDK retries this for you: up to 1,000 attempts by default, honouring the hint but capping each wait at 250ms (Options.Retry). The caller’s context and RequestTimeout still bound the call, and a call shed on every attempt fails with ErrRetriesExhausted. Shed reads are retried the same way.

This cannot duplicate records, and the reason matters. Overloaded is raised by the WAL admission check before anything is stored, so it is a promise that nothing landed. A retry re-sends a batch the server provably does not have. TestIngest_RetriedShedBatchesLandExactlyOnce censuses this against a real shedding node.

Nothing else is retried. Every other error code is a statement about the request — re-sending fails identically. RemoteError.RetryAfter() is the single place that decides, and it says yes only to Overloaded.

The ambiguous failure, stated honestly

If a connection dies while an ingest is in flight, the batch may have been applied with only the ack lost. ResilientClient returns ErrAmbiguous and does not retry.

That is not timidity. For candles a re-send is harmless to the data it repeats (a bar the server already holds is restated, and an identical one skipped), but it overwrites any bar someone else restated in between with older values, and a trade batch has no such key at all: two trades may share a timestamp, so a re-send can store one twice. The SDK cannot know which happened, so it says so.

There is a distinction worth internalizing:

  • Connection known dead before the request → not ambiguous. The server never saw a first copy; the batch goes out on a fresh connection. Safe for reads and writes.

  • Connection dies during the request → ambiguous for writes only. Reads re-run for free.

TestResilient_InFlightWriteIsAmbiguousNotRetried pins that the server sees exactly one ingest.

Recovering from one

Read the range back and re-send what is missing. For candles, re-sending the whole batch is also safe since 2026-10-23: a bar at a time the stream already holds is restated wherever the server keeps it, and an unchanged one is skipped. A batch older than everything the stream stores — a lost FIRST batch — is still refused by the live path and needs IngestHistoryCandles.

TestChaos_AmbiguousBatchIsReconciledPromptly drives the working recovery; TestChaos_NoAckedRecordIsLost is the harder guarantee — under a proxy severing connections mid-request against a real node, every batch whose ingest returned nil is present afterwards.

Batching moves the receipt

Batcher.Add returning nil means the record is buffered, not stored. The receipt still exists but arrives later — at a subsequent Add, at Flush, or at Close.

Consequences:

  • Records live in memory until flushed. A process exiting without Close loses them, and no ack was ever given for them.

  • A failed flush poisons the batcher rather than continuing: those records are not stored, and accepting more would silently interleave stored and unstored data.

  • Add blocks during a flush. That is backpressure, not a bug — the alternative is a buffer that grows without bound.

Subscriptions

The backfill-to-live boundary guarantees no gap, not no duplicate. The backfill window and the live queue overlap on purpose, so a record ingested during the backfill below its cutoff arrives on both sides. Ingest is idempotent by (stream, timestamp); dedupe on that key if it matters.

A dropped batch is gone, not delayed. Event.Dropped counts them with MissingFirst/MissingLast naming the range. Recover with a query or a backfilling re-subscribe.

Limits, plainly

  • Authentication is real but off by default. With security.auth.enabled, a node verifies an Ed25519-signed token and grants at most what it carries (clamped by security.max_permissions). With it off, the permissions a client asks for are taken on trust, so do not expose such a node to an untrusted network.

  • On a single node, one disk. The ack means the data survives a process crash and a power cut on that machine, and says nothing about that machine’s disk failing.

  • In a cluster, the ack is the primary’s alone. Copies pull from the primary asynchronously. A graceful partition move loses no acknowledged write (TestCutover_UnderConcurrentWritesNoAckedWriteIsLost), but a primary that crashes can lose writes it acknowledged after its copies’ last pull. This was measured at 0 to a few thousand candles under heavy load, every one acknowledged within about 40ms of the kill (TestServerBinary_ACrashedPrimaryLosesOnlyWritesItsCopyHadNotPulled). Nothing older than the in-sync staleness bound is lost.

  • There is no node-wide memory budget. Many streams can collectively outgrow memory; per-writer WAL bounds exist, a global one does not.

  • IngestHistoryCandles is not the live path. It stages, compresses and installs chunks with no WAL, and with DurabilityAcked the ack means the chunks are installed — a stronger promise than the live ack, not a weaker one.