Unloading infrequently-used metadata

Over time, Helix Server accumulates metadata associated with old projects that are no longer in active development. On large sites, reducing the working set of data, (particularly that stored in the db.have and db.labels tables) can significantly improve performance.

Create the unload depot

To create an unload depot named //unload, enter p4 depot unload, and fill in the resulting form as follows:

Depot:       unload
Type:        unload
Map:         unloaded/...

In this example, unloaded metadata is stored in flat files in the /unloaded directory beneath your server root (that is, as specified by the Map: field).

After you have created the unload depot, you can use p4 unload and p4 reload to manage your installation’s handling of workspace and label-related metadata.

Note

The output of p4 -ztag info includes unloadSupport enabled if the administrator has created a depot of type unload. If not, the output includes unloadSupport disabled.

Unload old client workspaces, labels, and task streams

The p4 unload command transfers infrequently-used metadata from the Helix Core Server db.* files to a set of flat files in the unload depot.

Individual users can use the -c, -l, and -s flags to unload client workspaces, static labels, or task streams that they own. For example, maintainers of build scripts that create one workspace and/or label per build, particularly in continuous build environments, should be encouraged to unload the labels after each build:

$ p4 unload -c oldworkspace
$ p4 unload -l oldlabel

Similarly, developers should be encouraged to unload (p4 unload -s oldtaskstream) or delete (p4 stream -d oldtaskstream) task streams after use.

To manage old or obsolete metadata in bulk, administrators can use the -a, -al, or -ac flags in conjunction with the -d date and/or -u user flags to unload all static labels and workspaces older than a specific date, owned by a specific user, or both.

By default, only unlocked labels or workspaces are unloaded; use the -L flag to unload locked labels or workspaces.

To unload or reload a workspace or label, a user must be able to scan all the files in the workspace’s have list and/or files tagged by the label. Set MaxScanrows and MaxResults high enough (see Limits for users in multiple groups) that users do not need to ask for assistance with p4 unload or p4 reload operations.

Accessing unloaded data

By default, Helix Server commands such as p4 clients, p4 labels, p4 files, p4 sizes, and p4 fstat ignore unloaded metadata. Users who need to examine unloaded workspaces and labels (or other unloaded metadata) can use the -U flag when using these commands. For more information, see the Helix Core Command-Line (P4) Reference.

Reloading workspaces and labels

If it becomes necessary to restore unloaded metadata back into the db.have or db.labels table, use the p4 reload command.