P4D "-xv" Flag
Low Level Database Structure Validation
Warning: If you suspect Perforce database corruption, and you can not restore from a recent checkpoint and journal, call or contact Perforce support immediately. Attempting to address the issue on your own can result in the corruption or loss of your data.
SUMMARY
The "-xv" command checks the low-level structure and integrity of your Perforce database tables, and reports any errors found. The basic syntax is:p4d -xv
DETAILS
The P4D "-xv" flag was introduced in revision 2001.1.The Perforce Server database tables are kept in a B-tree structure, which allows rapid keyed access, and keeps the data organized. The data stored in this structure uses offsets within the file to either point to pages or to specific information within a page. Data on the pages is often relocated to accommodate new data or to reuse space from deleted items.
The structures can become damaged in the event of:
- An unexpected server halt (crash, power outage, hardware failure).
- Insufficient disk space.
- Partial hardware failure (Hard drives, controllers, bad memory).
- Checkpoint creation fails -- the checkpoint file itself may be present, but incomplete, and the journal file failed to truncate.
- If items appear in a checkpoint, but are not accessible by way of Perforce client commands.
- If P4D crashes during any operation that scans large portions of the database.
- You receive any Perforce Server error messages with "dbscan" or "db write" errors.
Validating db.nameThe length of time the command takes to run varies according to the size of each table. For example, a typical "db.protect" table will validate more quickly than "db.have". In general, validating your Perforce database tables takes about the same time as taking a checkpoint. The tables are locked individually as needed during validation.
Some validation errors you might see:
- Pages beyond the size of the file.
- Circular free list.
- Pages which are not readable.
- Pages which are not connected to tree or freelist.
- Pages which are not valid or are uninterpretable.
- Pages which are visited multiple times in tree and freelist.
- Data is out of order - table restore required.
- B-tree does not have consistent level count.
- Pages of uninterpretable contents found.
- Items within pages have structural problems.
Note:
One validation message can be safely ignored:
- Free list pages which are not marked as free.
