Skip to content

spanner request id prototype - #16448

Draft
scotthart wants to merge 8 commits into
googleapis:mainfrom
scotthart:spanner_request_id_phase1
Draft

scotthart wants to merge 8 commits into
googleapis:mainfrom
scotthart:spanner_request_id_phase1

Conversation

@scotthart

Copy link
Copy Markdown
Member

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a generalized OperationContext mechanism to inject request IDs and track attempt lifecycles across retries, generalizing the Bigtable generator option and implementing a robust request ID tracking system in the Spanner client. The review feedback highlights critical thread-safety and correctness issues: a broken double-checked locking pattern in DefaultSpannerOperationContextFactory::StaticPrefix() that introduces data races, a thread-safety hazard in ProcessRandomId() due to returning a reference to a mutable static string instead of returning by value, and a bug in BatchWriteGuard where premature stream cancellation incorrectly reports a successful status.

Comment thread google/cloud/spanner/internal/spanner_operation_context_factory.cc
Comment thread google/cloud/spanner/internal/spanner_request_id.h Outdated
Comment thread google/cloud/spanner/internal/spanner_request_id.cc Outdated
Comment thread google/cloud/spanner/internal/connection_impl.cc
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.80470% with 157 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.24%. Comparing base (6e0a08e) to head (28e6fe0).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...e/cloud/spanner/internal/spanner_auth_decorator.cc 2.70% 36 Missing ⚠️
...gle/cloud/spanner/internal/spanner_tracing_stub.cc 5.40% 35 Missing ⚠️
google/cloud/spanner/internal/session_pool.cc 81.81% 20 Missing ⚠️
...nner/internal/spanner_operation_context_factory.cc 79.72% 15 Missing ⚠️
...loud/spanner/internal/spanner_logging_decorator.cc 76.92% 12 Missing ⚠️
...internal/spanner_operation_context_factory_test.cc 85.89% 11 Missing ⚠️
.../cloud/spanner/internal/spanner_request_id_test.cc 86.20% 8 Missing ⚠️
generator/internal/descriptor_utils.cc 22.22% 7 Missing ⚠️
...oud/spanner/internal/spanner_metadata_decorator.cc 75.00% 6 Missing ⚠️
google/cloud/spanner/internal/connection_impl.cc 96.35% 5 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16448      +/-   ##
==========================================
- Coverage   92.28%   92.24%   -0.05%     
==========================================
  Files        2246     2254       +8     
  Lines      212894   213541     +647     
==========================================
+ Hits       196474   196973     +499     
- Misses      16420    16568     +148     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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