]> git.sommitrealweird.co.uk Git - onak.git/commitdiff
cscvs to tla changeset 59
authorJonathan McDowell <noodles@earth.li>
Mon, 31 May 2004 23:47:28 +0000 (23:47 +0000)
committerJonathan McDowell <noodles@earth.li>
Mon, 31 May 2004 23:47:28 +0000 (23:47 +0000)
Author: noodles
Date: 2003/02/15 13:53:34
Enable deadlock detection for the DB3 backend.

keydb_db3.c

index 2cb61aacaccacc4b353df1a25ea314ca3100c34d..21977193fd41cf9fb2f1b72d5b439e378becb7c2 100644 (file)
@@ -118,15 +118,16 @@ void initdb(void)
        }
 
        /*
-        * This is a bit of a kludge. Either we run a separate process for
-        * deadlock detection or we do this every time we run. What we really
-        * want to do is specify that our locks are exclusive locks when we
-        * start to do an update.
+        * Enable deadlock detection so that we don't block indefinitely on
+        * anything. What we really want is simple 2 state locks, but I'm not
+        * sure how to make the standard DB functions do that yet.
         */
-       ret = lock_detect(dbenv,
-                       0, /* flags */
-                       DB_LOCK_RANDOM,
-                       NULL); /* If non null int* for number broken */
+       ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT);
+       if (ret != 0) {
+               logthing(LOGTHING_CRITICAL,
+                       "db_env_create: %s", db_strerror(ret));
+               exit(1);
+       }
 
        ret = dbenv->open(dbenv, config.db_dir,
                        DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_LOCK |