From 1ba49d2ddbdf79766a2777bd359f4e249053c633 Mon Sep 17 00:00:00 2001 From: Maxime Legendre Date: Tue, 21 Dec 2021 15:30:11 +0100 Subject: [PATCH] Bug(FS): Consider empty pre-created directory as unexisting DB --- meilisearch-lib/src/index_controller/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meilisearch-lib/src/index_controller/mod.rs b/meilisearch-lib/src/index_controller/mod.rs index 5e50ff281..0cbdbb159 100644 --- a/meilisearch-lib/src/index_controller/mod.rs +++ b/meilisearch-lib/src/index_controller/mod.rs @@ -167,7 +167,11 @@ impl IndexControllerBuilder { let db_exists = db_path.as_ref().exists(); if db_exists { - versioning::check_version_file(db_path.as_ref())?; + // Directory could be pre-created without any database in. + let db_is_empty = db_path.as_ref().read_dir()?.next().is_none(); + if !db_is_empty { + versioning::check_version_file(db_path.as_ref())?; + } } if let Some(ref path) = self.import_snapshot {