Perforce Public Knowledge Base - How to reseed a replica server
Reset Search
 

 

Article

How to reseed a replica server

« Go Back

Information

 
Problem
How do I re-seed a replica server?
My replica has inconsistencies or is otherwise corrupted. How do I recreate a new uncorrupted copy of my replica metadata?
Solution

This procedure should be used when you detect an inconsistency or corruption in the replica database. This procedure does not involve transferring the depot files again.

Reseeding from a specified checkpoint

This method will look in the master's P4ROOT directory and play back numbered journal files automatically.  Versioned files (other than shelved files) edited after the checkpoint will be automatically pulled from the master.  Assuming a checkpoint taken on the master is available, and replication configurables are set, no further downtime is needed on the master.
  1. Stop the replica
p4 -p replica:1666 admin stop
  1. Move the replica's database and associated metadata files to a safe place. The files are named db.* in the replica's P4ROOT directory such as db.rev and db.protect.  Move any journal and log file, and any .lbr file and any state file (including 'statejcopy' if it exists).

  2. Copy the checkpoint file to the replica and replay it by running
p4d -r P4ROOT -jr checkpoint.312
 
More information about replaying a checkpoint can be found in the System Administrator's Guide.
  1. Ensure that any numbered journals created subsequent to the checkpoint having been taken on the master are in the master designated directory and that numbered journals have not been compressed. Replication cannot use compressed journal files.  For example, if journal.312 exists, it should be uncompressed.

  2. Start the replica.

  3. Check that replication is running. You should observe the journal and sequence numbers increasing when you run this command against the replica:
p4 -p replica:1666 pull -l -j
  1. Schedule the transfer of missing revisions. If the checkpoint used to seed the replica is newer than the archive files on the replica, you need to update the replica with the missing revisions using the command.

p4 -p replica:1666 verify -qtS //...

or if you are using Perforce 2014.2 or earlier, run

p4 -p replica:1666 verify -qt //...

Note, if on Perforce 2015.1, you must be on a release after 2015.1/1202710 to have access to p4 verify -S:

#1202710 (Bugs #44639, #63140, #74807) **
   The verify command now supports the -S flag to specify that
   shelved files are to be verified. This flag can also be combined
   with the -t flag on a replica to schedule the transfer of any
   missing or damaged shelf archives from the master server.


See the output of p4 info to obtain the specific release of Perforce Server. 
  1. For Perforce 2014.2 or earlier, if the production server was running after the checkpoint was created, transfer any newly created shelved versioned files from the master to the replica.
Shelved files in Perforce 2014.2 or earlier are not detected by the p4 verify command.  To find any newly created shelves, run the p4 changes command.

p4 -p replica:1666 changes -t -s shelved

To verify shelved files are available, run the p4 print command.  If an error is seen, transfer the shelved versioned file (1.shelved_changelist) from master to the replica.

p4 -p replica:1666 print @=changelist

If the p4 print command produces an error, transfer the shelved versioned file (1.shelved_changelist) from master to the replica.
  See How To Confirm Shelved Archives.
 

Reseeding from a restored checkpoint and restored numbered journals

This procedure assumes that the replica already has all numbered journals applied (but the current running journal has not been applied).  Assuming a checkpoint taken on the master is available, and replication configurables are set, no further downtime is needed on the master.  The advantage of this method is that there is some assurance that the numbered journals will correctly play into the replica.
  1. Stop the replica

    p4 -p replica:1666 admin stop

  2. Move the replica's database and associated metadata files to a safe place. The files are named db.* in the replica's P4ROOT directory such as db.rev and db.protect.  Move any journal and log file, and any .lbr file and any state file (including 'statejcopy' if it exists).

  3. Copy the checkpoint file to the replica and replay it by running:

    p4d -r P4ROOT -jr checkpoint.312

    More information about replaying a checkpoint can be found in the System Administrator's Guide.

  4. Copy all numbered journals created subsequent to the checkpoint (if any) from the master to the replica and replay these on the replica.

    p4d -r P4ROOT -jr journal.312
    p4d -r P4ROOT -jr journal.313

    Note the running journal (usually named "journal") has not been restored.

  5. Reset the replica's state file in the P4ROOT directory to contain a number one more than the last journal number replayed; in this example '314'
echo 314 > state

Note that replica server versions of 2011.1 and later do not require this step; they will create the state file once replication is started and there has been some data replicated from the master server.
  1. Start the replica.

  2. Check that replication is running. You should observe the journal and sequence numbers increasing when you run this command against the replica:

p4 -p replica:1666 pull -lj

  1. Schedule the transfer of missing revisions. If the checkpoint used to seed the replica is newer than the archive files on the replica, you need to update the replica with the missing revisions using the command:

p4 -p replica:1666 verify -qtS //...

or you are using Perforce 2015.1 or earlier, run

p4 -p replica:1666 verify -qt //...

  1. For Perforce 2014.2 or earlier, If the production server was running after the checkpoint was created, transfer any newly created shelved versioned files from the master to the replica.
Shelved files in Perforce 2014.2 or earlier are not detected by the p4 verify command.  To find any newly created shelves, run the p4 changes command.

p4 -p replica:1666 changes -t -s shelved

To verify shelved files are available, run the p4 print command.  If an error is seen, transfer the shelved versioned file (1.shelved_changelist) from the master to the replica.

p4 -p replica:1666 print @=changelist
 
If the p4 print command produces an error, transfer the shelved versioned file (1.shelved_changelist) from master to the replica.  See How To Confirm Shelved Archives.



 
Related Links

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255