Skip to content

Allow custom locking in GeneralHTTPCredentialsProvider - #46

Open
kolsha wants to merge 1 commit into
ClickHouse/1.11.907from
custom-locking-general-http-credentials-provider
Open

kolsha wants to merge 1 commit into
ClickHouse/1.11.907from
custom-locking-general-http-credentials-provider

Conversation

@kolsha

@kolsha kolsha commented Nov 13, 2026 •

Copy link
Copy Markdown

ExpiresSoon, m_loadFrequencyMs and m_credentials of GeneralHTTPCredentialsProvider become protected, so that a derived provider can replace the SDK locking while it reuses the SDK refresh and cache.

The provider holds its ReaderWriterLock across the credential request. A caller that runs the request in a cooperative scheduler, where the request suspends, needs its own lock around the refresh. To do that without copying the refresh logic, the derived provider has to decide when to refresh (ExpiresSoon, m_loadFrequencyMs) and return the cached result (m_credentials), as the SDK GetAWSCredentials does. Reload is already protected.

Only access specifiers change; the order of data members, and therefore the layout, is unchanged. ClickHouse builds with the same change on top of a748a5d, and the gtests of its derived provider pass; this branch was not built on top of the current ClickHouse/1.11.907.

Make `ExpiresSoon`, `m_loadFrequencyMs` and `m_credentials` protected so that derived providers can replace the synchronization while reusing the SDK refresh implementation and cache. The order of data members is unchanged.

Validation: ClickHouse builds against it, and the gtests of its derived provider pass.
@kolsha
kolsha marked this pull request as ready for review November 16, 2026 13:30
@kolsha
kolsha requested a review from mstetsyuk November 16, 2026 13:30
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.

1 participant