about summary refs log tree commit diff
path: root/src/db.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-10-16T08·52+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-10-16T08·52+0000
commitf7c7aad1351a0ed58f458e485968af498d542b5b (patch)
tree11edd455ae41e78084c206c96e1538290afb08ae /src/db.cc
parent181aa3dc4198d2e2cfa89d3ebb53a96fa567e12f (diff)
* Upgraded to Berkeley DB 4.1.25 and do not synchronously flush the
  log on commit.  This means that there is a small change that some
  transactions may be rolled back in case of a system crash, but this
  should not be a problem (it merely might cause some expression
  realisations to be rolled back), and it vastly improves performance.

* Upgraded to ATerm 2.0.5 (which also includes Armijn's 64-bit
  patches).


Diffstat (limited to 'src/db.cc')
-rw-r--r--src/db.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/db.cc b/src/db.cc
index 75f97a1e45b9..2f53ca3b5231 100644
--- a/src/db.cc
+++ b/src/db.cc
@@ -160,6 +160,7 @@ void Database::open(const string & path)
         env->set_lg_bsize(32 * 1024); /* default */
         env->set_lg_max(256 * 1024); /* must be > 4 * lg_bsize */
         env->set_lk_detect(DB_LOCK_DEFAULT);
+        env->set_flags(DB_TXN_WRITE_NOSYNC, 1);
         
 
         /* The following code provides automatic recovery of the
@@ -252,11 +253,11 @@ void Database::close()
         {
             debug(format("closing table %1%") % i->first);
             Db * db = i->second;
-            db->close(0);
+            db->close(DB_NOSYNC);
             delete db;
         }
 
-        env->txn_checkpoint(0, 0, 0);
+//         env->txn_checkpoint(0, 0, 0);
         env->close(0);
 
     } catch (DbException e) { rethrow(e); }
@@ -285,8 +286,8 @@ TableId Database::openTable(const string & tableName)
         Db * db = new Db(env, 0);
 
         try {
-            // !!! fixme when switching to BDB 4.1: use txn.
-            db->open(tableName.c_str(), 0, DB_HASH, DB_CREATE, 0666);
+            db->open(0, tableName.c_str(), 0, 
+                DB_HASH, DB_CREATE | DB_AUTO_COMMIT, 0666);
         } catch (...) {
             delete db;
             throw;