2

Running drush updb to upgrade drupal core or other modules, puts the site in maintenance mode. I recently faced an issue (probably an edge case) where the site was stuck in maintenance mode after running updb in a pipeline of a containerized infrastructure. Here is the sequence of events:

  1. Run drush updb -y
  2. Container terminated (system failure or unknown reason)
  3. Re-attempt at drush updb
  4. drupal returns "no updates were required" (this tells me that the step 1 may have completed the update in the background?"
  5. Site remains in maintenance mode.
  6. I manually bring the site back online.

After all this it looked like the update was successful.

How do I ensure the integrity of the system when this happens without restoring a backup and running the updates again? When running subsequent drush updb that says "no updates required" does this guarantee the previous updates were successful.

  • You also can run drush state:set system.maintenance_mode 0 to disable maintenance mode. When you've run drush updb there must have been some output of which updates exactly are going to be run and you should also see the output of the last hook that was run before it failed. Do you remember the hook name and have you looked at what it was supposed to be doing and checked that it has done it? I'd also assume that the registry of performed updates will only be updated if an update was run successfully til the end. But that's just an assumption. – leymannx Jun 23 at 21:09
0

When running subsequent drush updb that says "no updates required" does this guarantee the previous updates were successful.

When Drush queues up batch items to be processed for drush updb, it adds these operations:

  • Any module schema updates
  • Any entity definition updates (off by default, not supported after 8.7)
  • A cache clear & post hook update functions (on by default)
  • Toggle off maintenance mode (if it not already enabled)

If the only updates were module schema updates then you might be in a scenario where things are ok; there are no post-update hooks needed (e.g. some batch data ops following a schema change) and only the last step of toggling off maintenance mode didn't complete.

How do I ensure the integrity of the system when this happens without restoring a backup and running the updates again?

You'd have to audit the list of updated modules to double-check each schema update was applied and there were no post-update hooks missed in the update.

Depending on your update scenario this may or may not be easy, hence the best practice is doing a DB rollback and re-applying updates to ensure data integrity when uncertain.

| improve this answer | |

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.