From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/3] searchidx: avoid holding Xapian lock in cat-file
Date: Tue, 9 Aug 2016 00:48:45 +0000 [thread overview]
Message-ID: <20160809004845.GA3383@whir> (raw)
In-Reply-To: <20160809002252.31177-1-e@80x24.org>
We must ensure cat-file process is launched before Xapian
grabs lock, too. Our use of "git cat-file --batch" has
the same problem as "git log" did, (which was fixed in
commit 3713c727cda431a0dc2865a7878c13ecf9f21851)
"searchidx: release Xapian FDs before spawning git log"
---
lib/PublicInbox/Git.pm | 4 +++-
lib/PublicInbox/SearchIdx.pm | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index f47bc43..59c2747 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -39,7 +39,7 @@ sub _bidi_pipe {
sub cat_file {
my ($self, $obj, $ref) = @_;
- $self->_bidi_pipe(qw(--batch in out pid));
+ batch_prepare($self);
$self->{out}->print($obj, "\n") or fail($self, "write error: $!");
my $in = $self->{in};
@@ -89,6 +89,8 @@ sub cat_file {
$rv;
}
+sub batch_prepare ($) { _bidi_pipe($_[0], qw(--batch in out pid)) }
+
sub check {
my ($self, $obj) = @_;
$self->_bidi_pipe(qw(--batch-check in_c out_c pid_c));
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 6efc1f3..0582526 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -390,6 +390,7 @@ sub _index_sync {
my $tip = $opts->{ref} || 'HEAD';
my $reindex = $opts->{reindex};
my ($mkey, $last_commit, $lx, $xlog);
+ $self->{git}->batch_prepare;
my $xdb = _xdb_acquire($self);
$xdb->begin_transaction;
do {
--
EW
prev parent reply other threads:[~2016-08-09 0:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-09 0:22 [PATCH 0/3] searchidx: workaround lack of close-on-exec Eric Wong
2016-08-09 0:22 ` [PATCH 1/3] searchidx: remove unused $git parameters Eric Wong
2016-08-09 0:22 ` [PATCH 2/3] searchidx: persist the PublicInbox::Git object Eric Wong
2016-08-09 0:22 ` [PATCH 3/3] searchidx: release Xapian FDs before spawning git log Eric Wong
2016-08-09 0:48 ` Eric Wong [this message]
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=20160809004845.GA3383@whir \
--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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).