]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
v2writable: confess on broken {idx_shards}
authorEric Wong <e@80x24.org>
Wed, 14 Aug 2024 00:16:43 +0000 (00:16 +0000)
committerEric Wong <e@80x24.org>
Thu, 15 Aug 2024 08:29:05 +0000 (08:29 +0000)
There's a bug in `lei import' introduced in 4ff8e8d21ab5
(lei/store: stop shard workers + cat-file on idle, 2024-04-16)
which causes {idx_shards} to not be recreated properly.
Hopefully this can help me track it down since it's not easily
reproducible.

lib/PublicInbox/V2Writable.pm

index 15a7315813803ba729116be6daebbb23228eff70..dab5e64d95b1a3623328abdbf7123e0903c7b738 100644 (file)
@@ -90,6 +90,9 @@ sub init_inbox {
 
 sub idx_shard ($$) {
        my ($self, $num) = @_;
+       use Carp qw(confess); # FIXME: lei_store bug somewhere..
+       confess 'BUG: {idx_shards} unset' if !$self->{idx_shards};
+       confess 'BUG: {idx_shards} empty'  if !@{$self->{idx_shards}};
        $self->{idx_shards}->[$num % scalar(@{$self->{idx_shards}})];
 }