datalevin
datalevin copied to clipboard
Storing an error becomes unretractable
trafficstars
It seems that storing an error as a value in datalevin is unretractable, and therefor the entity also becomes unretractable. Here is an example that can be run on a fresh database.
(let [conn (d/create-conn "db.dl")]
(d/transact!
conn
[{:entity-with-error (ex-info "Boom" {})}])
(d/entity (d/db conn) 1) ;; Looks good
(d/transact!
conn
[[:db/retractEntity 1]])
(d/entity (d/db conn) 1) ;; Still exists
(d/touch (d/entity (d/db conn) 1))) ;; Can still return data
On further investigation, I found the following behaviors:
- You can still add attributes to the affected entity via
:db/add - You cannot retract the error attribute via
:db/retractor:db/retractAttribute - You cannot retract the entity via
:db/retractEntity(probably because of 2) - You can retract still retract other attributes on the entity via
:db/retract
Seems to be related to https://github.com/juji-io/datalevin/issues/234
In doing so, we will disallow storing arbitrary objects that are not registered.