unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH] msgmap: tmp_clone: use in-memory journal
Date: Mon, 25 May 2020 03:30:20 +0000	[thread overview]
Message-ID: <20200525033020.20198-1-e@yhbt.net> (raw)

This prevents $TMPDIR from being littered with *-journal files
after running the test suite.

This shouldn't cause excessive memory use since $v2w->{mm_tmp}
doesn't see big transactions.  There's no need to worry about
data loss, here,either, since this is just a temporary clone
we've even disabled fsync on.

Fixes: 78888d36fb80889f ("msgmap: use TRUNCATE for journal_mode, for now")
---
 lib/PublicInbox/Msgmap.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/PublicInbox/Msgmap.pm b/lib/PublicInbox/Msgmap.pm
index 5fe14383ac4..a2ffe7203e7 100644
--- a/lib/PublicInbox/Msgmap.pm
+++ b/lib/PublicInbox/Msgmap.pm
@@ -70,6 +70,7 @@ sub tmp_clone {
 	$self->{dbh}->sqlite_backup_to_file($fn);
 	my $tmp = ref($self)->new_file($fn, 1);
 	$tmp->{dbh}->do('PRAGMA synchronous = OFF');
+	$tmp->{dbh}->do('PRAGMA journal_mode = MEMORY');
 	$tmp->{tmp_name} = $fn; # SQLite won't work if unlinked, apparently
 	$tmp->{pid} = $$;
 	close $fh or die "failed to close $fn: $!";

                 reply	other threads:[~2020-05-25  3:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200525033020.20198-1-e@yhbt.net \
    --to=e@yhbt.net \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).