user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/2] v2writable: detect shard count for ExtSearchIdx properly
  2020-11-29  5:09  5% [PATCH 0/2] extindex: administrative stuffs Eric Wong
@ 2020-11-29  5:09  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-11-29  5:09 UTC (permalink / raw)
  To: meta

Otherwise, any explicitly set shard counts were ignored and
we'd be counting CPUs every single time.
---
 lib/PublicInbox/V2Writable.pm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index a3938b56..e9a43000 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -65,13 +65,21 @@ sub nproc_shards ($) {
 
 sub count_shards ($) {
 	my ($self) = @_;
-	$self->{ibx} ? do {
+	if (my $ibx = $self->{ibx}) {
 		# always load existing shards in case core count changes:
 		# Also, shard count may change while -watch is running
-		my $srch = $self->{ibx}->search or return 0;
-		delete $self->{ibx}->{search};
+		my $srch = $ibx->search or return 0;
+		delete $ibx->{search};
 		$srch->{nshard} // 0
-	} : $self->{nshard}; # self->{nshard} is for ExtSearchIdx
+	} else { # ExtSearchIdx
+		$self->{nshard} // do {
+			if ($self->xdb_sharded) {
+				$self->{nshard} // die 'BUG: {nshard} unset';
+			} else {
+				0;
+			}
+		}
+	}
 }
 
 sub new {

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] extindex: administrative stuffs
@ 2020-11-29  5:09  5% Eric Wong
  2020-11-29  5:09  7% ` [PATCH 1/2] v2writable: detect shard count for ExtSearchIdx properly Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-11-29  5:09 UTC (permalink / raw)
  To: meta

Welcome to episode #968 of "Deletes Are Hard".

Since inboxes may be removed from the config file and made
inaccessible unbeknownst to public-inbox indexing code; we need
to support a way to remove stale indexed data associated with
them.  PATCH 2/2 makes it happen with garbage collection.

Lightly-tested, but it seems to work reasonably well.

PATCH 1/2 is a bug fix :x

Eric Wong (2):
  v2writable: detect shard count for ExtSearchIdx properly
  extindex: support `--gc' to remove dead inboxes

 lib/PublicInbox/ExtSearchIdx.pm   | 90 ++++++++++++++++++++++++++++++-
 lib/PublicInbox/MiscIdx.pm        | 16 ++++++
 lib/PublicInbox/SearchIdx.pm      | 23 +++++++-
 lib/PublicInbox/SearchIdxShard.pm | 21 ++++++--
 lib/PublicInbox/V2Writable.pm     | 16 ++++--
 script/public-inbox-extindex      | 19 +++++--
 t/extsearch.t                     | 19 ++++++-
 7 files changed, 190 insertions(+), 14 deletions(-)

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-11-29  5:09  5% [PATCH 0/2] extindex: administrative stuffs Eric Wong
2020-11-29  5:09  7% ` [PATCH 1/2] v2writable: detect shard count for ExtSearchIdx properly Eric Wong

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).