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 9/9] searchidxshard: simplify newline elimination
  2020-12-15  2:02  7% ` [PATCH 0/9] extindex: " Eric Wong
@ 2020-12-15  2:02  6%   ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-12-15  2:02 UTC (permalink / raw)
  To: meta

This overdue change fixes {current_info} to not inject a newline
into every warning message.

Simpler code helps us avoid bugs and the need to make
fixes like commit 44de182766037948d62bc2a8ba924de2264dd5fc
("searchidxshard: chomp $eidx_key from pipe").
---
 lib/PublicInbox/SearchIdxShard.pm | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/lib/PublicInbox/SearchIdxShard.pm b/lib/PublicInbox/SearchIdxShard.pm
index ee00858b..2e654769 100644
--- a/lib/PublicInbox/SearchIdxShard.pm
+++ b/lib/PublicInbox/SearchIdxShard.pm
@@ -69,33 +69,31 @@ sub shard_worker_loop ($$$$$) {
 	$0 = "shard[$shard]";
 	$self->begin_txn_lazy;
 	while (my $line = readline($r)) {
+		chomp $line;
 		$v2w->{current_info} = "[$shard] $line";
-		if ($line eq "commit\n") {
+		if ($line eq 'commit') {
 			$self->commit_txn_lazy;
-		} elsif ($line eq "close\n") {
+		} elsif ($line eq 'close') {
 			$self->idx_release;
-		} elsif ($line eq "barrier\n") {
+		} elsif ($line eq 'barrier') {
 			$self->commit_txn_lazy;
 			# no need to lock < 512 bytes is atomic under POSIX
 			print $bnote "barrier $shard\n" or
 					die "write failed for barrier $!\n";
-		} elsif ($line =~ /\AD ([0-9]+)\n\z/s) {
+		} elsif ($line =~ /\AD ([0-9]+)\z/s) {
 			$self->remove_by_docid($1 + 0);
 		} elsif ($line =~ s/\A\+X //) {
 			my ($len, $docid, $eidx_key) = split(/ /, $line, 3);
-			chomp $eidx_key;
 			$self->add_eidx_info($docid, $eidx_key, eml($r, $len));
 		} elsif ($line =~ s/\A-X //) {
 			my ($len, $docid, $eidx_key) = split(/ /, $line, 3);
-			chomp $eidx_key;
 			$self->remove_eidx_info($docid, $eidx_key,
 							eml($r, $len));
-		} elsif ($line =~ s/\AO ([^\n]+)\n//) {
+		} elsif ($line =~ s/\AO ([^\n]+)//) {
 			my $over_fn = $1;
 			$over_fn =~ tr/\0/\n/;
 			$self->over_check(PublicInbox::Over->new($over_fn));
 		} else {
-			chomp $line;
 			my $eidx_key;
 			if ($line =~ s/\AX=(.+)\0//) {
 				$eidx_key = $1;

^ permalink raw reply related	[relevance 6%]

* [PATCH 0/9] extindex: --reindex support
  @ 2020-12-15  2:02  7% ` Eric Wong
  2020-12-15  2:02  6%   ` [PATCH 9/9] searchidxshard: simplify newline elimination Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-12-15  2:02 UTC (permalink / raw)
  To: meta

Patches 1 and 2 are resends, the rest have gone through a lot of
changes and I'm probably ready to run this live on the
extindex which holds my lore mirror onion
<http://rskvuqcfnfizkjg6h5jvovwb3wkikzcwskf54lfpymus6mxrzw67b5ad.onion/all/>

Eric Wong (9):
  extindex: preliminary --reindex support
  extindex: delete stale messages from over.sqlite3
  over: sort xref3 by xnum if ibx_id repeats
  extindex: support --rethread and content bifurcation
  extsearchidx: reindex works on Xapian, too
  extsearchidx: checkpoint releases locks
  extsearchidx: simplify reindex code paths
  extsearchidx: reindex releases over.sqlite3 handles properly
  searchidxshard: simplify newline elimination

 lib/PublicInbox/ExtSearchIdx.pm   | 369 +++++++++++++++++++++++++++++-
 lib/PublicInbox/Over.pm           |   5 +-
 lib/PublicInbox/OverIdx.pm        |  23 ++
 lib/PublicInbox/SearchIdx.pm      |  13 +-
 lib/PublicInbox/SearchIdxShard.pm |  20 +-
 lib/PublicInbox/V2Writable.pm     |  11 +-
 t/extsearch.t                     | 133 ++++++++++-
 7 files changed, 542 insertions(+), 32 deletions(-)

^ permalink raw reply	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-12-11  3:37     [PATCH] extindex: preliminary --reindex support Eric Wong
2020-12-15  2:02  7% ` [PATCH 0/9] extindex: " Eric Wong
2020-12-15  2:02  6%   ` [PATCH 9/9] searchidxshard: simplify newline elimination 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).