From: Daira Hopwood <daira@jacaranda.org>
Date: Mon, 15 Apr 2013 19:50:40 +0000 (+0100)
Subject: Use "PRAGMA synchronous = OFF" for leasedb.
X-Git-Url: https://git.rkrishnan.org/%5B/frontends?a=commitdiff_plain;h=2daabbb303541dee80964cb202b1d709dabc6e72;p=tahoe-lafs%2Ftahoe-lafs.git

Use "PRAGMA synchronous = OFF" for leasedb.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---

diff --git a/src/allmydata/storage/leasedb.py b/src/allmydata/storage/leasedb.py
index d64233d8..dbd72f90 100644
--- a/src/allmydata/storage/leasedb.py
+++ b/src/allmydata/storage/leasedb.py
@@ -119,8 +119,16 @@ class LeaseDB:
     STARTER_LEASE_DURATION = 2*MONTH
 
     def __init__(self, dbfile):
+        # synchronous = OFF is necessary for leasedb to pass tests for the time being,
+        # since using synchronous = NORMAL causes failures that are apparently due to
+        # a file descriptor leak, and the default synchronous = FULL causes the tests
+        # to time out. For discussion see
+        # https://tahoe-lafs.org/pipermail/tahoe-dev/2012-December/007877.html
+
         (self._sqlite,
-         self._db) = dbutil.get_db(dbfile, create_version=(LEASE_SCHEMA_V1, 1))
+         self._db) = dbutil.get_db(dbfile, create_version=(LEASE_SCHEMA_V1, 1),
+                                   # journal_mode="WAL",
+                                   synchronous="OFF")
         self._cursor = self._db.cursor()
         self.debug = False
         self.retained_history_entries = 10