[ENH](log-service): defer Spanner init to first use - #6915
Conversation
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
|
This PR changes replicated log topology initialization to defer It also standardizes gRPC error conversion by adding This summary was automatically generated by @propel-code-bot |
This comment has been minimized.
This comment has been minimized.
dc3170f to
3413a33
Compare
This comment has been minimized.
This comment has been minimized.
| Status::with_metadata(code, message, metadata) | ||
| } | ||
|
|
||
| fn status_from_chroma_error(err: impl ChromaError + std::fmt::Display) -> Status { |
There was a problem hiding this comment.
would it be useful to instead put this into the chroma-error crate so that others can also benefit from it?
Introduce LazySpannerClient that wraps SpannerClient behind a OnceCell, deferring connection from boot time to first use so the log server can start even when Spanner is temporarily unreachable. - Map Spanner connection and session errors to Unavailable instead of Internal/Unknown, enabling clients to retry transient failures. - Replace Status::unknown with status_from_chroma_error throughout to propagate proper gRPC status codes from ChromaError. - Extract connect_spanner, build_storage_wrappers_for_topology, and create_repl_factories_for_topology as free functions, removing the duplicated topology-setup logic. - Add tests verifying lazy startup, error code mapping, and that init failures remain retryable. Co-authored-by: AI
b8a30b8 to
a838839
Compare
Description of changes
Introduce LazySpannerClient that wraps SpannerClient behind a OnceCell,
deferring connection from boot time to first use so the log server can
start even when Spanner is temporarily unreachable.
Internal/Unknown, enabling clients to retry transient failures.
propagate proper gRPC status codes from ChromaError.
create_repl_factories_for_topology as free functions, removing the
duplicated topology-setup logic.
failures remain retryable.
Test plan
CI
Migration plan
N/A
Observability plan
N/A
Documentation Changes
N/A
Co-authored-by: AI