about summary refs log tree commit homepage
path: root/lib/PublicInbox/V2Writable.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-02-27 20:25:36 +0000
committerEric Wong <e@80x24.org>2019-02-27 20:26:21 +0000
commit7d9b50c3df67d22a289afa31eddcc3a06ddd93cf (patch)
tree4ed8805ca693bab4bffa9627c48137e2109503f0 /lib/PublicInbox/V2Writable.pm
parent1c8b2e78042d774a199faa18679c22547b13420e (diff)
downloadpublic-inbox-7d9b50c3df67d22a289afa31eddcc3a06ddd93cf.tar.gz
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 <konstantin@linuxfoundation.org>
Diffstat (limited to 'lib/PublicInbox/V2Writable.pm')
-rw-r--r--lib/PublicInbox/V2Writable.pm4
1 files changed, 3 insertions, 1 deletions
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;