Skip to content
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

fix: delete peer's parent on PeerEventDownloadSucceeded event #1085

Merged
merged 1 commit into from
Feb 23, 2022

Conversation

eryugey
Copy link
Contributor

@eryugey eryugey commented Feb 22, 2022

When a peer leaves, it calls scheduler's LeaveTask() interface to
notify scheduler that it's leaving. And LeaveTask() will re-schedule
all its children to find a new parent by calling ScheduleParent().

But some of this peer's children might be in PeerStateSucceeded
state, as they have finished downloading tasks from parent. So
ScheduleParent() on such children is pointless.

Let's delete peer's parent on PeerEventDownloadSucceeded event, so
its parent won't call ScheduleParent() on it again, when its parent
is leaving.

Signed-off-by: Eryu Guan [email protected]

Description

Related Issue

Motivation and Context

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • Code compiles correctly.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

When a peer leaves, it calls scheduler's LeaveTask() interface to
notify scheduler that it's leaving. And LeaveTask() will re-schedule
all its children to find a new parent by calling ScheduleParent().

But some of this peer's children might be in PeerStateSucceeded
state, as they have finished downloading tasks from parent. So
ScheduleParent() on such children is pointless.

Let's delete peer's parent on PeerEventDownloadSucceeded event, so
its parent won't call ScheduleParent() on it again, when its parent
is leaving.

Signed-off-by: Eryu Guan <[email protected]>
@eryugey eryugey requested a review from a team as a code owner February 22, 2022 05:42
Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@jim3ma jim3ma left a comment

Choose a reason for hiding this comment

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

LGTM

@jim3ma jim3ma merged commit 29c46ff into dragonflyoss:main Feb 23, 2022
gaius-qi pushed a commit that referenced this pull request Jun 28, 2023
When a peer leaves, it calls scheduler's LeaveTask() interface to
notify scheduler that it's leaving. And LeaveTask() will re-schedule
all its children to find a new parent by calling ScheduleParent().

But some of this peer's children might be in PeerStateSucceeded
state, as they have finished downloading tasks from parent. So
ScheduleParent() on such children is pointless.

Let's delete peer's parent on PeerEventDownloadSucceeded event, so
its parent won't call ScheduleParent() on it again, when its parent
is leaving.

Signed-off-by: Eryu Guan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants