0

I haven't been able to get any clear answer on this and it seems like a lot of very experienced people have different views on this. So the question is:

  1. I've made a setup install/update script + maybe some code dependent on what is configured there - like layout xml with attributes.
  2. I deploy it live on a heavy visited page

True or false:

  • The first visitor will trigger and wait for all the scripts to run?
  • Other visitors can visit the site meanwhile with old settings?
  • Other visitors are just blocked until the scripts have run?
  • Other visitors can use the site but what data they get is totally random depending on where in time it is.
  • Layout xml can break if it is dependent on an attribute which isn't created (consider also flat tables)
  • Magento clears out cache after setup scripts?
2

The first visitor will trigger and wait for all the scripts to run?

Correct.

Other visitors can visit the site meanwhile with old settings?

Wrong, they will trigger it again

Other visitors are just blocked until the scripts have run?

Nope.

Other visitors can use the site but what data they get is totally random depending on where in time it is.

Yes, kind of. Magento checks the DB for not yet run scripts and processes them (as many times as users are there)

Layout xml can break if it is dependent on an attribute which isn't created (consider also flat tables)

Everything can break.

Magento clears out cache after setup scripts?

No, but if the caches are not cleared (read config cache), no scripts run. Neither before nor after setups magento clears any cache by default.

Solutions

So there are two solutions for that:

  • You have one "admin" server, which is only accessable for you. You clean the cache, run the scripts once, the db changes are backwards compatible and everything is fine
  • You corehack (afaik is there no other possibility?) so that you can pass a parameter or something to call the update scripts (or just use magerun on console)
  • "Wrong, they will trigger it again" - what do you mean with "again", they will continue with unprocessed scripts right? I doesn't make sense if it would restart from 0.. update script often don't work to run multiple times (because of lacking checks) but I have never seen or heard that being a problem.. – OZZIE Jul 24 '16 at 15:59
  • "No, but if the caches are not cleared (read config cache), no scripts run.", maybe you misread that question, I meant after the last setup script has run, not before, I know you have to clear it for it to start running. But I'm pretty sure config cache or any other cache is NOT cleared after the execution of the scripts.. – OZZIE Jul 24 '16 at 16:02
  • Correct. Fixed that answer :-) – Fabian Blechschmidt Jul 24 '16 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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