You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jq...@apache.org on 2014/11/17 21:11:31 UTC

svn commit: r1640221 - /spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm

Author: jquinn
Date: Mon Nov 17 20:11:31 2014
New Revision: 1640221

URL: http://svn.apache.org/r1640221
Log:
Disabled synchronous commit for Postgres Bayes store

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm?rev=1640221&r1=1640220&r2=1640221&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm Mon Nov 17 20:11:31 2014
@@ -30,6 +30,11 @@ which makes SQL calls involving the toke
 for the token column type you must make sure that the DBD driver does the proper
 quoting.  You can accomplish this by binding the token column to a specific type.
 
+In versions 8.3 and up, synchronous_commit is disabled for faster performance.
+Data is not guaranteed to be stored until (3 * wal_writer_delay) (default: 0.6s)
+after it is written. This tradeoff works for Bayes because we care about aggregate
+data and a small period of time can be lost without sacrificing accuracy.
+
 =cut
 
 package Mail::SpamAssassin::BayesStore::PgSQL;
@@ -932,6 +937,10 @@ sub _connect_db {
     dbg("bayes: database connection established");
   }
 
+  if ( $dbh->{pg_server_version} >= 80300 ) {
+    $dbh->do('SET synchronous_commit=off')
+  }
+
   if ( $dbh->{pg_server_version} >= 80100 ) {
     $self->{_esc_prefix} = 'E';
   }