-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Upgrade Spanner to the latest version #37433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ | |
| import com.google.cloud.spanner.DatabaseAdminClient; | ||
| import com.google.cloud.spanner.DatabaseClient; | ||
| import com.google.cloud.spanner.DatabaseId; | ||
| import com.google.cloud.spanner.SessionPoolOptions; | ||
| import com.google.cloud.spanner.Spanner; | ||
| import com.google.cloud.spanner.SpannerOptions; | ||
| import com.google.cloud.spanner.v1.stub.SpannerStubSettings; | ||
|
|
@@ -38,6 +39,7 @@ | |
| import com.google.spanner.v1.ExecuteSqlRequest; | ||
| import com.google.spanner.v1.PartialResultSet; | ||
| import java.util.HashSet; | ||
| import java.util.Optional; | ||
| import java.util.Set; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
| import org.apache.beam.sdk.options.ValueProvider; | ||
|
|
@@ -61,6 +63,9 @@ public class SpannerAccessor implements AutoCloseable { | |
| */ | ||
| private static final String USER_AGENT_PREFIX = "Apache_Beam_Java"; | ||
|
|
||
| private static final java.time.Duration DEFAULT_SESSION_WAIT_DURATION = | ||
| java.time.Duration.ofMinutes(5); | ||
|
|
||
| /** Instance ID to use when connecting to an experimental host. */ | ||
| public static final String EXPERIMENTAL_HOST_INSTANCE_ID = "default"; | ||
|
|
||
|
|
@@ -113,6 +118,11 @@ public static SpannerAccessor getOrCreate(SpannerConfig spannerConfig) { | |
| static SpannerOptions buildSpannerOptions(SpannerConfig spannerConfig) { | ||
| SpannerOptions.Builder builder = SpannerOptions.newBuilder(); | ||
|
|
||
| // TODO(https://github.com/apache/beam/issues/37451) Disable gRPC gcp extension which was | ||
| // causing the application thread to stall. | ||
| // Remove this once Spanner fixes the hanging issue | ||
| builder.disableGrpcGcpExtension(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the root cause known/is there a timeline for us to remove this? If so, could you please file a Beam issue tracking the fix and reference it in a TODO here? |
||
|
|
||
| Set<Code> retryableCodes = new HashSet<>(); | ||
| if (spannerConfig.getRetryableCodes() != null) { | ||
| retryableCodes.addAll(spannerConfig.getRetryableCodes()); | ||
|
|
@@ -265,6 +275,15 @@ static SpannerOptions buildSpannerOptions(SpannerConfig spannerConfig) { | |
| builder.setCredentials(credentials.get()); | ||
| } | ||
|
|
||
| ValueProvider<java.time.Duration> waitForSessionCreationDuration = | ||
| spannerConfig.getWaitForSessionCreationDuration(); | ||
| java.time.Duration waitDuration = | ||
| Optional.ofNullable(waitForSessionCreationDuration) | ||
| .map(ValueProvider::get) | ||
| .orElse(DEFAULT_SESSION_WAIT_DURATION); | ||
| builder.setSessionPoolOption( | ||
| SessionPoolOptions.newBuilder().setWaitForMinSessionsDuration(waitDuration).build()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change related to the hangs?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. This is related to DEADLINE EXCEEDED in dataflow workers. b/462499883 |
||
|
|
||
| return builder.build(); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this version to be tracked at all now or can we remove this line?