RPM Community Forums

Mailing List Message of <rpm-devel>

Re: DB_SECONDARY_BAD: Secondary index inconsistent with primary

From: Jeff Johnson <n3npq@mac.com>
Date: Mon 15 Feb 2010 - 14:03:37 CET
Message-id: <386CA93E-2D9F-40BF-B2C1-728C11D1A7B2@mac.com>

On Feb 15, 2010, at 8:09 AM, Bernhard Rosenkränzer wrote:

> Hi,
> the chroot environment that was producing bogus dependency messages when
> checking BuildRequires last week has "moved on" to not installing binary
> packages anymore, saying
> 
> /var/lib/rpm/Packages: DB_SECONDARY_BAD: Secondary index inconsistent with
> primary
> error: db4 error(-30973) from dbcursor->get: DB_SECONDARY_BAD: Secondary
> index inconsistent with primary
> rpm: rpmdb.c:2179: rpmmiNext: Assertion `0' failed.
> Aborted
> 

What sources are these? Presumably rpmdb.c:2179 is

    else if (dbi->dbi_primary) {
        rc = rpmmiGet(dbi, mi->mi_dbc, &k, &p, &v, _flags);
        switch (rc) {
        default:
assert(0);
            /*@notreached@*/ break;
        case DB_NOTFOUND:
            return NULL;
            /*@notreached@*/ break;
        case 0:
            mi->mi_setx++;

in which case DB_SECONDARY_BAD perhaps could/should
be handled somehow. Off to see if the doco describes
the specifics of DB_SECONDARY_BAD return.

> rpm --rebuilddb doesn't fix it.
> 

Hmmm ... the fix for DB_SECONDARY_BAD is to regenerate
the secondary index. Which can be done by removing the
secondary index, the index will be regenerated on next
open. That's all that --rebuilddb is doing these days,
removing the secondary indices.

> Probably it's db corruption after all...
> 

Do you have a reproducer? Or can you supply more context
about what access was being attempted?

73 de Jeff
Received on Mon Feb 15 14:04:20 2010
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.