From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/2] cindex: clarify fatal vs non-fatal messages
Date: Thu, 26 Oct 2023 08:20:07 +0000 [thread overview]
Message-ID: <20231026082007.1313217-3-e@80x24.org> (raw)
In-Reply-To: <20231026082007.1313217-1-e@80x24.org>
cindex must be able to handle coderepos being deleted mid-run
since `public-inbox-clone --purge' may be running at the same
time. This is a step towards handling parallel invocations
of -cindex and public-inbox-clone as gracefully as possible
by improving error messages.
---
lib/PublicInbox/CodeSearchIdx.pm | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 33080664..bf410734 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -249,12 +249,12 @@ EOM
}
sub cidx_reap_log { # awaitpid cb
- my ($pid, $self, $op_p) = @_;
+ my ($pid, $cmd, $self, $op_p) = @_;
if (!$? || ($DO_QUIT && (($? & 127) == $DO_QUIT ||
($? & 127) == POSIX::SIGPIPE))) {
send($op_p, "shard_done $self->{shard}", 0);
} else {
- warn "E: git @LOG_STDIN: \$?=$?\n";
+ warn "W: @$cmd (\$?=$?)\n";
$self->{xdb}->cancel_transaction;
}
}
@@ -265,8 +265,9 @@ sub shard_index { # via wq_io_do in IDX_SHARDS
my $in = delete($self->{0}) // die 'BUG: no {0} input';
my $op_p = delete($self->{1}) // die 'BUG: no {1} op_p';
sysseek($in, 0, SEEK_SET);
- my $rd = popen_rd($git->cmd(@LOG_STDIN), undef, { 0 => $in },
- \&cidx_reap_log, $self, $op_p);
+ my $cmd = $git->cmd(@LOG_STDIN);
+ my $rd = popen_rd($cmd, undef, { 0 => $in },
+ \&cidx_reap_log, $cmd, $self, $op_p);
close $in;
PublicInbox::CidxLogP->new($rd, $self, $git, $roots);
# CidxLogP->event_step will call cidx_read_log_p once there's input
@@ -372,7 +373,7 @@ sub docids_by_postlist ($$) { # consider moving to PublicInbox::Search
sub _cb { # run_await cb
my ($pid, $cmd, undef, $opt, $cb, $self, $git, @arg) = @_;
return if $DO_QUIT;
- ($git->{-cidx_err} = $?) ? warn("@$cmd error: \$?=$?\n") :
+ ($git->{-cidx_err} = $?) ? warn("W: @$cmd (\$?=$?)\n") :
$cb->($opt, $self, $git, @arg);
}
@@ -864,7 +865,7 @@ sub prep_alternate_start {
sub cmd_done { # run_await cb for sort, xapian-delve, sed failures
my ($pid, $cmd, undef, undef, $run_on_destroy) = @_;
- $? and die "@$cmd failed: \$?=$?";
+ $? and die "fatal: @$cmd (\$?=$?)\n";
# $run_on_destroy calls associate() or run_prune()
}
prev parent reply other threads:[~2023-10-26 8:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-26 8:20 [PATCH 0/2] unrelated coderepo-related fixes Eric Wong
2023-10-26 8:20 ` [PATCH 1/2] git: cleanup un-associated coderepo processes Eric Wong
2023-10-26 8:20 ` 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=20231026082007.1313217-3-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.
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).