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

treat sync1.1 errors as warnings #989

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

brianolson
Copy link
Contributor

No description provided.

Copy link
Collaborator

@bnewbold bnewbold left a comment

Choose a reason for hiding this comment

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

overall looks good, and a couple good little cleanups along the way.

I flagged a couple places we probably don't need warn-versus-error: #sync events aren't emitted by pre-sync1.1 software at all, and DID syntax in #commit events can always be enforced strictly (not a sync1.1 change)


did, err := syntax.ParseDID(msg.Did)
if err != nil {
syncVerifyErrors.WithLabelValues(hostname, "did").Inc()
return nil, err
if !val.Sync11ErrorsAreWarnings {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think all these #sync event checks could be errors-not-warnings. The whole event is new in sync v1.1, so there shouldn't be any problem with old implementations outputting events which don't validate. It is only the #commit events we need to handle with warning-not-error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is where I thought the discussion went yesterday, that we have to allow mediocre implementation of sync1.1 for a while

@brianolson brianolson force-pushed the bolson/sync11-error-as-warn branch from d604306 to e5f3163 Compare March 20, 2025 13:59
Comment on lines 409 to 419
commit, err := atrepo.LoadCARCommit(ctx, bytes.NewReader([]byte(msg.Blocks)))
if err != nil {
commitVerifyErrors.WithLabelValues(hostname, "car").Inc()
return nil, err
if !val.Sync11ErrorsAreWarnings {
return nil, err
} else {
logger.Warn("invalid car", "err", err)
}
}

if commit.Rev != rev.String() {
Copy link
Contributor

@devinivy devinivy Mar 20, 2025

Choose a reason for hiding this comment

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

If there was an error in loading the CAR, I would expect commit to be nil. If that's the case, falling through on the "invalid car" warn would cause a nil pointer exception here checking the rev.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed (and in commit handler)

Comment on lines 409 to 412
commit, err := atrepo.LoadCARCommit(ctx, bytes.NewReader([]byte(msg.Blocks)))
if err != nil {
commitVerifyErrors.WithLabelValues(hostname, "car").Inc()
if !val.Sync11ErrorsAreWarnings {
if !val.Sync11ErrorsAreWarnings || commit == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would expect that if err != nil that the commit is going to be nil. Is that not the case? I think that means we always have to error if we fail to read the commit from the CAR, there's no case where we'll end-up warning here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, yeah, content and err are mutually exclusive, cleaned up

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