You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2022/09/07 20:51:34 UTC

svn commit: r1903917 - in /spamassassin/trunk: lib/Mail/SpamAssassin/BayesStore/SQL.pm t/bayessql.t

Author: sidney
Date: Wed Sep  7 20:51:34 2022
New Revision: 1903917

URL: http://svn.apache.org/viewvc?rev=1903917&view=rev
Log:
Bug 8033 - Add PRAGMA to SQLite test to speed test without unreliable use of /dev/shm

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm
    spamassassin/trunk/t/bayessql.t

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm?rev=1903917&r1=1903916&r2=1903917&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm Wed Sep  7 20:51:34 2022
@@ -1676,6 +1676,13 @@ sub _connect_db {
     dbg("bayes: database connection established");
   }
 
+  # SQLite PRAGMA attributes - here for tests, see bug 8033
+  if ($self->{_dsn} =~ /^dbi:SQLite:.*?;(.+)/i) {
+    foreach my $attr (split(/;/, $1)) {
+      $dbh->do("PRAGMA $attr");
+    }
+  }
+  
   $self->{_dbh} = $dbh;
 
  return 1;

Modified: spamassassin/trunk/t/bayessql.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/bayessql.t?rev=1903917&r1=1903916&r2=1903917&view=diff
==============================================================================
--- spamassassin/trunk/t/bayessql.t (original)
+++ spamassassin/trunk/t/bayessql.t Wed Sep  7 20:51:34 2022
@@ -25,15 +25,14 @@ diag "Note: If there is a failure it may
 my ($dbconfig, $dbdsn, $dbusername, $dbpassword);
 
 if (SQLITE) {
-  # bug 8033 - Test is 7 times faster using /dev/shm but on some test machines it fails 
   my $dbdir = tempdir("bayessql.XXXXXX", DIR => "log");
   die "FATAL: failed to create dbdir: $!" unless -d $dbdir;
-  $dbdsn = "dbi:SQLite:dbname=$dbdir/bayes.db";
+  # Bug 8033 - undocumented extension to dsn format we added for this test
+  $dbdsn = "dbi:SQLite:dbname=$dbdir/bayes.db;synchronous=OFF";
   $dbusername = "";
   $dbpassword = "";
   my $dbh = DBI->connect($dbdsn,$dbusername,$dbpassword);
   $dbh->do("PRAGMA synchronous = OFF");
-  $dbh->do("PRAGMA cache_size = 10000");
   $dbh->do("
   CREATE TABLE bayes_expire (
     id int(11) NOT NULL default '0',