From 2daabbb303541dee80964cb202b1d709dabc6e72 Mon Sep 17 00:00:00 2001
From: Daira Hopwood <daira@jacaranda.org>
Date: Mon, 15 Apr 2013 20:50:40 +0100
Subject: [PATCH] Use "PRAGMA synchronous = OFF" for leasedb.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---
 src/allmydata/storage/leasedb.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

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
-- 
2.45.2