[p4] Separating depot from DB's

Robert Cowham robert at vaccaperna.co.uk
Fri May 4 05:19:17 PDT 2007


Hi Benjamin

A couple of issues.

You have slightly misunderstood the checkpoint/journal process/numbering
sequence (more below).

When you create a checkpoint, perforce will make a snapshot of db.* and
write it to a checkpoint file (say checkpoint.123), and it will also copy
live journal to a backup (journal.122) and truncate the live journal. Thus
the journal.122 is the log of all updates since checkpoint.122 - if you have
checkpoint.123 you will not need journal.122.

To restore to the same place you need the checkpoint.123 and the live
journal (typically called just journal).

It may seem strange that the checkpoint process updates the live journal,
but if you look inside it you will see a couple of records resetting the
journal counter ready for next time, and to prevent journal being replayed
out of order.

In my test env:

C:\bruno_ws>p4 admin checkpoint new

C:\bruno_ws>cd \perforce

C:\perforce>dir new*
 Volume in drive C is Main
 Volume Serial Number is 740F-93CE

 Directory of C:\perforce

04/05/2007  13:12         1,787,947 new.ckp.16
04/05/2007  13:12           568,263 new.jnl.15

C:\perforce>tail new.jnl.15
@pv@ 7 @db.revsx@ @//allspecs/depot/depot.p4s@ 1 3
/allspecs/depot/depot.p4s@ @1.1@ 3
@ex@ 8116 1178280557
@rv@ 0 @db.counters@ @journal@ 16
@ex@ 6696 1178280740

C:\perforce>cat journal
@vv@ 0 @db.counters@ @journal@ 16
@ex@ 6696 1178280741

So the final entry in journal.15 updates the counter to 16, and the new live
journal (which at next checkpoint will be copied to journal.16) has a (vv)
line meaning roughly "make sure the value of db.counter is currently 16 or
exit with incorrect sequence error".

==================================
But in any case, in such situations it is probably just as easy to copy the
db.* files (and license) to the new location!!


Note that after recreating/copying db.* files, you will need to run a "p4
depot" command on each existing depot and change the Map: field to be an
absolute path, e.g. from "depot/..." to "e:/p4/depot/...".

C:\bruno_ws>p4 depots
Depot allspecs 2007/03/28 spec .p4s allspecs/... 'Created by bruno. '
Depot depot 2005/10/11 local depot/... 'Default depot '

(NOTE map is depot/...)

C:\bruno_ws>p4 verify -q //depot/...

C:\bruno_ws>p4 depot depot
Depot depot saved.

C:\bruno_ws>p4 depots
Depot allspecs 2007/03/28 spec .p4s allspecs/... 'Created by bruno. '
Depot depot 2007/05/04 local c:/perforce/depot/... 'Default depot '

(Note changed Map - forward slashes work fine on Windows too)

C:\bruno_ws>p4 verify -q //depot/...

Robert

> -----Original Message-----
> From: perforce-user-bounces at perforce.com 
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Benjamin Nias
> Sent: 04 May 2007 12:31
> To: perforce-user at perforce.com
> Subject: [p4] Separating depot from DB's
> 
> Hi all,
> 
>  
> 
> I have a P4 server running Server 2003 with an attached RAID 
> Array for the depot. Currently P4ROOT set to E:\P4 (a logical 
> drive on the RAID). 
> 
>  
> 
> I have a separate logical drive on a directly attached RAID 
> (D:\) that has 10K drives. I wish to run P4 so that our depot 
> lives in it's current location on E:\P4 but the .db's are held on D:\.
> 
>  
> 
> I tried to do this this morning with the following:
> 
>  
> 
> E:\P4> p4d -jc
> 
>  
> 
> E:\P4> p4 set -s P4ROOT="D:\"
> 
>  
> 
> E:\P4> p4 admin stop
> 
>  
> 
> E:\P4> p4d -r d:\ -jr checkpoint.xxx journal.xxx-1
> 
>  
> 
> This produces and error of "journal is out of sequence". I've 
> doubled checked this and the checkpoint and journal files 
> specified are indeed in sequence and the ones just generated 
> by my -jc command.
> 
>  
> 
> Then, when restarting the server I get 
> 
>  
> 
> Connect to server failed; check $P4PORT.
> 
> TCP connect to 1666 failed.
> 
> connect: 1666: WSAECONNREFUSED
> 
>  
> 
> When this failed I decided to set the root back to the 
> original folder so my users could continue whilst I made this 
> post. However when invoking -jr to the original location, I 
> got the same error. I then copied back the backed up .db's 
> from before my checkpoint and all worked fine.
> 
>  
> 
> My questions are:
> 
>  
> 
> Am I making the right steps to make the migration work?
> 
> Am I being thrown off by a possible corrupted journal file as 
> the -jr didn't work even when P4ROOT was set to the original location?
> 
>  
> 
> Cheers,
> 
>  
> 
>  
> 
> Benjamin Nias


More information about the perforce-user mailing list