ec-europa / rdf_entity

7 stars 9 forks source link

system_post_update_entity_revision_metadata_bc_cleanup() fails on updb #143

Open donquixote opened 2 years ago

donquixote commented 2 years ago

From #141.

When upgrading a website to Drupal 9, with new version of rdf_skos, following the instructions from rdf_skos readme and rdf_entity readme, the following problem occurs in updb:

system_post_update_entity_revision_metadata_bc_cleanup() fails, because "Drupal\rdf_entity\Entity\RdfEntitySparqlStorage does not implement Drupal\Core\Entity\ContentEntityStorageInterface".

Debugging reveals that the exception is thrown in Drupal\Core\Entity\ContentEntityType::checkStorageClass(). At this time, the old definition of rdf_entity entity type is still stored in the key_value table, with its old storage class, which has since been removed.

Of course the "does not implement ..." is slightly misleading, more accurate would be "does not exist".

I wonder what we need to do here. Some ideas:

The main use case we want to support here is for rdf_skos and oe_content, which unfortunately did not respect the alpha status of rdf_entity. In this use case, the rdf_entity entity type does not really matter. So losing all data in rdf_entity it would be ok?

donquixote commented 2 years ago

Provide a stub storage class RdfEntitySparqlStorage extends SparqlEntityStorage to prevent the class-not-found error.

Tried this, it does prevent the error from happening! Not sure what other side effects we need to worry about..

donquixote commented 2 years ago

Tried this, it does prevent the error from happening!

Just to clarify, I did this without any sparql db configured locally. Drupal seems to only care about the class existing, not about actual data.

donquixote commented 2 years ago

The linked PR https://github.com/idimopoulos/rdf_entity/pull/7 fixes the problem for me. However, I don't really have sparql working in my local, and no entities stored there. It just removes the error on updb from system_post_update_entity_revision_metadata_bc_cleanup().