Repository navigation
ZephyrDB v0.6.0
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 getandzdb kv listno longer print ashell_hexdumptable. They
print ahex:line that can be pasted straight back intozdb kv set hex,
plus astr:line when the value is printable.zdb ts appendno 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: valuefor scalars,
[i] key=value …for listing rows, a closingshown:/truncated:summary,
anderror: <op> failed: <STATUS>with an optionalhint:. Commands return
a negative errno matching the status they printed.
Fixes
zdb kv setstoredstrlen()bytes, dropping the NUL terminator that
zdb_kv_set_str()stores and offering no way to write binary at all.
Encoding is now explicit:strkeeps the terminator,rawomits it,hex
decodes bytes.zdb kv getread 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 querynever reportedzdb_ts_agg_result_t.truncated, so an
aggregate capped atCONFIG_ZDB_TS_MAX_AGG_POINTSread as exact.
zdb ts aggreports it.zdb_kv_iter_open()discarded a failed key-index allocation, so a
CONFIG_HEAP_MEM_POOL_SIZEtoo small forCONFIG_ZDB_KV_INDEX_MAX_ENTRIES
madezdb kv listreport an empty namespace instead of a problem. It now
returnsZDB_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()
andzdb_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 inforeports the version, enabled models, active backends,
and the compile-time bounds an operator will hit.zdb stats resetand
zdb stats exportround out the counters. - Key-value —
zdb kv reset(factory reset a namespace) and
zdb kv defaults. - Time-series —
zdb ts readandzdb ts tailwalk samples in either
direction,zdb ts recovertruncates a corrupt tail, and
zdb ts watermark get|set|clearmanages 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, andfind 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 existingzdb_status_str().ZDB_VERSION_MAJOR/_MINOR/_PATCH/_STRING.
Notes
CONFIG_CBPRINTF_FP_SUPPORT=yis required byzdb ts aggand thef64
document commands, which print doubles. Itsdefault y if FPUdoes not fire
on every target.CONFIG_HEAP_MEM_POOL_SIZEmust fit the KV key index, which is sized by
CONFIG_ZDB_KV_INDEX_MAX_ENTRIESandCONFIG_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, andzdb infoare the
substitutes. The Shell Guide explains the reasoning. samples/shell_basicnow enables all three models and seeds a namespace, a
stream, and a document, so every command has something to report.- New
tests/unit/shellsuite drives the whole tree through the dummy shell
backend;tests/unit/shell_fcbis build-only and guards the FCB paths.