cubicweb #3705746 deleted entities still findable during the transaction [open]

After deleting an entity, an rql query looking for it by its eid will find it until the next commit.

As an illustration, the assertion in the following script will fail:

eid = create_entity('CWGroup', name=u'dummy').eid
rql("DELETE CWGroup X WHERE X eid %(eid)s", {'eid': eid})
assert rql("Any X WHERE X eid %(eid)s", {'eid': eid}).rowcount == 0

Discussing the matter on the public forum brought the following elements:

  • After the DELETE, the eid is still present in repo._type_source_cache, hence considered existing.
  • This cache is shared with other transactions, hence the eid cannot be removed from it before commit.
  • session.deleted_in_transaction(eid) (or the cache underneath) is a track to follow in attempting to solve this bug.
done in<not specified>
closed by<not specified>