While looking at many broken repositories over the past couple of months, it became obvious to me that having a way to trace which view committed which changes to an item and when would be very helpful in piecing together a particular bug's reproduction scenario.

I just checked in changes that implement this new debugging feature,
err, bug 7152. There are four new APIs that print out short records about versions and the views that wrote them:

Repository.printVersions()          (with optional version number boundaries)
Repository.printItemVersions(item)  (likewise)
RepositoryView.printVersions()      (likewise)
RepositoryView.printItemVersions(item) (likewise)

The latter two APIs limit the output to versions written by views of the same name.

For example, to know where and the masterEvents collection changed:

  > RunPython tools/headless.py
  >>> m = schema.ns('osaf.pim').masterEvents
  >>> view.repository.printItemVersions(m)
     1: 21-Oct-06,15:14:58 3597 3597 0x00800542 MainThread
     3: 21-Oct-06,15:16:19  957  174 0x00000002 viewpool-2
     7: 21-Oct-06,15:18:46 1772  947 0x00000002 viewpool-0
    11: 21-Oct-06,15:20:40 2691 1223 0x00000002 viewpool-1

which shows that it was modified when the repo was created and then when the three collections that came in with 'Restore Settings' got committed.

The table's columns are:
  - version number
  - timestamp of commit
  - size of view at commit (number of items currently loaded in that view)
  - size of commit (number of items being committed)
  - status bits of item which are defined at the bottom of this file:
http://svn.osafoundation.org/chandler/trunk/internal/chandlerdb/chandlerdb/item/item.h
  - name of the view that did the commit

Another example shows that just re-starting Chandler causes 1924 items to get loaded before the startup commit of the UI. Look at the size of the view for version 24:

     1: 21-Oct-06,15:14:58 3597 3597 MainThread
     2: 21-Oct-06,15:15:06 3597    3 MainThread
     3: 21-Oct-06,15:16:19  957  174 viewpool-2
     4: 21-Oct-06,15:16:19  957    2 viewpool-2
     5: 21-Oct-06,15:16:20  964    2 viewpool-2
     6: 21-Oct-06,15:16:20 3671    5 MainThread
     7: 21-Oct-06,15:18:46 1772  947 viewpool-0
     8: 21-Oct-06,15:18:52 1772    2 viewpool-0
     9: 21-Oct-06,15:18:53 1779    2 viewpool-0
    10: 21-Oct-06,15:18:55 4231  257 MainThread
    11: 21-Oct-06,15:20:40 2691 1223 viewpool-1
    12: 21-Oct-06,15:20:45 2691    2 viewpool-1
    13: 21-Oct-06,15:20:46 2698    2 viewpool-1
    14: 21-Oct-06,15:20:46 4945  221 MainThread
    15: 21-Oct-06,15:21:40 4946    2 MainThread
    16: 21-Oct-06,17:29:33 1542  193 MainThread
    17: 21-Oct-06,17:29:39 1720    3 MainThread
    18: 21-Oct-06,19:54:52 1544  193 MainThread
    19: 21-Oct-06,19:55:43 2823  418 MainThread
    20: 21-Oct-06,19:55:46 2869  301 MainThread
    21: 21-Oct-06,19:56:00 2882   45 MainThread
    22: 21-Oct-06,19:56:01 2882  250 MainThread
    23: 23-Oct-06,14:57:13 1640  193 MainThread
    24: 23-Oct-06,14:57:33 1924   11 MainThread

Andi..

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev

Reply via email to