[p4] Backup and restore

Robert Cowham robert at vaccaperna.co.uk
Mon Mar 26 03:09:54 PST 2007


You don't need the journals to recover to a checkpoint.

However, it is worth bearing in mind that checkpoint.3 = checkpoint.2 +
journal.2

So the journals are an audit trail of what happened between the checkpoints
(which can on occasion be useful to work out some sequence of events). Thus
keeping journals for some period of time can be worth it.

As you have no doubt seen, when you do a checkpoint command, an entry is
written to the "live" journal to update the journal counter (used in the
numbering sequence). This also helps to avoid journals being replayed out of
order.

Typically you want to restore the latest checkpoint and any journals since
then (including live journal).

Some larger sites just rotate the journal on a nightly basis and save
complete checkpoints for the weekend say to minimise down time.

HTH
Robert 

> -----Original Message-----
> From: perforce-user-bounces at perforce.com 
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Calvin Guan
> Sent: 25 March 2007 05:46
> To: perforce-user at perforce.com
> Subject: [p4] Backup and restore
> 
> Hello group,
> 
> I'm not a p4 pro so please bear with me...
> 
> We, a small team are using perforce without a fulltime admin. 
> As our database grows, I started to worry about data 
> corruption or harddisk failure after reading some scary crash 
> courses. I do take checkpoint and backup the checkpoint.n, 
> journal.n-1 and the perforce/depot/ but I never have a chance 
> to restore it. I read the p4 admin manual but still want to 
> make sure if I got it right.
> 
> Let's say I made a checkpoint on Tue, checkpoint.2 and 
> journal.1 were generated. On Wed, checkpoint.3 and journal.2 
> were generated. On Sat. the server caught a fire; both depot 
> and db.* are gone(ouch).
> 
> If I'd like to restore the server to the most recent backup 
> state(Wed), I'd:
> p4d -r $P4ROOT -jr checkpoint.3
> and restore the perforce/depot/ taken on Wed.
> 
> If for some reason, I'd like to restore the server to Tue, state, I'd:
> p4d -r $P4ROOT -jr checkpoint.2
> and restore the perforce/depot/ taken on Tue.
> 
> It seems to me I don't need the journal.n file in both cases. 
> Is it true that the only time I need to specify a journal 
> file in the "p4d -jr" command is to restore the database to 
> the latest state given that the versioned files and the 
> current journal file are not affected by a crash. If my 
> understanding is correct, then why do I need to backup the 
> journal.n files?
> 
> Thanks,
> Calvin


More information about the perforce-user mailing list