Author: robin.munn
Date: Tue Mar 22 17:27:43 2005
New Revision: 63

Modified:
   trunk/mailman/src/mailman/database/__init__.py
Log:
SQLite is really slow under OS X because it's being extra paranoid about
fsync() calls, using F_FULLFSYNC to cause the disk to flush its internal
buffer cache. This is good for when you want to ensure data integrity, but
not so good when you want to run unit tests which build a complete database
every time. :-) So I wrote an SQLite-specific hack to work around the
problem. It's commented out by default because it's a BAD idea for
production code; but if your unit tests are running really slow on OS X,
you'll want to use this patch.


Modified: trunk/mailman/src/mailman/database/__init__.py
==============================================================================
--- trunk/mailman/src/mailman/database/__init__.py      (original)
+++ trunk/mailman/src/mailman/database/__init__.py      Tue Mar 22 17:27:43 2005
@@ -25,6 +25,18 @@
 class Database:
     def open(self, connection_url):
         self._conn = connectionForURI(connection_url)
+        # XXX SQLite is really slow under OS X because it's being extra
+        # paranoid about fsync() calls, using F_FULLFSYNC to cause the disk
+        # to flush its internal buffer cache. This is good for when you want
+        # to ensure data integrity, but not so good when you want to run unit
+        # tests which build a complete database every time. :-)
+        # So if you want to turn off paranoid fsync() calls under SQLite
+        # because your unit tests are REALLY SLOW, uncomment the following
+        # three lines:
+        # curs = self._conn._conn.cursor()
+        # curs.execute('PRAGMA synchronous = OFF')  # SQLite specific
+        # curs.close()
+        # XXX End of "make my unit tests blazing fast" code
         # Dynamically set the connection object and create if necessary, all
         # SQLObject tables.
         import mailman.database.schema
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to