Closed (fixed)
Project:
Bean (for Drupal 7)
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Mar 2017 at 17:01 UTC
Updated:
23 Aug 2018 at 16:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
skwashd commentedI haven't had time to roll and test a patch for this but I've had a look through the code. The bean_uuid sub module needs to implement
hook_bean_presave(). The hook should check if$bean->is_new_revisionisset()to see if it is a new revision. If it is a new revision then$bean->vuuidneeds to be assigned a new UUID by callinguuid_generate(). Something like this should do the trick:Comment #3
badjava commentedHere is a patch based on @skwashd's comments. We may want to add a hook_update function to clean up all the existing revisions with duplicate vuuids.
Comment #4
dixon_Looks good
Comment #5
damienmckennaAgreed, this needs an update script.
Comment #6
badjava commentedPatch has been updated with a hook_update implementation.
Comment #7
badjava commentedComment #8
badjava commentedUpdated the hook_update implementation to only empty the value of inactive revisions as they will contain duplicate vuuids and then regenerate them. The active revision is left alone with its existing vuuid.
Comment #10
skwashd commentedLet's see if the bot is still misbehaving.
Comment #11
skwashd commentedFixing status
Comment #12
damienmckennaIn case there are a large number of UUID-enabled entities in the system, I think uuid_sync_all() should be in its own update script.
Comment #13
badjava commentedAgreed and good catch - here is an updated patch with an interdiff from #8.
Comment #14
timaholt commentedI've reviewed the code and tested the patch in #13 in a complex site with the parent issue, and the module and update hooks resolve the issue for me.
Comment #15
badjava commentedIs it possible to get this patch committed? Thanks!
Comment #16
damienmckennaThinking through the logic here.. if uuid_sync_all() times out in bean_uuid_update_7203() what would happen? IIRC the process will fail and the next time the updates are ran it'll try to do the same update only with fewer records to go. Right?
Comment #17
damienmckennaNow that we have support for Devel (Contrib) Generate via #2894053 I'm going to see about manually testing this with a bazillion beans.
Comment #18
indytechcook commentedA site with a bazillion beans (fun to say) would be running this via drush anyway. PHP CLI default timeout is 0 so it would just run forever. I'm committing this. Good work!
Comment #20
indytechcook commentedThanks for all the work!
https://www.drupal.org/commitlog/commit/22232/f90a5fbbed6871f6e319eef37b...