From ad281240644ee370c75d95b35ad7833863257286 Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Mon, 19 Mar 2018 08:14:34 +0000 Subject: v2writable: support "barrier" operation to avoid reforking Stopping and starting a bunch of processes to look up duplicates or removals is inefficient. Take advantage of checkpointing in "git fast-import" and transactions in Xapian and SQLite. --- lib/PublicInbox/SearchIdxPart.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/PublicInbox/SearchIdxPart.pm') diff --git a/lib/PublicInbox/SearchIdxPart.pm b/lib/PublicInbox/SearchIdxPart.pm index 6d8cb2a7..dd7ace67 100644 --- a/lib/PublicInbox/SearchIdxPart.pm +++ b/lib/PublicInbox/SearchIdxPart.pm @@ -49,6 +49,11 @@ sub partition_worker_loop ($$$) { } elsif ($line eq "close\n") { $self->_xdb_release; $xdb = $txn = undef; + } elsif ($line eq "barrier\n") { + $xdb->commit_transaction if $txn; + $txn = undef; + print { $self->{skeleton}->{w} } "barrier $part\n" or + die "write failed to skeleton: $!\n"; } else { chomp $line; my ($len, $artnum, $oid, $mid0) = split(/ /, $line); @@ -81,4 +86,11 @@ sub atfork_child { close $_[0]->{w} or die "failed to close write pipe: $!\n"; } +# called by V2Writable: +sub barrier { + my $w = $_[0]->{w}; + print $w "barrier\n" or die "failed to print: $!"; + $w->flush or die "failed to flush: $!"; +} + 1; -- cgit v1.2.3-24-ge0c7