Perforce Public Knowledge Base - MISSING! errors from p4 verify
× PRODUCTS SOLUTIONS CUSTOMERS LEARN SUPPORT
Downloads Company Partners Careers Contact Free Trials
Menu Search
Perforce
Reset Search
 

 

Article

MISSING! errors from p4 verify

« Go Back

Information

 
Problem

How do I fix MISSING! errors from p4 verify?

Solution

The MISSING! error indicates that Perforce cannot find the specified revisions within the versioned file tree. There are several general cases that produce the error:

  • The archive file is missing from the versioned file tree.
  • The revision(s) can not be extracted from the archive file.
  • Permissions/ownership of depot files is set incorrectly in local file system.

In the first case, you see all revisions of the file reported as MISSING!. In the second case, you might see only a subset of the file revisions reported as MISSING!. In the third case, you will see the permissions/owner of the depot revision files is not set or does not include read, write, execute access for the user running the P4D instance/service.

Shelved Change Archives

Shelved changes present a special case when dealing with obliteration. When an obliterate is performed on a depot branch with the "..." wildcard where files are shelved, those archives will be marked as MISSING.

For example, if change 1234 is a shelved change containing files on the depot path being deleted, the MISSING archives will be detected with the p4 verify -S flag:

	p4 obliterate //depot/old_project/...

p4 verify -Sq //depot/...
[...]
//depot/old_project/foo.txt#2 - edit change 1234 (text) 
428FCD25613A109737464574878B8558 MISSING!

To fix those errors, delete the shelved change as a super user:

p4 shelve -d -f -c 1234

Or replace the missing archives using the technique below.

Note: All shelved files are stored as individual revisions, regardless of file type. As a result, even archives stored as ",v" (RCS delta) files will have a shelved archive stored in a ",d" directory.

Using the same example, the foo.txt file would appear as two possible file paths:

depot/old_project/foo.txt,v
depot/old_project/foo.txt,d/1.1234

In either case, the fix can be confirmed with this command syntax:

p4 verify -Sq @=1234

Note: If correcting a post-obliterate MISSING error, this command will produce no output (it returns to prompt).

Locating archive files

When dealing with fixing MISSING! errors, you need to locate archive files in the versioned file tree. Archive files are generally stored as either RCS format (",v") files or compressed binaries (",d") and are located off of the Perforce server root (P4ROOT) directory. For example, the archive file location for the text file "//depot/foo.c" would be "<P4ROOT>/depot/foo.c,v". The archive file location for the binary file "//depot/bar" would be the directory "<P4ROOT>/depot/bar,d" in which there is a *.gz file for each revision.

The "librarian path" of a revision that indicates where its archive is located is usually (but not necessarily) the same as its user-visible depot path. To quickly find the librarian path of a file, run p4 fstat -Oc on the file/revision (note that this is an undocumented command). The "lbrFile" and "lbrRev" fields show the librarian path and revision number for the specified revision.

The following sections detail solutions for the MISSING! error. You might need to mix and match these concepts to fit your situation:

Verify ownership/permissions of the depot folder(s) in local file system

Confirm that the user running P4D has read, write, and execute permissions to the depot libriarian/revision file.

Restore the versioned file from backup

If you have a versioned file from a backup that has the latest changes to these files, restore it.

Obliterate MISSING! revisions then restore the head revision

The head revision of a file most likely exists on a user's workstation. If this head revision is available, you can obliterate the missing revisions and then re-add the head revision.

  1. Obliterate the missing revision or revisions:

    Check that you can obliterate the missing revision or revisions:
    p4 obliterate <filename>#<rev>
    Then destroy the MISSING! revisions with p4 obliterate:
    p4 obliterate -y <filename>#<rev>
  2. Add in the missing head revision:

    Have the user add the head revision from their workstation back into Perforce using a GUI or through the command line:
    p4 edit <filename>
    
    If the obliterate command removed all revisions of the file, use p4 add instead of p4 edit. Note that the date of this latest version will be today's date instead of the original date.
    Warning:  If you use the obliterate command, it destroys all history of the file or the revision of the file. After this point it is not possible to recover the file from within Perforce. Therefore, make sure you have a Perforce checkpoint and backups of the versioned files before you obliterate the files. It is possible that the revision you obliterate may be needed as a base for merging branches.  If this is the case, you will need to specify a revision range on your next integrate that avoids use of the missing base.  After obliterating the revision, you can add the latest revision back in, but note that the file revision date will be today's date and not the date when it was originally added.

Obliterate MISSING! revisions only

If you do not care about the particular revisions missing, you can use the p4 obliterate command to destroy particular revisions of the file.

Check that you can obliterate the missing revision or revisions:

p4 obliterate <filename>#<rev>

Then destroy the MISSING! revisions with:

p4 obliterate -y <filename>#<rev>

This command removes future p4 verify errors for that revision, but users will still receive an error if they try to access the obliterated revisions. If a user does need this particular version in the future, the version is probably available on older checkpoints and associated versioned files. Restore the old checkpoint and the old versioned files into a directory and start up a test instance on a different port. For example,

p4d -r . -jr <old checkpoint>

Then retrieve the missing version by either creating a new client and getting the revision, or by running:

p4 print //<depot>/<dir>/<filename>#<rev> > <filename>

Obliterate the entire file

If you do not care about the entire file, you can completely obliterate it. If the file is needed, versions of the file are likely to be found in a previous Perforce backup.

p4 obliterate <filename>
p4 obliterate -y <filename>

Recreate the versioned file

It is possible to recreate the versioned file. Retrieve any missing versions by restoring old checkpoints and associated versioned files. Then start a test instance of Perforce under a new port number such as 12345:

p4d -r . -p 12345 -jr <checkpoint>

Then retrieve all missing versions.

Recreate a working versioned file by creating another test instance in another directory on the production server and restoring a checkpoint without any missing versions. This procedure gives you a partial, but error-free "<filename>,v" file. Add in missing versions to this test server one at a time, and you recreate a new "<filename>,v" file.

In older versions of Perforce, you can add this newly created versioned file back into the production server. In Perforce 2006.2 or later, you need an additional step because the versions in the versioned files have unique "librarian revision" numbers that are based on changelists. To find the proper librarian revision numbers, use the p4 fstat -Oc command,

Edit the test versioned file and replace the newly added missing versions with the proper revision numbers before copying this modified versioned file onto the production server.

In all  cases, make sure you back up your original versioned files before overwriting them.

Verify your fixes

When you have completed the restore of MISSING! files, check to see if the problem is fixed by running:

p4 verify -q //<depot>/<dir>/...
Related Links

Feedback

 

Was this article helpful?


   

Feedback

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

Characters Remaining: 255