Repository navigation
Compatibility
These changes can require changes in existing code:
- Python 3.12–3.15. Support for Python 3.9, 3.10 and 3.11 ends
(previously 3.9–3.14); thetomlidependency is gone. Nonein a BASE field raisesValueErrorfor every type (R9E-01).
Previouslyutf8silently stored the text"None"andboolstored
False. Store a null withput_cell(u, v, None), remove a value with
delete_cell.delete_celldeletes only a live cell (a storedNoneincluded). For
an already deleted or never written cell it returnsFalseand writes
nothing (R9A-04). Previously a deleted BASE field returnedTrueagain,
and every call on a deleted cell wrote another tombstone.- Iterators after
rollback(): openrecords,cellsandscan
iterators end withDnhydbError("iterator invalidated") instead of
returning buffered values of the discarded state (I7). repair_file()no longer cuts intact committed blocks or keeps
uncommitted blocks silently; such a repair raisesCorruptionErrorunless
allow_data_loss=Trueorkeep_uncommitted=Trueis given (details under
Changed).- Rust:
Db::has_recordreturnsResult<bool>; new error variants
Error::MemoryandError::IoPath.
Changed
- macOS, durability
fsync: the data of a commit is now synchronized with
F_BARRIERFSYNC(anfsyncplus an I/O barrier) before the superblock is
written, so the drive persists the data before the superblock. This
guarantees the write order, not the persistence of the latest commits
(the drive cache is not flushed; onlyfullrequests that). Where the
file system does not support the barrier, dNHyDB falls back to plain
fsyncwithout this ordering guarantee. Single commits get slower: on an
Apple M1 Max a commit with data takes about 1 ms instead of roughly
0.06 ms; batch commits are barely affected. Commit less often if
throughput matters.full,none, Linux and Windows are unchanged. repair_file()(anddnhydb repair) no longer discards intact committed
blocks or keeps uncommitted blocks silently. New options
allow_data_loss=Falseandkeep_uncommitted=False(CLI
--allow-data-loss,--keep-uncommitted; RustRepairOptionswith
Db::repair_file_opts). Without them, a repair that would lose data
raisesCorruptionErrorand changes nothing. The dry run reports the
plannedaction; the report has new keys (superblocks,
superblock_problem,uncommitted_bytes,missing_committed_bytes,
damaged_blocks,later_valid_blocks,safe_end,cut_reason,
lost_blocks,discarded_uncommitted_blocks,kept_uncommitted_blocks).inspect_tail()also checks both superblocks;cleanisfalseif a
superblock is damaged or the commit boundary is beyond the end of the
file or not on a block boundary.verify()reports every damaged block; a stale VALUE index is reported
under the new keyswarnings/warning_countand no longer makesok
false (health()then reportswarninginstead ofunhealthy).- A commit without new blocks writes nothing; opening, reading and closing
leaves the file unchanged. - After a failed data or superblock sync during a commit, the handle is
unusable: write methods,commit,rollback,flush,beginand
checkpointraiseDnhydbError;close()releases handle and lock. - Paths are anchored as absolute paths when opening (
path,
stats()["file"]andcompact()["file"]are absolute). - A directory as database path raises
IsADirectoryError(also for
createwithoutoverwrite); OS errors carryerrno,strerrorand
filenameand use the matchingOSErrorsubclass. - Command line: defined exit codes (0 ok, 1 problems found, 2 error without
traceback);tailandrepairwithout--applyexit with 1 on a file
that is not clean;verifyreports the tail inspection if a damaged file
cannot be opened. - VALUE index: NaN never matches (equality or range), as in a scan.
- A buffered (uncommitted) cell reads with the same normalised value as
after the commit. read_numpy(..., masks=True)adds"_cells": per field a bool array that
isTruewhere the cell lives (R9E-02). Withoutmasksthe output is
unchanged.compact(output=...)locks the target for the whole run and never
replaces a file that appeared in the meantime (RD4-08).
Fixed
- Data blocks found by the scan (without or beyond the catalog) and
SECONDARY index blocks are CRC-checked before first use; damaged block
prefixes no longer lead to silently wrong or missing values but to
CorruptionError. - Opening as writer no longer truncates complete blocks behind the commit
boundary when the other superblock is damaged; it fails with
CorruptionError(readers read the older state). create(overwrite=True)replaces the old file atomically; on failure the
old database stays intact.close()after own commits also writes the second superblock slot.- Repair writes new superblocks with rising generations before cutting the
file, takes the write lock before inspecting it, and creates unique,
synchronized backups (never overwritten within the same second); files
that are too short or not a database are rejected unchanged. - Failed batch writes (
put_cells,put_records, NumPy batches) leave no
blocks behind. - Windows: replacing a file that is briefly in use is retried.
- The lock file is never opened through a symbolic link; a directory or an
empty path is rejected before the lock file is created, and a lock file
created by a failedcreateis removed. - After
close(), every method and iterator raisesDnhydbError
(includinghas_record,schema,verify,health, setters);
withon a closed database raisesDnhydbError, and a failed commit on
leaving awithblock still releases handle and lock. - Huge
countvalues inread_numpyand allocation failures (bytes(n),
index build) raiseMemoryErrorinstead of aborting the process. - Deeply nested or cyclic values raise
ValueError, deeply nested
metadata JSON raisesCorruptionError(no stack overflow); values and
groups of cells larger than 4 GiB are rejected withValueError;
decompression of posting lists is bounded. - NumPy columns of unsupported types (
float16,longdouble) raise
TypeErrorinstead of recursing. - Missing required keys in the schema JSON raise
CorruptionErrorinstead
ofKeyError. - A side with only free cells is no longer reported as stale after
build_indexes(). - A block at a foreign position (copied or swapped, CRC valid) no longer
returns old values: block ids must grow with the file position, and
blocks known from the catalog are checked against their header; open,
reads andverify()reportCorruptionError(RD-01, RD-05). - Two blocks with the same id no longer crash
verify(), compaction or
point listings; they raiseCorruptionError. get_cellreturns a value written withput_cellfor a BASE field that
the record's stored shape did not have yet (it returnedNone).- Concurrent use of one handle from several threads raises
RuntimeError
instead ofPanicExceptionin every method and iterator (R9D-01). - A failed
define_baseleaves no metadata blocks that a later commit would
make durable. - A failed compaction no longer leaves
<db>.compactingbehind; a leftover
is replaced under the lock (RD4-03). - A failed commit inside
checkpoint()no longer leaves a checkpoint offset
that points at a discarded block.