Links

Content Skeleton

This Page

Previous topic

Altbackup

Next topic

bitbucket

Bitten Querying

altquery.py for trac.db querying

Warning

never use this on a live trac.db, always extract one from a backup tarball and query that

Usage:

  1. define envvar DBPATH to the path to the extracted trac.db (a 7 GB file)
  2. if no recent extraction, use altbackup.py extract_tracdb

Examples:

altquery.py last_by_slave
altquery.py step_times_byrev -s ALL

python version

Some commands use group_concat requiring a recent sqlite. The one that comes with py27 is suitable.

sub-commands

last_by_slave

[blyth@cms01 scm]$ ./altquery.py last_by_slave
2013-05-17 19:02:41,419 __main__ INFO     ./altquery.py last_by_slave
 slave                 id      rev         lastrevtime             laststart             
 belle7.nuu.edu.tw     20652   20479       2013-05-08 00:23:01     2013-05-08 03:40:09   
 daya0001.rcf.bnl.gov  20654   20479       2013-05-08 00:23:01     2013-05-08 08:43:41   
 farm4.dyb.local       20719   20536       2013-05-15 20:23:03     2013-05-15 21:36:59   
 lxslc507.ihep.ac.cn   20720   20536       2013-05-15 20:23:03     2013-05-15 23:42:34   
 pdyb-03               20717   20536       2013-05-15 20:23:03     2013-05-16 00:51:11   
 farm2.dyb.local       20715   20536       2013-05-15 20:23:03     2013-05-16 01:20:45   
 lxslc504.ihep.ac.cn   20716   20536       2013-05-15 20:23:03     2013-05-16 01:46:54   
 pdyb-02               20721   20536       2013-05-15 20:23:03     2013-05-16 02:27:27   
 daya0004.rcf.bnl.gov  20718   20536       2013-05-15 20:23:03     2013-05-16 02:49:22   
[blyth@cms01 scm]$ 

step_times_byrev

[blyth@cms01 scm]$ ./altquery.py step_times_byrev -s test-fmcp11a
2013-05-17 18:46:36,297 __main__ INFO     ./altquery.py step_times_byrev -s test-fmcp11a
bitten_build_step_times_byrev   config dybinst  step test-fmcp11a   modifier -30 days   dbpath /data/env/tmp/tracs/dybsvn/2013/05/16/104702/dybsvn/db/trac.db 

    rev       rev_time                              belle7.nuu.edu.tw     daya0001.rcf.bnl.gov  daya0004.rcf.bnl.gov  farm2.dyb.local       lxslc504.ihep.ac.cn   pdyb-03               
    20370     2013-04-18 09:19:02                   6352                  -                     -                     5823                  5320                  6929                  
    20386     2013-04-20 06:39:31                   1592                  -                     -                     1472                  -                     1705                  
    20394     2013-04-22 21:52:00                   1594                  -                     -                     -                     -                     1697                  
    20400     2013-04-23 15:31:44                   9817                  -                     -                     -                     -                     10431                 
    20404     2013-04-24 15:46:54                   1633                  -                     -                     1471                  -                     1911                  
    20405     2013-04-24 20:51:16                   1609                  -                     -                     1470                  -                     1864                  
    20411     2013-04-25 19:44:08                   1582                  -                     -                     1476                  -                     1656                  
    20418     2013-04-26 06:04:23                   1602                  1049                  -                     1483                  -                     1775                  
    20446     2013-04-30 21:53:33                   1599                  1054                  -                     1478                  -                     1756                  
    20453     2013-05-02 11:43:14                   1600                  -                     1047                  1488                  1334                  1723                  
    20471     2013-05-07 08:36:53                   1599                  -                     1052                  1465                  -                     1669                  
    20477     2013-05-07 22:49:37                   1589                  -                     1043                  1463                  -                     1706                  
    20479     2013-05-08 00:23:01                   1599                  1045                  -                     1464                  1449                  1869                  
    20520     2013-05-14 05:56:46                   -                     -                     4268                  5804                  5489                  7073                  
    20530     2013-05-15 02:40:52                   -                     -                     4230                  5803                  -                     -                     
    20531     2013-05-15 05:42:24                   -                     -                     1047                  1486                  1420                  2356                  
    20534     2013-05-15 16:45:42                   -                     -                     1048                  1509                  1395                  1911                  
    20535     2013-05-15 18:58:10                   -                     -                     1047                  -                     -                     -                     
    20536     2013-05-15 20:23:03                   -                     -                     1052                  1466                  -                     -