Repository navigation
fix(spanner): add BatchWrite retry prerequisites, resumption state, and retry policy - #15194
alkatrivedi wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces robust retry and resumption logic for BatchWrite operations in the Spanner client. Key changes include the addition of BatchWriteResumptionState to track unacknowledged mutation groups and BatchWriteRetryPolicy to manage backoff and timeout budgets during stream resumptions. Additionally, BuiltInMetricsTracer was updated with thread-safe attributes, and SessionImpl was enhanced to merge default client contexts and respect transaction exclusion options. Feedback on the changes highlights a critical bug in BatchWriteResumptionState where streamIndexes is not initialized for the first attempt, potentially causing out-of-bounds exceptions, and suggests a robust simplification for extracting status codes in BatchWriteRetryPolicy using gRPC's Status.fromThrowable.
This PR introduces independent client/metrics prerequisites and the pure resumption-state and retry-policy building blocks (not yet wired into GapicSpannerRpc, so existing retry behavior is unchanged).