about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-11-07 10:56:55 +0000
committerEric Wong <e@80x24.org>2020-11-08 10:18:18 +0000
commitd463ecedb2030e53eb92befe8f642d9e244c9eae (patch)
tree8c8fe37daf3c1a137dbc5fb658fbcf4c0e1cac52 /lib
parent2392f941f40289636b37ae9a0672c244861aa794 (diff)
downloadpublic-inbox-d463ecedb2030e53eb92befe8f642d9e244c9eae.tar.gz
Since extindex holds no locks on parallel inbox writers,
we can simply use "barrier" IPC shard commands to checkpoint
and avoid respawning shard or git processes.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/V2Writable.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index 0364857f..224675ab 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -620,13 +620,13 @@ sub checkpoint ($;$) {
 
                 # Now deal with Xapian
                 if ($wait) {
-                        my $barrier = $self->barrier_init(scalar @$shards);
+                        my $barrier = barrier_init($self, scalar @$shards);
 
                         # each shard needs to issue a barrier command
                         $_->shard_barrier for @$shards;
 
                         # wait for each Xapian shard
-                        $self->barrier_wait($barrier);
+                        barrier_wait($self, $barrier);
                 } else {
                         $_->shard_commit for @$shards;
                 }
@@ -860,11 +860,16 @@ sub atfork_child {
 sub reindex_checkpoint ($$) {
         my ($self, $sync) = @_;
 
-        $self->git->cleanup; # *async_wait
+        $self->git->async_wait_all;
         ${$sync->{need_checkpoint}} = 0;
         my $mm_tmp = $sync->{mm_tmp};
         $mm_tmp->atfork_prepare if $mm_tmp;
-        $self->done; # release lock
+        die 'BUG: {im} during reindex' if $self->{im};
+        if ($self->{ibx_map}) {
+                checkpoint($self, 1); # no need to release lock on pure index
+        } else {
+                $self->done; # release lock
+        }
 
         if (my $pr = $sync->{-opt}->{-progress}) {
                 $pr->(sprintf($sync->{-regen_fmt}, ${$sync->{nr}}));