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: delay concluding attempt in pushsync #2016

Merged
merged 4 commits into from
Jun 15, 2021
Merged

fix: delay concluding attempt in pushsync #2016

merged 4 commits into from
Jun 15, 2021

Conversation

metacertain
Copy link
Member

@metacertain metacertain commented Jun 7, 2021

This PR intends to make forwarder behavior ensure that chunk is successfully written to at least one further peer before concluding attempt has been made


This change is Reviewable

if triggerCount < 9 {
triggerCount++
stream.Close()
return errors.New("fmt")
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a better error here.

Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

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

tag increment needs to be reverted to previous state

@@ -470,6 +461,15 @@ func (ps *PushSync) pushPeer(ctx context.Context, peer swarm.Address, ch swarm.C
return nil, true, err
}

// if you manage to get a tag, just increment the respective counter
t, err := ps.tagger.Get(ch.TagID())
Copy link
Member

Choose a reason for hiding this comment

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

this is not correct... you should increment the sent count once the chunk is sent.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, it was a misunderstanding

@@ -488,7 +488,7 @@ func TestPushChunkToNextClosest(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if ta2.Get(tags.StateSent) != 2 {
Copy link
Member

Choose a reason for hiding this comment

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

this seems a bit wrong no? why is this change needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

restored as well

Copy link
Contributor

@mrekucci mrekucci left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions (waiting on @acud and @metacertain)


pkg/pushsync/pushsync_test.go, line 944 at r3 (raw file):

	triggerCount := 0
	var lock sync.Mutex

Does this lock suppose to guard just the triggerCount variable? If so, I'd recommend to rename it to signal that those two are related.

@istae istae self-requested a review June 9, 2021 21:26
@metacertain metacertain added the ready for review The PR is ready to be reviewed label Jun 14, 2021
@metacertain metacertain merged commit 7ba295a into master Jun 15, 2021
@metacertain metacertain deleted the push_attempt branch June 15, 2021 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull-request ready for review The PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants