]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Over.pm
www: rework async_* to use method table
[public-inbox.git] / lib / PublicInbox / Over.pm
index e3f264564434ef477fd90c25de29b8450bebb27c..0146414cf4f2ebcf9575714b090e98992b201797 100644 (file)
@@ -18,7 +18,12 @@ sub dbh_new {
        my $f = delete $self->{filename};
        if (!-f $f) { # SQLite defaults mode to 0644, we want 0666
                if ($rw) {
+                       require PublicInbox::Spawn;
                        open my $fh, '+>>', $f or die "failed to open $f: $!";
+                       PublicInbox::Spawn::set_nodatacow(fileno($fh));
+                       my $j = "$f-journal";
+                       open $fh, '+>>', $j or die "failed to open $j: $!";
+                       PublicInbox::Spawn::set_nodatacow(fileno($fh));
                } else {
                        $self->{filename} = $f; # die on stat() below:
                }
@@ -40,6 +45,7 @@ sub dbh_new {
                $st = pack('dd', $st[0], $st[1]);
        } while ($st ne $self->{st} && $tries++ < 3);
        warn "W: $f: .st_dev, .st_ino unstable\n" if $st ne $self->{st};
+       $dbh->do('PRAGMA synchronous = OFF') if ($rw // 0) > 1;
        $dbh;
 }