diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-19 08:14:34 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-19 08:16:34 +0000 |
commit | ad281240644ee370c75d95b35ad7833863257286 (patch) | |
tree | fd8b3a3d57b7f0115fb91c4ecefa42d5b93a826b /lib/PublicInbox/SearchIdxPart.pm | |
parent | dd83a896a7eb718dcd49560d0aab967f1f481883 (diff) | |
download | public-inbox-ad281240644ee370c75d95b35ad7833863257286.tar.gz |
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.
Diffstat (limited to 'lib/PublicInbox/SearchIdxPart.pm')
-rw-r--r-- | lib/PublicInbox/SearchIdxPart.pm | 12 |
1 files changed, 12 insertions, 0 deletions
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; |