-
Notifications
You must be signed in to change notification settings - Fork 2.6k
AWS: Prevent excessive creation of auth sessions in S3V4RestSignerClient #13215
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
base: main
Are you sure you want to change the base?
Conversation
d6e7493
to
f72358f
Compare
} | ||
} | ||
} | ||
|
||
return authSession; | ||
} | ||
|
||
static { |
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 we move this further to the top?
Heads up: I need more changes to make this work properly. |
f72358f
to
58342c0
Compare
Done, this is now ready for review. FYI we needed to implement session caching for sessions obtained via the |
sessionCache = newSessionCache(name, properties); | ||
} | ||
|
||
if (config.token() != null) { |
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.
This is basically the same logic as in catalogSession()
, but with caching enabled.
@VisibleForTesting | ||
AuthSession authSession() { | ||
if (null == authSession) { | ||
private AuthManager authManager() { |
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.
could you please move the authManager()
method just below authSession()
as it's causing a diff that adds visual overhead during review
See apache/iceberg#13215 for context. In Iceberg 1.9.0, "standalone" sessions created by the S3 request signer client weren't cached, and an AuthManager was created for each signer instance. This is a performance degradation compared to the situation pre-AuthManager, where sessions were cached by the signer itself, and the cache was a static field. In Iceberg 1.10.0, this should be fixed, but also requires this AuthManager to implement proper caching of sessions created by the signer client.
See apache/iceberg#13215 for context. In Iceberg 1.9.0, "standalone" sessions created by the S3 request signer client weren't cached, and an AuthManager was created for each signer instance. This is a performance degradation compared to the situation pre-AuthManager, where sessions were cached by the signer itself, and the cache was a static field. In Iceberg 1.10.0, this should be fixed, but also requires this AuthManager to implement proper caching of sessions created by the signer client.
See apache/iceberg#13215 for context. In Iceberg 1.9.0, "standalone" sessions created by the S3 request signer client weren't cached, and an AuthManager was created for each signer instance. This is a performance degradation compared to the situation pre-AuthManager, where sessions were cached by the signer itself, and the cache was a static field. In Iceberg 1.10.0, this should be fixed, but also requires this AuthManager to implement proper caching of sessions created by the signer client.
This PR fixes an oversight in
S3V4RestSignerClient
introduced by the switch to the AuthManager API: the session cache was previously a static field, but became an instance field. As a result, too many token fetches are being observed when using request signing.