3

I am trying to upgrade a site from 2.0.2551 to 2.1.2570. I have ~18k entries and ~28 elements. The upgrade process seems to want to save all the elements again as far as I can tell, is there any way to avoid this or make it quicker? Is there some magical SQL I might play with to do it all?

At present I've had it sat for 14 hours before I gave up...

Incidentally I can legitimately reduce the number of entries to about ~3k and the elements to ~11k as I can just re-import those from an API service - I have tried this and it still takes an awfully long time.

Any advice or previous similar situations you people have run in to would be most helpful :)

9
  • What about editing the ResaveAllElementsTask/ResaveElementTask and add a limit/offset, and then do it in batches? Sep 24, 2014 at 11:09
  • Yeah I thought about something like that but surely it'll still take the same amount of time in total? Sep 24, 2014 at 13:14
  • I don't know. Actually 14 hours for "only 18k entries" makes me believe there is something else going on. Does it stall/error out, or do you see that it just takes an awful amount of time to resave every single element? How long does 1 element take? Is it still running? Sep 24, 2014 at 13:18
  • Well I can't see much to be honest - just that from running top mysql is doing things...I see a drop in cpu once a second or so at the moment, and mostly about 2 out of 4 cores are in the red. I'm doing this on an iMac. Sep 24, 2014 at 13:20
  • 1
    Oh dear. All I needed to do was more thoroughly read through the migration scripts added in the 2.1 release. One of them loops over all the entry versions (~2.6m in my db)...I just truncated that table and it went in a few seconds! No harm done apparently either. Thanks for your suggestions - helped me think about it more logically! Sep 24, 2014 at 13:58

1 Answer 1

5

In my specific case - upgrading from 2.0.2551 to 2.1.2570 - the issue was caused by there being millions of rows in the craft_entryversions table. One of the migrations in the update needed to loop through every row in that table and do something to it and therefore it took ages.

Simply emptying that table solved the upgrade process for me.

Caveats

Obviously this deletes all your entry versions...so, each entry will just exist at its last known 'live' state. This wasn't a problem for me - but might be for you.

Its worth noting that this shouldn't affect any drafts users might have made as they are stored in a separate craft_entrydrafts table.

Thanks to Fred Carlsen for helping me think aloud...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.