Notas da versão

Versão 0.9.1

Mudanças, notas de migração e compatibilidade desta versão.

Para v0.9.4 Ver a fonte no GitHub ↗

Installation and release channels

0.9.1 is a stable release, combining the capabilities of 0.9.1-beta.1 with compressed reranking, document ANN integration, unified queries, and modular bindings. Rust Embedded Core implements storage, transactions, queries, recovery, and lifecycle semantics for Python, Node, CLI, and Server callers.

The Rust crate, CLI, Server source, npm package, and Python package use 0.9.1. Python supports 3.9–3.12, npm uses latest, and Git tag v0.9.1 identifies the validated Release merge commit. Server and WebUI retain their nightly development and compatibility boundaries.

Shell
cargo add triviumdb@0.9.1
pip install "triviumdb==0.9.1"
npm install triviumdb@0.9.1

Document identity, structure, and evidence

  • Document roots store source identity, content, hashes, and revisions. Structural manifests describe UTF-8 ranges, parents, and optional node representations for words, lines, paragraphs, and other blocks. Structural nodes can omit vectors, while vector representations follow database dimensions and dtype.
  • Atomic writes install roots, representation nodes, and structural edges together, validating ownership, ranges, hierarchy, and expected revisions. Replacement, deletion, and recovery use existing transactions, WAL, and file-group publication, with structured conflict errors.
  • Whole-document and fragment BM25 corpora support stable source grouping, block-kind field weights, root and fragment metadata filters, array membership intersections/unions, and source restrictions. Results include revisions, ranks, original byte ranges, and line/column evidence.
  • Positional indexes support terms, phrases, and ordered proximity with the tdb-text-ascii-cjk2-v1 analyzer. Repeated terms, overlapping CJK bigrams, Unicode casing, and multiline ranges follow one positional contract.
  • Context requests validate revisions in one read view, expand neighbors and structural ancestors, and merge adjacent or overlapping ranges. Derived indexes build on demand and invalidate after fact changes, with budgets and cancellation for workspaces, positional visits, and output.

See document sources and structure for the full contract.

Parsing, source mapping, and staged publication

  • Built-in parsers handle plain text, Markdown, HTML, JSON, and JSONL. Explicit format, media type, or extension selects a parser, producing stable configuration identity and UTF-8 logical blocks, with bounded leaf splitting and optional line blocks.
  • Parsed and source text have separate SHA-256 hashes. Evidence maps return exact, cover, or synthetic source ranges, line/column information, and optional page, paragraph, and region data. Hosts submit PDF, Office, and OCR results through ParsedDocument and maintain the original binary hash.
  • Durable begin/append/status/list/publish/abort operations prepare large documents in batches. Identical identities and batch contents support retries. Order, hashes, and root revisions are checked before a final atomic transaction installs the version.
  • Candidates, parsed archives, and publication state survive checkpoints, WAL recovery, and directory snapshots. Uploads can be inspected or aborted after reopening. Resolve active candidates before dimension migration, with published archives retained in target facts.

See document ingestion for protocols, limits, and examples.

Named graphs, shared members, and independent edges

  • Named graphs have their own identity, metadata, and revision, share database-wide NodeIds, and identify edges by (graph_id, src, dst, label). Nodes and same-key edges participate independently in multiple graphs.
  • Creation, replacement, batch editing, and deletion support revision conditions. Revisions combine a creation UUID and monotonic counter, recreation receives a new identity, and conflicts return TDB_GRAPH_REVISION_MISMATCH.
  • Removing a graph or membership clears its relationships. Deleting a global node atomically clears references across graphs and advances revisions. Mixed node/graph transactions share preflight and WAL boundaries.
  • Explicit scopes support individual graphs, unions, and outgoing traversal. Union nodes deduplicate while independent edges retain identity and stable ordering. Rust Reader, Python graph_request, and Node graphRequest use the same facts and budgets.

See named graphs for identity, revisions, capacity, and persistence.

Unified document and named-graph TQL/Planner

  • The new DOCUMENTS source accepts search, search_vector, or search_hybrid with existing document options. Each hit produces a row containing node _ and document metadata with source revision, group and hit ranks, evidence, term windows, component scores, and actual retrieval settings.
  • Document sources compose with WITH, filters, graph expansion, reranking, aggregation, and pagination. Rows sort by hit score with stable ID ties, while metadata preserves group ranks. similarity(), text_score(), and document.score expose vector, text, and fusion scores respectively.
  • Read-only queries accept GRAPH {graph_ids: [...], include_default: false, expected_revisions: {...}}. MATCH, OPTIONAL MATCH, paths, Expand, and graph algorithms share a request-owned topology view. Same-key edges remain distinct across graphs, and graph_id identifies named edges, with null for the default graph property.
  • Cascades distinguishes text, exact-vector, and ANN document sources and plans graph stages using scoped statistics. EXPLAIN reports source settings, access paths, graph revisions, and scope statistics. EXPLAIN ANALYZE runs the same pipeline and reports observed rows and operators.
  • Prepared queries support scalar parameter leaves in source configuration and preserve required parameter catalogs, first-reference locations, and structured errors. AST, plan, and execute diagnostics use original UTF-8 byte ranges and Unicode-scalar line/column positions.
  • Graph views, documents, projections, and returned values share admission, budgets, and cancellation. MATCH/WITH row limits, RETURN workspace ownership, and direct-executor control propagation are hardened together.

Usage note GRAPH scopes graph matching and operators. Document, text, property, and vector sources generate candidates from their own conditions. Request topology memory grows with selected graphs and metadata. Rust struct literals for TqlQuery and EdgeView require graph_scope and graph_id, using None for defaults. See the TQL reference for syntax and composition.

QuIVer compressed reranking and residency

  • Encodings include existing int8, centered_int8, and centered_int4, with fp32, int8, or int4 query representations. The accuracy preset uses centered INT8 × FP32, and compact uses centered INT4 × FP32. Both support Hot and SSD residency.
  • Encoding, query precision, residency, and cache_bytes are independent settings. Original vectors remain facts, Hot retains compressed rows in memory, and SSD reads rows on demand. Rust exposes generic configuration, search, statistics, and close APIs with compatible INT8 aliases. Python and Node use quiver_request and quiverRequest.
  • Centered encoding persists the shared mean, group parameters, and full reconstruction norm in QVSSD v2. Codec 1 QVSSD v1 uses its existing decoder. Directory, source, encoding, row identity, slot, tombstone, and CRC checks apply at relevant stages, including arbitrary tail dimensions.
  • use_for_ann explicitly selects compressed reranking for ordinary ANN. TQL vector sources identify these scores as Approximate. Default original-vector reranking follows existing query settings.
  • Database Readers share the primary QuIVer route by generation and validate the hot section with fixed streaming workspace, reducing duplicate routing and decoding peaks. routing_shared identifies ownership, with primary routing and ID/slot mappings accounted in the database base heap. Independent Readers own their routes.
  • Complete final-candidate prefetch uses bounded batches of up to 64 rows and coalesces adjacent records and overlapping windows. I/O batching and scoring SIMD dispatch are independent. Full groups use AVX2 on x86_64, with scalar tails and other-platform scoring.
  • Valid persisted routing snapshots restore during opening, validation is reused within that opening operation, and scanned cold-vector pages are reclaimed using platform mechanisms, reducing repeated initialization and unnecessary residency.

Usage note Compressed reranking produces approximate cosine scores. Validate recall and thresholds against application data and settings. Read-only configuration requires matching existing artifacts. FP16 query representation is future work. See QuIVer for fields, presets, and budgets.

SSD I/O, caching, and shutdown

  • .qssd binds facts to a source digest and publication UUID. Publication uses exclusive temporary files, synchronization, atomic replacement, and directory synchronization. Existing Readers retain generation-specific handles. Failures report not_committed or unknown according to the commit point.
  • Ready LRU resizing is byte-based, Pending reads for one row coalesce, and independent row leases retain content and budget. Resizing, transitions, and closure release owned resources, while live leases retain corresponding content and accounting.
  • Windows uses OVERLAPPED/NO_BUFFERING and Linux uses O_DIRECT with kernel AIO, aligned to actual storage and filesystem constraints. Limited capability discovery uses a conservative 64 KiB probe. Each backend reuses up to a 64 KiB read window, reporting actual backends, reads, alignment, and reuse.
  • Hot warming, SSD transitions, builds, and checkpoint refreshes admit transitional peaks before starting. Failures preserve usable state and support retries. Hot completion releases asynchronous I/O backends, and SSD transitions readmit them.
  • Bounded queues drain native I/O and join workers after cancellation, failures, and closure. I/O and CPU pools share Runtime thread limits. Publisher candidates use OS leases so writable operations can reclaim staging files from exited publishers.

Compressed document ANN

  • Document vector and hybrid queries accept rerank="compressed", reusing encoding, query precision, Hot/SSD, and cache settings. original is the default, and document requests select their mode independently.
  • Source, field, metadata, membership, and positional conditions constrain candidates before prefetch and scoring. Expansion targets document-group coverage. Exact and ANN paths report routes, scoring counts, navigation visits, and stop reasons.
  • Hybrid retrieval uses RRF and retains component scores and ranks. retrieval.rerank and nullable retrieval.compression report actual reranking, encoding, query precision, and residency, with evidence feeding citations.
  • Document and Reader workspaces share accounting. Vector changes refresh compressed generations from facts. Budget failures, read errors, and cancellation return temporary resources.

Usage note Compressed document retrieval requires a configured floating-point ANN runtime. Combining exact with compressed reranking returns TDB_INVALID_INPUT. Configure the runtime after reopening. See document vector and hybrid retrieval.

SDK, errors, transactions, and lifecycle hardening

  • SDK adapters own shared handles, request borrowing, language conversion, and error propagation. The storage kernel owns WAL, lock ordering, recovery, draining, and file release. Repeated ownership, callback reentry, and cross-thread contention return stable errors. Admission failures preserve transaction buffers for retry.
  • Rust, Python, Node, and Server share error codes, field locations, schema_version, stage, and write completion states. Constructors, CRUD, retrieval, graphs, text, indexes, Prepared queries, and wrappers provide argument/member diagnostics while retaining host exceptions and original causes.
  • RequestContext propagates identity, cancellation, and deadlines through typed calls, native workers, and custom bridges. Cleanup follows ownership, while request exit and transport delivery report their completion states.
  • Console snapshots and version-guarded transactions share kernel locks. Bounded durable receipts support confirmation after reopening with the complete original request. Conflicts, idempotency mismatches, and unknown writes retain structured status for confirmation.
  • Shutdown drains foreground/background tasks and real I/O, releasing Windows mmap, files, Hooks, and instance quotas. Retained closed objects, snapshots, and row leases follow their ownership contracts, enabling path reuse after the relevant resources release.
  • Parallel document, budget, cancellation, and SSD validation uses isolated ResourceRuntime instances and checks their own ledgers, complete results, and retry behavior.

See kernel SDK, error contracts, embedded Console, and lifecycle/snapshots.

Modular Python and Node bindings

  • Rust bindings live under src/bindings/python/ and src/bindings/nodejs/, divided by arguments, errors, requests, runtimes, databases, records, search, graphs, text, indexes, TQL, transactions, Hooks, maintenance, lifecycle, and snapshots. Entry modules assemble compatible exports.
  • Python uses PyO3 multiple-pymethods for separate method registration. Node centralizes TriviumDB registration so napi-rs 2 implementation blocks contribute to one native constructor and method set. Batch tasks and Hook reference cleanup have dedicated modules.
  • The Python stub generator, .pyi, npm .d.ts, type consumers, and installed artifacts remain synchronized. Installed wheels and npm tarballs validate names, signatures, returns, and lifecycle contracts.

Formats, upgrades, and backups

The current main file is .tdb v13 and WAL is v6, storing document candidates, parsed archives, named graphs, and bounded editing receipts. Main-file readers support v5–v13, while historical WAL uses corresponding decoders. Derived sidecars retain their own format versions, with centered .qssd using QVSSD v2.

  1. Stop writes, close the database, and back up the complete file group, including the main file, WAL, sidecars, manifests, and related files.
  2. Open databases requiring recovery with a 0.9.1 Writer, complete a checkpoint, and configure compressed runtimes as needed.
  3. ReadOnly/Immutable use existing artifacts with physical zero-write semantics. Prepare derived indexes through a writable instance when needed.
  4. Restore generation-consistent file groups. Derived .qssd can rebuild from matching facts. Use pre-upgrade backups when returning to an older kernel.

Reproduction materials and validation scope

The Git-tracked evaluation/ archive contains the ICDE paper, frozen sources, experiment identities, complete tables, and offline data instructions. Run python evaluation/tools/verify_data.py to verify it. Prepare raw vectors and indexes as documented. The Cargo manifest excludes large evaluation materials. Research configurations and production runtimes retain their implementation identities. See the ICDE archive.

Preparation reuses completed Windows validation covering Core, concurrency/fault hooks, document/named-graph TQL, installed Python wheels, Node native modules and npm tarballs, types, and resource lifecycle. Release preparation checks metadata, documentation, package contents, and source provenance. Cross-platform, native I/O, sanitizer, Miri, fuzz, and final-artifact results follow CI/CD records for their actual commits. See testing practices.