Repository navigation
Pari 0.4.0 alpha
Pre-releasePari 0.4.0 alpha
Pari 0.4.0 alpha makes small commits to large persistent indexes take
milliseconds instead of seconds. A commit now appends only what changed to the
index file, instead of rewriting the whole snapshot.
Installation
python -m pip install "pari-similarity==0.4.0"
cargo add pari-core@0.4.0 pari-index@0.4.0 pari-store@0.4.0Python imports remain import pari. Keep all four public Rust crates on the
same release version. CLI archives, checksums, and the dependency SBOM are
attached to the
GitHub release with
GitHub build provenance attestations.
Delta commits
flush(), sync() and close() on a persistent index append the inserts and
removals since the last commit as a checksummed delta generation after the
snapshot. Queries, reopen, ReadOnlyIndex, LazyIndex32/LazyIndex64 and
pari verify apply every generation, and return the same results as a
rewritten snapshot. An interrupted append is ignored on the next open and
replaced by the next commit. A damaged generation is rejected, not skipped.
A commit rewrites the snapshot automatically once 32 generations exist, the
generations would exceed a quarter of the snapshot, or hidden memberships of
removed keys exceed a quarter of the live keys. compact() on Rust persistent
indexes and Python's Index/Index64, and the new pari compact --index PATH
command, rewrite the file as one snapshot on demand.
This covers PersistentIndex32/PersistentIndex64, Python's
Index/Index64, DedupeIndex(backend="local"), and batched pari index
builds, which no longer rewrite the growing file on every batch.
Measured on the dedicated 12-vCPU, 132 GiB host, committing 1,000 inserts and
1,000 removals to a full-scale persistent index:
| 1M items | 10M items | |
|---|---|---|
| Delta commit | 4.7 ms | 3.7 ms |
| Full snapshot rewrite (every commit before 0.4.0) | 2.78 s | 35.2 s |
| Delta size | 448 KB | 448 KB |
| Reopen with one delta generation | 720 ms | 7.98 s |
| Reopen without delta generations | 707 ms | 7.13 s |
Candidate parity held after the commit, after reopening, and after compaction.
New stats report the generations: delta_generations and delta_bytes in Rust
StoreStats, Python IndexStats and pari stats --json,
LazyStats::delta_generations, and delta_generations in
pari verify --json.
Upgrading from 0.3
- Files. 0.4.0 reads every snapshot written by earlier releases. Once a
0.4.0 commit appends a delta generation, Pari 0.3 and earlier refuse the file
(they report trailing bytes) instead of returning stale results. Run
compact()orpari compact --index PATHbefore handing a file to an older
reader. Snapshots without delta generations are byte-for-byte unchanged. - Rust.
StoreStatsandLazyStatsgain fields, andFormatErrorgains
AppendedGenerationsandInvalidGeneration.FileLayout::read_fromkeeps
its base-only meaning and rejects a file with delta generations; use
FileLayout::read_with_generationsto read one.
StoreStats::suppressed_base_keysandcommitted_bucketscount every
committed generation. - Python. No incompatible changes;
Index.compact(),Index64.compact()
and the newIndexStatsproperties are additions.
See index format,
persistence and compatibility.