]> Sergey Matveev's repositories - public-inbox.git/commitdiff
msgmap: disable CoW for tmp_clone, too
authorEric Wong <e@yhbt.net>
Wed, 29 Jul 2020 21:25:43 +0000 (21:25 +0000)
committerEric Wong <e@yhbt.net>
Thu, 30 Jul 2020 09:36:42 +0000 (09:36 +0000)
The temporary clone starts as large as the full msgmap
and deletes will write to it randomly.  So ensure it
doesn't get fragmented and slower as time goes on.

lib/PublicInbox/Msgmap.pm

index 51b6a68c8547e81a4eaf9168000354fea548085a..c85e7796cbd4512f2c286628a4eff8f04aed9388 100644 (file)
@@ -14,6 +14,7 @@ use DBI;
 use DBD::SQLite;
 use File::Temp qw(tempfile);
 use PublicInbox::Over;
+use PublicInbox::Spawn;
 
 sub new {
        my ($class, $git_dir, $writable) = @_;
@@ -50,6 +51,7 @@ sub new_file {
 sub tmp_clone {
        my ($self, $dir) = @_;
        my ($fh, $fn) = tempfile('msgmap-XXXXXXXX', EXLOCK => 0, DIR => $dir);
+       PublicInbox::Spawn::set_nodatacow(fileno($fh));
        my $tmp;
        if ($self->{dbh}->can('sqlite_backup_to_dbh')) {
                $tmp = ref($self)->new_file($fn, 2);