Skip to content

ZephyrDB v0.6.0

Choose a tag to compare

@beriberikix beriberikix released this 03 Aug 03:21
· 6 commits to main since this release
a0f852a

ZephyrDB v0.6.0 reworks the zdb shell command tree. The previous tree reached
10 of the library's 57 public functions; this one covers everything that has a
sensible console form — 36 commands across all three models — and fixes several
ways the old commands mishandled data.

See the new Shell Guide
for the full reference.

Breaking changes

The command surface was redesigned for consistency. Existing invocations need
updating:

Before Now
zdb kv set <ns> <key> <value> zdb kv set str|hex|raw <ns> <key> <value>
zdb ts query <stream> <agg> … zdb ts agg <stream> <agg> …
zdb ts flush <stream> zdb ts flush sync <stream> [timeout_ms]
zdb stats zdb stats show
zdb doc open <coll> <id> zdb doc get <coll> <id> [field]

Also changed:

  • zdb kv get and zdb kv list no longer print a shell_hexdump table. They
    print a hex: line that can be pasted straight back into zdb kv set hex,
    plus a str: line when the value is printable.
  • zdb ts append no longer forces a flush. Closing a stream already persists
    buffered samples, so the old hardcoded two-second timeout only added a way
    to fail.
  • Command output follows one format throughout: name: value for scalars,
    [i] key=value … for listing rows, a closing shown:/truncated: summary,
    and error: <op> failed: <STATUS> with an optional hint:. Commands return
    a negative errno matching the status they printed.

Fixes

  • zdb kv set stored strlen() bytes, dropping the NUL terminator that
    zdb_kv_set_str() stores and offering no way to write binary at all.
    Encoding is now explicit: str keeps the terminator, raw omits it, hex
    decodes bytes.
  • zdb kv get read into a fixed 256-byte buffer and truncated silently. The
    buffer is now sized to one KV I/O slab block, which bounds any storable
    record, so it cannot truncate.
  • zdb ts query never reported zdb_ts_agg_result_t.truncated, so an
    aggregate capped at CONFIG_ZDB_TS_MAX_AGG_POINTS read as exact.
    zdb ts agg reports it.
  • zdb_kv_iter_open() discarded a failed key-index allocation, so a
    CONFIG_HEAP_MEM_POOL_SIZE too small for CONFIG_ZDB_KV_INDEX_MAX_ENTRIES
    made zdb kv list report an empty namespace instead of a problem. It now
    returns ZDB_ERR_NOMEM.
  • The FCB time-series backend did not compile at all. zdb_cursor_next()
    referenced undeclared locals in its FCB branch, zdb_ts_flush_work_handler()
    and zdb_ts_append_i64() left locals and a label unused, and three static
    helpers exist only for scans FCB does not perform. Nothing in the repository
    built FCB, so none of it had ever been caught.

New commands

  • Core — zdb info reports the version, enabled models, active backends,
    and the compile-time bounds an operator will hit. zdb stats reset and
    zdb stats export round out the counters.
  • Key-value — zdb kv reset (factory reset a namespace) and
    zdb kv defaults.
  • Time-series — zdb ts read and zdb ts tail walk samples in either
    direction, zdb ts recover truncates a corrupt tail, and
    zdb ts watermark get|set|clear manages the consumer watermark.
  • Documents — the model is now usable from a console at all:
    zdb doc create, delete, get (whole document or one field),
    list, set i64|f64|str|bool|bytes, and find i64|f64|str|bool.

API additions

All additive; no existing signature changed.

  • zdb_ts_cursor_next_sample(cursor, out_sample) — the decoded form of
    zdb_cursor_next(). Raw cursor records carry a build-dependent layout with
    part of the timestamp in the segment header, so they were not portably
    decodable by a caller.
  • zdb_health_str(health) — the companion to the existing zdb_status_str().
  • ZDB_VERSION_MAJOR / _MINOR / _PATCH / _STRING.

Notes

  • CONFIG_CBPRINTF_FP_SUPPORT=y is required by zdb ts agg and the f64
    document commands, which print doubles. Its default y if FPU does not fire
    on every target.
  • CONFIG_HEAP_MEM_POOL_SIZE must fit the KV key index, which is sized by
    CONFIG_ZDB_KV_INDEX_MAX_ENTRIES and CONFIG_ZDB_MAX_KEY_LEN.
  • Tab completion cannot offer namespace, stream, or collection names — there
    is no API to enumerate them, and a filesystem scan inside line editing would
    stall the console. zdb kv list, zdb doc list, and zdb info are the
    substitutes. The Shell Guide explains the reasoning.
  • samples/shell_basic now enables all three models and seeds a namespace, a
    stream, and a document, so every command has something to report.
  • New tests/unit/shell suite drives the whole tree through the dummy shell
    backend; tests/unit/shell_fcb is build-only and guards the FCB paths.