fix: retry CreateSession also when waitForMinSessions is zero#4360
fix: retry CreateSession also when waitForMinSessions is zero#4360
Conversation
The creation of a session at startup would only be retried if waitForMinSessions was set. This changed introduces retries for CreateSession at startup if the error code is potentially transient. The number of retries is set to maximum 10.
Summary of ChangesHello @olavloite, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the robustness of the Spanner client library by implementing more comprehensive retry mechanisms for session creation during application startup. It ensures that transient issues during initial session establishment are handled gracefully, preventing immediate failures. Additionally, the changes include new test coverage for transaction options and error handling during session creation, contributing to overall stability and reliability. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces retry logic for CreateSession at startup, which is a valuable improvement for handling transient network issues. The implementation in MultiplexedSessionDatabaseClient.java is sound. I've added one suggestion to replace a magic number with a named constant to improve code maintainability. Additionally, please note that the new test file google-cloud-spanner/src/test/java/com/google/cloud/spanner/ExcludeFromChangeStreamTest.java appears to be unrelated to the scope of this pull request and may have been included unintentionally.
The creation of a session at startup would only be retried if waitForMinSessions was set. This changed introduces retries for CreateSession at startup if the error code is potentially transient. The number of retries is set to maximum 10.