Rotating or Truncating the Perforce Journal
Changes to journal handling in 2007.3
SUMMARY
Beginning with the 2007.3 version of the Perforce Server, the journal file is renamed during the checkpointing process rather than copied. The associated server message also changed to use the word "Rotating" instead of "Truncating". Checkpointing scripts that depended on the earlier output message might therefore break.
DETAILS
The Perforce Server now renames
the journal file at the end of the checkpoint process. Prior to 2007.3,
checkpointing the Perforce Server entailed copying and then truncating
the running journal. The change from copy/truncate to move/rename of
the journal file has two consequences that affect the backup process.
- Journal Ownership
The journal is owned by the user running the checkpoint command. For example, if Perforce is normally started by user "perforce", but the command
p4d -jc
is run by user "root", then the journal is subsequently owned by user "root", and Perforce does not run. To fix this, run the p4d -jc command as the user that runs Perforce.
Example
Here the journal is originally owned by user "perforce".
# ls -al journal -rw-r--r-- 1 perforce perforce 58 2008-01-22 10:02 journal
A checkpoint changes the ownership to "root", which disables Perforce.
# ./p4d -r . -J journal -jc Checkpointing to checkpoint.910... Rotating journal to journal.909... # ls -al journal -rw-r--r-- 1 root root 58 2008-01-22 13:20 journal # ./p4 info open for write: journal: Permission denied Perforce client error: TCP send failed. write: socket: Connection reset by peer
To fix this ownership problem, change the journal ownership back to user "perforce" and then perform the checkpoint command as user "perforce".# chown perforce:perforce journal # su perforce -c "./p4d -r . -J journal -jc" Checkpointing to checkpoint.911... Rotating journal to journal.910... # ls -al journal -rw-r--r-- 1 rfong rfong 58 2008-01-22 09:53 journal
- Rotating Versus Truncating
Your backup script might search for the word, "Truncating". In the 2007.3 release the word has been replaced with "Rotating". Make changes to your backup script as needed.
Example
Before:
$ ./p4d -r . -J journal -jc Checkpointing to checkpoint.884... Saving journal to journal.883... Truncating journal...
After:
$ ./p4d -r . -J journal -jc Checkpointing to checkpoint.912... Rotating journal to journal.911...
This change to journal handling is documented in the Perforce 2007.3 release notes:
#125001 **
Journal rotation with 'p4d -jc' or 'p4d -jj' is now an
instantaneous rename (rather than a copy) on UNIX. The
-z flag (compress checkpoint/journal) still copies.
The message displayed will now be "Rotating journal" instead
of "Truncating journal". Note that the new journal file
will be owned by the user running the "p4d -jx" command.
(Bug #21537, #24909)
