RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/rpmdb/ rpmdb.c

From: Jeff Johnson <n3npq@mac.com>
Date: Wed 27 Aug 2008 - 15:48:45 CEST
Message-id: <12AA9B34-D400-47CF-A755-58DC9FBE5D35@mac.com>
I see you've discovered the RPMDBI_LABLE hackery ;-)

RPMTAG_BASENAMES is an even deeper hack because of
the file fingerprint's and disk accounting that are coupled in as
side effects of a path lookup.

But on a forward looking note:

An additional loop over multiple rpmdb paths might be attempted
somewhen near where the special casing for RPMDB_LABEL is
handled.

An iterator over colon separated path elements in %_dbpath
while reading headers, returning next header found, would not
be hard to implement. OTOH, performance starts to rot instantly
because of the added loop overhead.

Note that only the 1st element in the colon separated path should
be used for dbiPut/dbiDel operations. Only dbiGet should be
permitted to loop. Also rpmdbSetIteratorModified() should be
prevented for all elements but the 1st in %_dbpath.

hth

73 de Jeff
On Aug 27, 2008, at 8:58 AM, Alexey Tourbin wrote:

>   RPM Package Manager, CVS Repository
>   http://rpm5.org/cvs/
>    
> ______________________________________________________________________ 
> ______
>
>   Server: rpm5.org                         Name:   Alexey Tourbin
>   Root:   /v/rpm/cvs                       Email:  at@rpm5.org
>   Module: rpm                              Date:   27-Aug-2008  
> 14:58:24
>   Branch: HEAD                             Handle: 2008082712582400
>
>   Modified files:
>     rpm/rpmdb               rpmdb.c
>
>   Log:
>     rpmdb.c (rpmdbInitIterator): restored isLabel check before dbiOpen
>
>   Summary:
>     Revision    Changes     Path
>     1.270       +8  -3      rpm/rpmdb/rpmdb.c
>    
> ______________________________________________________________________ 
> ______
>
>   patch -p0 <<'@@ .'
>   Index: rpm/rpmdb/rpmdb.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.269 -r1.270 rpmdb.c
>   --- rpm/rpmdb/rpmdb.c	27 Aug 2008 12:25:47 -0000	1.269
>   +++ rpm/rpmdb/rpmdb.c	27 Aug 2008 12:58:24 -0000	1.270
>   @@ -2636,12 +2636,19 @@
>        rpmdbMatchIterator mi;
>        dbiIndexSet set = NULL;
>        dbiIndex dbi;
>   +    int isLabel = 0;
>
>        if (db == NULL)
>    	return NULL;
>
>        (void) rpmdbCheckSignals();
>
>   +    /* XXX HACK to remove rpmdbFindByLabel/findMatches from the  
> API */
>   +    if (rpmtag == RPMDBI_LABEL) {
>   +	rpmtag = RPMTAG_NAME;
>   +	isLabel = 1;
>   +    }
>   +
>        dbi = dbiOpen(db, rpmtag, 0);
>        if (dbi == NULL)
>    	return NULL;
>   @@ -2681,9 +2688,7 @@
>    	int rc;
>    	int xx;
>
>   -	/* XXX HACK to remove rpmdbFindByLabel/findMatches from the API */
>   -	if (rpmtag == RPMDBI_LABEL) {
>   -	    rpmtag = RPMTAG_NAME;
>   +	if (isLabel) {
>    	    xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0);
>    	    rc = dbiFindByLabel(dbi, dbcursor, &k, &v, keyp, &set);
>    	    xx = dbiCclose(dbi, dbcursor, 0);
>   @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org
Received on Wed Aug 27 15:49:59 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.