Lean and Mean Perforce: Label and Workspace Unloading
I’m always a fan of not having to make tough choices. Zero calorie anything, ‘educational’ cartoons for my son...these are some of life’s finer pleasures. The new metadata unloading tools in Perforce fall into this category of pain-free indulgence.
You see, labels and workspaces are two core pieces of version management power that Perforce offers. Labels are a great way to specify, explicitly, a set of file revisions that you’re interested in. You might use a label to identify a particular configuration of a product as it was released, a stable snapshot for QA to test, or just to identify the state of a development codeline.
Likewise, workspaces are a great way for Perforce users to maintain several working areas. Some developers have one workspace for each product, or each version of a product, that they work on. Workspaces are also used to feed data to build processes and other automated activities.
So in general I recommend making as much use of labels and workspaces as you want: they’re productive and powerful tools.
Labels and workspaces do have a cost associated with them. Some of that cost is just associated with the size of your Perforce database, while another part is the user experience when working with a big set of data. If you have 100,000 labels in your Perforce repository, it’s a real trick to quickly find the ones you want, even with all the filtering tools that Perforce provides.
That’s why a bit of housekeeping is in order with labels and workspaces. A common strategy is to retire old labels and workspaces: find the ones that haven’t been accessed in a few months, save off all the data that you’d need to recreate them if necessary, and then delete them. The housekeeping is easy enough, and Perforce’s consulting team includes the necessary scripts in the Server Deployment Package.
Now, though, the housekeeping tools are built into Perforce. With the new
p4 unload command, you can easily retire a single label or workspace:
p4 unload -l mylabel
Or, I can unload all labels older than a certain date:
p4 unload -f -al -d 2010/01/01
Equivalent commands exist for unloading workspaces. Run this single command once every few weeks, and you’ll keep your labels and workspaces under control.
Unloading moves the label information into an unload depot. That keeps the size of the database in check, and also means that you won’t see as many labels when you run commands like p4 labels. (There are ways to see unloaded labels when you want to, of course.) So unloading labels and workspaces is a great way to improve system performance and usability.
Need the information back? Just run
p4 reload -l mylabel
If you’re addicted to making labels and workspaces, Perforce is now a more responsible enabler! Grab the latest release and see for yourself.