diff options
author | Eric Wong <e@80x24.org> | 2021-09-18 09:33:26 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-18 20:25:27 +0000 |
commit | 04bb05ee7f8d304757cbb016128c0aea157fc842 (patch) | |
tree | 1991c0200efe9651cdd08203517c10eacf2675d4 /lib | |
parent | 47d4e53734820b4e5a2f6cfa29056329e387ef22 (diff) | |
download | public-inbox-04bb05ee7f8d304757cbb016128c0aea157fc842.tar.gz |
As with other SQLite3 databases, copy-on-write with files experiencing random writes leads to write amplification and low performance.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/LeiMailSync.pm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiMailSync.pm b/lib/PublicInbox/LeiMailSync.pm index 690c6477..f185b585 100644 --- a/lib/PublicInbox/LeiMailSync.pm +++ b/lib/PublicInbox/LeiMailSync.pm @@ -14,6 +14,11 @@ sub dbh_new { my ($self, $rw) = @_; my $f = $self->{filename}; my $creat = $rw && !-s $f; + if ($creat) { + require PublicInbox::Spawn; + open my $fh, '+>>', $f or Carp::croak "open($f): $!"; + PublicInbox::Spawn::nodatacow_fd(fileno($fh)); + } my $dbh = DBI->connect("dbi:SQLite:dbname=$f",'','', { AutoCommit => 1, RaiseError => 1, |