Skip to content

[refactor](status) Refactor status handling in agent task#11940

Merged
yiguolei merged 4 commits intoapache:masterfrom
platoneko:refactor_status_handling_task
Aug 29, 2022
Merged

[refactor](status) Refactor status handling in agent task#11940
yiguolei merged 4 commits intoapache:masterfrom
platoneko:refactor_status_handling_task

Conversation

@platoneko
Copy link
Contributor

@platoneko platoneko commented Aug 20, 2022

Proposed changes

Issue Number: #11874

Problem summary

  1. Refactor TaggableLogger
  2. Refactor status handling in agent task:
    1. Unify log format in TaskWorkerPool
    2. Pass Status to the top caller, and replace some OLAPInternalError with more detailed error message Status
    3. Premature return with the opposite condition to reduce indention

Checklist(Required)

  1. Does it affect the original behavior:
    • Yes
    • No
    • I don't know
  2. Has unit tests been added:
    • Yes
    • No
    • No Need
  3. Has document been added or modified:
    • Yes
    • No
    • No Need
  4. Does it need to update dependencies:
    • Yes
    • No
  5. Are there any changes that cannot be rolled back:
    • Yes (If Yes, please explain WHY)
    • No

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@platoneko platoneko force-pushed the refactor_status_handling_task branch 3 times, most recently from d029815 to 66f2c91 Compare August 22, 2022 06:34
Copy link
Member

@jackwener jackwener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase to fix the P0

jackwener
jackwener previously approved these changes Aug 22, 2022
Copy link
Member

@jackwener jackwener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
except maybe add redundant include.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

for (const auto& rs : consistent_rowsets) {
status = rs->copy_files_to(full_path, rs->rowset_id());
if (!status.ok()) {
Status ret = FileUtils::remove_all(full_path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is removed, then there exists garbage in this folder?

Copy link
Contributor Author

@platoneko platoneko Aug 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EngineStorageMigrationTask::_migrate will do this garbage collection.

}
if (!build_all_report_tablets_info_status.ok()) {
LOG(WARNING) << "build all report tablets info failed. status: "
<< build_all_report_tablets_info_status;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If build failed, some logic in handle report maybe wrong, it think this logic should not be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, build_all_report_tablets_info always returns OK, I even consider let build_all_report_tablets_info return void.

}

LOG(INFO) << "finish to process delete data. res=" << res;
return res;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these tasks have a same problem. If the task is success, there is no log. So if a table lost some data or data is wrong, we could not find what happened on this tablet. I think we should print some success log to help us debug. Maybe could add a log in EngineTask.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such log will be print in _push_worker_thread_callback:

        if (status.ok()) {
            LOG_INFO("successfully execute push task")
                    .tag("signature", agent_task_req.signature)
                    .tag("tablet_id", push_req.tablet_id)
                    .tag("push_type", push_req.push_type);
            ++_s_report_version;
            finish_task_request.__set_finish_tablet_infos(tablet_infos);
        } else {
            LOG_WARNING("failed to execute push task")
                    .tag("signature", agent_task_req.signature)
                    .tag("tablet_id", push_req.tablet_id)
                    .tag("push_type", push_req.push_type)
                    .error(status);
        }

Copy link
Contributor

@yiguolei yiguolei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yiguolei yiguolei merged commit db07e51 into apache:master Aug 29, 2022
GoGoWen pushed a commit to GoGoWen/incubator-doris that referenced this pull request Aug 31, 2022
Refactor TaggableLogger
Refactor status handling in agent task:
Unify log format in TaskWorkerPool
Pass Status to the top caller, and replace some OLAPInternalError with more detailed error message Status
Premature return with the opposite condition to reduce indention
Yukang-Lian pushed a commit to Yukang-Lian/doris that referenced this pull request Sep 2, 2022
Refactor TaggableLogger
Refactor status handling in agent task:
Unify log format in TaskWorkerPool
Pass Status to the top caller, and replace some OLAPInternalError with more detailed error message Status
Premature return with the opposite condition to reduce indention
Yukang-Lian pushed a commit to Yukang-Lian/doris that referenced this pull request Sep 2, 2022
Refactor TaggableLogger
Refactor status handling in agent task:
Unify log format in TaskWorkerPool
Pass Status to the top caller, and replace some OLAPInternalError with more detailed error message Status
Premature return with the opposite condition to reduce indention
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants