-
Notifications
You must be signed in to change notification settings - Fork 17
don't cache if the schema registry is unavailable #143
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3a358e6
don't cache the error when the schema registry is unavailable
adrianmester be6320d
remove circular dependency
adrianmester d998a3e
add comment
adrianmester 39fa195
don't panic!
adrianmester 2f296b8
upgrade go version and update vulnerable packages
adrianmester 9c67d20
upgrade linter
adrianmester b0005e5
upgrade github actions
adrianmester e28e23d
linter config
adrianmester 1bf8865
wip
adrianmester 4efb647
Revert "wip"
adrianmester 1bc1c70
wip
adrianmester 17aafff
wip
adrianmester 452ce9c
fix test
adrianmester 64a1756
Update .github/workflows/avro.yaml
adrianmester 6160ecd
change go version to 1.23
adrianmester 50d1e0b
go mod tidy
adrianmester File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| ! go2avro Foo | ||
| stderr 'undefined: bar.Foo' | ||
| stderr 'undefined: pkg.Foo' | ||
|
|
||
| -- bar.go -- | ||
| package bar | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,32 @@ | ||
| module github.com/heetch/avro | ||
|
|
||
| go 1.19 | ||
| go 1.23.0 | ||
|
|
||
| require ( | ||
| github.com/actgardner/gogen-avro/v10 v10.2.1 | ||
| github.com/frankban/quicktest v1.14.0 | ||
| github.com/google/uuid v1.3.0 | ||
| github.com/google/uuid v1.6.0 | ||
| github.com/kr/pretty v0.3.0 | ||
| github.com/linkedin/goavro/v2 v2.11.1 | ||
| github.com/rogpeppe/go-internal v1.9.0 | ||
| github.com/rogpeppe/go-internal v1.14.1 | ||
| github.com/sebdah/goldie/v2 v2.5.5 | ||
| github.com/stretchr/testify v1.7.1 | ||
| golang.org/x/text v0.3.0 | ||
| golang.org/x/text v0.23.0 | ||
| gopkg.in/httprequest.v1 v1.2.1 | ||
| gopkg.in/retry.v1 v1.0.3 | ||
| ) | ||
|
|
||
| require ( | ||
| github.com/davecgh/go-spew v1.1.1 // indirect | ||
| github.com/golang/snappy v0.0.4 // indirect | ||
| github.com/google/go-cmp v0.5.6 // indirect | ||
| github.com/google/go-cmp v0.6.0 // indirect | ||
| github.com/julienschmidt/httprouter v1.3.0 // indirect | ||
| github.com/kr/text v0.2.0 // indirect | ||
| github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e // indirect | ||
| github.com/pmezard/go-difflib v1.0.0 // indirect | ||
| github.com/sergi/go-diff v1.0.0 // indirect | ||
| golang.org/x/net v0.0.0-20200505041828-1ed23360d12c // indirect | ||
| golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect | ||
| golang.org/x/net v0.33.0 // indirect | ||
| golang.org/x/sys v0.28.0 // indirect | ||
| golang.org/x/tools v0.26.0 // indirect | ||
| gopkg.in/errgo.v1 v1.0.0 // indirect | ||
| gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it lead to an overload of the registry if we don't cache anything? The other open PR that addresses the same issue caches the error for 1 minute: #127
Can we just merge that one, or maybe decrease the duration a bit if necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging mentioned PR would be nice.
1min might be a bit too much in our case indeed. How about we make that duration configurable (e.g w/ default and overridable through env var)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the schema registr\y is unavailable the request doesn't reach the schema registry pod at all, so it's not stressed.
If i'm understanding this correctly, this should only be called once per pod per topic (unless there's a race condition where it's called for each partition on the same pod at the same time). In any case, the number of requests to the schema registry is very low.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the registry is unavailable for 10 minutes, and in that timeframe one pod after another is started (e.g. autoscaling, node consolidation) and runs into the error, then the registry comes back up, won't all pods send their requests to the registry at the same time? Could that lead to issues?
If yes, the error caching could spread that initial load a bit if I'm not mistaken (assuming the pods with the errors didn't all start at the same time, but spread over those 10 minutes of registry downtime).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we could check the exact issue
But this current PR is good enough as a first step IMO
This is already the current behavior when a deploy happens, the registry should accommodate this (as Adrian mentioned the number of requests per service should be low, basically 1 per topic consumed/produced in per instance)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My PR explicitly only doesn't cache
avroregistry.UnavailableErrorLooking at the code, that can only happen if:
I believe that it would be a mistake to cache the error in either of those cases. If we want to limit the cache time for other types of errors, that would be beyond the scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Then no blocker, and we can consider improving it in the future if necessary