[devtools][pg] Activate the non-durability settings of Postgresql.
authorChristophe de Vienne <christophe@unlish.com>
Mon, 06 Oct 2014 10:34:38 +0200
changeset 10038 f2f065d406dc
parent 10037 6b83ceda8323
child 10046 96f5ca0a86e5
[devtools][pg] Activate the non-durability settings of Postgresql. It speed up the PG tests by a factor of 3. See http://www.postgresql.org/docs/current/static/non-durability.html.
devtools/__init__.py
--- a/devtools/__init__.py	Mon Nov 17 09:32:37 2014 +0100
+++ b/devtools/__init__.py	Mon Oct 06 10:34:38 2014 +0200
@@ -560,8 +560,12 @@
         env = os.environ.copy()
         env['PGPORT'] = str(port)
         env['PGHOST'] = str(directory)
+        options = '-h "" -k %s -p %s' % (directory, port)
+        options += ' -c fsync=off -c full_page_writes=off'
+        options += ' -c synchronous_commit=off'
         try:
-            subprocess.check_call(['pg_ctl', 'start', '-w', '-D', datadir, '-o', '-h "" -k %s -p %s' % (directory, port)],
+            subprocess.check_call(['pg_ctl', 'start', '-w', '-D', datadir,
+                                   '-o', options],
                                   env=env)
         except OSError, err:
             if err.errno == errno.ENOENT: