From 4ac55dde4d10887a7ad9c325924d322491bd61d1 Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Tue, 27 Feb 2018 20:29:55 +0000 Subject: v2writable: commit to skeleton via remote partitions We need to ensure Xapian transaction commits are made to remote partitions before associated commits hit the skeleton DB. This causes unnecessary commits to be made to the skeleton DB; but they're mostly harmless. Further work will be necessary to ensure proper ordering and avoidance of unnecessary commits. --- lib/PublicInbox/V2Writable.pm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/PublicInbox/V2Writable.pm') diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index ff3b6573..73110ff0 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -131,22 +131,21 @@ sub searchidx_checkpoint { # order matters, we can only close {skel} after all partitions # are done because the partitions also write to {skel} - if (my $parts = $self->{idx_parts}) { foreach my $idx (@$parts) { - $idx->remote_commit; + $idx->remote_commit; # propagates commit to skel $idx->remote_close unless $more; } delete $self->{idx_parts} unless $more; } if (my $skel = $self->{skel}) { - $skel->{mm}->{dbh}->commit; + my $dbh = $skel->{mm}->{dbh}; + $dbh->commit; if ($more) { - $skel->{mm}->{dbh}->begin_work; - } - $skel->remote_commit; - unless ($more) { + $dbh->begin_work; + } else { + $skel->remote_commit; # XXX should be unnecessary... $skel->remote_close; delete $self->{skel}; } -- cgit v1.2.3-24-ge0c7