From 7d9b50c3df67d22a289afa31eddcc3a06ddd93cf Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 27 Feb 2019 20:25:36 +0000 Subject: v2writable: fix epoch rollover on incremental imports All of our internal epoch rollover calculations are done using the estimated unpacked (and uncompressed) size of the repo. The importer instance needs to check that unpacked size before selecting an epoch when an epoch already has packed data. This bug did not impact the initial mass imports since we only initialize the Import instance once-per-epoch and did not need to take existing epochs into account. Tested manually with -mda on a local clone of LKML Reported-by: Konstantin Ryabitsev --- lib/PublicInbox/V2Writable.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 1f17fe21..b1d8095f 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -588,7 +588,9 @@ sub importer { if (defined $latest) { my $git = PublicInbox::Git->new($latest); my $packed_bytes = $git->packed_bytes; - if ($packed_bytes >= $self->{rotate_bytes}) { + my $unpacked_bytes = $packed_bytes / $PACKING_FACTOR; + + if ($unpacked_bytes >= $self->{rotate_bytes}) { $epoch = $max + 1; } else { $self->{epoch_max} = $max; -- cgit v1.2.3-24-ge0c7