Chapter 12. Occasional View Maintenance

This chapter presents step-by-step procedures for a variety of view-maintenance tasks.

Moving a View (Same Architecture)

This section presents a procedure for moving a view storage directory to another location, either on the same host or on another host with the same architecture. (To move a view to a host of a different architecture, see “Moving a View (Different Architecture)”.) For clarity, we use an example:

  • The current location of the view storage directory to be moved is /users/gomez/viewstore/gomez.vws, on a host named earth.

  • The new location for the view storage directory is /public/gomez.vws. We consider two cases: (1) the new location is also on earth; (2) the new location is on another host, named ccsvr04.

To move the view, follow these steps:

  1. Go to the view's host—Log in as the view's owner:

    % rlogin earth -l gomez
    

  2. Determine whether the view has a nonlocal private storage area.

    % ls -ld /users/gomez/viewstore/gomez.vws/.s /
        ...   .s -> /public/view_aux/gomez
        (a symbolic link indicates that the private storage area is remote)
    

  3. Deactivate the view—Use the ps(1) command to determine the process-ID of the view's view_server process. Then, use the kill(1) command to terminate that process.

  4. (if necessary) Validate the private storage area's global pathname—This step is required only if the view's private storage area is remote, and you are moving the view to another host. You must verify that the view's new host can access the private storage area using the same “global pathname” as the view's current host:

    % rlogin ccsvr04
    % ls /public/view_aux/gomez
      .
      . (this command should succeed)
      .
    % exit
    

    If the intended destination host cannot access the view's private storage area in this way, select and validate another host.

  5. Back up the view storage directory—Use the procedure in “Backing Up a View”.

  6. Copy the view storage directory—First, make sure that the desired parent directory of the target location exists and is writable. Then, copy the entire view storage directory tree (but not a remote private storage area) to the new location.

    • Same host:

      <verify that `/public' already exists>

      % cd /users/gomez/viewstore
      % tar -cf - gomez.vws | ( cd /public ; tar -xBpf - )
          (-B option is not necessary (and not supported on HP-UX systems)
      

    • Different host:

      <verify that `/public' already exists on remote host `ccsvr04'>

      % cd /users/gomez/viewstore
      % tar -cf - gomez.vws | rsh ccsvr04 'cd /public; \
          tar -xBpf -'
          (-B option is not necessary (and not supported on HP-UX systems)
      


      Note: On some systems, the “remote shell” command has another name (for example, remsh).


  7. Ensure that the “old” view cannot be reactivated—Remove it from the ClearCase storage registries:

    # cleartool rmtag -view -all gomez
    # cleartool unregister -view /users/gomez/viewstore/gomez.vws
    

    This prevents reactivation by ClearCase Release 2 client hosts. If your network also includes client hosts running ClearCase Release 1, prevent them from reactivating the view by moving aside the view storage directory:

    % cd /users/gomez/viewstore
    % mv gomez.vws gomez.vws.OLD
    

  8. Register the view at its new location.

    % cleartool register -view /public/gomez.vws
    % cleartool mktag -view -tag gomez /public/gomez.vws
    

    If your network has several network regions, you need to make additional registry entries. This procedure is essentially similar to the one in “Ensuring the VOB's Global Accessibility”.

  9. Reactivate the view.

    % cleartool startview gomez
    

  10. Delete the old view storage directory—Be sure to first verify that the view can be accessed at its new location.

    % rm -fr /users/gomez/viewstore/gomez.vws
    


    Note: Moving a view does not modify the .view file in the view storage directory. The information in this file always describes the view “first incarnation”.


Moving a View (Different Architecture)

This section presents a procedure for moving a view storage directory to a host with a different architecture. This includes converting the binary-format files that implement the view database. (To move a view to a host of the same architecture, or to another location on the same host, see “Moving a View (Same Architecture)”.) For clarity, we use an example:

  • The current location of the view storage directory to be moved is /users/gomez/viewstore/gomez.vws, on a host named earth.

  • The new location for the view storage directory is /public/gomez.vws on host ccsvr04, whose architecture differs from earth's.

To move the view, follow these steps:

  1. Go to the view's host—Log in as the view's owner:

    % rlogin earth -l gomez
    

  2. Determine whether the view has a nonlocal private storage area.

    % ls -ld /users/gomez/viewstore/gomez.vws/.s
       ...   .s -> /public/view_aux/gomez
        (a symbolic link indicates that the private storage area is remote)
    

  3. Deactivate the view—Use the ps(1) command to determine the process-ID of the view's view_server process. Then, use the kill(1) command to terminate that process.

  4. (if necessary) Validate the private storage area's global pathname—This step is required only if the view's private storage area is remote, and you are moving the view to another host. You must verify that the view's new host can access the private storage area using the same “global pathname” as the view's current host:

    % rlogin ccsvr04
    % ls /public/view_aux/gomez
      .
      . (this command should succeed)
      .
    % exit
    

    If the intended destination host cannot access the view's private storage area in this way, select and validate another host.

  5. Back up the view storage directory—Use the procedure in “Backing Up a View”.

  6. Dump the view's database to ASCII dump files.

    % cleartool reformatview -dump /users/gomez/viewstore/gomez.vws
    

    This creates files view_db.dump_file and view_db.state in the view storage directory. It also renames the view database subdirectory to db.dumped.

  7. Copy the view storage directory—First, make sure that the desired parent directory of the target location exists and is writable. Then, copy the entire view storage directory tree (but not a remote private storage area) to the new location.


    Note: On some systems, the “remote shell” command has another name (for example, remsh).

    <verify that `/public' already exists on remote host `ccsvr04'>

    % cd /users/gomez/viewstore
    % tar -cf - gomez.vws | rsh ccsvr04 'cd /public; tar -xBpf -'
        (-B option is not necessary (and not supported on HP-UX systems)
    

  8. Ensure that the “old” view cannot be reactivated—Remove it from the ClearCase storage registries:

    # cleartool rmtag -view -all gomez
    # cleartool unregister -view /users/gomez/viewstore/gomez.vws
    

    This prevents reactivation by ClearCase Release 2 client hosts. If your network also includes client hosts running ClearCase Release 1, prevent them from reactivating the view by moving aside the view storage directory:

    % cd /users/gomez/viewstore
    % mv gomez.vws gomez.vws.OLD
    

  9. On the new host, recreate the view database from the ASCII dump files.

    % rlogin ccsvr04
    % cleartool reformatview -load /public/gomez.vws
    

  10. Register the view at its new location.

    % cleartool register -view /public/gomez.vws
    % cleartool mktag -view -tag gomez /public/gomez.vws
    

    If your network has several network regions, you need to make additional registry entries. This procedure is essentially similar to the one in “Ensuring the VOB's Global Accessibility”.

  11. Reactivate the view.

    % cleartool startview gomez
    

  12. Delete the backup view database—This backup, named db.dumped, was created by reformatview –load in Step #6.

    % rm -fr /public/gomez.vws/db.dumped
    

  13. Delete the old view storage directory—Be sure to first verify that the view can be accessed at its new location.

    % rm -fr /net/sol/users/gomez/viewstore/gomez.vws
    


Note: Moving a view does not modify the .view file in the view storage directory. The information in this file always describes the view “first incarnation”.


Moving a View's Private Storage Area

Use the following procedure to move a view's private storage area to another location. For clarity, we use an example involving view storage directory /users/gomez/viewstore/gomez.vws, on host earth. The procedure works both when the private storage area is local (.s is an actual subdirectory of the view storage directory) and when it is remote (.s is a UNIX-level symbolic link to a remote location).

  1. Go to the view's host—Log in as the view's owner:

    % rlogin earth -l gomez
    

  2. Deactivate the view—Use the ps(1) command to determine the process-ID of the view's view_server process. Then, use the kill(1) command to terminate that process.

  3. Go to the private storage area—The private storage area is standard UNIX directory tree, with .s as its root.

    % cd /users/gomez/viewstore/gomez.vws/.s
    

  4. Copy the entire directory tree—You can copy the directory tree to a new location using cp, rcp, tar, or other commands. For example:

    % mkdir -p /public/view_aux/gomez.priv
    % cp -r * /public/view_aux/gomez.priv
    

    Be sure to select a new location that is globally accessible.

  5. Replace the old .s directory with a symbolic link—It doesn't matter whether the existing .s is an actual subdirectory or a symbolic link. Just move it aside and create a (new) symbolic link in its place:

    % cd ..
    % mv .s .s.MOVED
    % ln -s /public/view_aux/gomez.priv .s
    

  6. Reactivate the view—Use startview or setview.

  7. Remove the private storage area—When you have verified that the private storage pool is working well in its new location, you can remove the old one:

    • If old private storage area .s.MOVED is an actual directory:

      % rm -fr /users/gomez/viewstore/gomez.vws/.s.MOVED
      

    • If old private storage area .s.MOVED is a UNIX symbolic link:

      % cd /users/gomez/viewstore/gomez.vws/.s.MOVED
      % rm -fr *
      % cd ..
      % rmdir .s.MOVED
      

Manual Cleanup of a View

Use the following procedure to remove unwanted files from a view's private storage area. (You may wish to adapt this procedure to your own organization's needs, and then publicize it to all ClearCase users.)

Suppose the view's view-tag is R2integ.

  1. Set the view.

    % cleartool setview R2integ
    

  2. Take inventory of the view's private files with lsprivate—The lsprivate command lists view-private files using the pathnames at which they appear in VOBs:

    % cleartool lsprivate | tee /tmp/R2integ.lsp
    /vobs/proj/sun4/pick.o
    /vobs/proj/sun4/spar.o
    /vobs/proj/lib/get.c  [checkedout]
    /vobs/proj/lib/get.c~
    /vobs/proj/lib/querytty.c  [checkedout]
    /vobs/proj/lib/querytty.c~
    /vobs/proj/lib/strut.c  [checkedout]
      .
      .
    

    Be sure to place the output in a scratch “inventory” file, as in this example. Don't worry if some not available - deleted perhaps? error messages appear. Such messages are sent to stderr; corresponding information is also written to stdout, and thus will be captured in the scratch file.

  3. Extract the names of unneeded files—Use a text editor, the grep utility, or any other tool to extract from the scratch file the names of files that can safely be deleted. Write this list to another file—for example, /tmp/R2integ.deleteme. Likely candidates include:

    • text-editor temporary files and backup files (foo.c~, #foo.c#, foo.c.backup, and so on)

    • output files produced by text formatters (foo.ps, foo.dvi, and so on)

    • core dump files

    Be sure to exclude from the to-be-deleted list any checked-out files. Such files are annotated with [checkedout] in the lsprivate output, as shown above.

  4. Double-check the list—Make sure it contains only files to be deleted.

  5. Delete the view-private files—Use the shell's “command substitution” feature to delete the files in the extracted list:

    % rm `cat /tmp/R2integ.deleteme`
    


    Note: The following steps are appropriate only if not available - deleted perhaps? error messages appeared in Step #2 above.


  6. Decide which stranded files should be deleted—The error messages, and corresponding lines with VOB– and/or DIR– in the inventory file, describe stranded view-private files. Such files belong to VOBs and/or directories that are not currently accessible—and, in some cases, may never become accessible again. Consult the lsprivate manual page to learn more about stranded files, and to decide which files should be deleted. In general, you don't select individual files, but entire directories or entire VOBs, all of whose view-privates files are to be deleted.

  7. Collect the appropriate UUIDs—Determine the UUID of each VOB directory and each VOB whose files are to be deleted. For example, the following lines from lsprivate output describes a stranded file named hello.c.ann:

    <VOB-beeb313c.0e8e11cd.ad8e.08:00:69:06:af:65>/
        <DIR-375b5ca0.0e9511cd.ae20.08:00:69:06:af:65>/hello.c.ann
    

    (Here, we've split the line for readability—it is not split in lsprivate's output.) The VOB from which the file is stranded has UUID beeb313c.0e8e11cd.ad8e.08:00:69:06:af:65; the VOB directory in which the stranded file was created has UUID 375b5ca0.0e9511cd.ae20.08:00:69:06:af:65.

  8. Move stranded files to the view's lost+found directory—To remove a set of stranded files, first transfer them to the view's special lost+found directory, using the recoverview command. For example, this command transfers all stranded view-private files created in the same directory as hello.c.ann:

    % cleartool recoverview -dir 375b5ca0.0e9511cd.ae20.08:00:69:06:af:65 -tag R2integ
    Moved file /net/ccsvr03/vus/integ/.s/lost+found/57FBB6DF.0418.util.c.ann
    Moved file /net/ccsvr03/vus/integ/.s/lost+found/2203B56D.00C2.hello.c.ann
    

    In this example, recoverview transfers just two files, util.c.ann and hello.c.ann, to the lost+found directory.

  9. Delete the files from the lost+found directory—You can now use a standard rm(1) command to delete the stranded files:

    % cd /net/ccsvr03/vus/integ/.s/lost+found
    % rm 57FBB6DF.0418.util.c.ann
    % rm 2203B56D.00C2.hello.c.ann