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

[Access] Cleanup access connection management #4730

Merged
merged 2 commits into from
Sep 23, 2023

Conversation

peterargue
Copy link
Contributor

@peterargue peterargue commented Sep 19, 2023

The client connection caching logic was updated to handle invalidations within a connection interceptor:

if status.Code(err) == codes.Unavailable {
switch clientType {
case AccessClient:
if m.Remove(address) {
m.logger.Debug().Str("cached_access_client_invalidated", address).Msg("invalidating cached access client")
if m.metrics != nil {
m.metrics.ConnectionFromPoolInvalidated()
}
}
case ExecutionClient:
if m.Remove(address) {
m.logger.Debug().Str("cached_execution_client_invalidated", address).Msg("invalidating cached execution client")
if m.metrics != nil {
m.metrics.ConnectionFromPoolInvalidated()
}
}
default:
m.logger.Info().Str("client_invalidation_interceptor", address).Msg(fmt.Sprintf("unexpected client type: %d", clientType))
}
}

The old Invalidate* methods were left, but mostly unused outside of tests.

This PR removes those methods, fixes tests that were still using them, and fixes some other tests that were using an old version of the connection factory mock.

@@ -378,9 +378,6 @@ func (b *backendScripts) tryExecuteScriptOnArchiveNode(
}(closer)
resp, err := archiveClient.ExecuteScriptAtBlockID(ctx, req)
if err != nil {
if status.Code(err) == codes.Unavailable {
b.connFactory.InvalidateAccessAPIClient(executorAddress)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

archiveClient is using the connection manager, so this invalidation will happen automatically

@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.01% ⚠️

Comparison is base (ad121db) 55.68% compared to head (effaeb7) 55.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4730      +/-   ##
==========================================
- Coverage   55.68%   55.68%   -0.01%     
==========================================
  Files         934      934              
  Lines       86532    86508      -24     
==========================================
- Hits        48188    48173      -15     
+ Misses      34707    34706       -1     
+ Partials     3637     3629       -8     
Flag Coverage Δ
unittests 55.68% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
engine/access/rpc/backend/backend_scripts.go 67.24% <ø> (+1.00%) ⬆️
engine/access/rpc/connection/connection.go 57.14% <ø> (+2.75%) ⬆️

... and 11 files with indirect coverage changes

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

Copy link
Collaborator

@Guitarheroua Guitarheroua left a comment

Choose a reason for hiding this comment

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

Looks much cleaner now.

@peterargue peterargue added this pull request to the merge queue Sep 22, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 22, 2023
@peterargue peterargue added this pull request to the merge queue Sep 23, 2023
Merged via the queue into master with commit dafd8fd Sep 23, 2023
35 of 36 checks passed
@peterargue peterargue deleted the petera/cleanup-access-connection-management branch September 23, 2023 05:46
@peterargue peterargue self-assigned this Sep 27, 2023
This pull request was closed.
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.

4 participants