fluree / db

Fluree database library
https://fluree.github.io/db/
Other
330 stars 21 forks source link

Fix irregular deletions after indexing #798

Closed zonotope closed 1 month ago

zonotope commented 1 month ago

There were two issues that prevented delete (and other) transactions from correctly modifying data and/or queries from returning accurate results after data was modified.

The first issue stemmed from the max-namespace-code field on JsonLdDb records not being incremented after a transaction. This caused new namespace codes to be generated for previously encountered namespaces, and left flakes that should have had the same subject id (or other iri flake components) with different subject ids because there were two different namespace codes for the same namespace. This was fixed in 311f375.

The second issue stemmed from our flake deserialization process converting nil into {} for the flake meta component. That meant that flakes in novelty could have nil as the meta value, but {} when they move from novelty to the index nodes. This caused queries to return inconsistent results because retracting flakes in novelty could not be linked to their assertions in the index nodes. This was fixed in 32c799c.

The rest of these changes are a bit of cleanup and debugging aides.