Initial add of defaria.com
[clearscm.git] / defaria.com / blogs / Status / archives / week_2006_12_24.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
4 <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6    <meta name="generator" content="Movable Type 5.2.3" />
7
8    <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles-site.css" type="text/css" />
9    <link rel="alternate" type="application/atom+xml" title="Atom" href="http://defaria.com/blogs/Status/atom.xml" />
10    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://defaria.com/blogs/Status/index.xml"$>" />
11
12    <title>Status for Andrew DeFaria: December 24, 2006 - December 30, 2006 Archives</title>
13
14    <link rel="start" href="http://defaria.com/blogs/Status/" title="Home" />
15    <link rel="prev" href="http://defaria.com/blogs/Status/archives/week_2006_12_17.html" title="December 17, 2006 - December 23, 2006" />
16    <link rel="next" href="http://defaria.com/blogs/Status/archives/week_2006_12_31.html" title="December 31, 2006 - January  6, 2007" />
17 </head>
18 <body class="layout-one-column">
19    <div id="container">
20       <div id="container-inner" class="pkg">
21
22          <div id="banner">
23             <div id="banner-inner" class="pkg">
24                <h1 id="banner-header"><a href="http://defaria.com/blogs/Status/" accesskey="1">Status for Andrew DeFaria</a></h1>
25                <h2 id="banner-description">Searchable status reports and work log</h2>
26             </div>
27          </div>
28
29          <div id="pagebody">
30             <div id="pagebody-inner" class="pkg">
31                <div id="alpha">
32                   <div id="alpha-inner" class="pkg">
33                      
34                      <p class="content-nav">
35                         <a href="http://defaria.com/blogs/Status/archives/week_2006_12_17.html">&laquo; December 17, 2006 - December 23, 2006</a> |
36                         <a href="http://defaria.com/blogs/Status/">Main</a>
37                         | <a href="http://defaria.com/blogs/Status/archives/week_2006_12_31.html">December 31, 2006 - January  6, 2007 &raquo;</a>
38                      </p>
39                      
40                      
41                      
42
43                      <h2 class="date-header">December 28, 2006</h2>
44                      <a id="a000604"></a>
45                      <div class="entry" id="entry-604">
46                         <h3 class="entry-header">Mkcc.pm and mkvob</h3>
47                         <div class="entry-content">
48                            <div class="entry-body">
49                               <ul>
50   <li>Pulled out common code from mkview that will be needed for mkvob into Mkcc.pm Perl module</li>
51
52   <li>Re-engineered mkview to use Mkcc.pm</li>
53
54   <li>Started recoding mkvob to use GPDB and the new Mkcc.pm</li>
55
56   <li>Code complete on mkvob - need to test</li>
57
58   <li><b>Issue</b>: It seems that we have multiple versions of mkview_linked and that UK has continued development of their version of mkview_linked while we've been developing on mkview_linked here in Dallas. IOW there are two versions in separate vobs!</li>
59 </ul>
60                               
61                               <h3>The old mkvob_db</h3>
62
63 <p>There are some oddities in the old mkvob_db code. For example, there is an insistence in setting umask to 0 before creating directories, which are created with specific permissions. Setting umask is only for the new creation of a directory or file. One could, instead, simply make the directory then chmod it to whatever you really wanted the permissions to be. The new subroutine MakeDir in Mkcc.pm does just that, as well as chown if owner and group are passed in as well as only making the directory if it is needed. This simplifies the code a lot and removes the need to save, set and restore umask.</p>
64
65 <p>Another oddity of the old code can be seen in the following:</p>
66
67 <div class=code><pre>
68 foreach $rgn (@regionList) {
69   $debug && print "DEBUG: Checking tag in $rgn\n";
70
71   $cmd = 'lsvob -s -region $rgn';
72
73   @output = ctcmd($cmd);
74
75   foreach $item (@output)
76   {
77     if ($item =~ /^$tag$/)
78       {
79         print "VOB tag $tag already exists in $rgn\n\n";
80         exit (1);
81       }
82   }
83 }
84 </pre></div>
85
86 <p>Looks innocuous enough - run through a list of regions looking to see if this newly requested vob tag already exists in any of the regions. However there are bugs and inefficiencies in the above code. For starters the single quote on the setting of $cmd says to <b>not</b> expand the variable $rgn. The resulting command then becomes "cleartool lsvob -s region $rgn" which, of course, would return an error, which, of course, is not checked for here. So the code, while trying to verify that this vob tag does not exist in any of the regions, fails to actually check it!</p>
87
88 <p>However if we just correct that by using double quotes we will now incur a performance penalty. Now the registry server will be required to return all the vob tags for each and every region which can take some time. Is there any way we can make this faster? Why yes there is! Specify the actual vob tag (as in cleartool lsvob -s -region &lt;region name&gt; &lt;vob tag&gt;)! You know sometimes people say that Clearcase always returns all of the registry data which is then parsed locally. Then again, sometimes it's the programmer who asks for it!</p>
89
90 <p>So the new code looks like:</p>
91
92 <div class=code><pre>
93 foreach (@regionList) {
94   debug "Checking for $tag in region $_";
95
96   @output = ctcmd "lsvob -s -region $_ $tag";
97
98   error "VOB tag $tag already exists in region $_", 1 if !grep /Error/, @output;
99 } # foreach
100 </pre></div>
101
102 <p>Note the simplifications for debug (now a subroutine from Mkcc.pm), usage of the default variable ($_) and error reporting (also a subroutine from Mkcc.pm). This algorithm performs the same task, correctly and orders of magnitude quicker.
103                               
104                               <p class="entry-footer">
105                                  <span class="post-footers">Posted by  at  4:50 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000604.html">Permalink</a>
106                                  
107                                  
108                               </p>
109                            </div>
110                         </div>
111                      </div>
112                      
113                      
114
115                      <h2 class="date-header">December 27, 2006</h2>
116                      <a id="a000603"></a>
117                      <div class="entry" id="entry-603">
118                         <h3 class="entry-header">Reworking GPDB tables, mkview</h3>
119                         <div class="entry-content">
120                            <div class="entry-body">
121                               <ul>
122   <li>Finished gpdb_add_project.pl with new table layout</li>
123
124   <li>With gpdb_getProjectsAtSite I can now return to mkview. Implemented new paging usage listing projects at the site</li>
125
126   <li>Finished coding of mkview such that it is now functional with GPDB and can make views</li>
127 </ul>
128                               
129                               <p class="entry-footer">
130                                  <span class="post-footers">Posted by  at  4:46 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000603.html">Permalink</a>
131                                  
132                                  
133                               </p>
134                            </div>
135                         </div>
136                      </div>
137                      
138                   </div>
139                </div>
140             </div>
141          </div>
142       </div>
143    </div>
144 </body>
145 </html>