diff options
author | Eric Wong <e@80x24.org> | 2020-12-09 09:25:10 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-12-10 06:39:36 +0000 |
commit | db0fff29f2ee736117ba03e8d1e0ad8a251013f3 (patch) | |
tree | 4e4977f242681b38db3dc82fa6ab9f078251166c /lib/PublicInbox/V2Writable.pm | |
parent | db7c206a4e2c71d08dd286d6dfa92431976e9693 (diff) | |
download | public-inbox-db0fff29f2ee736117ba03e8d1e0ad8a251013f3.tar.gz |
This should help us detect bugs in our code or storage synchronization problems more easily. This probably won't detect corrupted git storage, but can detect corrupted SQLite files. "Bad blobs, bad blobs, whatcha gonna do when they come for you?"
Diffstat (limited to 'lib/PublicInbox/V2Writable.pm')
-rw-r--r-- | lib/PublicInbox/V2Writable.pm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 5aec7561..07a7fa42 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -17,7 +17,8 @@ use PublicInbox::InboxWritable; use PublicInbox::OverIdx; use PublicInbox::Msgmap; use PublicInbox::Spawn qw(spawn popen_rd); -use PublicInbox::SearchIdx qw(log2stack crlf_adjust is_ancestor check_size); +use PublicInbox::SearchIdx qw(log2stack crlf_adjust is_ancestor check_size + is_bad_blob); use IO::Handle; # ->autoflush use File::Temp (); @@ -896,6 +897,7 @@ sub reindex_checkpoint ($$) { sub index_oid { # cat_async callback my ($bref, $oid, $type, $size, $arg) = @_; + return if is_bad_blob($oid, $type, $size, $arg->{oid}); my $self = $arg->{self}; local $self->{current_info} = "$self->{current_info} $oid"; return if $size == 0; # purged @@ -1147,6 +1149,7 @@ sub unindex_oid_aux ($$$) { sub unindex_oid ($$;$) { # git->cat_async callback my ($bref, $oid, $type, $size, $sync) = @_; + return if is_bad_blob($oid, $type, $size, $sync->{oid}); my $self = $sync->{self}; local $self->{current_info} = "$self->{current_info} $oid"; my $unindexed = $sync->{in_unindex} ? $sync->{unindexed} : undef; |