fixare cavalli

This commit is contained in:
andrew (from workstation) 2020-05-19 11:46:24 +02:00
parent b1e9774e62
commit c20e21aa6e
2 changed files with 13 additions and 4 deletions

View File

@ -2946,7 +2946,13 @@ FileId FileManager::next_file_id() {
}
FileManager::FileNodeId FileManager::next_file_node_id() {
FileNodeId res = static_cast<FileNodeId>(file_nodes_.size());
if (!empty_node_ids_.empty()) {
auto res = empty_node_ids_.back();
empty_node_ids_.pop_back();
return FileNodeId{res};
}
auto res = static_cast<FileNodeId>(file_nodes_.size());
file_nodes_.emplace_back(nullptr);
return res;
}
@ -3476,8 +3482,8 @@ void FileManager::memory_cleanup() {
}
/* DESTROY ASSOCIATED FILE */
file_id_info_[file_id.get()] = FileIdInfo();
empty_file_ids_.push_back(file_id.get());
file_id_info_.erase(file_id_info_.begin() + ((int32) file_id.get()));
}
/* DESTROY MAIN QUERY */
@ -3494,14 +3500,16 @@ void FileManager::memory_cleanup() {
file_id_info_.erase(file_id_info_.begin() + ((int32) i));
/* DESTROY MAIN NODE */
node.reset();
file_nodes_[main_node_id] = nullptr;
empty_node_ids_.push_back(main_node_id);
}
}
}
}
vector<FileIdInfo>(file_id_info_).swap(file_id_info_);
vector<int32>(empty_file_ids_).swap(empty_file_ids_);
file_id_info_.shrink_to_fit();
empty_file_ids_.shrink_to_fit();
LOG(INFO) << empty_file_ids_.size() << " empty ids and " << queries_container_.size() << " running queries";
is_closed_ = false;

View File

@ -559,6 +559,7 @@ class FileManager : public FileLoadManager::Callback {
std::vector<FileIdInfo> file_id_info_;
vector<int32> empty_file_ids_;
vector<int32> empty_node_ids_;
vector<unique_ptr<FileNode>> file_nodes_;
ActorOwn<FileLoadManager> file_load_manager_;
ActorOwn<FileGenerateManager> file_generate_manager_;