Offline Checkpoints

Reducing server downtime during backups

Info & Tags

Article #:
126
Created:
05/18/06
Modified:
10/13/08
Tags:
checkpoints, offline, p4d

Related Articles

Links

SUMMARY

The checkpoint operation locks all Perforce database files and makes your server inaccessible for the duration of the process. As your Perforce server grows in size, the length of time it takes to create the checkpoint can become long enough to interfere with users' work. The off-line checkpoint procedure detailed below dramatically reduces the time your server is unavailable due to checkpoint operations.


DETAILS

The off-line checkpoint process entails creating a second instance of your Perforce database, and then performing checkpoints on this second, off-line database instance. By taking checkpoints off-line, users are no longer blocked from accessing the primary (production) server during lengthy checkpoint operations.

You need to create the off-line instance of the Perforce Server on a different disk volume than the production server instance to reduce unfavorable performance effects. The off-line server can also be set up on a separate host machine to completely isolate your production server instance.

A prerequisite to setting up an off-line checkpoint process is choosing a location for your off-line Perforce database files. In the examples below, D:\Offline_P4ROOT is used as the off-line Perforce Server root location.

Seeding the off-line server

The off-line checkpoint process begins by seeding an off-line server with a current production server checkpoint. Seeding the off-line server entails first taking a checkpoint on your production Perforce server, copying this checkpoint to the off-line location, then restoring the checkpoint in the off-line location. For example:

  1. Checkpoint the production server:
    cd C:\P4ROOT
    p4d -r C:\P4ROOT -jc
    
  2. Copy the checkpoint to the offline location:
    copy C:\P4ROOT\checkpoint.NNN D:\Offline_P4ROOT\checkpoint.NNN
  3. Restore the checkpoint in the off-line location:
    p4d -r D:\Offline_P4ROOT -jr checkpoint.NNN

Should the off-line server instance ever become corrupt or out-of-sync with the production server, you can restart the process by re-seeding the offline server with a fresh checkpoint from the production server, as outlined above.

Taking off-line checkpoints

When the off-line server is created, you can keep its contents updated by restoring truncated journal files from the production server. The content in the off-line server will be as current as the latest journal truncation and replay process. For example:

  1. Truncate the journal file on the production server:
p4d -r C:\P4ROOT -jj D:\Offline_P4ROOT\journal
The -jj flag instructs the server to create a numbered journal file. Without an argument, the -jj flag creates a numbered journal in the production server root location. By providing a path argument, you can specify the location where the numbered journal is written. In this example, since the off-line backup directory is on the same machine as the production server root, we can automatically create the numbered journal in the off-line root directory. Otherwise, you would have to manually copy the numbered journal to the off-line root, as in the seeding process above.
  1. Restore the production journal on the off-line server:
p4d -r D:\Offline_P4ROOT -jr journal.NNN
  1. Checkpoint the off-line server without truncating the journal (-jd):
p4d -r D:\Offline_P4ROOT -jd checkpoint.mmddyyyy
Upon completion of this process there is an off-line checkpoint that can be used to rebuild your production server, should the need ever arise.

Note the use of the -jd flag in the last step. The -jd flag instructs the server to not truncate the journal or increment the journal counter when creating a checkpoint. If the -jc flag is used on the off-line server instead, then the journal counter is incremented -- and the next attempt to replay a production journal would fail, generating an 'out of sequence' error.

Warning: If you create off-line checkpoints on the same system as the production Perforce server, always specify the path to the P4ROOT folder using the -r flag. This prevents inadvertently running any commands against your "live" Perforce database.

Notes:

The production server journal can be truncated at arbitrary intervals, such as once a day or once an hour, depending on your particular requirements.

When the production journal is truncated (copied), the production server briefly stalls during the copy operation. This stall is often imperceptible, but might be noticeable for busy servers with large journal files. Regardless of this short stall, the journal copy operation is markedly faster than a checkpoint operation.

The off-line checkpoint and restore process does not require an additional Perforce license, since the off-line server never requires starting. However, if you want to start and inspect the off-line server instance, you need a license file. Please contact support@perforce.com if you need a license for this purpose.