Page MenuHomePhabricator

Add a `storage renamespace` for mangling SQL dumpfiles into a new namespace
ClosedPublic

Authored by epriestley on Mar 17 2015, 11:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 11 2024, 10:57 AM
Unknown Object (File)
Feb 7 2024, 5:44 AM
Unknown Object (File)
Feb 3 2024, 2:35 AM
Unknown Object (File)
Feb 2 2024, 10:41 PM
Unknown Object (File)
Jan 26 2024, 9:20 AM
Unknown Object (File)
Dec 26 2023, 6:32 PM
Unknown Object (File)
Dec 22 2023, 11:58 PM
Unknown Object (File)
Nov 30 2023, 12:23 AM
Subscribers

Details

Summary

Ref T7149. When users give us dumpfiles for import, they will almost inevitably use the phabricator namespace. They need to be renamed to use an instance namespace.

We can do this either by:

  • importing the data first, then renaming; or
  • renaming first, then importing.

This implements the second one, basically storage renamespace --in dump.sql --from phabricator --to instancename > instance.sql.

Renaming first is a little hackier since we have to preg_match() a SQL dump file, but I think it's better overall:

  • With only one database, it lets you dump/import without downtime.
  • If you have development stuff in a development environment in the phabricator namespace, you don't have to move it aside to do an import.
  • No possibility that two people doing an import at the same time on the same box will collide with each other.
  • You can do the rename once and then repeat the import process with the renamed dump more easily.
  • No tricky stuff with modern Phabricator running against an old dump and the database names not matching up.

None of this is super important, but it just makes large dumps a bit easier to work with, and the dumpfile format is regular enough that this seems unlikely to ever really not work.

Test Plan

Renamespaced a dump, did a diff -u, saw all the relevant parts changed (and only those parts changed).

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Add a `storage renamespace` for mangling SQL dumpfiles into a new namespace.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.
This revision is now accepted and ready to land.Mar 17 2015, 11:50 PM
This revision was automatically updated to reflect the committed changes.