]> Sergey Matveev's repositories - public-inbox.git/commit
searchidxshard: ensure we set indexlevel on shard[0]
authorEric Wong <e@yhbt.net>
Sat, 28 Mar 2020 00:56:03 +0000 (00:56 +0000)
committerEric Wong <e@yhbt.net>
Sun, 29 Mar 2020 23:28:28 +0000 (23:28 +0000)
commit8e1ec8836dabc58dfc0115b36ed440b4371b70d7
tree49746b343d3570a858fbde12d46be26253c9597d
parent6d6c6d27dd3ecafd523962dff2170d48a71680cf
searchidxshard: ensure we set indexlevel on shard[0]

For sharded v2 repositories with few-enough messages, it is
possible for shard[0] to go unused and never trigger the
->commit_txn_lazy to set the indexlevel field in Xapian
metadata.

So set it immediately at initialization and avoid this case.
While we're at it, avoid triggering needless pwrite syscalls
from ->set_metadata by checking with ->get_metadata, first.
lib/PublicInbox/SearchIdx.pm
lib/PublicInbox/SearchIdxShard.pm
t/init.t