Tweak up BDB flags to avoid breakage from --verifydb
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 5 Jan 2011 11:26:11 +0000 (13:26 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 5 Jan 2011 11:26:11 +0000 (13:26 +0200)
- db->verify() has semantics unlike anything else in BDB and does
  strange things to a shared environment (causes persistent ENOMEM
  failures in the environment after a couple of attemps). Use a private
  environment and no CDB when verifying.
- The whole --verifydb is rather useless, perhaps the better option
  would be deleting the lot...

lib/backend/db3.c

index c3c1a6e..45b5363 100644 (file)
@@ -122,6 +122,11 @@ static int db_init(rpmdb rdb, const char * dbhome)
     /* By no means necessary but speeds things up a bit */
     if (rdb->db_flags & RPMDB_FLAG_REBUILD)
        eflags &= ~DB_INIT_CDB;
+    /* XXX Something bizarre with verify... use private environment, no cdb */
+    if (rdb->db_flags & RPMDB_FLAG_VERIFYONLY) {
+       eflags |= DB_PRIVATE;
+       eflags &= ~DB_INIT_CDB;
+    }
 
     rc = db_env_create(&dbenv, 0);
     rc = dbapi_err(rdb, "db_env_create", rc, _debug);