Skip to content

Database purge doesn't remove values at all

@lehtonen and @villberg took a long look at database purging and found out that the logic to deny values in TGRemover is completely broken.

https://gitlab.simantics.org/simantics/platform/-/blob/c029bc36750f03200b40a2bfa83838586808dfde/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/TGRemover.java#L63 first of all prevents ModelTransferableGraphSourceRequest from listing any values at all in the produced TransferableGraphSource. Also the implementation of TransferableGraphSource.forValueResources in ModelTransfeableGraphSource is completely broken when conf.values = true. It is reading the value output stream as if it only listed resource IDs that contain values, when in reality it contains serialized values also.

The original idea with conf.values = false and forValueResources was clearly to optimize the removal so that it doesn't even include the serialized values in the value output stream at all, in which case the current forValueResources would actually work. This should still be implemented to optimize the footprint of the removal to not depend on the size of literal values. It will need a new option in the TG production though.

Edited by Tuukka Lehtonen