未验证 提交 ef5f3a86 编写于 作者: C chen qingxiang 提交者: GitHub

fix the crash caused by Task::label() is null in issue#3472 (#3523) (#3527)

Signed-off-by: Ngodchen0212 <qingxiang.chen@zilliz.com>
上级 45460218
...@@ -86,9 +86,12 @@ DeletedDocsFormat::Write(const storage::FSHandlerPtr& fs_ptr, const std::string& ...@@ -86,9 +86,12 @@ DeletedDocsFormat::Write(const storage::FSHandlerPtr& fs_ptr, const std::string&
size_t old_num_bytes; size_t old_num_bytes;
std::vector<engine::offset_t> delete_ids; std::vector<engine::offset_t> delete_ids;
if (exists) { if (exists) {
CHECK_MAGIC_VALID(fs_ptr, full_file_path);
CHECK_SUM_VALID(fs_ptr, full_file_path);
if (!fs_ptr->reader_ptr_->Open(temp_path)) { if (!fs_ptr->reader_ptr_->Open(temp_path)) {
return Status(SERVER_CANNOT_OPEN_FILE, "Fail to open tmp deleted docs file: " + temp_path); return Status(SERVER_CANNOT_OPEN_FILE, "Fail to open tmp deleted docs file: " + temp_path);
} }
fs_ptr->reader_ptr_->Seekg(MAGIC_SIZE + HEADER_SIZE);
fs_ptr->reader_ptr_->Read(&old_num_bytes, sizeof(size_t)); fs_ptr->reader_ptr_->Read(&old_num_bytes, sizeof(size_t));
delete_ids.resize(old_num_bytes / sizeof(engine::offset_t)); delete_ids.resize(old_num_bytes / sizeof(engine::offset_t));
fs_ptr->reader_ptr_->Read(delete_ids.data(), old_num_bytes); fs_ptr->reader_ptr_->Read(delete_ids.data(), old_num_bytes);
......
...@@ -217,6 +217,8 @@ Resource::executor_function() { ...@@ -217,6 +217,8 @@ Resource::executor_function() {
ResMgrInst::GetInstance()->GetResource("disk")->WakeupLoader(); ResMgrInst::GetInstance()->GetResource("disk")->WakeupLoader();
} }
task_item->task = FinishedTask::Create(task_item->task);
if (subscriber_) { if (subscriber_) {
auto event = std::make_shared<FinishTaskEvent>(shared_from_this(), task_item); auto event = std::make_shared<FinishTaskEvent>(shared_from_this(), task_item);
subscriber_(std::static_pointer_cast<Event>(event)); subscriber_(std::static_pointer_cast<Event>(event));
......
...@@ -14,11 +14,14 @@ ...@@ -14,11 +14,14 @@
namespace milvus::scheduler { namespace milvus::scheduler {
std::shared_ptr<FinishedTask> std::shared_ptr<FinishedTask>
FinishedTask::Create() { FinishedTask::Create(const TaskPtr& task) {
return std::make_shared<FinishedTask>(); return std::make_shared<FinishedTask>(task);
} }
FinishedTask::FinishedTask() : Task(TaskType::SearchTask, nullptr) { FinishedTask::FinishedTask(const TaskPtr& task) : Task(TaskType::SearchTask, nullptr) {
Task::task_path_ = task->task_path_;
Task::type_ = task->type_;
Task::label_ = task->label_;
} }
Status Status
......
...@@ -20,10 +20,10 @@ namespace milvus::scheduler { ...@@ -20,10 +20,10 @@ namespace milvus::scheduler {
class FinishedTask : public Task { class FinishedTask : public Task {
public: public:
static std::shared_ptr<FinishedTask> static std::shared_ptr<FinishedTask>
Create(); Create(const TaskPtr& task);
public: public:
FinishedTask(); explicit FinishedTask(const TaskPtr& task);
Status Status
OnLoad(LoadType type, uint8_t device_id) override; OnLoad(LoadType type, uint8_t device_id) override;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册