Perforce Public Knowledge Base - Differences Between "journal" and "journal.n" Files
Downloads Blog Company Integrations Careers Contact Try Free
Menu Search
Reset Search



Differences Between "journal" and "journal.n" Files

« Go Back



What is the difference between the current running journal file ("journal") and a numbered journal.n file ("journal.123")?
How do I know which journal file to use when restoring the Perforce Server?


First, note that a checkpoint is a complete snapshot of Perforce Server metadata at a particular moment in time. When a checkpoint is created, the current running journal file is rotated and saved as a numbered journal.n file.

journal vs. journal.n

The Perforce Server journal file contains all server transactions since the time of the last checkpoint. By default, the journal file is named "journal" and is found in the P4ROOT location. The current running journal file can also be set to an arbitrary name using the -J flag in the p4d server startup command, or specified by the P4JOURNAL environment variable. It is important to know where the current running journal file is located for backup and recovery purposes.

Numbered journal.n files, where n is a journal sequence number, contain server transactions from after checkpoint.n and before checkpoint.n+1. In other words, a numbered journal contains a record of all changes to a Perforce Server's metadata between checkpoints. By default, journal sequence numbers are always one less (n-1) than the associated numbered checkpoint.n file that was created at the same time.


    This example shows four (4) checkpoints and four (4) corresponding rotated journals, plus the current running journal. The example checkpoint and journal files use a prefix of "p4backup".

    Below are the names of each checkpoint and journal, showing which {changelists} are included in each. Note that the first journal ("journal.0") has the same transactions as the first checkpoint ("checkpoint.1"). Subsequent numbered journals contain only the new changelists and other transactions since the prior checkpoint.

    a) p4backup.ckp.1  {1099}    
       p4backup.jnl.0  {1-1099}     // first numbered journal
    b) p4backup.ckp.2  {9309}
       p4backup.jnl.1  {1100-9309}  // transactions since checkpoint.1
    c) p4backup.ckp.3  {9413}
       p4backup.jnl.2  {9310-9413}  // transactions since checkpoint.2
    d) p4backup.ckp.4  {9418}
       p4backup.jnl.3  {9414-9418}  // transactions since checkpoint.3
    e) journal  {9419-9423}         // current running journal  


    Below is an illustration of all the checkpoints and journals along with their corresponding changelists.



    NOTE: In the example above , if a new checkpoint is taken, then checkpoint "ckp.5" would be a snapshot of the database up to change 9423. Journal "jnl.4" would then include changes 9419 through 9423. The current running journal would then contain any changes to the database from change 9424 forward.


    Restoring checkpoints and journals

    To restore the Perforce Server database to the most recent point in time, you only need the most recent checkpoint ("ckp.4"  in the example above) and the current running journal file ("journal").

    In general, you do not need to restore numbered journal.n files. Numbered journal files are only needed when the last checkpoint is missing or corrupt. In that case, restoring the Perforce Server requires restoring the last good checkpoint, then restoring all subsequent numbered journals, in sequence, and finally, restoring the current running journal.

    Related Links
    For further reference on backup and recovery procedures, see the following resources:



    Was this article helpful?



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

    Characters Remaining: 255