unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: "Eric Wong (Contractor, The Linux Foundation)" <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 17/21] v2writable: commit to skeleton via remote partitions
Date: Wed, 28 Feb 2018 23:41:58 +0000	[thread overview]
Message-ID: <20180228234202.8839-18-e@80x24.org> (raw)
In-Reply-To: <20180228234202.8839-1-e@80x24.org>

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/SearchIdxPart.pm |  1 +
 lib/PublicInbox/V2Writable.pm    | 13 ++++++-------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/PublicInbox/SearchIdxPart.pm b/lib/PublicInbox/SearchIdxPart.pm
index 6025fc4..2f577ec 100644
--- a/lib/PublicInbox/SearchIdxPart.pm
+++ b/lib/PublicInbox/SearchIdxPart.pm
@@ -45,6 +45,7 @@ sub partition_worker_loop ($$$) {
 		if ($line eq "commit\n") {
 			$xdb->commit_transaction if $txn;
 			$txn = undef;
+			$self->{skeleton}->remote_commit;
 		} elsif ($line eq "close\n") {
 			$self->_xdb_release;
 			$xdb = $txn = undef;
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index ff3b657..73110ff 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};
 		}
-- 
EW


  parent reply	other threads:[~2018-02-28 23:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 23:41 [PATCH v2 0/21] UI bits and v2 import fixes Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 01/21] v2writable: warn on duplicate Message-IDs Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 02/21] v2/ui: some hacky things to get the PSGI UI to show up Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 03/21] v2/ui: retry DB reopens in a few more places Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 04/21] v2writable: cleanup unused pipes in partitions Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 05/21] searchidxpart: binmode Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 06/21] use PublicInbox::MIME consistently Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 07/21] searchidxpart: chomp line before splitting Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 08/21] searchidx*: name child subprocesses Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 09/21] searchidx: get rid of pointless index_blob wrapper Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 10/21] view: remove X-PI-TS reference Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 11/21] searchidxthread: load doc data for references Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 12/21] searchidxpart: force integers into add_message Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 13/21] search: reopen skeleton DB as well Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 14/21] searchidx: index values in the threader Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 15/21] search: use different Enquire object for skeleton queries Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` [PATCH 16/21] rename SearchIdxThread to SearchIdxSkeleton Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:41 ` Eric Wong (Contractor, The Linux Foundation) [this message]
2018-02-28 23:41 ` [PATCH 18/21] searchidxskeleton: extra error checking Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:42 ` [PATCH 19/21] searchidx: do not modify Xapian DB while iterating Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:42 ` [PATCH 20/21] search: query_xover uses skeleton DB iff available Eric Wong (Contractor, The Linux Foundation)
2018-02-28 23:42 ` [PATCH 21/21] v2/ui: get nntpd and init tests running on v2 Eric Wong (Contractor, The Linux Foundation)
2018-03-01 23:40 ` [PATCH v2 0/21] UI bits and v2 import fixes Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180228234202.8839-18-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).