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.
use DBD::SQLite;
use File::Temp qw(tempfile);
use PublicInbox::Over;
use DBD::SQLite;
use File::Temp qw(tempfile);
use PublicInbox::Over;
sub new {
my ($class, $git_dir, $writable) = @_;
sub new {
my ($class, $git_dir, $writable) = @_;
sub tmp_clone {
my ($self, $dir) = @_;
my ($fh, $fn) = tempfile('msgmap-XXXXXXXX', EXLOCK => 0, DIR => $dir);
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);
my $tmp;
if ($self->{dbh}->can('sqlite_backup_to_dbh')) {
$tmp = ref($self)->new_file($fn, 2);