user/dev discussion of public-inbox itself
 help / color / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 03/10] v2writable: move {reindex} field to $sync state
Date: Wed, 29 May 2019 08:28:53 +0000
Message-ID: <20190529082900.9312-4-e@80x24.org> (raw)
In-Reply-To: <20190529082900.9312-1-e@80x24.org>

reindexing info is not used outside of the index_sync code path.
---
 lib/PublicInbox/V2Writable.pm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index efb9f42..e05dadc 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -706,7 +706,7 @@ sub mark_deleted {
 }
 
 sub reindex_oid {
-	my ($self, $sync, $git, $oid, $regen, $reindex) = @_;
+	my ($self, $sync, $git, $oid, $regen) = @_;
 	my $len;
 	my $msgref = $git->cat_file($oid, \$len);
 	my $mime = PublicInbox::MIME->new($$msgref);
@@ -750,7 +750,7 @@ sub reindex_oid {
 	if (!defined($mid0) || $del) {
 		if (!defined($mid0) && $del) { # expected for deletes
 			$num = $$regen--;
-			$self->{mm}->num_highwater($num) unless $reindex;
+			$self->{mm}->num_highwater($num) if !$sync->{reindex};
 			return
 		}
 
@@ -940,10 +940,11 @@ sub unindex {
 		qw(-c gc.reflogExpire=now gc --prune=all)]);
 }
 
-sub index_ranges ($$$) {
-	my ($self, $reindex, $epoch_max) = @_;
-	return last_commits($self, $epoch_max) unless $reindex;
+sub sync_ranges ($$$) {
+	my ($self, $sync, $epoch_max) = @_;
+	my $reindex = $sync->{reindex};
 
+	return last_commits($self, $epoch_max) unless $reindex;
 	return [] if ref($reindex) ne 'HASH';
 
 	my $ranges = $reindex->{from}; # arrayref;
@@ -964,9 +965,9 @@ sub index_sync {
 	my $sync = {
 		mm_tmp => $self->{mm}->tmp_clone,
 		D => {}, # "$mid\0$cid" => $oid
+		reindex => $opts->{reindex},
 	};
-	my $reindex = $opts->{reindex};
-	my $ranges = index_ranges($self, $reindex, $epoch_max);
+	my $ranges = sync_ranges($self, $sync, $epoch_max);
 
 	my $high = $self->{mm}->num_highwater();
 	my $regen = $self->index_prepare($opts, $epoch_max, $ranges);
@@ -999,8 +1000,7 @@ sub index_sync {
 			if (/\A$x40$/o && !defined($cmt)) {
 				$cmt = $_;
 			} elsif (/\A:\d{6} 100644 $x40 ($x40) [AM]\tm$/o) {
-				$self->reindex_oid($sync, $git, $1,
-						$regen, $reindex);
+				$self->reindex_oid($sync, $git, $1, $regen);
 			} elsif (/\A:\d{6} 100644 $x40 ($x40) [AM]\td$/o) {
 				$self->mark_deleted($sync, $git, $1);
 			}
-- 
EW


  parent reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  8:28 [PATCH 00/10] index: support progress output Eric Wong
2019-05-29  8:28 ` [PATCH 01/10] v2writable: introduce $sync state and put mm_tmp in it Eric Wong
2019-05-29  8:28 ` [PATCH 02/10] v2writable: sync: move delete markers into $sync state Eric Wong
2019-05-29  8:28 ` Eric Wong [this message]
2019-05-29  8:28 ` [PATCH 04/10] v2writable: move {regen} " Eric Wong
2019-05-29  8:28 ` [PATCH 05/10] v2writable: move {ranges} " Eric Wong
2019-05-29  8:28 ` [PATCH 06/10] v2writable: localize unindex-range.$EPOCH to " Eric Wong
2019-05-29  8:28 ` [PATCH 07/10] v2writable: use prototypes for internal subs Eric Wong
2019-05-29  8:28 ` [PATCH 08/10] v2writable: move index_sync options to sync state Eric Wong
2019-05-29  8:28 ` [PATCH 09/10] index: support --verbose option Eric Wong
2019-05-29  8:29 ` [PATCH 10/10] v2writable: show progress updates for index_sync Eric Wong

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: http://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=20190529082900.9312-4-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

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git