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

dont interrupt sync if ballots in the layer were ignored or rejected #5729

Closed

Conversation

dshulyak
Copy link
Contributor

related: #5701

in the implementation sync loop will repeatedly asks for objects even if it can't process them.
in this pr we allow sync to make progress if the remaining objects in the layer can't be processed with retries.

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 82.75862% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 80.0%. Comparing base (3b4f769) to head (76147e2).
Report is 24 commits behind head on develop.

❗ Current head 76147e2 differs from pull request most recent head e5c8bfa. Consider uploading reports for the commit e5c8bfa to get more accurate results

Files Patch % Lines
syncer/syncer.go 66.6% 1 Missing and 2 partials ⚠️
fetch/mesh_data.go 84.6% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #5729     +/-   ##
=========================================
- Coverage     80.0%   80.0%   -0.1%     
=========================================
  Files          279     279             
  Lines        29009   29032     +23     
=========================================
+ Hits         23224   23240     +16     
- Misses        4182    4186      +4     
- Partials      1603    1606      +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

fetch/mesh_data.go Outdated Show resolved Hide resolved
Comment on lines +444 to +447
nested := &BatchError{}
if errors.As(err, &nested) && nested.Ignore() {
return true
}
Copy link
Member

@fasmat fasmat Mar 18, 2024

Choose a reason for hiding this comment

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

I'm not sure I fully understand that logic: a batch containing an ignored hash will trigger all parent batches to be ignored as well? Can BatchErrors be nested arbitrarily deep?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it depends on the type of the object. for atxs batch error can be as long as atx chain, for ballots this is limited by the tortoise window size.

the logic here, if all dependencies are "ignored" then ignore then don't try to download this object as well.

// and added to the tortoise.
decoded, err := h.tortoise.DecodeBallot(b.ToTortoiseData())
if err != nil {
return nil, fmt.Errorf("failed to decode ballot id %s err %w", b.ID().AsHash32().ShortString(), err)
return nil, fmt.Errorf(
"%w: failed to decode ballot id %s. %v",
Copy link
Member

Choose a reason for hiding this comment

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

Since Go 1.20 it is possible to wrap multiple errors into one:

Suggested change
"%w: failed to decode ballot id %s. %v",
"%w: failed to decode ballot id %s. %w",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i remember but i don't find it useful, there are errors that simply add more context and errors that are a part of the api

require.ErrorIs(t, th.HandleSyncedBallot(context.Background(), b.ID().AsHash32(), peer, data), expected)
err := th.HandleSyncedBallot(context.Background(), b.ID().AsHash32(), peer, data)
require.ErrorIs(t, err, fetch.ErrIgnore)
require.Contains(t, err.Error(), expected.Error())
Copy link
Member

Choose a reason for hiding this comment

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

With the suggested change above this becomes:

Suggested change
require.Contains(t, err.Error(), expected.Error())
require.ErrorIs(t, err, expected)

@dshulyak dshulyak changed the title make it possible for sync to ignore certain errors not interrupt sync if ballots in the layer were ignored or rejected Mar 19, 2024
@dshulyak dshulyak changed the title not interrupt sync if ballots in the layer were ignored or rejected dont interrupt sync if ballots in the layer were ignored or rejected Mar 19, 2024
@dshulyak
Copy link
Contributor Author

reopened from local branch #5761

@dshulyak dshulyak closed this Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants