Repository navigation
fix(transact): write fidelity, part 2 — one fact identity, microsecond temporals, value reads - #2109
Conversation
This reverts 987a937, "fix(transact): a DELETE can name a stored ill-typed literal", as pushed for review round 1. DELETE DATA and DELETE templates refuse an ill-typed literal ("abc"^^xsd:integer) again, as #1988 left them, so a DELETE template agrees with DELETE WHERE, with a WHERE constant and with a query constant. #1987's test is back as it was. The reverted message overstated what it changed. It said DELETE WHERE templates could name such a literal, but the WHERE half of a DELETE WHERE still lowered strictly and refused it, so a DELETE WHERE naming one failed before that commit and after it. Only DELETE DATA and a DELETE template over an empty WHERE had become lenient. A stored ill-typed literal is removed through a bound variable (FILTER(STR(?o) = "abc")), or replaced by an upsert or a graph sync.
datatypes.md said JSON-LD transactions and SPARQL UPDATE reject a literal that is not a value of its datatype, and that Turtle keeps one. It did not say how to remove one that is stored. A DELETE cannot name it as a constant; it binds it through a variable, with FILTER(STR(?o) = …), or an upsert or a graph sync replaces the property's values. #1987's ill_typed_literals_keep_their_lexical_form already deletes one through a bound variable over an index; a new test replaces one with an upsert, over novelty and once indexed.
…slot One subject holds n values of one predicate (1k/5k/10k/20k by scale) in a bulk-imported ledger, and the measured transaction deletes all of them: a JSON-LD delete naming each value, and a WHERE-witnessed delete on a ledger that stores one list elsewhere, so every row reads its slot for a list position. The other delete and upsert benches put one value in each slot, so a cost that grows with a slot's values times the intents naming it does not show in them. Setup asserts the fixture is indexed and on the intended side of the list gate; each measured delete asserts it retracted all n values.
The binary scan decodes every big number with dt_id = DECIMAL, because it cannot tell an overflow integer from a decimal without decoding. Since #2012, materialize_one_binding takes an overflow integer's datatype from the decoded value (resolve_dt_id_sid_for_value), so a DELETE WHERE over an indexed big integer stages its retraction with the xsd:integer the value is stored with, not as (BigInt, xsd:decimal). That matters to the resolver as well as to the commit. Storage merges ops by index key, so a decimal-typed retraction did remove the value from queries, but the resolver compared it by term and still read the indexed xsd:integer fact as current: an upsert of the same value afterwards restated it and committed nothing. Tests: that DELETE WHERE and upsert, and the datatype the retraction records.
…cts as storage does folded index rows with novelty ops by term. 007aa29 indexed each slot once (SlotMatcher), dropped an index row whose key a novelty op holds, and retracts every list entry holding a witnessed row's term. This replaces that resolver with the one the rest of this PR builds on: the shared fact identity, the value reads and the witness flag. 007aa29's tests pass against it unchanged. - The read merges ops the way storage does before the term fold: per predicate, index key and list position, the newest op wins, and on one t the retraction, for index rows and novelty ops alike (queries over novelty merge by key too, in resolve_overlay_ops). Keys are computed only for the kinds of value whose key two terms can share, named by an exhaustive match beside the key encoding; a read of strings, IRIs or integers computes none. - One DeleteResolver per transaction. A slot with more than 16 facts is read once and grouped once: by term (value, datatype and lowercased tag, hashed; a collision compares terms), by index key when an intent first needs one, and list entries by position. Each intent or row is a lookup. Slots of 16 facts or fewer are scanned. - A witnessed row is matched to the stored facts its decode can be: list entries in slot order, then the plain value, by index key for a kind whose key can merge terms. The k-th identical row of a slot, counted across WHERE batches, takes the k-th of them. A WHERE yields one row per stored fact it matches, so each fact is retracted once, as 007aa29 does; a row past them, from a join repeating rows, takes the last again and the accumulator collapses it. Intents a WHERE does not witness keep their contract: one list entry per distinct DELETE row. Tests: a revert of an indexed big integer written with a subtype, then an upsert that must write it again; an ignored test for what remains between two novelty ops of a sub-microsecond dateTime (closed by the microsecond precision later in this PR); identical rows over ["v", "v", "w"] in one batch and across batches; a value stored as an entry and plain; the first-entry rule for intents not witnessed; the indexed path answering as the scan on a mixed slot and with every term colliding in one hash group; and through the API, a WHERE-matched delete of both shapes empties the slot on SPARQL and JSON-LD, over novelty and indexed.
007aa29 made ADD, COPY and MOVE judge a destination fact the transfer restates as a restatement, so whether a transfer into a graph the identity cannot view succeeds no longer depends on what that graph holds. These tests pin it beyond its own ADD and COPY case: MOVE as well, with the source holding a value the identity may change beside one it may not; and a restated fact the identity can view commits nothing without modify permission, and as root.
An upsert of RDF text scopes its blank nodes by the document's content, so the same document upserted again addresses the same nodes. The identity hashed literals as spelled: `1` and "1"^^xsd:integer, `true` and "true"^^xsd:boolean, @en-us and @en-us, and 1.0 and 1.00 each gave two identities, and a statement written twice counted twice. A re-upsert spelled another way minted new blank nodes and left the old ones. A literal is now hashed as it is stored, on both of the sink's literal paths: its value, its datatype, and its language tag lowercased, as tags compare. A decimal is hashed by value without its trailing zeros, with no allocation when its mantissa fits an i64. A statement written twice counts once. IRIs were already hashed in full however written. Renaming a blank-node label still gives new nodes: making that canonical needs RDF dataset canonicalization, a follow-up. upsert.md and turtle.md say what the identity covers. The identity is computed only where it is used: by an upsert with no caller-supplied skolem scope (parse_rdf_text takes a ContentIdentity), and only for a document with a blank node, the one thing it scopes. Every other lane — insert, sync, the Graph Store routes, the TriG insert fallback — now hashes nothing while it parses. Parse cost, instructions retired over 15 parses of a 220,000-statement document (dev-fast, three interleaved rounds, against the head before this commit): - an upsert of a document with blank nodes: +1.8%, the repeat-once dedup (a sort of one u128 per statement) being most of it; - an upsert of a document without: +0.35%; - every other lane: -12%. insert_formats/upsert_turtle end to end shows no difference within its run-to-run spread (instructions retired over the bench's six cells, three interleaved rounds). Tests: the identity ignores each spelling of a stored literal, a prefixed or full IRI, and a statement written twice, and tells apart another term and a renamed blank-node label; only an upsert computes it, and not for a document without blank nodes.
…eside a new graph 007aa29 stopped a DELETE that names only a graph the ledger lacks from registering it. These tests pin each DELETE form over such a graph (DELETE DATA, WITH, a GRAPH ?g bound to a new IRI), over novelty and indexed; INSERT DATA, CREATE GRAPH and a DELETE/INSERT of the same new graph still register it; and a DELETE-only new graph that sorts first does not shift the id of the graph the same transaction writes, whose value reads back and whose per-graph Reject-mode SHACL override still refuses a violating write (it_config_graph, shacl feature). retractions.md says a DELETE naming a graph the ledger lacks commits nothing.
urn:default names the default graph, so a write naming a graph by it is refused (TransactError::DefaultGraphNameAsGraph). Staging refuses it as a write graph or a sync target, which covers the TriG insert and upsert lanes. The sync and Graph Store routes check a TriG body's blocks against the graph the request targets before staging, and refused a urn:default block as naming another graph than the target, a different message for the same write. The RDF text reader now refuses a block labeled urn:default itself, with the same error, whatever the lane and its target. Test: a TriG insert, a sync payload with the block, a sync targeting urn:default, and a Graph Store insert with the block are each refused with that error and leave the ledger as it was, with no graph registered under that name.
An upsert replaces every value of a (graph, subject, predicate), all languages together: the documented unit. A client that writes one language at a time, such as one prefLabel per language, accumulated languages when a tagged upsert retracted nothing; it now replaces the others with each upsert. upsert.md's language bullet pointed at a FILTER on lang() without showing one. A new "Replacing One Language" section gives the update that does it: DELETE the stored values in one language, INSERT the new one, with the WHERE in an OPTIONAL so the insert happens when that language is not stored yet. Test: the update, read from upsert.md, replaces the French name and keeps the English one, with and without a French name stored, over novelty and indexed.
…s the stored term A DELETE whose template a WHERE triple witnesses retracts each row as the WHERE decoded it, with no read, on a ledger that stores no list position. That row is the stored fact, except for a term in novelty whose index key keeps less than the term: an integer too large for 64 bits written with an XSD subtype, a dateTime or time past the microsecond, or a double with no order-preserving encoding. A query over novelty reads such a term through its key, so the row is the key's decode. Retracted as decoded, it shares the stored term's key: storage merged the two and the value read as gone, but novelty's set-semantics dedup, which compares terms, still held the stored term as asserted and dropped its next assertion. An upsert or insert of the value committed and the value stayed gone until the next index build. Novelty now records whether an assertion it holds keeps less in its key than the term (has_lossy_index_terms, sticky like has_list_meta; checked per assertion as it is applied). While it does, a witnessed row of a kind whose key can merge terms reads its slot, as on a list-bearing ledger, and retracts the stored term its key names. Every other row keeps the fast path. The predicates live in fluree-db-core beside each other: FlakeValue::index_key_loses_detail for a term and FlakeValue::index_key_may_merge_terms for a kind, the latter replacing the query crate's key_may_merge_terms and narrowed to the kinds whose key holds less than the term (big integers, doubles, nulls, dateTimes, times). A key for a kind that needs no predicate id is computed for a predicate the index does not have yet, as queries over novelty key it. Tests: a sub-microsecond dateTime and time, a subtyped big integer whose value the index already holds, and a sub-microsecond dateTime under a predicate the index does not have, matched by a WHERE that binds the predicate, each deleted through its WHERE row and upserted again, survive, before and after the next index build; the predicates' unit tests; novelty sets the flag for a lossy assertion on both apply paths, and not for a retraction or an exact term.
…ay carry The resolver asserts, in debug builds, that a txn-meta entry in a reserved namespace is one the system writes, and its list held f:identity and db:receivedAt. A commit can also carry f:reverts, one per commit a revert undid, and the user claims f:message and f:author, which extract_txn_meta admits in that namespace. An index build over any of them panicked in a debug build. Release builds skip the assertion and index the entries as they should. The list now names all five. Tests: an index build after a revert keeps its f:reverts entry, and one after a commit with f:message and f:author keeps both, each queryable in the txn-meta graph; each panicked in a debug build before this change. The revert test of an indexed big integer now also builds the index after the revert.
The DeleteResolver made a DELETE over a wide slot linear again, but a JSON-LD delete naming every value of one k-value slot still cost 1.20x main's instructions at 5k to 20k values. It reads the slot's stored facts so that each retraction names one, which main never did, and it paid per-fact work around that read. Four cuts: - A slot read from the index alone skips the term fold. Its rows are the index's current facts, one row each in SPOT order, as a range read returns them (whole_graph relies on the same); the fold, a sort and a hashed pass over every fact, runs only when novelty ops join them. - Grouping a wide slot by term no longer compares each group's first fact with itself. - A DELETE intent that names a stored fact by a value written as stored (a string, IRI, integer or boolean) becomes the retraction, taking the fact's graph, datatype, tag and list position, so the stored value is not copied. Other values, which can equal the stored one in another form (a decimal's scale, an instant's offset), still copy the fact. - Consecutive intents of one slot reuse its place without hashing its key again. Instructions in the measured transaction (dev-fast, read in-process, median of 5 fixtures, two interleaved rounds), against main: - a JSON-LD delete of every value of one slot, 5k/10k/20k: 1.20 to 1.11; - a WHERE-matched delete over one slot on a ledger that stores a list: 1.04 to 0.98; - one value per slot, 20k subjects: a WHERE-matched delete unchanged (within 0.5%), an upsert replacing each value 1.7% fewer, from the skipped fold. What remains of the 11% is the read itself: the index scan and each value's decode (about half), grouping the facts by term, and matching each intent. Tests: retract_named gives the stored fact's retraction, from an intent written alike (keeping the stored tag's case and list position) and from a decimal written at another scale; an upsert over an indexed value and a novelty term of its index key retracts one fact, which pins the fold to reads that novelty ops join.
…nteger The transaction WHERE decodes its rows through its single resolved USING/WITH/from graph (6a03e83). The witnessed DELETE lane relies on it twice: it retracts a decoded row in the graph its template writes, and a row of a kind whose key can merge terms is matched to the stored term by its index key in that graph. Both graphs hold an integer too large for 64 bits under one predicate, at the same per-graph arena handle. The first delete reads the named graph's value from the index alone, so the WHERE decodes it. The named graph then gets the value written with an XSD subtype in novelty, which the WHERE reads through the index's key, and a second delete removes it. Through WITH, USING, and JSON-LD graph and from, the test checks that the witnessed lane ran, that the named graph's values are gone and the default graph's is kept, and that an upsert writes the subtyped value again, before and after the next index build.
…es once from text Earlier versions upserted Turtle by converting it to JSON-LD and scoped its blank nodes by the converted document; RDF text is now scoped by its parsed statements. The test upserts a document the earlier way, then from text: the first upsert from text mints the blank nodes again and the same upsert after it commits nothing. The documented orphan query lists the earlier nodes, whose ids share one scope the current nodes do not, and deleting each by its stable id leaves the current nodes intact.
…t those values A DELETE intent is matched against the stored facts of its slot, so naming one value of a k-value slot read and decoded all k facts: one value of a 20,000-value slot cost 1.82x main's instructions. A slot whose intents in a batch are plain strings or references, none of them witnessed, is now read only for the values they name when the slot is wide enough for that to pay: per value, the index rows of (s, p, value) and the novelty ops in its bounds. The index keys those kinds by one dictionary id per term (IRI_REF, which blank nodes share, and XSD_STRING), so the read returns exactly the facts that hold the value, in slot order, and matching names what reading the slot would. Facts read this way are not the slot and are not kept as a wide slot for later batches. Tagged and otherwise typed strings, numbers, the kinds whose index key can merge terms, and witnessed rows read the slot as before. A value read costs a dictionary lookup and a seek, about what reading ten facts of a slot costs (measured over deletes naming 1 to 32 values of slots of 1 to 20,000 values). So a slot is read by value when its intents times 10 is at most its expected width: the predicate's current facts over its distinct subjects, from the index's statistics for the graph. With no index row of the predicate possible, a value read is a narrower seek into novelty, and one intent takes it; with an index but no statistics, the slot is read. A batch that reads a slot stamps `delete_point_read`. Instructions in the measured transaction (dev-fast, median of 5 fixtures, two interleaved rounds, load 5 to 8), against main and against the head before this commit: - one value of a slot of 1k, 5k and 20k values: 1.09x main (1.34x, 1.65x and 1.85x before); - 8 and 32 values of a 20k-value slot: 1.09x and 1.11x main (1.86x and 1.85x before); - deletes that still read the slot (one or more values of each of 2,000 slots of 1 to 16 values, more values than a slot's bound): within 0.35% of before; - a delete of every value of a wide slot, a WHERE-matched delete on a ledger that stores a list, and the narrow delete and upsert: within 0.4% of before. Tests: over novelty, read by one walk and by seeks, value reads answer as slot reads do (a tagged and a typed twin, list repeats, retracted and restored values, references, a blank node, a named graph, absent values; every batching, and a slot held as wide by an earlier batch), and are not kept as the slot; witnessed rows read their slot even when one row names it. On indexed and novelty-over-index ledgers, deleting each of those values alone and beside four absent values leaves the same facts. The routing stamp proceeds for a few values of a wide slot and falls back for more values, a tagged value and a narrow slot.
…index
A push checks each retraction in a pushed commit against the target's
current state and rejects the commit when one names no stored fact. The
check range-read the slot and kept the rows whose graph equalled the
retraction's, but index rows come back without their graph, so once a
target had indexed a named graph, every retraction in it was rejected
("retract targets non-existent assertion"). It also compared datatypes
exactly, so once indexed, a big integer written with an XSD subtype,
which the index stores without it, could not be retracted by a push.
The check now reads the slot through CurrentFacts, which stamps the
graph, and accepts a retraction that names a current fact by its term
and metadata or, for a kind whose index key can merge terms, by that key
and list position, which storage resolves as the same fact
(CurrentFacts::holds).
Tests: on a target that indexed the first of two pushed commits, the
second commit's retraction is accepted and replaces the value, in a
named graph and for a subtyped big integer; both fail before the change.
holds names a stored fact by its term and metadata, and not an absent or
retracted value, nor a stored one under another tag or list position.
… a rollback A Transaction stages its operations again on a rollback. A Turtle upsert names its blank nodes from the document's statements, so staging it again, and committing it, keeps the nodes the caller already read, as a_rollback_keeps_the_blank_nodes_staged_before_it pins for a JSON-LD insert.
…eeps A ';'-separated update (and a Cypher sequential write, and a Transaction) folds its operations' flakes per fact and drops a fact a later operation reversed. The fold told facts apart by term, but storage tells a value whose index key can merge terms (a big integer with an XSD subtype, a dateTime past the microsecond) by that key and list position, so on an indexed ledger: - DELETE x ; INSERT x retracted the term the index stores and asserted the term as written: two facts to the fold, one key to storage, which resolves the pair on one t as the retraction. The value was lost. - INSERT x ; DELETE x asked whether the base held the written term, got no (the index holds the value with less detail), and dropped the retraction. The value stayed. The fold now keys such a value by its index key and list position, the reversal check asks the base through CurrentFacts::named_by by the same identity, and a retraction that stays names the fact as stored. Other values fold by term as before, and single-operation staging is unchanged.
Storage tells a value whose index key can merge terms (a big integer with
an XSD subtype, a dateTime or time past the microsecond) apart by that key
and list position, and resolves a retraction and an assertion of one fact
at one t as the retraction. A DELETE names such a value as the index
stores it, so on an indexed ledger one write that deleted it and wrote it
again as written (DELETE { x } INSERT { x } WHERE {}, its JSON-LD twin, an
identical upsert or graph sync) staged a retraction of the stored term and
an assertion of the written one. The accumulator cancelled by term, both
committed, and the value was lost.
FactIdentity (and FactTerm) is now the one rule for when two facts are the
same: an operation that both retracts and asserts keys such a value in its
accumulator by index key and list position, the sequential fold keys by
it, and CurrentFacts::named_by matches by it. Other values are told apart
by term as before. The graph-id and slot lookups move into transact
(graph_id_in, Slot::in_ledger).
Push validation asked CurrentFacts whether each retraction of a pushed commit names a stored fact, one call per retraction, and each call read the retraction's whole (subject, predicate) slot: a commit retracting k values of one n-value slot cost k slot reads, O(k·n). The multi-operation fold's reversal check did the same for each fact a later operation reversed. CurrentFacts::named_by now takes every (slot, flake) at once, reads each distinct slot once and matches each item against the slot's facts by hash on its FactIdentity: one read per slot and O(k + n) matching. Push validation and the fold ask it once. CurrentFacts::holds is gone.
point_values kept each slot's distinct values with Vec::contains, which is quadratic in the values one slot is named by. The bound lets that reach a tenth of the slot's width, so a delete naming 100k values of a 1M-value slot compared values 5 billion times. A set of (slot, value) keeps the first-seen order at one hash probe per intent.
…mits A DELETE naming m values of a slot whose expected width is k read them by value when m * 10 <= k. The constant was fitted on m <= 32. Measured over m up to k / 2 with each read forced, value reads cost as much as the slot read at m = k / 12.2 to k / 13.5 when the values lie close together in the slot (k from 1,000 to 100,000, in instructions and wall time alike), and at k / 19 to k / 21 when they are spread over it (every seventh value, wall time). Near the old bound they cost up to 10% more than the slot read. At m * 16 <= k they cost 6 to 7% less when the values lie together and 5 to 7% more when spread; 20 would make the spread case even and cost up to 12% on the other. The bound's width is the predicate's average over its subjects; the doc now says so, and that a wrong guess costs time, never results.
…no-op
Since an operation tells facts apart the way storage does, an upsert or a
graph sync that restates a big integer written with an XSD subtype, or a
dateTime or time past the microsecond, cancels against its stored fact on
an indexed ledger, and DELETE { x } INSERT { x } WHERE {} of one commits
nothing, as retractions.md says of any present value. upsert.md drops the
exception for those values. One remains, for a sub-microsecond temporal
re-upserted after a ledger that was never indexed is reloaded.
… less detail The two tests that documented this as a known exception, ignored until a fix landed, now pass: an indexed big integer typed with an XSD subtype and a dateTime past the microsecond survive an identical re-upsert, since the upsert's retraction of the stored value and its assertion of the written one are one fact to the operation, as to storage.
Its unit test named facts of one slot only. It now interleaves items of a second slot: a value of that slot is named, and a value only the first slot holds is not.
A commit writes a dateTime or time with six fractional digits and the index keys microseconds, but a value read with more kept them in memory: in the novelty of the process that wrote it, in a DELETE intent and in a query constant. So one literal named one value before a reload and another after. On a ledger never indexed, a DELETE DATA naming such a value as written committed nothing after a restart, and an identical re-upsert after a restart read as gone until the next index build; a query constant written past the microsecond never matched the stored value. DateTime::from_instant and Time::from_naive, which every constructor goes through, now drop the digits past the microsecond as the commit and the index do. The value written is then the value stored on every write lane, and a query constant is read the same way. A dateTime or time no longer holds more than its index key, so index_key_may_merge_terms and index_key_loses_detail drop them. datatypes.md and compatibility.md say so, and upsert.md's last exception goes.
The shared fact identity keyed a big integer by its persisted index key, which exists only once the `(graph, predicate)` arena holds the value. A value first written since the last index build was told apart by term, but the next build gives it a handle by value, whatever its XSD subtype. So one operation that retracted it under one subtype and asserted it under another committed both flakes at one `t`, and the build resolved them as one fact, retracted. An integer too large for 64 bits is now keyed by its value and list position (`FactKey::BigInt`), which is a function of the term: the accumulator, the multi-op fold and `named_by` agree with the index before it has seen the value, and on a ledger with no index yet. Other kinds keep their persisted key (`FactKey::Index`). `named_by` matches an item by term first, so of two terms of one value that novelty holds side by side, an item naming one exactly names that one.
The shared fact identity keys a double or a big integer by key and list position. A list holding one such value twice, indexed or not, loses both entries to one write that retracts the value and asserts something else, and keeps the third entry through the next index build.
`DateTime` and `Time` derived `Deserialize`, which built the field directly and was the one way in that skipped `from_instant` / `from_naive`. Both now read their serialized form through those constructors, so every value is held to the microsecond however it is made. The serialized form is unchanged.
…ex key `FactIdentity::of_flake` resolved the flake's graph (for a named graph a `decode_sid`, a string build and a registry lookup) before asking whether the value has an index key at all. The multi-operation fold calls it for every flake of every operation, strings and references included. The graph is now resolved lazily, after the kind check, and not for a big integer either, which is keyed by value. Behavior is unchanged.
The graph-transfer verbs compared the source's facts with the destination's by term (`flake_content`). A big integer is one fact per value to storage, whatever XSD subtype it carries, and the index decodes it under another term than novelty holds. So when the destination held the value in its index and the source held it since the last build, COPY and MOVE retracted the destination's term and asserted the source's at one `t`, storage kept the retraction, and the destination lost the value, after the write and after the next index build. ADD in the other direction asserted a second term beside the stored one. The transfer now keys every fact it compares (destination contents, re-homed source facts, the restatements judged under a policy, and the edge-annotation signatures) by subject, predicate and `FactIdentity` in the destination graph, through a new `FactIdentity::in_graph`. A fact both graphs hold is left in place. `a_transfer_keeps_a_value_both_graphs_hold`: ADD, COPY and MOVE of a subtyped big integer (same and different subtype), a dateTime past the microsecond and a string, indexed destination with a novelty source and the reverse, into a named graph and the default graph, read in process, reloaded and after the next index build.
…ng too
A dateTime or time constant past the microsecond was held to it for
equality but ordered by every digit, through a rewrite of the comparison
in the SPARQL and Cypher lowerings (`Function::against_digits_past_micros`)
and an every-digit ordering of a plain string (`cmp_lexical`). Two rules
could then disagree: a stored value was `=` a constant and `<` it, a
client that wrote a nine-digit timestamp and paged with `>=` on it missed
its own record, a constant bound through `BIND` or `VALUES` answered
differently from the same constant inline, and the rewrite assumed the
other operand sat on a microsecond, which a plain string ordered against
the constant does not.
A constant is now held to the microsecond like every value, for ordering
as well as equality, so exactly one of `<`, `=` and `>` holds. The
rewrite, its two call sites, `digits_past_micros`, `against_every_digit`
and `cmp_lexical` are removed; `cmp_with_lexical` reads a string as a
value of the temporal's kind, as it already did for dates and the
Gregorian kinds.
Tests replace the every-digit ones: `<`, `<=`, `=`, `>=`, `>` against
constants at, past and either side of the stored microsecond, as a typed
literal, a cast, on the left, through `BIND` and `VALUES` (SPARQL), as a
string and through `values` (JSON-LD), and as Cypher `datetime()` and
`time()`, including a constant equal to the value written ("…123456789Z")
under `>=`; a plain string against a constant past the microsecond, both
ways round. compatibility.md and datatypes.md describe the one rule.
Merge and revert fold a range of commits into one net change per fact (`NetChangeAccumulator`), keyed by term. An integer too large for 64 bits is one stored fact whatever XSD subtype it is written with, so a range that deleted it under one subtype and wrote it under another replayed as a retraction of one term and an assertion of the other at one `t`, and storage kept the retraction: reverting `DELETE x^^integer` and `INSERT x^^nonNegativeInteger` lost the value on an indexed ledger, and merging a branch that ended by writing it lost it at the next index build. `main` loses it in both. The net change is now keyed by value for such an integer (`FlakeValue::index_keys_by_value`, which `FactIdentity` uses too), so the range nets to that fact's last op. The change is then named as the target stores it, for the kinds of value whose index key two terms can share: an assertion of a fact the target holds is dropped as a restatement, and a retraction is renamed to the stored fact, or dropped when the target holds none. `merge_and_revert_keep_a_big_integer_written_under_another_subtype`: revert and non-fast-forward merge, on an indexed and a never-indexed ledger, read after the write and after the next build.
A write-verb policy (`f:create` / `f:update` / `f:delete`) classifies a subject that a transaction only retracts from as deleted when every fact the pre-state read returns is retracted. That check compared each pre-state fact with the retractions by term. But a retraction names a fact as the stored-fact read resolves it, which can be another term of the same stored fact than the raw pre-state read returns: on an indexed ledger holding `x^^xsd:integer`, with `x^^xsd:nonNegativeInteger` written since the build, the read returns the `integer` term and the removal retracts the `nonNegativeInteger` one. So removing every fact of the subject was classified as an update: a delete-only grant refused it, and an update-only grant let it through. The check now compares by predicate and `FactIdentity`, in the graph the subject is classified in, as the accumulator, the fold, `named_by` and ADD/COPY/MOVE do. The retractions are a set, so the check is linear in the subject's facts rather than their product. `a_full_removal_is_a_delete_whichever_term_names_a_fact`: SPARQL and JSON-LD, indexed and never indexed, under a delete-only and an update-only grant, with a language-tagged value and a list beside the big integer.
`a_transfer_keeps_a_value_both_graphs_hold` failed in CI on a MOVE whose source was written since the destination's build: the source read back its moved value after a reload. `FlureeBuilder::file` starts a background indexer, which can run an incremental build between the transfer and the read, and an incremental build brings back a fact inserted and retracted since its base in a graph the base holds nothing for (#2118, a separate fix). The read before any build is right. Every instance in this PR's file-backed transfer, merge/revert, multi-op and temporal-ordering tests is now built `without_indexing()`, and the tests build the index themselves. The transfer test reads with no build since the transfer, after an incremental build, and after a full rebuild. After the incremental build it reads the source only where #2118 cannot reach it (any verb but a MOVE out of a graph written since the base), and after the full rebuild it reads both. The full rebuild after an incremental one is published through `Fluree::reindex`. `publish_index` declines an index whose `t` is not newer than the published one, so the rebuild the multi-op test ran after its incremental build was never published, and its "after a rebuild" read repeated the incremental one.
…ands A plain string compared with a temporal value is ordered as the temporal it reads as, held to the microsecond, but it is not value-equal to one, as on earlier versions. So a string that orders equal to a temporal satisfies `<=` and `>=` but need not satisfy `=`, and the paragraph now states its trichotomy for typed temporal operands only.
Brings in 57bf7a9 (#2120, #2009). Two conflicts: - fluree-db-api/src/commit_transfer.rs: #2009 routes a push's graphs to the ids the ledger's graph registry gives them. The push's retraction check reads its slots through that routing as it is; only the routing struct's doc comment conflicted, and main's is kept. - fluree-db-transact/src/parse/jsonld.rs: #2009 reworks JSON-LD graph scoping, and carries the delete templates' `ill_typed_as_stored` that this branch reverts (call 2, aa1b3e6). Main's file is kept and the revert applied to it again: a delete template refuses an ill-typed literal, as #1988 had it.
Call 2 reverted the delete templates' lenient reading of an ill-typed literal (aa1b3e6), and `sparql_update_rejects_ill_typed_literal` pins the refusal on SPARQL. Nothing pinned it on JSON-LD, where `main` still carries the lenient reading: a merge that kept it would have passed every test. `jsonld_transactions_reject_ill_typed_literal`: a JSON-LD insert, a delete, and a delete with a `where` each refuse `"1990-00-00"^^xsd:date` written as a constant, with a Turtle write having stored that literal. With `main`'s parser the delete retracts it instead.
|
Thanks for this one too. COPY/MOVE reproduced on That test was also why CI went red on I also went back through the other term comparisons on the write side. The class turned out to have a fifth site, merge and revert, which net a range of commits per fact by term ( On the kinds that need the target's index there: doubles don't lose anything, since The last one was |
…every term of it A DELETE intent (a `DELETE DATA` or template constant) names the stored fact of its slot by term, else by index key. The key fallback named only a fact whose surviving op was read from the index, and only through a key the persisted index holds. Both disagree with `FactIdentity`, which every other part of staging names a fact by: a big integer is one fact per value, whatever XSD subtype each term carries, indexed or not. So, for an integer too large for 64 bits: - with the index holding `x^^xsd:integer` and novelty a later `x^^xsd:nonNegativeInteger`, the two merge into one stored fact whose surviving op came from novelty, and `DELETE DATA x^^xsd:integer` named nothing. `INSERT DATA x^^nonNegativeInteger ; DELETE DATA x^^integer` kept the value, as one request or as two; - on a ledger never indexed, a delete under one subtype of a value novelty holds under another named nothing: `INSERT DATA x^^integer ; DELETE DATA x^^nonNegativeInteger` kept it even after the next build; - novelty holds the subtypes of one value apart until the next build, and a delete retracted only the term it named, so the value read as present until the build and absent after it. `SlotFacts::named` now names a big integer by value and any other kind whose key can merge terms by its persisted key, whichever op of the fact survived, as `CurrentFacts::named_by` and witnessed rows do. The intent retracts the fact it names and every other term novelty holds of it at the same list position. `a_multi_op_update_ends_where_its_last_op_leaves_a_value` now covers every one- and two-op sequence over the stored spelling and another, every three-op sequence whose first and last ops spell the value differently, and the longer ones it had, each for a base without the value, with it in novelty and with it indexed, for a subtyped big integer and a dateTime past the microsecond. The one- and two-op sequences also run as one request per op. Each case is read in process, reloaded, after an incremental build and after a full rebuild.
… of a fact Novelty holds the XSD subtypes of one big integer apart until the next index build: on a ledger never indexed, `x^^xsd:integer` and a later `x^^xsd:nonNegativeInteger` are both current terms of one stored fact. Two places named such a fact through `CurrentFacts::named_by`, which answers one term, and retracted only that one: - the multi-operation fold, which keys facts by identity and so folds the retractions of several terms into one entry. `INSERT DATA x^^integer ; DELETE DATA x^^nonNegativeInteger` over such a base retracted one term, and the value read as present until the next build and absent after it; - merge and revert (`as_stored`), whose net retraction of such a value retracted one term the same way. `CurrentFacts::all_named_by` answers every current term of each item's fact, its own term first; `named_by` is its first answer. The fold asks it for every fact whose first and last ops differ, and for every retraction of a big integer, and retracts each term the base holds; merge and revert retract each term the target holds. `a_multi_op_update_ends_where_its_last_op_leaves_a_value` also starts from a ledger whose novelty holds the value under two subtypes and from one whose index holds it and whose novelty holds a later subtype. `merge_and_revert_keep_a_big_integer_written_under_another_subtype` reverts both writes of a value novelty holds under two subtypes.
The extended `a_multi_op_update_ends_where_its_last_op_leaves_a_value` ran about 590 cases in one test, 158–326 s on a loaded machine, against nextest's 360 s terminate-after. It is now one test per base state and value kind (eight, each about 60 cases) through `multi_op_last_op_matrix(base, kind)`, so they run in parallel. The dateTime kind runs on the three bases that hold one spelling: its spellings are one term once read, so the two bases holding a second spelling repeat them.
… per item `a89bf9e30` made `CurrentFacts::named_by` the first answer of `all_named_by`, which indexed each slot's facts by identity key with a vector per key. So every fact of a kind whose key can merge terms (a double, a big integer) cost one more allocation whenever its slot was named, and `named_by`, which push validation runs for every pushed retraction, went through it. `f0ee77742` also grew `SlotFacts` by an inline `Groups` that most slots never build, and every slot a DELETE batch reads carries it. Each slot is now indexed by its first fact per key, with a chain to the next, allocated only when two terms of one fact are current (novelty holding one big integer under two subtypes). `named_by` answers from that without collecting, and `all_named_by` walks the chain. `SlotFacts` boxes its by-value groups. Against `3ebb552b5` (release; retired instructions and allocations per write, 7 runs in each of 2 interleaved rounds): a multi-operation delete of 600 strings and references over 600 slots allocated 33.6 KB more before this and is at parity after; one reversing 300 doubles made 301 more allocations before and is at parity after.
|
A gap turned up after this went up for review, so I've folded in a fix: the fold's cross-spelling case. Widening the test turned up the rest of that class. On a ledger with no index, a big integer had no key to be named by at all. And novelty holds two subtypes of one value apart until the next build, so a delete that retracted only the term it named left the value present until the build and gone after it.
The multi-op test, now eight tests under |
…ferences Brings in #2137, #2118 and #2109. The one conflict is stage.rs's fluree_db_core import: #2109 dropped `FlakeMeta` from it, and this branch added the dataset-reference types. #2109's FactIdentity DELETE naming and fold, and this branch's typed graph resolution for USING / WITH and the write table, sit in separate hunks and merge as both wrote them.
Brings main since 1888006 onto next, #2109 and #2118 among it. Resolved: - template_sink: main's statement hashes for the content identity, with next's rdf:reifies link and its datatype check; no bundle templates. - incremental: main's Phase2Route (a leafless branch is built fresh, the fresh builder keeps in-window history, an empty fresh branch is not published) on next's storage handle, without cache_dir. - build_from_commits tests: main's helpers with next's term fields. - commit_transfer, rebase: the imports both sides still use. - test support: main's publish_built_index, publishing allow-equal under the ledger's fence; its callers take main's side. Ported to next: - index_key_may_merge_terms answers for a triple term: its key merges two terms only through its object's. - The SPARQL triple-term literal drops IllTyped, which main removed; it refuses an ill-typed literal, as it did. - Main's new tests read a ledger's store through its storage namespace, await the async genesis_ledger, and the ill-typed upsert test names a ledger per iteration rather than a branch.
The parent now carries main 4a0d14a (#2109, #2118, #2133). Four files conflicted: - temporal.rs: main's `cmp_with_lexical` body is the one this branch already had (#2109's); the two docs are merged, so it says both that a dateTime or time lexical is held to the microsecond and that the evaluator and the bounds pass it only a plain xsd:string. `lexical_as_kind_of` stays, over the same parse functions. - query_bounds.rs: this branch's string-vs-temporal arm (the plain-string guard and the per-kind parse cache) replaces main's simplified one, which called `cmp_with_lexical` with no guard. `string_bound_otypes` stays. - eval/compare.rs: the plain-string guard stays on the evaluator's coercion. - binary_history.rs: main's shared object check (#2133) is kept, with the term-aware `matches(&f.o, &f.dt)`; this branch's separate bound test in the novelty walk is dropped, as the shared check covers both lanes.
#2008 merged from its first-round head plus
007aa2983. This PR brings the rest of its review rounds, reconciled with007aa2983. It fixes a class of silent value loss that the merge left onmain, and it removes a per-delete cost that #2008 added.Partially addresses #2087: a delete naming a few values of a wide slot now reads just those values. The constant-object DELETE over many subjects still reads one slot per subject.
Partially addresses #2090: an identical re-upsert or re-sync keeps a value stored with less detail than written, and a
dateTimeortimeis held to the microsecond, query constants included, for equality and ordering alike. Novelty's term-keyed dedup, #2027's subtype in the index,BIND's integer datatype,-0.0/"1.50"after indexing andxsd:floatprecision remain.Why: what
mainloses todayOn
main(c5874d586), a write that retracts a stored value and asserts the same value commits both, if the index keeps less of the value than the write carries:dateTimeortimepast the microsecond.They commit at one
t, and storage resolves them as the retraction. The value is gone after the write and stays gone after the next index build.This hits
DELETE { x } INSERT { x } WHERE {}, its JSON-LD twin,Transactiondelete-then-insert, andDELETE DATA x ; INSERT DATA x, on indexed and partly indexed ledgers. It also hits an identical upsert or sync of such a value. Measured with a 420-case probe of restating writes (lanes × value kinds × index states × graphs):mainbefore fix(transact): retractions name stored facts; RDF text is parsed once #2008 kept.Three more operations lose a big integer with an XSD subtype the same way:
COPYandMOVEonto a graph that holds it in its index, from a graph that holds it since the last build; and a revert or a non-fast-forward merge of a range that deletes it under one subtype and writes it under another, on an indexed ledger (a revert at once, a merge at the next build; checked onmainat57bf7a944).A
DELETE DATAof a sub-µsdateTimeortimeon a ledger never indexed does nothing once the ledger has been reloaded. Before #2008 it deleted.A delete naming one value of a wide slot reads the whole slot: 3.9 / 16 / 65 / 127 ms at 1k / 5k / 20k / 40k values (debug build).
What changes
f7151f883,4f7550181,7423627e6,233d0941b,bb24623e4,f240eb7fd,a3596467d,1ea595170,af53c8110,ddd9bbee9,8960668d1,59e86424b,f0ee77742,a89bf9e30FactIdentityis the one rule for when two facts are the same, and it is how storage keeps them. A big integer is one fact per value and list position. A kind whose index key can merge terms is one fact per key and list position. Every other value is its term. It is used in seven places: the accumulator of an operation that both retracts and asserts; the multi-operation fold; the DELETE resolver, which names the stored fact aDELETE DATAor template constant retracts;CurrentFacts::named_by; ADD/COPY/MOVE, which compare the source's facts with the destination's by identity in the destination graph (FactIdentity::in_graph); merge and revert, which net a range of commits with a big integer keyed by value and then name the net change as the target stores it; and a write-verb policy's check that a retract-only subject is fully removed. So a restating write commits nothing and keeps the value; an identical upsert or sync is a no-op;INSERT x ; DELETE xdeletes; and a transfer leaves a fact both graphs hold in place. In the fold, a fact whose first and last ops are both retractions keeps its first retraction, which was staged against the base and names the fact as stored. A DELETE names a fact by its identity whichever op of it survived, read from the index or from novelty, a big integer by value whether indexed or not (f0ee77742); novelty holds the subtypes of one big integer apart until the next build, so a retraction of the fact retracts every term the base holds of it, in the resolver, the fold and merge/revert (a89bf9e30,CurrentFacts::all_named_by). The write-verb check (59e86424b) closes a regression from earlier rounds of this branch, not one onmain: once a retraction names a fact as storage holds it, comparing it with the pre-state read by term called a full removal on an indexed ledger an update.18c200200,140717905,26d2be888,1c3740dbc,b70bee8cc,dfaaa858e,25cdfe4d4dateTimeortimeis held to the microsecond the commit writes and the index keys, from the moment it is read: every write lane, a query constant, deserialization. A query constant past the microsecond compares as the value written with it, for equality and ordering alike, so exactly one of<,=and>holds against a stored value, a constant inline answers as one bound throughBINDorVALUES, and>=on a timestamp a client wrote with nine digits finds its record. A plain string compared with a temporal value is read to the microsecond too. It is not value-equal to one, as onmain, so the docs state that trichotomy for typed temporal operands only. (dfaaa858ereplaces26d2be888's every-digit ordering, as decided in review.) Iceberg nanosecond timestamps round down to the microsecond. A table timestamp before 1970 renders on its own day.ba07c214db146d1098,3eace56c1,b65e4a63b,dab422f84,d01072aeb73e28b254,cf4522b22,79fa40f00±INFand NaN, so novelty holding one no longer makes a delete read its slot. This replaces007aa2983'sSlotMatcher; see Reconciliation.a8bd0cfbb,40f481de41and"1"^^xsd:integerare one statement, a tag in any case is one, and a statement written twice counts once. AGRAPH <urn:default>block gets theurn:defaultrefusal on every lane.aa1b3e6be,e4fd65f67,3ebb552b53ebb552b5adds the JSON-LD twin of SPARQL's test for it.9b7cc1a0e,44d5f4bef,4984d1d6b,e3de4b1acf:reverts,f:messageandf:author; an index build over such a commit panicked in debug builds.upsert.mdshows how to replace one language.FactIdentityresolves a fact's graph only for a value with an index key, so the fold no longer decodes the graph of every string and reference.e3de4b1acnames every term of a fact without allocating a vector per identity key or per item.898b2ccbb,ce9e6c197,edea2bdf5,8698db279,7e0b63aae,2446d0fca,43c2bb253,18369233emain's code wheremainhas the fix.43c2bb253makes the index state at every read of this PR's file-backed tests the test's own (see Tests).18369233esplits the multi-op matrix into one test per base state and value kind, so they run in parallel.Reconciliation with
007aa2983007aa2983answered the same first-round review items independently. Per item:main'sfluree syncfallback on the v4.2.0/4.2.1 400main'smain'sadd_copy_and_move_are_refused_regardless_of_destination_contents).main'smain's keeps the routing consistent, which this PR's per-graph SHACL test (shacl_per_graph_mode_reaches_a_new_graph_beside_one_only_deleted_from) confirms.it_join_batched_overlaymain's007aa2983added passes against it unchanged:a_reverted_indexed_big_integer_can_be_written_again,a_where_driven_delete_removes_every_identical_list_entry,a_delete_in_a_new_graph_commits_nothingand the transfer tests. A witnessed row comes from one stored fact, so rows and facts match one to one; a repeated row retracts each fact once.maindocuments a spelling-sensitive identity. This makes it spelling-insensitive, which changes which documents re-mint (see Upgrade notes).DELETE DATAmainkeeps the first-round behavior and documents it indatatypes.md; the review's ruling on call 2 was the strict refusal, so this PR reverts it anddatatypes.mdshows the removal through a variable.it_delete_stored_facts.rs007aa2983placed the transfer test's doc paragraph underrestating_a_viewable_value_commits_nothing_without_modify.Behavior changes against
mainmainDELETE { x } INSERT { x }(SPARQL, JSON-LD,Transaction) orDELETE DATA x ; INSERT DATA x, where x is a big integer with an XSD subtype or adateTime/timepast the µs, on an indexed ledgerCOPY/MOVEwhere the destination holds a subtyped big integer in its index and the source holds it since the last buildADDwhere the source holds a subtyped big integer in its index and the destination holds it since the last buildINSERT x ; DELETE xof such a value, the two spelled alike or under different subtypesDELETE DATAof a big integer under one subtype where the ledger holds it under another, not yet indexed or indexed with a later subtype in noveltyDELETE DATAof a sub-µsdateTimeortimeafter a reloaddateTimeortimewritten past the microsecond=never matches a stored value;<,>order by every digit=,<,>(and<=,>=,VALUES, a pattern's object) compare against the value held to the µsdateTime/timeconstant past the microsecondDELETE DATAof an ill-typed literalUpgrade notes
dateTimeortimewith more than six fractional digits reads back, and compares, with six. That includes a query constant:>=the nine-digit constant a value was written with now finds it. Applications that need more should store it as its own property.1against"1"^^xsd:integer, tag case, a statement written twice) mint their blank nodes once more on the first upsert after upgrading; later upserts of the same document commit nothing. The orphan query inturtle.mdlists the earlier nodes.Tests, non-vacuity, gates
Tests (new, besides those
007aa2983added, which pass unchanged):a_write_that_restates_a_stored_value_keeps_it: seven lanes (SPARQL and JSON-LD delete-and-insert in the default and a named graph, JSON-LD and Turtle upsert, graph sync) × five values × index-only and index-plus-novelty slots, read after the write and after the next index build.a_multi_op_update_ends_where_its_last_op_leaves_a_valueand its seven siblings (one test per base state and value kind, throughmulti_op_last_op_matrix): every one- and two-op sequence over the stored spelling and another, every three-op sequence whose first and last ops spell the value differently, and the longer ones, × five base states (the value absent, in novelty, indexed, held in novelty under two subtypes, and indexed with a later subtype in novelty) × a subtyped big integer and (on the first three bases) adateTimepast the microsecond; the one- and two-op sequences also run as one request per op. Each case is read in process, reloaded, after an incremental build and after a full rebuild.a_transfer_keeps_a_value_both_graphs_hold: ADD, COPY and MOVE × a big integer under the same and another subtype, adateTimepast the microsecond and a string × an indexed destination with a novelty source and the reverse × a named and the default graph. The destination is read in process, reloaded, after an incremental build and after a full rebuild; the source reloaded and after the full rebuild, and after the incremental build wherever an incremental build can't bring back a deleted fact (not after a MOVE out of a graph first written since the base; that is fixed separately in fix(indexer): a fact deleted before an incremental build stays deleted in a graph new to the index #2118).merge_and_revert_keep_a_big_integer_written_under_another_subtype: revert and a non-fast-forward merge, on an indexed and a never-indexed ledger, and a revert of both writes of a value novelty holds under two subtypes, read after the write and after the next build.a_full_removal_is_a_delete_whichever_term_names_a_fact: a write-verb policy with a delete-only and an update-only grant, a full removal on SPARQL and JSON-LD, indexed and never indexed, with a language-tagged value and a list beside the big integer.multi_op_reversal_nets_a_value_the_index_keeps_less_of,changing_a_big_integers_subtype_keeps_it(four index states × three lanes),a_write_retracting_a_value_a_list_holds_twice_retracts_both_entries, the two identical re-upsert tests (un-ignored), andnamed_byunit tests.a_push_retracts_values_the_target_holds_in_its_index(a named graph, a subtyped big integer).jsonld_transactions_reject_ill_typed_literal: a JSON-LD insert, delete, and delete with awhererefuse an ill-typed literal, beside SPARQL'ssparql_update_rejects_ill_typed_literal.it_temporal_storage_precision: every write lane (JSON-LD, SPARQL, Turtle and TriG insert and upsert, graph sync, Cypher,Transaction, push, bulk import) before and after a reload; aDELETE DATAas written; query constants in process, reloaded and indexed;<,<=,=,>=,>against constants at, past and either side of the stored microsecond, inline, cast, on the left and throughBIND/VALUES(SPARQL), as a string and throughvalues(JSON-LD), and as Cypherdatetime()/time(), including>=on the nine-digit constant the value was written with; a plain string against a constant past the microsecond, both ways round.it_delete_point_reads: value reads stamped byDELETE_POINT_READ_SITEand checked against the slot read.a_lexical_is_ordered_as_the_value_it_is_held_as), net-change keying (a_big_integer_nets_by_value_across_subtypes), both Iceberg readers, the R2RML timestamp rendering, and a double's index key (no_double_loses_detail_to_its_index_key, anda_lossy_term_assertion_sets_the_flagover±INFand NaN). Atransact_delete_wide_slotbench.This PR's file-backed tests run without the background indexer and build the index themselves (
43c2bb253), so the index state at each read is the test's: CI's red run of the transfer test atddd9bbee9was the background indexer's incremental build reviving the MOVE source between the transfer and the read. A full rebuild that follows an incremental one is published throughFluree::reindex, sincepublish_indexkeeps an index whosetis not newer.Non-vacuity. Each fix was undone and its tests run (
--all-features); every one failed for the fix's reason. A mutation counts as caught only when a test fails; a build that never ran is not counted. Rows marked † were run in this round; the rest at the heads that added them.a_write_that_restates_a_stored_value_keeps_it,an_identical_reupsert_keeps_an_indexed_big_integer_subtype,changing_a_big_integers_subtype_keeps_itmulti_op_reversal_nets_a_value_the_index_keeps_less_of,changing_a_big_integers_subtype_keeps_itaf53c8110)a_multi_op_update_ends_where_its_last_op_leaves_a_value(the review's case reads1, 1, 0, 0where0is expected throughout)ddd9bbee9)a_transfer_keeps_a_value_both_graphs_hold: its 12 big-integer casesmain(all of8960668d1)merge_and_revert_keep_a_big_integer_written_under_another_subtype: revert and merge on the indexed ledger59e86424b)a_full_removal_is_a_delete_whichever_term_names_a_fact: the four indexed attempts3ebb552b5INSERT DATA x^^nonNegativeInteger ; DELETE DATA x^^integeron the indexed base, as one request and as two;merge_and_revert_…: the revert of both subtypesmerge_and_revert_…: the revert of both subtypesmain's parser)jsonld_transactions_reject_ill_typed_literal(the delete retracts the stored literal)named_bymatches by term onlya_push_retracts_values_the_target_holds_in_its_index,multi_op_reversal_nets_a_value_the_index_keeps_less_ofnamed_bymatches every item against the first slotnamed_by_names_a_stored_fact_and_nothing_elsea_write_retracting_a_value_a_list_holds_twice_retracts_both_entrieschanging_a_big_integers_subtype_keeps_it,named_by_names_a_big_integer_by_value_its_own_term_firstnamed_bymatches by key before termnamed_by_names_a_big_integer_by_value_its_own_term_firstdateTimealone;timealoneit_temporal_storage_precision(up to nine tests), the restate, fold and re-upsert testsdfaaa858e's code undone)a_constant_is_held_to_the_microsecond_for_ordering_too,a_cypher_constant_is_held_to_the_microsecond_for_ordering_too,a_string_is_ordered_against_a_temporal_at_the_microsecondDateTime/Timedeserialized without truncationa_deserialized_temporal_is_held_to_the_microsecondint96_rounds_down_to_the_microsecond,nanosecond_timestamps_round_down_to_the_microseconda_timestamp_before_1970_renders_on_its_own_dayno_double_loses_detail_to_its_index_key,a_lossy_term_assertion_sets_the_flagOn
main(57bf7a944), the same multi-op matrix fails 172 cases: the big-integer ones on every base, and 79dateTimeones, whose spellingsmainkeeps apart.Doubles and nulls in merge and revert. The net change keys only a big integer by value; a double or a null is netted by term and then named against the target. For a double nothing is lost:
FlakeValue's equality and hash treat±0and every NaN as one value, as the index key'sencode_f64does, and the key's type follows the datatype, so the term is the key. Revert and merge of0.0/-0.0both ways and of NaN keep the value onmain(57bf7a944) and on this branch, indexed and not. Nulls share one key whatever their datatype, but no write lane produces one: JSON-LDnulland CypherNULLare refused at parse, and SPARQL has no null literal.Perf against
3ebb552b5, in release, measuring retired instructions and allocations per write over 7 runs in each of 2 interleaved rounds. All of these are within run-to-run spread:transact_delete_wide_slotscenarios at 1k, 5k, 20k and 40k values;DELETE DATAof one indexed big integer, under its own subtype and under another;The first measurement found two costs, which
e3de4b1acremoves: the multi-operation delete allocated 33.6 KB more, becauseSlotFactswas larger for every slot read, and the double fold made 301 more allocations, a vector per identity key.Gates at
e3de4b1ac, with all features (local, mirroring CI):cargo fmt --all -- --check; clippy-D warningson transact and api (all targets); a workspacecargo check --all-targets --all-featuresat the merge8ef028c82; the wholefluree-db-apisuite (5,121 passed, 28 skipped), includinggrp_transact(349),grp_query(531),grp_query_sparql(513),grp_misc(395) andgrp_policy(143). At18369233e,grp_transactran 5 more times in full, and the eight multi-op matrix tests 20 more times, the first five alongside the full runs, without a failure; the slowest matrix test took 237 s under that load (about 33 s on a quiet machine), within nextest's 360 s limit. Ran at3ebb552b5and not re-run here, since this round changed only transact and api: clippy on query, sparql, cypher and novelty, those crates' library tests, and the W3C suites. Not run locally: the default-features clippy, the server with no optional features, the CLI, doc tests, the other crates' suites and the wasm32 jobs; CI runs them.Merges with
main287357987mergesmainatba694ee79(#2019, #2044) into this branch as a merge commit, so the commits above keep their SHAs. One file conflicted,fluree-db-query/src/eval/compare.rs: #2044's ordering of doubles is kept as it is, and a temporal compared with a string goes throughfluree_db_core::temporal::cmp_with_lexical, as on this branch, inside #2044'sValueOrder. Againstba694ee79that file differs only by this branch's change. The 420-case probe answers as it did before the merge in every case, at the merge and at the head. Run over five doubles (INF,-INF,NaN,1.5,-0.0), its 210 cases answer as a string does, except that a-0.0written since the last index build reads back as0.0after the next one; that is the-0.0item of #2090 listed above.Against
main. The 420-case probe that finds the 36 losses onmainfinds none on this branch, and neither do the delete-after-reload and subtype-change probes. Across these probes this branch answers as the reviewed rounds did, except for one datatype read before a reindex (the value is there either way) and a push the big-integer keying now accepts, where the target holds the value under another subtype.d7059102emerges5b23362d6(#2046, #2048, #2049, #2052, #2053, #2056, #2068). It merged without conflicts beyond #2056's txn-meta allowlist, which is kept as is, and the P1 probe's 420 cases are byte-identical to the run at79fa40f00.451eff0d7mergesf3c3b00ec(#2010, #2096, #2097, #2098, #2101, #2102, #2108) without conflicts. #2010 changes how the query side compares an encoded binding with a decoded term; this branch's temporal and big-integer tests, and #2010's ownit_query_optional_encoded_bindingsandit_novelty_encoded_equality, pass together.6208e94f0merges57bf7a944(#2120, #2009). Two files conflicted:fluree-db-api/src/commit_transfer.rs: fix: JSON-LD graph scoping, config integrity and explicit-only SHACL #2009 routes a push's graphs to the ids the ledger's graph registry gives them. This branch's push retraction check reads its slots through that routing as it is; only the routing struct's doc comment conflicted, andmain's is kept.fluree-db-transact/src/parse/jsonld.rs: fix: JSON-LD graph scoping, config integrity and explicit-only SHACL #2009 reworks JSON-LD graph scoping, and carries the delete templates' lenient reading of an ill-typed literal that this branch reverts (call 2).main's file is kept with the revert applied to it again, and3ebb552b5pins the refusal on JSON-LD.8ef028c82merges1d06ae2ef(#2119) without conflicts.Solo lockstep
No solo change is needed.
chrono::Utc::now().to_rfc3339()(nine digits on Linux) read back with six.fluree-lambda-identity,store.rs:2508:FILTER(?at < "{at}" …)). Its cursor is a value read back from the ledger, so it has at most six fractional digits, and the comparison answers the same whether the string is read to the microsecond or by every digit.