[p4] How to restore an obliterated branch from the backed up checkpoint

Jeff A. Bowles jeff at vizim.com
Wed Oct 28 08:45:53 PDT 2009


I think that Guillaume has excellently described the situation to you, and
none of the home-grown options are very nice ones.

Support might have a trick up their sleeves, because there are a few
database-things that happen as part of an obliterate that might not be
[easily] undoable.... and would require modification of the database in ways
that really, really...

.... really, really, really...

... really need Support to help you with.

Do not modify that checkpoint or any similar "checkpoint surgery" without
Support on the telephone, not just email. Their email support is absolutely
tremendous, but you want them to hear each keystroke and verify it with you
before you hit return/enter. Every last keystroke - the only thing more
powerful (and dangerous) than a Perforce admin running "p4 obliterate -y" is
a Perforce admin sitting in the editor on a checkpoint, muttering "if I
change this line, what other parts of this file do I need to change also?"

Call Support. And send a thank-you note to Guillaume; he's pegged it
perfectly for you.

  -Jeff Bowles



On Wed, Oct 28, 2009 at 7:28 AM, G Barthelemy <gb.perforce at googlemail.com>wrote:

> On Wed, Oct 28, 2009 at 1:02 PM, Alok Narula <anarula at beceem.com> wrote:
> > I'm aware of the following command to restore a Perforce server from a
> > backup:
> >
> > p4d -r $P4ROOT -jr checkpoint_file journal_file
> >
> > But when I use this command, I will restore the entire P4 Depot. How can
> > I restore only one obliterated branch from the backup?
>
> In a nutshell, you don't. Obliterating removes data in a way that is
> irreversible. And Perforce's checkpoint is merely a database dump. You
> can't partially restore a Perforce database, it wouldn't make sense as
> all groups of database tables have a chronological integrity that must
> be preserved.
>
> Having said that there may be ways to get at least some or all of your
> branch back. It really depends on what has been obliterated and what
> you are interested in retrieving (just the #head revision on that
> branch or all its history ?). From the top of my head:
>
> 1- If the data (another branch) that created that branch is still on
> the depot then why not re-integrating that ? (Even more obvious, if
> that obliterated branch had a clone branch or close enough, then 'p4
> duplicate' could help).
>
> 2- Similarly, if your obliterated branch has been branched somewhere
> else, could it be re-created from that ?
>
> 3- You could restore your checkpoint (that contains the branch) and
> corresponding RCS archive to a separate Perforce domain, and mount the
> relevant branch as a remote depot (on your production server) from
> which you integrate to re-create the missing branch. This will enable
> you to pick and choose the relevant milestones.
>
> 4- The sledge-hammer method: as 3, you restore a separate Perforce
> domain from your checkpoint / RCS and p4 obliterate everything but
> your branch. This leaves you with a small depot containing just your
> branch. You merge this depot with your live one using perfmerge++.
> It's an involved process, but would restore all your branch history.
> It wouldn't re-conciliate its integration history, unfortunately and
> some changelists would be renumbered.
>
> 5- If you have preserved all your journal entries since that
> checkpoint, you could restore the checkpoint (and the missing RCS, if
> any) and replay all journals skipping the obliteration (so a journal
> would need to be edited). I am only speculating that this would work
> and would require assistance from Perforce Support. This should
> restore everything as if the obliteration never occurred.
>
> 1, 2 and 3 do not require any downtime but do not restore the same
> file and integration history as before.
> 4 and 5 require downtime and dry runs on a test environment, etc...
>
> Maybe Perforce Support has another method up their sleeves. Talk to
> them first anyway.
>
> Good luck !
> Guillaume
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>



More information about the perforce-user mailing list