- Issue created by @efpapado
- @efpapado opened merge request.
- 🇳🇴Norway efpapado
efpapado → changed the visibility of the branch 3518109-the-new-revision to hidden.
I used the module on a site that uses the memcache module → , to convert some nodes from bundle A to bundle B. After the process finished, although all the revisions of the node (both on base tables, and on field tables) got converted to B, when the new revision got saved, it got saved again as bundle A. Also in the log message of this revision there was written "Converted from A to A."
I have noticed also other cache problems, not related to convert_bundles, which I haven't yet debugged, clearly memcache has some issues on cache invalidation.
I see that addNewFields
calls drupal_flush_all_caches()
in the beginning, which should be enough when the entity is loaded later. But because of the insufficient cache invalidation on memcache, the entity gets loaded on its old status, so it gets loaded as bundle A, and the new revision is created and saved again as bundle A.
The description should be enough to explain how to reproduce, but there is a problem: The bug is random. It doesn't happen every time.
It never happens when the default db cache is used.
It definitely has to do with using external systems (like memcache) for caching. It might have to do with bugs on the memcache module, or the memcache library, or the memcache extension, or the memcached itself, or it could also be a generic issue when external caching systems are used.
I have an open question whether calling drupal_flush_all_caches()
at the beginning is too hard and should be removed, but this is irrelevant here. Let's keep it as it is for now.
But I propose to use the core's resetCache
function, as an extra step before loading the entity in the addNewFields
operation. That way, even if the flushing of caches did not complete successfully (which, of course, is NOT convert_bundle's responsibility), at least we instruct the core to load the entity completely uncached, directly from the database, which is anyway the intention.
Review.
-
-
-
Needs review
2.0
Code
efpapado → changed the visibility of the branch 3518109-the-new-revision to hidden.