Changes between Version 1 and Version 2 of YumDB

Show
Ignore:
Author:
james (IP: 65.172.155.230)
Timestamp:
07/28/10 20:51:18 (7 years ago)
Comment:

Add more info. about yumdb design

Legend:

Unmodified
Added
Removed
Modified
  • YumDB

    v1 v2  
    1212}}} 
    1313 
    14 Each keyname is a file the contents of which are the values. 
     14Each keyname is a file and the contents of that file are the values. 
     15'''Note''' since 3.2.28 hardlinks are allowed between different keys, this saves on load time and storage but means that if you try to change the data using a text editor it'll probably change more than you want it to. 
     16 
     17=== Why not a "real" database === 
     18 
     19The two main operations that yum uses the yumdb for are: 
     20 
     21 * Given an installed package XYZ-2-1.noarch, get the value of yumdb key FOO. (Eg. yumdb get from_repo yum). 
     22 * Given an installed package XYZ-2-1.noarch, set the value of yumdb key FOO to BAR. (Eg. yumdb set from_repo special yum). 
     23 
     24...using the filesystem allows both those operations to be fast and atomic. It is unlikely to be significantly better to use any other approach for the two main uses, however the most common suggestions "sqlite" and a key/value store (like "libdb*") fail at least one of those tests. 
     25Using the filesystem makes it easy to: 
     26 
     27 * Keep all the yum code simple. 
     28 * Have isolation. Eg. Something goes wrong and the "reason" key for package XYZ is broken, nothing else should be affected. 
     29 * Have a knowledgeable sysadmin fix any problems. 
     30 * Have interoperability (it's trivial to to the get/set operations from any language without having to use the yum API -- although we still don't recommend it). 
     31 
     32There are two minor downsides to using the filesystem: 
     33 
     34 * Searching is not fast (Eg. yumdb search from_repo updates-testing). The main thing to realize here is that no yum tool currently needs to perform operations like this. 
     35 * Load all keys of XYZ from all installed packages. The only usecase here is loading the checksum data to calculate rpmdb-versions, on install/etc. ... however we need a separate index for this anyway, as we when need to know this information quickly we don't want to load the packages at all. 
    1536 
    1637== Commonly stored information == 
    1940 * command_line: command line used to install this pkg 
    2041 * releasever: $releasever of the system at the time the pkg was installed (so you can look for pkgs which have lingered across release updates) 
     42 * installed_by (3.2.28): The loginuid of the user who first installed this package (can be non-existant). This doesn't cross Obsoletes. 
     43 * changed_by (3.2.28): The loginuid of the user who last installed this package (can be non-existant). 
    2144 
    2245== Accessing this information == 
    2851    }}} 
    2952  
    30  * set a note on the package 'joe
     53 * set a note on the packages 'joe' and 'geany
    3154    {{{  
    32        yumdb set note "installed by seth b/c he likes it" joe 
     55       yumdb set note "installed by seth b/c he likes them" joe geany 
    3356    }}} 
    3457   
    35   * Dump out all yumdb values about yum-utils: 
     58  * Dump out all yumdb values about yum and yum-utils: 
    3659    {{{ 
    37        yumdb info yum-utils 
     60       yumdb info yum-utils yum 
    3861     }}} 
    3962