Timestamp Optimization (TSO)

Timestamp Optimization (TSO)
In various situations, AccuRev searches some or all of your workspace tree to determine which files's status should include the (modified) indicator.
As of AccuRev Version 5.4, there are two different Timestamp Optimization (TSO) mechanisms used to perform this search:
Traditional, server-based TSO
Local, client-based TSO
This section describes these mechanisms and how to specify your site default.
Traditional, Server-Based Timestamp Optimization
The traditional method of evaluating whether an element in a workspace is modified is based upon comparing the timestamps and checksums of elements in the local workspace tree against checksums and a time threshold for the workspace stream, requiring communication with the AccuRev server:
When displaying the contents of a directory (folder), the checksum of each file element in that directory must be compared to the checksum of the corresponding version in the workspace stream.
In a Modified search, the checksum of each file element in the entire workspace tree must be compared to the checksum of the version in the workspace stream.
The Pending, Non-member, Overlap, Underlap, and Deep Overlap searches also involve a search for modified files throughout the workspace tree.
The Update command starts by performing a Non-member search, and refuses to proceed if it finds any modified files that are not in the workspace's default group. If the Timestamp Optimization checkbox (at the bottom on the File Browser tab) is checked, AccuRev skips the files in the workspace tree whose timestamps precede the workspace's scan threshold. This optimization can provide a significant performance increase.
The Scan Threshold of a Workspace
AccuRev keeps track of such modified-file searches, maintaining an ever-advancing scan threshold for each workspace:
After a successful update, the scan threshold is advanced to the time that the Update command began.
After any of the searches listed above, the scan threshold is advanced beyond the time of the most recent update, to the point in time just before the timestamp on the oldest non-member modified file that the search located.
The scan threshold is not advanced when you work in the Folders pane, only the Searches pane.
The intended effect of these manipulations is to set the scan threshold to the latest time for which this principle holds true:
For file elements that are not in the workspace's default group, the timestamp of a modified file is later than the workspace's scan threshold.
Taking Advantage of the Scan Threshold: Timestamp Optimization
AccuRev's timestamp optimization feature takes advantage of the principle stated above. If the checkbox at the bottom of the File Browser tab is checked, AccuRev ignores files in the workspace with timestamps preceding the scan threshold for all File Browser operations, including Update.
The advantage of using the scan threshold is simple: it enables AccuRev to ignore files and do its work more quickly. The later the scan threshold, the more files can be ignored, and the speedier the performance of the File Browser.
Validity of Traditional Timestamp Optimization
The traditional timestamp optimization principle is usually valid -- but, unfortunately, not always. In general, if the only way you change version-controlled files is with text editors and build tools, the principle will be valid: each new change gets timestamped with the current time. But there are tools that can introduce "a new change with an old timestamp" into a workspace:
The operating system's "copy file" command can preserve old timestamps when creating a new copy of a file. Similarly, the tar (UNIX) and zip (UNIX and Windows) utilities can preserve old timestamps when they copy files out of an archive.
If the environment variable ACCUREV_USE_MOD_TIME is set, the Send to Workspace, Populate, Update, and the various Revert commands preserve timestamps when copying versions from the repository into a workspace.
Less likely but possible, a severely-lagging system clock on an AccuRev client machine can cause edited files to get timestamps that precede the most recent update. (AccuRev commands won't execute if the client machine's clock is not synchronized with the server machine's clock. But something bad might happen to the client machine's clock at a time when no AccuRev commands are being executed.)
To work around these situations and continue using traditional TSO, clear the Timestamp Optimization checkbox before performing an Update or any of the relevant searches. This can slow performance significantly, but it guarantees that no modified file will be overlooked because of a misleading timestamp.
If you know exactly which modified files have old timestamps, you don't need to turn off the timestamp optimization. Instead, just update the timestamps to the current time, using the CLI command accurev touch.
Local, Client-Based Timestamp Optimization
Because of the issues listed in the previous section, AccuRev 5.4 introduces a new Timestamp Optimization (TSO) feature that is now optionally available as a server side setting. This new TSO makes use of cached server information that is stored on the client. This new approach to timestamp optimization ensures that all modified files in the workspace are correctly identified (even if they have an older time stamp and have been copied into the workspace from an external directory), while maintaining or increasing performance.
Note: Because this new Time Stamp Optimization feature requires a one-time, full scan of the workspace, the first accurev stat or accurev update CLI command, or the first GUI Update or search command such as Pending or Modified, that your users perform on any existing workspace may take up to several minutes to complete. (This does not apply to newly created workspaces.) After this one-time scan has been completed on the workspace, these commands will behave with performance that is equivalent to or better than prior releases.
AccuRev CLI users access this new behavior through the stat command, or through commands such as anchor -n, co -n, files, and update (which make calls to the stat command). AccuRev Java GUI users access the behavior through the Update command and the File Browser Search Pane options (which make calls to the stat command).
Local cache of element data
With local Timestamp Optimization, AccuRev maintains a cache database for each workspace which can be used for modified file detection, containing information about each file.
When TSO is enabled, this cache allows AccuRev to make a quick determination of modified state based on locally cached file sizes and timestamps without the hashcode computation and without going to the server.
The advantage of the new TSO approach is that time stamps for each individual file are compared to the cache, rather than comparing them to a single workspace scan threshold, which is set to the time stamp of the oldest modified file (as described in The Scan Threshold of a Workspace on page 33). This not only provides more valid results (by catching all modified files, even those with older time stamps that have been copied into the workspace from an external directory), it can be more efficient in situations such as a workspace that has a large number of (backed) files that have later time stamps than a single modified file.
The cache is updated by AccuRev commands that affect the file status or content on disk such as update, keep, add, pop, etc.
Setting and Overriding Default TSO Behavior
The AccuRev administrator can set the default, site-wide timestamp optimization behavior by setting the following variable in the acserver.cnf configuration file:
STAT_MODE=0 (or is not defined): Use traditional timestamp optimization.
STAT_MODE=1: No timestamp optimization.
STAT_MODE=2: Use the new, local timestamp optimization.
AccuRev CLI users can use or override the server STAT_MODE settings by using the following switches with the stat command (or commands which call the stat command (anchor -n, co -n, files, and update):
stat (no switch): use the default specified by STAT_MODE
stat -O: Do not use timestamp optimization (same as previous releases)
stat -O2: Use the new, local TSO
Note that if STAT_MODE=2, there is no way for an AccuRev CLI user to override this and specify the traditional TSO.
GUI users cannot override the server STAT_MODE setting, other than to not use any TSO, by turning off the Timestamp Optimization checkbox. This is the same behavior as in previous releases.

AccuRev, Inc.
Phone: 781-861-8700
Fax: 781-861-8704
support@accurev.com