You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Motivation
Catalog-vended credentials expire, typically within the hour, and
nothing
refreshed them. `loadTable` hands their access keys to the FileIO once
and
OpenDAL keeps signing with them until they stop working, at which point
the
sink fails and only recovers by restarting the dataflow. Any sink
running
longer than one credential lifetime hits this.
### Description
Adds `VendedCredentialLoader`, a `ProvideCredential` implementation that
re-fetches from the catalog's `loadCredentials` endpoint and hands the
result
to OpenDAL's S3 credential chain.
The loader caches with its own deadline rather than relying on reqsign's
cache. OpenDAL rebuilds its `Operator` for every file operation, so the
`Signer` that holds reqsign's cached credential never survives a single
call;
without an internal cache this would be one catalog round trip per
parquet
write and per metadata read. The deadline comes from
`s3.session-token-expires-at-ms` where the catalog reports one,
refreshing
ahead of expiry, and from a short fixed interval where it does not. That
interval is a constant for now, with a TODO to make it a dyncfg once we
know
what real catalogs report.
On a 401 or 403 the loader invalidates the catalog token so the next
attempt
mints a fresh one, since nothing else on the storage path re-mints it.
Two supporting changes:
- Materialize now constructs the OAuth2 provider itself instead of
passing a
`credential` catalog property, so a single token object serves both
catalog
requests and credential refreshes. The two cannot coexist: the catalog
client rejects a custom authenticator combined with that property.
- `connect` takes the table the handle will be used against, because the
credentials endpoint is table-scoped. Callers that only prove
reachability
(connection validation, sink purification) pass `None`.
Installing a loader hands it sole responsibility for S3 credentials,
since
OpenDAL replaces its entire provider chain and discards the static keys
parsed from the vended properties. It is therefore installed only when
the
connection asked for delegation and a table is known; every other case
keeps
the existing static-property path.
### Verification
`cargo check` and `cargo clippy` are clean. Not yet exercised against a
live
catalog: the refresh path needs a sink run long enough to cross a
credential
lifetime, and which branch of the deadline logic applies depends on
whether
the catalog reports an expiry.
0 commit comments