Skip to content

ZephyrDB v0.7.0 — events-focused refresh

Latest

Choose a tag to compare

@beriberikix beriberikix released this 03 Aug 21:37
· 3 commits to main since this release
19b628f

Eventing grew from key-value only to cover every model, but the documentation and the tests did not follow, and a year of new features shipped emitting nothing. This release makes what ZephyrDB reports match what it does, puts the whole surface under CI, and reports the state changes that were happening silently.

README.md still described eventing as key-value only — and it is the Doxygen mainpage, so that text was the published API site's definition of the feature.

Added

  • Instance events. A fourth listener category, zdb_core_event_listener_t / zdb_core_event_t, registered through zdb_cfg_t.core_event_listeners. Reports ZDB_CORE_EVENT_INIT, ZDB_CORE_EVENT_DEINIT and ZDB_CORE_EVENT_HEALTH, the last carrying prev_health and health. Health was previously observable only by polling zdb_health().
  • ZDB_TS_EVENT_ROLLOVER — a bounded stream discarding its oldest segments, with the bytes dropped in truncated_bytes. This is the only place ZephyrDB destroys data on purpose, and it used to do so silently.
  • ZDB_TS_EVENT_WATERMARK — a consumed watermark set or cleared.
  • ZDB_EVENT_KV_INDEX_FULL — a key that stored successfully but did not fit CONFIG_ZDB_KV_INDEX_MAX_ENTRIES. The value stays readable by name; only enumeration is lost.
  • zdb_core_event_chan and zdb_eventing_zbus_publish_core().
  • Test suites unit/core_events, unit/doc_events and unit/eventing_zbus — the zbus adapter had no automated coverage of any kind before this.

Fixed

  • Health could never degrade with CONFIG_ZDB_STATS=n. zdb_health_check() decided from durability counters that compile away when statistics are off, so such builds reported ZDB_HEALTH_OK no matter how much corruption they met.
  • Document events never reported failures. zdb_doc_save(), zdb_doc_delete() and zdb_doc_create() passed a hardcoded ZDB_OK and returned before the emit on every error path.
  • Time-series recovery never reported failures. Ten early returns in zdb_ts_recover_stream() emitted nothing.
  • Flush events undercounted. Only the periodic work-queue drain emitted, so flushes caused by zdb_ts_close() or by a full ingest buffer during append were invisible and flushed_bytes did not reflect what reached storage.
  • zdb_deinit() could crash after an append. The time-series context was freed without settling a queued flush, leaving the work queue to run a handler in memory that had since been reused.
  • samples/eventing_zbus had no sample.yaml, so Twister never built it — the reason this drift went unnoticed. It now builds in CI, mounts LittleFS so its time-series and document paths actually run, and fails rather than silently skipping them.
  • The documented arm64 test workflow was broken. Zephyr matches boards/<board-target>.overlay, and native_sim.overlay only matches an unqualified target, so native_sim/native/64 built without the LittleFS partition and every filesystem-backed suite failed. Each suite now ships the qualified name alongside it.

Changed

  • CONFIG_ZDB_EVENTING now depends on ZDB_CORE rather than requiring a data model, since instance events are model-independent.
  • Event callbacks are documented as never running while an internal lock is held, so a listener may call back into the same instance. Flush, rollover and health events detected inside locked sections are published on release.
  • Health is documented as one-way and derived from time-series integrity checks.
  • README, docs/api.md and docs/configuration.md rewritten around the four categories.

Upgrading

Existing listeners will observe behaviour changes: document events and time-series recovery now deliver failure statuses they previously never sent, and flush events fire from more paths. A listener that assumed status was always ZDB_OK should be reviewed.

Requires Zephyr v4.4.1. 0.x: the API may change between minor releases; on-disk formats are versioned and readers accept older ones.

Full changelog: https://github.com/beriberikix/zephyrdb/blob/v0.7.0/CHANGELOG.md