-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue_3170: drop space after stop all AdminTaskJobs #3406
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3406 +/- ##
==========================================
- Coverage 85.23% 85.20% -0.03%
==========================================
Files 1277 1304 +27
Lines 119088 121306 +2218
==========================================
+ Hits 101502 103360 +1858
- Misses 17586 17946 +360
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, good job
so now, drop space may stuck in console for a while? |
No, console execute "drop space" will delete space infos in meta, and return. This PR only changed the storage, storage will drop the space when it found this space is not in heartbeat info from meta. |
Mmmm, functional, this PR looks good to me. Also, I suggest not to modify meta client. I think it's better to open a add (un)register function in kvstore, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; Perfect job!
Thanks~ meta client should not know the taskManger, I will change this PR for this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job, LGTM
meta::cpp2::AdminCmd cmdType() { return ctx_.cmd_; } | ||
|
||
public: | ||
std::atomic<size_t> unFinishedSubTask_; | ||
SubTaskQueue subtasks_; | ||
std::atomic<bool> running_{false}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a enum is better than bool.
|
||
protected: | ||
StorageEnv* env_; | ||
TaskContext ctx_; | ||
std::atomic<nebula::cpp2::ErrorCode> rc_{nebula::cpp2::ErrorCode::SUCCEEDED}; | ||
std::atomic<bool> canceled_{false}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
What type of PR is this?
What does this PR do?
When Storage use MetaClient Heartbeat find out there is a space have been dropped, before remove the space, cancel all AdminTasks in this space and wait them stopped first.
mark AdminTask status in memory, use std::atomic, when the AdminTask in task, and status is QUEUE, we will set QUEUE to CANCELED, and do not run this task.
Which issue(s)/PR(s) this PR relates to?
issue: #3170
Special notes for your reviewer, ex. impact of this fix, etc:
This PR is trying to stop all the AdminTasks(RebuildTagIndex, RebuildEdgeIndex, Stats) before storage delete a space. AdminTaskManager support the interface to cancel a job, but this interface only set a flag (canceled_) to true, when the job pending in the taskQueue, it won't be canceled until the job going to run.
So this PR add a atomic enum to mark the job's status, the status is
QUEUE, RUNNING, CANCELED, FINISNED
, and when we canceled a job, first if the job's status is QUEUE, change status to CANCELED, and return. else we only change the flag(canceled_), because this job is RUNNING or FINISHED.When TaskManager take a job in taskQueue, it will check the job's status, and if the status is CANCELED, TaskManager will clean this job without running it. if the job's status is QUEUE, taskManger change it to RUNNING and run it. And a RUNNING job will be canceled if flag(canceled_) is true.
Additional context:
Checklist:
Release notes:
Please confirm whether to reflect in release notes and how to describe: