Page MenuHomePhabricator

Apply storage patches patch-by-patch, not database-by-database
ClosedPublic

Authored by epriestley on Nov 22 2016, 2:07 PM.
Tags
None
Referenced Files
F14061611: D16912.diff
Mon, Nov 18, 7:31 AM
F14046939: D16912.diff
Thu, Nov 14, 12:46 AM
F14036040: D16912.diff
Sun, Nov 10, 8:19 AM
F14021999: D16912.diff
Wed, Nov 6, 2:18 PM
F13996724: D16912.diff
Wed, Oct 23, 11:29 PM
F13981270: D16912.id40719.diff
Oct 19 2024, 3:25 PM
Unknown Object (File)
Oct 9 2024, 4:07 PM
Unknown Object (File)
Sep 29 2024, 7:05 AM
Subscribers
None

Details

Summary

Ref T11044. Sometimes we have a sequence of patches like this:

  • 01.newtable.sql: Adds a new table to Files.
  • 02.movedata.php: Moves some data that used to live in Tokens to the new table.

This is fairly rare, but not unheard of. More commonly, we can have this sequence:

  • 03.newtable.sql: Add a new column to Phame.
  • 04.setvalue.php: Copy data into that new column.

In both cases, when applying database-by-database, we can get into trouble.

  • In the first case, if Files is on a different master, we'll try to move data into a new table before creating the table.
  • In the second case, if Phame is on a different master, the PHP patch will connect to it before we add the new column.

In either case, we try to interact with tables or columns which don't exist yet.

Instead, apply each patch in order, to all databases which need it. So we'll apply 01.newtable.sql EVERYWHERE first, then move on.

In the case of PHP patches, we also now only apply them once, since they never make schema changes. It should normally be OK to apply them more than once safely, but this is a little faster and a little safer if we ever make a mistake.

Test Plan
  • Ran bin/storage upgrade on single-host and clustered setups.
  • Initialized new storage on single-host and clustered setups.
  • Upgraded again after initialization.
  • Ran with --apply.
  • Ran with --dry-run.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Apply storage patches patch-by-patch, not database-by-database.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
  • Fix a bad interaction between --apply and --force.
chad edited edge metadata.
This revision is now accepted and ready to land.Nov 22 2016, 4:56 PM
This revision was automatically updated to reflect the committed changes.