mirror of
https://github.com/typesense/typesense.git
synced 2025-05-19 13:12:22 +08:00
Temporarily disable memory threshold check.
This commit is contained in:
parent
6593d959ec
commit
d3d25768a0
@ -63,7 +63,7 @@ public:
|
||||
|
||||
Option<bool> load(const size_t init_batch_size=1000);
|
||||
|
||||
// frees in-memory data structures when server is shutdown - helps us run a memory leak detecter properly
|
||||
// frees in-memory data structures when server is shutdown - helps us run a memory leak detector properly
|
||||
void dispose();
|
||||
|
||||
Collection* init_collection(const nlohmann::json & collection_meta, const uint32_t collection_next_seq_id);
|
||||
@ -84,7 +84,7 @@ public:
|
||||
|
||||
std::vector<Collection*> get_collections();
|
||||
|
||||
Option<bool> drop_collection(std::string collection_name, const bool remove_from_store = true);
|
||||
Option<bool> drop_collection(const std::string& collection_name, const bool remove_from_store = true);
|
||||
|
||||
uint32_t get_next_collection_id();
|
||||
|
||||
|
@ -160,9 +160,9 @@ Option<nlohmann::json> Collection::add(const std::string & json_str) {
|
||||
return Option<nlohmann::json>(doc_seq_id_op.code(), doc_seq_id_op.error());
|
||||
}
|
||||
|
||||
if(is_exceeding_memory_threshold()) {
|
||||
/*if(is_exceeding_memory_threshold()) {
|
||||
return Option<nlohmann::json>(403, "Max memory ratio exceeded.");
|
||||
}
|
||||
}*/
|
||||
|
||||
const uint32_t seq_id = doc_seq_id_op.get();
|
||||
const std::string seq_id_str = std::to_string(seq_id);
|
||||
@ -220,6 +220,7 @@ nlohmann::json Collection::add_many(std::vector<std::string>& json_lines) {
|
||||
record.index_failure(doc_seq_id_op.code(), doc_seq_id_op.error());
|
||||
}
|
||||
|
||||
/*
|
||||
// check for memory threshold before allowing subsequent batches
|
||||
if(is_exceeding_memory_threshold()) {
|
||||
exceeds_memory_limit = true;
|
||||
@ -233,6 +234,7 @@ nlohmann::json Collection::add_many(std::vector<std::string>& json_lines) {
|
||||
json_lines[i] = index_res.dump();
|
||||
record.index_failure(500, "Max memory ratio exceeded.");
|
||||
}
|
||||
*/
|
||||
|
||||
iter_batch[seq_id % this->get_num_memory_shards()].emplace_back(record);
|
||||
|
||||
|
@ -191,6 +191,7 @@ Option<bool> CollectionManager::load(const size_t init_batch_size) {
|
||||
}
|
||||
|
||||
add_to_collections(collection);
|
||||
LOG(INFO) << "Loaded " << num_docs_read << " documents into collection " << collection->get_name();
|
||||
}
|
||||
|
||||
std::string symlink_prefix_key = std::string(SYMLINK_PREFIX) + "_";
|
||||
@ -343,7 +344,7 @@ std::vector<Collection*> CollectionManager::get_collections() {
|
||||
return collection_vec;
|
||||
}
|
||||
|
||||
Option<bool> CollectionManager::drop_collection(std::string collection_name, const bool remove_from_store) {
|
||||
Option<bool> CollectionManager::drop_collection(const std::string& collection_name, const bool remove_from_store) {
|
||||
Collection* collection = get_collection(collection_name);
|
||||
if(collection == nullptr) {
|
||||
return Option<bool>(404, "No collection with name `" + collection_name + "` found.");
|
||||
@ -352,8 +353,7 @@ Option<bool> CollectionManager::drop_collection(std::string collection_name, con
|
||||
if(remove_from_store) {
|
||||
const std::string &collection_id_str = std::to_string(collection->get_collection_id());
|
||||
|
||||
// Note: The following order of dropping documents first before dropping collection meta is important for
|
||||
// replication to work properly!
|
||||
// Note: The order of dropping documents first before dropping collection meta is important for replication
|
||||
rocksdb::Iterator* iter = store->scan(collection_id_str);
|
||||
while(iter->Valid() && iter->key().starts_with(collection_id_str)) {
|
||||
store->remove(iter->key().ToString());
|
||||
|
Loading…
x
Reference in New Issue
Block a user