Merge pull request #226 from meilisearch/fix-rotxn-number-documents

Use a read-only transaction to retrieve the number of documents
This commit is contained in:
Clément Renault 2019-10-17 17:39:56 +02:00 committed by GitHub
commit 86ab729356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,7 @@ impl Main {
Ok(new)
}
pub fn number_of_documents(&self, reader: &zlmdb::RwTxn) -> ZResult<u64> {
pub fn number_of_documents(&self, reader: &zlmdb::RoTxn) -> ZResult<u64> {
match self.main.get::<Str, OwnedType<u64>>(reader, NUMBER_OF_DOCUMENTS_KEY)? {
Some(value) => Ok(value),
None => Ok(0),