From 9d6468d9560b8cd26ba2529d7a09a93ec5ad8c00 Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Thu, 5 Apr 2018 21:45:27 +0000 Subject: over: use only supported and safe SQLite APIs Some of this jankiness was from early performance problems and they turned out to be unnecessary measures. --- lib/PublicInbox/OverIdx.pm | 9 --------- lib/PublicInbox/V2Writable.pm | 3 +-- 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'lib/PublicInbox') diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index 0e43aabc..5c20f1f0 100644 --- a/lib/PublicInbox/OverIdx.pm +++ b/lib/PublicInbox/OverIdx.pm @@ -14,21 +14,12 @@ use DBI qw(:sql_types); # SQL_BLOB sub dbh_new { my ($self) = @_; my $dbh = $self->SUPER::dbh_new; - $dbh->do('PRAGMA synchronous = OFF'); # commit_fsync instead $dbh->do('PRAGMA journal_mode = TRUNCATE'); $dbh->do('PRAGMA cache_size = 80000'); create_tables($dbh); $dbh; } -sub commit_fsync { - my $fn = $_[0]->{filename}; - if (open my $fh, '+<', $fn) { - $fh->sync; - close $fh; - } -} - sub get_counter ($$) { my ($dbh, $key) = @_; my $sth = $dbh->prepare_cached(<<'', undef, 1); diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index b858dcc7..a8117aaa 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -397,7 +397,7 @@ sub checkpoint { # issue a write barrier to ensure all data is visible to other processes # and read-only ops. Order of data importance is: git > SQLite > Xapian sub barrier { - my ($self, $fsync) = @_; + my ($self) = @_; if (my $im = $self->{im}) { $im->barrier; @@ -416,7 +416,6 @@ sub barrier { $_->remote_barrier foreach @$parts; $over->barrier_wait; # wait for each Xapian partition - $over->commit_fsync if $fsync; # last_commit is special, don't commit these until # remote partitions are done: -- cgit v1.2.3-24-ge0c7