user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: Re: [PATCH 3/3] v2writable: reindex handles 3-headered monsters
Date: Mon, 21 Oct 2019 11:34:11 +0000	[thread overview]
Message-ID: <20191021113411.wm7rgoccrvhtygrn@dcvr> (raw)
In-Reply-To: <20191021110221.23753-4-e@80x24.org>

Eric Wong <e@80x24.org> wrote:
> +++ b/lib/PublicInbox/V2Writable.pm
> +sub reindex_oid ($$$$) {

<snip>

> +	} else { # multiple MIDs are a weird case:
> +		my $del = 0;
> +		for (@$mids) {
> +			$del += delete($sync->{D}->{"$_\0$cid"}) // 0;
> +		}
> +		if ($del) {
> +			unindex_oid_remote($self, $oid, $_) for @$mids;
> +			# do not delete from {mm_tmp}, since another
> +			# single-MID message may use it.
> +		} else { # handle them at the end:
> +			push @{$sync->{multi_mid} //= []}, $oid;

Part of me worres @$multi_mid can be abused here by people
trying to OOM the indexing process...

<snip>

> @@ -1184,10 +1265,22 @@ sub index_sync {
>  
>  	# unindex is required for leftovers if "deletes" affect messages
>  	# in a previous fetch+index window:
> +	my $git;
>  	if (my @leftovers = values %{delete $sync->{D}}) {
> -		my $git = $self->{-inbox}->git;
> -		unindex_oid($self, $git, $_) for @leftovers;
> -		$git->cleanup;
> +		$git = $self->{-inbox}->git;
> +		for my $oid (@leftovers) {
> +			$self->{current_info} = "leftover $oid";
> +			unindex_oid($self, $git, $oid);
> +		}
> +	}
> +	if (my $multi_mid = delete $sync->{multi_mid}) {
> +		$git //= $self->{-inbox}->git;
> +
> +		while (defined(my $oid = pop(@$multi_mid))) {
> +			$self->{current_info} = "multi_mid $oid";
> +			reindex_oid_m($self, $sync, $git, $oid);
> +		}
> +		$git->cleanup if $git;
>  	}
>  	$self->done;

I suppose we could easily write to a temporary file and use
fixed offsets, too; but fixed offsets would make git + SHA-256
more difficult.  So maybe Tie::File (stdlib) or a SQLite-based
stack could work, too...

  reply	other threads:[~2019-10-21 11:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 21:14 BUG: --reindex broken on multiple Message-IDs reuse Eric Wong
2019-10-17 11:22 ` [RFC] v2writable: reindex handles 3-headed monsters [was: BUG: --reindex broken on multiple Message-IDs reuse] Eric Wong
2019-10-22  8:09   ` [RFC/HELP] search: multiple From/To/Cc/Subject (what about Date?) Eric Wong
2019-10-21 11:02 ` [PATCH 0/3] fix reindex on multiple + overlapping Message-IDs Eric Wong
2019-10-21 11:02   ` [PATCH 1/3] v2writable: set unindexed article number Eric Wong
2019-10-21 11:02   ` [PATCH 2/3] v2writable: improve "num_for" API and disambiguate Eric Wong
2019-10-21 11:02   ` [PATCH 3/3] v2writable: reindex handles 3-headered monsters Eric Wong
2019-10-21 11:34     ` Eric Wong [this message]
2019-10-22  1:28     ` [PATCH 4/3] v2writable: move git->cleanup to the correct place Eric Wong
2019-10-22  1:29       ` [PATCH 5/3] v2writable: use msgmap as multi_mid queue Eric Wong
2019-10-23 18:19   ` [PUSHED] fix reindex on multiple + overlapping Message-IDs 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: https://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=20191021113411.wm7rgoccrvhtygrn@dcvr \
    --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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).