From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 792E71F9F4 for ; Sat, 18 Sep 2021 09:33:33 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/9] lei_mail_sync: set nodatacow on btrfs Date: Sat, 18 Sep 2021 09:33:26 +0000 Message-Id: <20210918093332.16054-4-e@80x24.org> In-Reply-To: <20210918093332.16054-1-e@80x24.org> References: <20210918093332.16054-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: As with other SQLite3 databases, copy-on-write with files experiencing random writes leads to write amplification and low performance. --- lib/PublicInbox/LeiMailSync.pm | 5 +++++ 1 file changed, 5 insertions(+) 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,