user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] msgmap: tmp_clone: use in-memory journal
@ 2020-05-25  3:30 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-05-25  3:30 UTC (permalink / raw)
  To: meta

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: $!";

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-25  3:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25  3:30 [PATCH] msgmap: tmp_clone: use in-memory journal Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).