Repository navigation
v0.6.2
Added
- CDC streams read only the topics they subscribe to. Each
PublishCDC
journal poll now filters by the topic pattern in SQL and stops at the
committed journal head. A pattern without wildcards is an exact match; a
pattern with a literal prefix (virtued.*,udb.*.recorded.v1) is a
byte-order range over that prefix, narrowed withLIKEwhen it has more
wildcards than one trailing*; a pattern that starts with a wildcard is
still filtered in memory. Startup creates two journal indexes:
(topic COLLATE "C", journal_position)and(published_at). - Progress markers. With
CDCSubscriptionRequest.progress_markers = true
(field 5, off by default) a stream also sends markers saying how far it has
read the journal. One follows the end of replay; later ones follow polls that
passed events the stream did not deliver, at most every 5 seconds or every
1,000 journal positions. A marker is aCDCEnvelopewith
progress_only = true(field 6) andjournal_position(field 7, now also set
on every event) equal to the position read through;topicis the reserved
udb.cdc.progress.v1;partition_keyis empty;payload_jsonis
{"kind":"progress","journal_position":"<position>","caught_up":true}; and
event_idis a progress token, a version-8 UUID whose bytes 0-5 areudbpro,
byte 6 is0x80, byte 7 is0x00and bytes 8-15 hold the position
big-endian under the variant bits10. A marker never carries another
event's id.AckCdcEventsaccepts the token and moves the named cursor to the
marker's position;NackCdcEventsrefuses it (INVALID_ARGUMENT); and
since_event_idaccepts it even after retention removed the rows around it.
The Go and TypeScript durable consumers and the Python and PHP event
subscriptions request markers and never pass them to your code; the
consumers acknowledge a marker only after every earlier event. - Choose where a new durable consumer starts.
CDCSubscriptionRequest.start(field 6, enumCdcConsumerStart) takes
CDC_CONSUMER_START_LATEST(the default) orCDC_CONSUMER_START_EARLIEST.
It applies only to a name's first subscription. Go:
ConsumeOptions{FromEarliest: true}; TypeScript:
consume(…, { fromEarliest: true }). - Journal retention settings.
UDB_CDC_JOURNAL_RETENTION(default7d)
prunes published and acknowledged journal rows older than it.
UDB_CDC_JOURNAL_RETENTION_OVERRIDES(defaultudb.lock.*=1h) sets shorter
retention for topic patterns as comma-separatedpattern=durationpairs; a
set value replaces the default list and an empty value turns overrides off.
An override deletes a row only at or below the position of every named
consumer that could read it and acknowledged within the global retention.
Dead-lettered rows, the newest row of each topic and the journal head are
never deleted. Retention runs in batches of 5,000 rows, at most 20 per pass. - Journal reader positions for the broker's own workers. The webhook
dispatcher and the cache invalidator keep their position in
udb_system.udb_journal_reader_cursors(webhook.dispatch,
cache.invalidate) and read at most 5,000 journal positions per tick. - Go durable consumers can acknowledge in batches.
udbclient.ConsumeOptions
gainsAckBatchSize,AckIntervalandAckTimeout, so a high-throughput
consumer settles a run of successful events as one watermark instead of one
AckCdcEventscall per event.AckIntervalflushes a partial batch on an idle
stream andAckTimeoutbounds each settlement, including a shutdown flush.
A redelivery of an event whose handler already completed is acknowledged again
without re-running the handler, so a cursor the broker never saw confirmed
still advances.AckBatchSizedefaults to 1, which keeps the per-event
contract: an event is acknowledged before the next one is read, and a failed
acknowledgement stops the stream before later events can advance the cursor.
Raising it trades that guarantee for throughput; handlers must be idempotent,
which at-least-once delivery already requires.
Fixed
-
A consumer of a quiet topic scanned the whole journal. Every poll read
the next 1,000 journal rows of every topic and filtered them in memory, so a
stream on a topic with few events paged through all other traffic on every
reconnect, and a page full of other topics counted as "not caught up". The
poll now reads only the pattern's topics, up to the committed head, and
counts rows the pattern selected. -
A quiet consumer's stored position never moved. A named consumer could
only acknowledge its own events, so on a quiet topic its cursor stayed far
behind the head and every restart rescanned everything since its last event.
Progress markers let it acknowledge the position it has read through. -
A new consumer name replayed the entire retained journal. A new name
started before the first retained event, so adding a consumer to a busy
deployment delivered days of history before any new event. It now starts at
the head unless the first subscription asks forCDC_CONSUMER_START_EARLIEST. -
The journal grew without bound. Retention removed only rows in state
acked, after the idempotency TTL; a row left in statepublishedwas never
pruned, and high-volumeudb.lock.*events, which nothing in the broker
replays, stayed for the full TTL. Retention now covers published rows, has
its own setting and per-topic overrides, and deletes in bounded batches. -
The webhook dispatcher joined the whole journal on every tick, even with
no active endpoint. With no endpoint it no longer reads the journal; with
endpoints it reads one window after its stored position. -
Two more full journal scans. The consumer lag in
GetCdcStatusand
udb verify --liveran an unanchored regex over the journal once per named
consumer; it now uses the topic index and reads the newest in-scope row. The
cache invalidator re-read the whole retained journal every tick; it now reads
one window after its stored position. -
The embedding work emitter and the search freshness and reindex workers
scanned the whole journal on every tick. Each joined every retained
journal row to its registrations and checked each one against the outbox and
the journal for a completion marker. Each now keeps its position in
udb_system.udb_journal_reader_cursors(embedding.work,
search.freshness,search.reindex) and reads at most 5,000 journal
positions per query, in position order, moving on to the next window in the
same tick (up to 20) while a window holds nothing to do. With no ACTIVE
embedding source naming a CDC topic, the emitter's change stage does not read
the journal and moves its position to the head; with no ACTIVE search index
naming one, neither does the freshness worker; with no index that is not
deleted, neither does the reindex stage. An event whose work failed is
retried: the position stops just before it. Changes published before a
source or index exists are no longer picked up when it is registered; run
BackfillorReindexfor those.
Breaking for callers
- A new embedding source or search index no longer replays journal history
on its own. The embedding work emitter and the search freshness and reindex
workers now read the journal from a durable cursor. A source or index
registered after the upgrade picks up only changes published after the
worker's cursor, not the whole retained journal it used to scan every tick.- detect: code:
EmbeddingSource - detect: code:
SearchIndex - fix: after registering a source or index, call
EmbeddingService.Backfill(orSearchService.Reindex) to process existing rows, as for any newly attached table.
- detect: code:
- A new durable consumer name starts at the journal head. A
consumer_namethat has never subscribed receives only events committed
after its first subscription; it used to replay the retained history first.- detect: code:
consumer_name - detect: code:
ConsumerName: - fix: to replay history, set
starttoCDC_CONSUMER_START_EARLIESTon the name's first subscription (Goudbclient.ConsumeOptions{FromEarliest: true}, TypeScriptconsume(…, { fromEarliest: true })); names that already have a position are unaffected.
- detect: code:
- Named consumers that never acknowledged anything move to the journal head
at upgrade. The first 0.6.2 startup moves every cursor still at position 0
with no acknowledged event to the current head, once; later claims are never
moved.- detect: sql:
SELECT tenant_id, consumer_name, topic_pattern FROM udb_system.udb_cdc_consumer_cursors WHERE last_journal_position = 0 AND last_event_id = '00000000-0000-0000-0000-000000000000' - fix: to keep them at the start of the journal, set
UDB_CDC_KEEP_UNACKED_CONSUMER_ORIGIN=1before the first 0.6.2 startup; the decision is recorded and later restarts do not revisit it.
- detect: sql:
- Published journal rows now expire. Published and acknowledged rows are
deleted after 7 days andudb.lock.*rows after 1 hour (once named consumers
have passed them). An anonymoussince_event_idolder than that gets
NOT_FOUNDunless it is the newest row of its topic or a progress token.
UDB_CDC_IDEMPOTENCY_TTL_SECSno longer sets journal retention.- detect: code:
since_event_id - detect: code:
SinceEventId - detect: env:
UDB_CDC_IDEMPOTENCY_TTL_SECS - fix: resume with a durable
consumer_name(positions survive retention) or with the last progress marker's token, or lengthenUDB_CDC_JOURNAL_RETENTION/ changeUDB_CDC_JOURNAL_RETENTION_OVERRIDES.
- detect: code:
- The topic
udb.cdc.progress.v1is reserved. Enqueueing an outbox event
or writing a journal row on it is refused (INVALID_ARGUMENT).- detect: code:
udb.cdc.progress.v1 - fix: publish on another topic name.
- detect: code:
CdcEnvelopeandCdcConfig(Rust crate) have new public fields.
CdcEnvelopegainsjournal_positionandprogress_only;CdcConfiggains
journal_retention_secsandjournal_retention_overrides. A struct literal
without..no longer compiles.- detect: code:
CdcEnvelope { - detect: code:
CdcConfig { - fix: add the new fields (
journal_position: 0, progress_only: falsefor an envelope that is not a journal row) or end the literal with..Default::default()forCdcConfig.
- detect: code: