Search code examples
optimizationclearcasecleartool

Cleartool command performance: lshistory or find -exec


I am looking for query optimization, but IBM is not very chatty about that in the clearcase documentation. So in short, we have quite big vob, and we would like to list all the change made between 2 dates, which query do you thing is the fastest, and do you see any improvement to be made ?

Method 1:

cleartool find -avobs -type f -element '(created_since(1-Jun-2016) &&                  !created_since(1-Sep-2016))
 && (Element_Type==""Program"" || Element_Type==""Output"" || Element_Type==""Data"")'
-ver 'created_since(1-Jun-2016) && !created_since(1-Sep-2016)' 
-exec 'cleartool describe -fmt ""#Name:%Xn Date:%Nd User:%u Label:%1.400Cl Attributes:%a Version:%Vn Comment:%Nc \n"" $CLEARCASE_XPN' 
>| test.txt

Method 2:

cleartool lshistory -avobs -since 1-Jun-2016 -fmt '#Name:%Xn Date:%Nd User:%u Label:%1.400Cl Attributes:%a Version:%Vn Comment:%Nc \n' -nco -pname >| test.txt

Thank you!


Solution

  • cleartool lshistory is about event records, the minors ones can be scrubbed. It offer less filtering options, which means you get everything and only then apply a filter yourself (grep)

    Generally, a cleartool find can be faster, as you can add criteria to refine the search.

    From "Additional examples of the cleartool find command", in order to see all changes (not just creations at the element level, but changes, at the version level), the query is:

    cleartool find . -version "{created_since(date1) && !created_since(date2)}"
    

    -print

    The fact that you can add:

    • type f (you want only files, not folders)
    • any other criteria (Note: I don't see "Element_Type" in query_language)

    Those will help to speed up the query.


    The OP M4hd1 adds in the comments:

    Based on your comment I changed the query to that:

    cleartool find -avobs -type f -element '(attr_sub(Element_Type,==,"Output"))' -ver 'created_since(1-Jun-2016) && !created_since(1-Sep-2016)' -exec 'cleartool describe -fmt ""#Name:%Xn Date:%Nd User:%u Label:%1.400Cl Attributes:%a Version:%Vn Comment:%Nc \n"" $CLEARCASE_XPN' >| test.txt
    

    In multiple lines:

    cleartool find -avobs -type f -element '(attr_sub(Element_Type,==,"Output"))' \
      -ver 'created_since(1-Jun-2016) && !created_since(1-Sep-2016)'  \
      -exec 'cleartool describe -fmt ""#Name:%Xn Date:%Nd User:%u Label:%1.400Cl Attributes:%a Version:%Vn Comment:%Nc \n"" $CLEARCASE_XPN' \
    >| test.txt