lib/PublicInbox/Search.pm | 6 +++--- lib/PublicInbox/SearchIdx.pm | 17 +++++++++-------- diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 098c97cdc2c11c72893d07a4eb4ffa3bb14bc856..45431ecc4819bdc0279231d0825b6f7f5a193833 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -131,9 +131,9 @@ } else { my $dir = "$self->{mainrepo}/xap" . SCHEMA_VERSION; return $dir if $rdonly; - my $part = $self->{partition}; - defined $part or die "partition not given"; - $dir .= "/$part"; + my $shard = $self->{shard}; + defined $shard or die "shard not given"; + $dir .= "/$shard"; } } diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index a088ce75fe62e5b32331e778b559bce7e0bc5d94..58b233759628074708c0ac63b0e21b6c0f4f2af0 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -29,7 +29,7 @@ my $xapianlevels = qr/\A(?:full|medium)\z/; sub new { - my ($class, $ibx, $creat, $part) = @_; + my ($class, $ibx, $creat, $shard) = @_; ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx"; my $levels = qr/\A(?:full|medium|basic)\z/; my $mainrepo = $ibx->{mainrepo}; @@ -62,9 +62,9 @@ $self->{lock_path} = "$mainrepo/ssoma.lock"; my $dir = $self->xdir; $self->{over} = PublicInbox::OverIdx->new("$dir/over.sqlite3"); } elsif ($version == 2) { - defined $part or die "partition is required for v2\n"; - # partition is a number - $self->{partition} = $part; + defined $shard or die "shard is required for v2\n"; + # shard is a number + $self->{shard} = $shard; $self->{lock_path} = undef; } else { die "unsupported inbox version=$version\n"; @@ -102,8 +102,8 @@ require File::Path; $self->lock_acquire; # don't create empty Xapian directories if we don't need Xapian - my $is_part = defined($self->{partition}); - if (!$is_part || ($is_part && need_xapian($self))) { + my $is_shard = defined($self->{shard}); + if (!$is_shard || ($is_shard && need_xapian($self))) { File::Path::mkpath($dir); } } @@ -824,9 +824,10 @@ delete $self->{txn} or return; $self->{-inbox}->with_umask(sub { if (my $xdb = $self->{xdb}) { - # store 'indexlevel=medium' in v2 part=0 and v1 (only part) + # store 'indexlevel=medium' in v2 shard=0 and + # v1 (only one shard) # This metadata is read by Admin::detect_indexlevel: - if (!$self->{partition} # undef or 0, not >0 + if (!$self->{shard} # undef or 0, not >0 && $self->{indexlevel} eq 'medium') { $xdb->set_metadata('indexlevel', 'medium'); }