Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Log a more meaningful error message and exit when another instance is started off the same data directory.

kishorenc4d53a6278418
diff --git a/include/store.h b/include/store.h
index fe58fded..b56a2c8e 100644
--- a/include/store.h
+++ b/include/store.h
@@ -74,6 +74,13 @@ public:
if(!s.ok()) {
LOG(ERR) << "Error while initializing store: " << s.ToString();
+ if(s.code() == rocksdb::Status::Code::kIOError) {
+ LOG(ERR) << "It seems like the data directory " << state_dir_path << " is already being used by "
+ << "another Typesense server. ";
+ LOG(ERR) << "If you are SURE that this is not the case, delete the LOCK file "
+ << "in the data directory and try again.";
+ exit(1);
+ }
}
assert(s.ok());
diff --git a/src/typesense_server_utils.cpp b/src/typesense_server_utils.cpp
index 36ee522d..61ebc02c 100644
--- a/src/typesense_server_utils.cpp
+++ b/src/typesense_server_utils.cpp
@@ -1,6 +1,7 @@
#include "core_api.h"
#include "typesense_server_utils.h"
#include <curl/curl.h>
+#include <sys/stat.h>
HttpServer* server;